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

# Set Timeout

> Update the auto-kill timeout for a running sandbox.

Updates the `timeout` field stored on the sandbox. Pass `0` to disable auto-kill.
This endpoint updates the persisted value only — it does not restart any existing
in-flight countdown timer that was set at creation time.

Use this endpoint to extend a sandbox's lifetime before it expires, or to reduce
the timeout if you want to reclaim resources sooner.

## Path Parameters

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

## Request Body

<ParamField body="timeout" type="integer" required>
  New timeout value in seconds. Pass `0` to disable auto-kill.

  Example: `600`
</ParamField>

## Response

<ResponseField name="ok" type="boolean">
  Always `true` when the update succeeds.
</ResponseField>

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X PATCH https://api.declaw.ai/sandboxes/sbx-a1b2c3d4/timeout \
    -H "X-API-Key: YOUR_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{ "timeout": 600 }'
  ```

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

  sbx = Sandbox.connect("sbx-a1b2c3d4", api_key="YOUR_API_KEY", domain="api.declaw.ai")
  sbx.set_timeout(600)
  ```

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

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

```json Response theme={null}
{
  "ok": true
}
```

## Error Responses

| Status | Cause                      |
| ------ | -------------------------- |
| `400`  | Invalid request body       |
| `401`  | Missing or invalid API key |
| `404`  | Sandbox not found          |
