> ## Documentation Index
> Fetch the complete documentation index at: https://docs.declaw.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Sandbox

> Retrieve the full details of a single sandbox by its ID.

Returns the complete sandbox object including state, configuration, resource
allocation, and connection details.

## Path Parameters

<ParamField path="sandbox_id" type="string" required>
  The sandbox identifier. Format: `sbx-<8 chars>`.

  Example: `sbx-a1b2c3d4`
</ParamField>

## Response

<ResponseField name="sandbox_id" type="string">
  Unique sandbox identifier.
</ResponseField>

<ResponseField name="template_id" type="string">
  Template the sandbox was created from.
</ResponseField>

<ResponseField name="name" type="string">
  Human-readable name derived from the template.
</ResponseField>

<ResponseField name="state" type="string">
  Current lifecycle state: `creating`, `running`, `paused`, or `killed`.
</ResponseField>

<ResponseField name="timeout" type="integer">
  Auto-kill timeout in seconds. `0` means no timeout is set.
</ResponseField>

<ResponseField name="metadata" type="object">
  Key-value metadata attached at creation time.
</ResponseField>

<ResponseField name="envs" type="object">
  Environment variables injected into the sandbox.
</ResponseField>

<ResponseField name="network" type="object">
  Network access configuration (if specified at creation).
</ResponseField>

<ResponseField name="resources" type="object">
  CPU and memory allocation (`vcpus`, `memory_mb`).
</ResponseField>

<ResponseField name="envd_access_token" type="string">
  Bearer token for envd daemon access.
</ResponseField>

<ResponseField name="traffic_access_token" type="string">
  Bearer token for the security/traffic proxy.
</ResponseField>

<ResponseField name="guest_ip" type="string">
  Internal IP address of the sandbox VM.
</ResponseField>

<ResponseField name="envd_port" type="integer">
  Port on which envd listens inside the VM.
</ResponseField>

<ResponseField name="started_at" type="string">
  UTC timestamp of sandbox creation.
</ResponseField>

<ResponseField name="end_at" type="string | null">
  UTC timestamp when the sandbox will be or was killed. `null` if no timeout.
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.declaw.ai/sandboxes/sbx-a1b2c3d4 \
    -H "X-API-Key: YOUR_API_KEY"
  ```

  ```python Python theme={null}
  from declaw import Sandbox

  sbx = Sandbox.connect("sbx-a1b2c3d4", api_key="YOUR_API_KEY", domain="api.declaw.ai")
  print(sbx.state)  # running
  ```

  ```typescript TypeScript theme={null}
  import { Sandbox } from "@declaw/sdk";

  const sbx = await Sandbox.connect("sbx-a1b2c3d4", {
    apiKey: "YOUR_API_KEY",
    domain: "api.declaw.ai",
  });
  console.log(sbx.state); // running
  ```
</CodeGroup>

```json Response theme={null}
{
  "sandbox_id": "sbx-a1b2c3d4",
  "template_id": "tpl-base",
  "name": "base",
  "state": "running",
  "timeout": 300,
  "metadata": { "project": "my-agent" },
  "resources": { "vcpus": 1, "memory_mb": 512 },
  "envd_access_token": "envd-ab12cd34",
  "sandbox_domain": "declaw.dev",
  "traffic_access_token": "traffic-ef56gh78",
  "guest_ip": "172.16.0.5",
  "envd_port": 49983,
  "started_at": "2024-01-15T10:30:00Z",
  "end_at": "2024-01-15T10:35:00Z"
}
```

## Error Responses

| Status | Cause                      |
| ------ | -------------------------- |
| `401`  | Missing or invalid API key |
| `404`  | Sandbox not found          |
