# Set sandbox timeout (/docs/api-reference/sandboxes/set-sandbox-timeout)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 725 · updated: 2026-07-30 -->
Related: [List sandboxes](/docs/api-reference/sandboxes/list-sandboxes.md), [Create sandbox](/docs/api-reference/sandboxes/create-sandbox.md), [List sandboxes (v2)](/docs/api-reference/sandboxes/list-sandboxes-v2.md), [List sandbox metrics](/docs/api-reference/sandboxes/list-sandbox-metrics.md), [Get sandbox logs](/docs/api-reference/sandboxes/get-sandbox-logs.md), [Get sandbox logs (v2)](/docs/api-reference/sandboxes/get-sandbox-logs-v2.md)

# Set sandbox timeout

`POST /sandboxes/{sandboxID}/timeout`

Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration.

## OpenAPI

```json
{
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "parameters": [
    {
      "name": "sandboxID",
      "in": "path",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "timeout"
          ],
          "properties": {
            "timeout": {
              "description": "Timeout in seconds from the current time after which the sandbox should expire",
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        }
      }
    }
  },
  "responses": {
    "204": {
      "description": "Successfully set the sandbox timeout"
    },
    "401": {
      "description": "Authentication error",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "format": "int32",
                "description": "Error code"
              },
              "message": {
                "type": "string",
                "description": "Error"
              }
            },
            "type": "object"
          }
        }
      }
    },
    "404": {
      "description": "Not found",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "format": "int32",
                "description": "Error code"
              },
              "message": {
                "type": "string",
                "description": "Error"
              }
            },
            "type": "object"
          }
        }
      }
    },
    "500": {
      "description": "Server error",
      "content": {
        "application/json": {
          "schema": {
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "integer",
                "format": "int32",
                "description": "Error code"
              },
              "message": {
                "type": "string",
                "description": "Error"
              }
            },
            "type": "object"
          }
        }
      }
    }
  }
}
```
