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

# Create sandbox from a template

> Creates a new sandbox pre-configured from a named template

Creates a new sandbox pre-configured from a named template

### Request body

`CreateFromTemplateRequest`

<ParamField body="template_id" type="string" required>
  Identifier of the template to use
</ParamField>

<ParamField body="timeout_seconds" type="integer">
  Timeout in seconds (30-3600)
</ParamField>

<ParamField body="env" type="object">
  Environment variables to inject
</ParamField>

<ParamField body="override_cpus" type="string">
  Override template CPU limit (e.g., '2', '500m')
</ParamField>

<ParamField body="override_memory" type="string">
  Override template memory limit (e.g., '2Gi', '512Mi')
</ParamField>

### Response

`CreateSandboxResponse`

<ResponseField name="sandbox_id" type="string (uuid)" />

<ResponseField name="session_id" type="string" />

<ResponseField name="status" type="SandboxStatusEnum" />

<ResponseField name="expires_at" type="string (date-time)" />

### Status codes

| Code  | Meaning                       |
| ----- | ----------------------------- |
| `200` | Sandbox created from template |
| `400` | —                             |
| `401` | —                             |
| `404` | —                             |
| `500` | —                             |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.sandbox.stateset.app/api/v1/sandbox/create-from-template' \
    --header 'Authorization: Bearer YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "template_id": "string",
    "timeout_seconds": 1,
    "env": {},
    "override_cpus": "string",
    "override_memory": "string"
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "sandbox_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "session_id": "string",
    "status": "creating",
    "expires_at": "2026-07-24T12:00:00Z"
  }
  ```
</ResponseExample>
