---
title: "Stop a session"
method: POST
path: "/v2/sandboxes/sessions/{sessionId}/stop"
tags: ["sandboxes"]
---

# Stop a session

`POST /v2/sandboxes/sessions/{sessionId}/stop`

## Request

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

Stops a running session and releases its allocated resources. All running processes within the session will be terminated. This action cannot be undone. A stopped session cannot be restarted.

## Path parameters

- `sessionId` string, required: The unique identifier of the session to stop.

## Query parameters

- `teamId` string
- `slug` string

## Response `200`

The session was stopped successfully.

- union
  - object
    - `session` Session, required: This object contains information related to a Vercel Sandbox Session. v2 endpoints return "session" instead of "sandbox" as the response wrapper key.
      - `abortedAt` number: The time when the sandbox was aborted, in milliseconds since the epoch.
      - `activeCpuDurationMs` number: The amount of CPU time the sandbox consumed, if available, in milliseconds. This value is only available once the sandbox is stopped, and only if it stopped successfully.
      - `architecture` 'amd64' | 'arm64': CPU architecture of the sandbox.
      - `createdAt` number, required: The time when the sandbox was created, in milliseconds since the epoch.
      - `cwd` string, required: The working directory of the sandbox.
      - `duration` number: The duration of the sandbox in milliseconds.
      - `id` string, required: The unique identifier of the sandbox.
      - `memory` number, required: Memory allocated to this sandbox in MB.
      - `networkPolicy` SandboxNetworkPolicy: The network policy applied to this sandbox, if any.
        - `allowedCIDRs` string[]: List of IP address ranges (in CIDR notation) the sandbox is allowed to connect to.
        - `allowedDomains` string[]: List of domain names the sandbox is allowed to connect to. Supports wildcard patterns (e.g., "*.vercel.com" matches all subdomains).
        - `deniedCIDRs` string[]: List of IP address ranges (in CIDR notation) the sandbox is blocked from connecting to. These rules take precedence over all allowed rules.
        - `injectionRules` SandboxInjectionRule[]: HTTP header injection rules for outgoing requests matching specific domains.
          - `domain` string, required: The domain (or pattern) that this injection rule applies to. Supports wildcards like *.vercel.com.
          - `headerNames` string[]: The names of HTTP headers that have value that will be injected for requests to this domain.
        - `mode` 'allow-all' | 'custom' | 'deny-all', required: The network policy mode. - 'allow-all': All traffic is allowed. - 'deny-all': All traffic is blocked. - 'custom': Traffic is controlled by explicit allow/deny rules.
      - `networkTransfer` object: The quantity of data transfered to and from the sandbox, in bytes. This value is only available once the sandbox is stopped, and only if it stopped successfully.
        - `egress` number, required
        - `ingress` number, required
      - `projectId` string, required: The unique identifier of the project associated with this session.
      - `region` string, required: The region where the sandbox is hosted.
      - `requestedAt` number, required: The time when the sandbox was requested, in milliseconds since the epoch.
      - `requestedStopAt` number: The time when the sandbox was requested to stop, in milliseconds since the epoch.
      - `runtime` string, required: The runtime of the sandbox.
      - `snapshottedAt` number: The time when a snapshot was requested, in milliseconds since the epoch.
      - `sourceSandboxName` string, required: The name of the source sandbox.
      - `sourceSnapshotId` string: The unique identifier of the snapshot associated with this sandbox, if any.
      - `startedAt` number: The time when the sandbox was started, in milliseconds since the epoch.
      - `status` 'aborted' | 'failed' | 'pending' | 'running' | 'snapshotting' | 'stopped' | 'stopping', required: The status of the sandbox.
      - `stoppedAt` number: The time when the sandbox was stopped, in milliseconds since the epoch.
      - `timeout` number, required: The maximum amount of time the sandbox will run for in milliseconds.
      - `updatedAt` number, required: The last time the sandbox was updated, in milliseconds since the epoch.
      - `vcpus` number, required: Number of vCPUs allocated to this sandbox.
      - `workloadType` 'sandbox' | 'v0': The workload type of this sandbox.
  - object
    - `sandbox` NamedSandbox, required: This object contains information related to a Vercel NamedSandbox.
      - `architecture` 'amd64' | 'arm64': CPU architecture of the sandbox. This value does not change.
      - `createdAt` number, required: The time when the named sandbox was created, in milliseconds since the epoch.
      - `currentSessionId` string, required: Current session ID the sandbox is pointing to.
      - `currentSnapshotId` string: Current snapshot ID that the named sandbox is pointing to.
      - `cwd` string: The working directory of the sandbox.
      - `expiresAt` number: The time at which the currently running sandbox will time out, in milliseconds since the epoch. Only present while a session is running.
      - `failoverRegions` string[]: The regions the sandbox fails over to. Empty when it does not fail over.
      - `image` string: Owner-qualified, digest-pinned reference of the container image the sandbox was created from ("{team}/{project}/{repository}@{manifestDigest}").
      - `keepLastSnapshots` object: Keep-last snapshot configuration.
        - `count` number, required: Number of most recent snapshots to keep.
        - `deleteEvicted` false | true, required: Whether to immediately delete evicted snapshots.
        - `expiration` number: Expiration time in milliseconds for kept snapshots.
      - `memory` number: Memory allocated in MB.
      - `mounts` object: Key-value pairs of mount path and drive.
      - `name` string, required: The unique identifier of the sandbox.
      - `networkId` string: The Connect network id for the target Secure Compute private network.
      - `networkPolicy` object: Network policy configuration.
        - `allowedCIDRs` string[]
        - `allowedDomains` string[]
        - `deniedCIDRs` string[]
        - `mode` 'allow-all' | 'custom' | 'default-allow' | 'default-deny' | 'deny-all', required
        - `s3Key` string
      - `persistent` false | true, required: Whether the sandbox persists its state across restarts via automatic snapshots.
      - `region` string: The region the sandbox is pinned to: the region stored on the sandbox, otherwise the platform default. Where a running session actually landed is reported by `session.region`.
      - `runtime` string: Runtime identifier.
      - `snapshotExpiration` number: Default snapshot expiration time in milliseconds. 0 means no expiration.
      - `status` 'running' | 'stopped' | 'stopping', required: The status of the current sandbox.
      - `statusUpdatedAt` number, required: The time when the sandbox status was last updated, in milliseconds since the epoch.
      - `tags` object: Key-value tags attached to the named sandbox.
      - `timeout` number: Timeout in milliseconds.
      - `totalActiveCpuDurationMs` number: Cumulative active CPU duration in milliseconds across all sandbox runs.
      - `totalDurationMs` number: Cumulative wall-clock duration in milliseconds across all sandbox runs.
      - `totalEgressBytes` number: Cumulative egress bytes across all sandbox runs.
      - `totalIngressBytes` number: Cumulative ingress bytes across all sandbox runs.
      - `updatedAt` number, required: The time when the named sandbox was last updated, in milliseconds since the epoch.
      - `vcpus` number: Number of virtual CPUs allocated.
      - `workloadType` 'sandbox' | 'v0': The workload type of this sandbox.
    - `session` Session, required: This object contains information related to a Vercel Sandbox Session. v2 endpoints return "session" instead of "sandbox" as the response wrapper key.
      - `abortedAt` number: The time when the sandbox was aborted, in milliseconds since the epoch.
      - `activeCpuDurationMs` number: The amount of CPU time the sandbox consumed, if available, in milliseconds. This value is only available once the sandbox is stopped, and only if it stopped successfully.
      - `architecture` 'amd64' | 'arm64': CPU architecture of the sandbox.
      - `createdAt` number, required: The time when the sandbox was created, in milliseconds since the epoch.
      - `cwd` string, required: The working directory of the sandbox.
      - `duration` number: The duration of the sandbox in milliseconds.
      - `id` string, required: The unique identifier of the sandbox.
      - `memory` number, required: Memory allocated to this sandbox in MB.
      - `networkPolicy` SandboxNetworkPolicy: The network policy applied to this sandbox, if any.
        - `allowedCIDRs` string[]: List of IP address ranges (in CIDR notation) the sandbox is allowed to connect to.
        - `allowedDomains` string[]: List of domain names the sandbox is allowed to connect to. Supports wildcard patterns (e.g., "*.vercel.com" matches all subdomains).
        - `deniedCIDRs` string[]: List of IP address ranges (in CIDR notation) the sandbox is blocked from connecting to. These rules take precedence over all allowed rules.
        - `injectionRules` SandboxInjectionRule[]: HTTP header injection rules for outgoing requests matching specific domains.
          - `domain` string, required: The domain (or pattern) that this injection rule applies to. Supports wildcards like *.vercel.com.
          - `headerNames` string[]: The names of HTTP headers that have value that will be injected for requests to this domain.
        - `mode` 'allow-all' | 'custom' | 'deny-all', required: The network policy mode. - 'allow-all': All traffic is allowed. - 'deny-all': All traffic is blocked. - 'custom': Traffic is controlled by explicit allow/deny rules.
      - `networkTransfer` object: The quantity of data transfered to and from the sandbox, in bytes. This value is only available once the sandbox is stopped, and only if it stopped successfully.
        - `egress` number, required
        - `ingress` number, required
      - `projectId` string, required: The unique identifier of the project associated with this session.
      - `region` string, required: The region where the sandbox is hosted.
      - `requestedAt` number, required: The time when the sandbox was requested, in milliseconds since the epoch.
      - `requestedStopAt` number: The time when the sandbox was requested to stop, in milliseconds since the epoch.
      - `runtime` string, required: The runtime of the sandbox.
      - `snapshottedAt` number: The time when a snapshot was requested, in milliseconds since the epoch.
      - `sourceSandboxName` string, required: The name of the source sandbox.
      - `sourceSnapshotId` string: The unique identifier of the snapshot associated with this sandbox, if any.
      - `startedAt` number: The time when the sandbox was started, in milliseconds since the epoch.
      - `status` 'aborted' | 'failed' | 'pending' | 'running' | 'snapshotting' | 'stopped' | 'stopping', required: The status of the sandbox.
      - `stoppedAt` number: The time when the sandbox was stopped, in milliseconds since the epoch.
      - `timeout` number, required: The maximum amount of time the sandbox will run for in milliseconds.
      - `updatedAt` number, required: The last time the sandbox was updated, in milliseconds since the epoch.
      - `vcpus` number, required: Number of vCPUs allocated to this sandbox.
      - `workloadType` 'sandbox' | 'v0': The workload type of this sandbox.
    - `snapshot` Snapshot, required: This object contains information related to a Snapshot of a Vercel Sandbox session (v2 API).
      - `architecture` 'amd64' | 'arm64': CPU architecture required to restore the snapshot.
      - `createdAt` number, required: The time when the snapshot was created, in milliseconds since the epoch.
      - `creationMethod` 'automatic' | 'manual': The method used to create the snapshot.
      - `expiresAt` number: The time when the snapshot will expire, in milliseconds since the epoch. If not set, the snapshot does not have any expiration.
      - `id` string, required: The unique identifier of the snapshot.
      - `lastUsedAt` number, required: The last time the snapshot was used (e.g. to resume or create a sandbox), in milliseconds since the epoch. Falls back to `createdAt` for older snapshots that predate this field.
      - `parentId` string: The unique identifier of the parent snapshot, if this snapshot was created from another snapshot.
      - `region` string: The region where the snapshot is stored.
      - `regions` string[]: The regions where the snapshot is available.
      - `sizeBytes` number, required: The size of the snapshot in bytes.
      - `sourceSessionId` string, required: The unique identifier of the session from which the snapshot was created.
      - `status` 'created' | 'deleted' | 'failed', required: The status of the snapshot.
      - `updatedAt` number, required: The last time the snapshot was updated, in milliseconds since the epoch.
      - `workloadType` 'sandbox' | 'v0': The workload type of this snapshot.

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

## Changes

- **2026-10-26** `01d3fe4ea5c3`: 1 breaking, 1 info
  - added `subschema #1, subschema #2` to the response body `oneOf` list for the response status `200`
  - removed `subschema #1, subschema #2` from the response body `oneOf` list for the response status `200`
- **2026-10-09** `336a06c75674`: 1 info
  - added the optional property `oneOf[subschema #2]/sandbox/mounts/additionalProperties/snapshot` to the response with the `200` status
- **2026-10-01** `9958fd10bb05`: 1 breaking, 1 info
  - added `subschema #1, subschema #2` to the response body `oneOf` list for the response status `200`
  - removed `subschema #1, subschema #2` from the response body `oneOf` list for the response status `200`
- **2026-09-18** `c32b8afee578`: 1 breaking, 1 info
  - added `subschema #1, subschema #2` to the response body `oneOf` list for the response status `200`
  - removed `subschema #1, subschema #2` from the response body `oneOf` list for the response status `200`
- **2026-09-08** `4b774da66d3d`: 1 warning, 1 info
  - added the new `snapshot` enum value to the `oneOf[subschema #2]/sandbox/mounts/additionalProperties/mode` response property for the response status `200`
  - added the optional property `oneOf[subschema #2]/sandbox/networkId` to the response with the `200` status

[Operation history](https://skmtc.dev/vercel/apis/vercel-api/changes/v2/sandboxes/sessions/:sessionId/stop/post.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)
