---
title: "List commands"
method: GET
path: "/v2/sandboxes/sessions/{sessionId}/cmd"
tags: ["sandboxes"]
---

# List commands

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

## Request

- Base URL: `https://api.vercel.com`
- URL: `https://api.vercel.com/v2/sandboxes/sessions/{sessionId}/cmd`
- Auth: HTTP bearer

Retrieves a list of all commands that have been executed in a session, including their current status, exit codes, and execution times, ordered from the most recent to the oldest.

## Path parameters

- `sessionId` string, required: The unique identifier of the session to list commands for.

## Query parameters

- `teamId` string
- `slug` string

## Response `200`

The list of commands executed in the session.

- object
  - `commands` SessionCommand[], required
    - `args` string[], required: The arguments of the command.
    - `cwd` string, required: The current working directory of the command.
    - `durationMs` number: Duration of the command execution in milliseconds.
    - `exitCode` number, nullable, required: If the command did finish, the exit code.
    - `id` string, required: The ID of the command.
    - `name` string, required: The name of the command.
    - `sessionId` string, required: The ID of the session associated with the command.
    - `startedAt` number, required: When the command was started, in milliseconds since the epoch.

## 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`

## Changes

- **2026-10-24** `4a06e85c2848`: 1 info
  - added the non-success response with the status `422`
- **2026-07-21** `2ae10ee9d21c`: 1 info
  - added the non-success response with the status `410`
- **2026-07-08** `3ff660568354`: 1 info
  - added the optional property `commands/items/durationMs` to the response with the `200` status
- **2026-06-11** `14b4658f819e`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/vercel/apis/vercel-api/changes/v2/sandboxes/sessions/:sessionId/cmd/get.md)

---

[API](https://skmtc.dev/vercel/apis/vercel-api.md) - [All operations](https://skmtc.dev/vercel/apis/vercel-api/llms.txt) - [OpenAPI document](https://skmtc.dev/vercel/apis/vercel-api/revisions/60686c0e1f6a?raw)
