---
title: "Get a command"
method: GET
path: "/v2/sandboxes/sessions/{sessionId}/cmd/{cmdId}"
tags: ["sandboxes"]
---

# Get a command

`GET /v2/sandboxes/sessions/{sessionId}/cmd/{cmdId}`

Retrieves the current status and details of a command executed in a session. Use the `wait` parameter to block until the command finishes execution.

## Path parameters

- `sessionId` string, required — The unique identifier of the session containing the command.
- `cmdId` string, required — The unique identifier of the command to retrieve.

## Query parameters

- `wait` 'true' | 'false' — If set to "true", the request will block until the command finishes execution. Useful for synchronously waiting for command completion.
- `teamId` string
- `slug` string

## Response `200`

The command data along with the exit code if the command did finish.

- object
  - `command` SessionCommand, required — This object represents a command run in a Vercel Sandbox session (v2 API).
    - `id` string, required — The ID of the command.
    - `name` string, required — The name of the command.
    - `args` string[], required — The arguments of the command.
    - `cwd` string, required — The current working directory of the command.
    - `sessionId` string, required — The ID of the session associated with the command.
    - `exitCode` number, nullable, required — If the command did finish, the exit code.
    - `startedAt` number, required — When the command was started, in milliseconds since the epoch.
    - `durationMs` number — Duration of the command execution in milliseconds.

## Other responses

- `400` — One of the provided values in the request query is invalid.
- `401` — The request is not authorized.
- `403` — You do not have permission to access this resource.
- `404`
- `410`
- `422`
- `429`
- `500`

---

[API](https://skmtc.net/vercel/apis/api.md) · [All operations](https://skmtc.net/vercel/apis/api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/vercel/api/versions/b4d86a3e3479/schema)
