---
title: "Connect sandbox (v2)"
method: POST
path: "/v2/sandboxes/{sandboxID}/connect"
tags: ["sandboxes"]
---

# Connect sandbox (v2)

`POST /v2/sandboxes/{sandboxID}/connect`

## Request

- Base URL: `https://api.e2b.app`
- URL: `https://api.e2b.app/v2/sandboxes/{sandboxID}/connect`
- Auth: one of:
  - API key in header `X-API-Key`
  - HTTP bearer and API key in header `X-Team-ID`
  - API key in header `X-Admin-Token` and API key in header `X-Team-ID`
  - HTTP bearer and API key in header `X-Team-ID`

Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. The request body is optional; an omitted timeout defaults to 300 seconds.

## Path parameters

- `sandboxID` string, required

## Request body

- ConnectSandboxV2
  - `timeout` integer: Timeout in seconds from the current time after which the sandbox should expire
  - `memory` boolean: Defaults to true. When false and the sandbox is paused, resume from disk state only: the sandbox cold-boots fresh and any memory in the snapshot is ignored, never modified or deleted. Disk state has crash-recovery semantics — writes not flushed before the pause may be lost. A no-op for snapshots that contain no memory. Rejected with an error in environments where this capability is not enabled, never silently downgraded to a memory restore.

## Response `200`

The sandbox was already running

- Sandbox
  - `templateID` string, required: Identifier of the template from which is the sandbox created
  - `sandboxID` string, required: Identifier of the sandbox
  - `alias` string: Alias of the template
  - `clientID` string, required: Identifier of the client
  - `envdVersion` string, required: Version of the envd running in the sandbox
  - `envdAccessToken` string: Access token used for envd communication
  - `trafficAccessToken` string, nullable: Token required for accessing sandbox via proxy.
  - `domain` string, nullable: Base domain where the sandbox traffic is accessible

## Other responses

- `201`: The sandbox was resumed successfully
- `400`: Bad request
- `401`: Authentication error
- `404`: Not found
- `409`: Conflict
- `429`: Too many requests
- `500`: Server error
- `503`: Service unavailable
- `504`: Backend timeout

## Changes

- **2026-09-18** `0fb774ca41bf`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/e2b-dev/apis/e2b-api/changes/v2/sandboxes/:sandboxID/connect/post.md)

---

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