Run a command in a pod
Run one command inside a running Runpod Pod’s container and get its stdout, stderr, and exit code back, with no SSH setup.
Authorizations
Runpod API key authentication. Generate an API key in the Runpod console and send it in the Authorization header as Bearer <api_key>. Keys are scoped to the permissions granted when created; requests may return 403 when a valid key lacks access to the requested resource or action.
Console sessions (Clerk JWTs) act for the signed-in user. To act for a team instead, also send X-Team-Id: <team_id>; it applies only when the user owns or belongs to that team, otherwise the request runs against the user's own account. API keys created inside a team already act for that team and do not need the header.
Path Parameters
Pod identifier
Body
Command to run, as an argv array of 1-256 arguments of at most 4096
characters each. It is run directly, never through a shell; for
pipes, redirects or globbing pass ["sh", "-c", "..."]. The first
element, the program, must contain a non-whitespace character;
later arguments may be empty. No argument may contain a NUL
character.
How long the call waits for the command to finish, in seconds. A
command still running at this point returns with timedOut: true.
1 <= x <= 2510
Absolute working directory for the command, at most 1024 characters
and without control characters. Defaults to the image's WORKDIR.
1024^/[^\x00-\x1f\x7f]*$"/workspace"
Up to 64 environment variables added to the container's environment
for this command only. A name is 1-256 characters and must not
contain = or a NUL character; a value is at most 16384 characters
and must not contain a NUL character.
Response
The command finished or the call stopped waiting for it. A non-zero exitCode is a result, not an error.
The command's standard output, as UTF-8 with invalid bytes
replaced. Capped at 1 MiB; see truncated.
The command's standard error, as UTF-8 with invalid bytes
replaced. Capped at 1 MiB; see truncated.
The command's exit code. A non-zero code is a result, not an error.
Null only when timedOut is true.
The call stopped waiting at timeoutSeconds. It does not mean the
command was stopped: it may still be running inside the container.
stdout or stderr reached the 1 MiB cap and was cut.
Wall time of the command as measured on the pod's machine, in milliseconds.