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

# Snapshot Sandbox

> Create a snapshot of a running sandbox so you can restore the same filesystem and memory state later.

Create a snapshot of a running sandbox so you can restore the same filesystem and memory state later.

You can optionally pass `snapshot_type` in the request body:

* `filesystem` (default): captures filesystem state only and restores with a cold boot.
* `memory`: captures filesystem, memory, and running process state and restores with a warm start.

## Endpoint

```http theme={null}
POST /sandboxes/{sandbox_id}/snapshot
```

## Example Request

```bash theme={null}
curl -X POST https://api.tensorlake.ai/sandboxes/<sandbox-id>/snapshot \
  -H "Authorization: Bearer $TENSORLAKE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"snapshot_type":"memory"}'
```

Use the created snapshot with [Restore Sandbox](/api-reference/v2/sandboxes/restore) when you want to boot a new sandbox from that saved state.

For the broader snapshot lifecycle, including listing and deleting snapshots, see [Snapshots](/sandboxes/snapshots).


## OpenAPI

````yaml post /sandboxes/{sandbox_id}/snapshot
openapi: 3.1.0
info:
  title: Tensorlake API
  description: >-
    Tensorlake Cloud APIs for Sandboxes, Document Ingestion, and Serverless
    Workflows
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://api.tensorlake.ai/
security:
  - bearerAuth: []
tags:
  - name: Tensorlake Cloud API
    description: >-
      Tensorlake Cloud APIs for Sandboxes, Document Ingestion, and Serverless
      Workflows
paths:
  /sandboxes/{sandbox_id}/snapshot:
    parameters:
      - name: sandbox_id
        in: path
        description: The ID of the sandbox.
        required: true
        schema:
          type: string
    post:
      tags:
        - sandboxes
      summary: Snapshot a sandbox
      description: >-
        Create a snapshot of a running sandbox so you can restore the same
        filesystem and memory state later.
      operationId: snapshot_sandbox
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                snapshot_type:
                  type: string
                  description: >-
                    Snapshot type. `memory` captures filesystem, memory, and
                    running process state for warm restore. `filesystem`
                    captures filesystem state only for cold-boot restore. When
                    omitted, the server default is `filesystem`.
                  enum:
                    - memory
                    - filesystem
      responses:
        '202':
          description: Snapshot creation initiated
          content:
            application/json:
              schema:
                type: object
                required:
                  - snapshot_id
                  - status
                properties:
                  snapshot_id:
                    type: string
                  status:
                    type: string
        '400':
          description: Invalid snapshot request
          content:
            text/plain: {}
        '401':
          description: Unauthorized. Invalid or missing credentials
        '403':
          description: Forbidden. You do not have permission to access this resource
        '404':
          description: Sandbox not found
          content:
            text/plain: {}
        '500':
          description: Internal server error
          content:
            text/plain: {}
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````