> ## Documentation Index
> Fetch the complete documentation index at: https://e2b-automation-api-reference-update.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Fork sandbox

> Fork the sandbox: checkpoint the running sandbox in place (it is briefly paused, snapshotted with its full memory state, and resumed on its node, keeping its ID and expiration untouched) and create count new sandboxes from that snapshot. Returns one result per requested fork, each carrying either the created sandbox or the error that prevented it from starting. A non-201 status means the request failed before any fork was attempted.



## OpenAPI

````yaml /openapi-public.yml post /sandboxes/{sandboxID}/fork
openapi: 3.1.0
info:
  title: E2B API
  version: 0.1.0
  description: >-
    Complete E2B developer API. Platform endpoints are served on api.e2b.app.
    Sandbox endpoints (envd) are served on the shared sandbox host
    (sandbox.e2b.app); target a specific sandbox with the E2b-Sandbox-Id and
    E2b-Sandbox-Port headers.
servers:
  - url: https://api.e2b.app
    description: E2B Platform API
security: []
tags:
  - name: Sandboxes
  - name: Templates
  - name: Tags
  - name: Volumes
  - name: Envd
  - name: Filesystem
  - name: Process
  - name: Teams
paths:
  /sandboxes/{sandboxID}/fork:
    servers:
      - url: https://api.e2b.app
        description: E2B Platform API
    post:
      tags:
        - Sandboxes
      summary: Fork sandbox
      description: >-
        Fork the sandbox: checkpoint the running sandbox in place (it is briefly
        paused, snapshotted with its full memory state, and resumed on its node,
        keeping its ID and expiration untouched) and create count new sandboxes
        from that snapshot. Returns one result per requested fork, each carrying
        either the created sandbox or the error that prevented it from starting.
        A non-201 status means the request failed before any fork was attempted.
      operationId: postSandboxFork
      parameters:
        - $ref: '#/components/parameters/sandboxID'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SandboxForkRequest'
      responses:
        '201':
          description: >-
            The sandbox was snapshotted and the forks were attempted; each entry
            reports one fork's outcome
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/SandboxForkResult'
        '401':
          $ref: '#/components/responses/401'
        '404':
          $ref: '#/components/responses/404'
        '409':
          $ref: '#/components/responses/409'
        '500':
          $ref: '#/components/responses/500'
      security:
        - ApiKeyAuth: []
components:
  parameters:
    sandboxID:
      name: sandboxID
      in: path
      required: true
      schema:
        type: string
  schemas:
    SandboxForkRequest:
      type: object
      properties:
        timeout:
          type: integer
          format: int32
          minimum: 0
          default: 15
          description: Time to live for the new forked sandboxes in seconds.
        count:
          type: integer
          format: int32
          minimum: 1
          maximum: 100
          default: 1
          description: >-
            Number of forked sandboxes to create. All forks boot from the same
            snapshot, so the snapshot is captured once regardless of count. Each
            fork succeeds or fails independently; the outcome of each is
            reported in its entry of the response list.
    SandboxForkResult:
      type: object
      description: >-
        Result of one requested fork. Exactly one of sandbox or error is set:
        sandbox when the fork started successfully, error when it failed to
        start.
      properties:
        sandbox:
          $ref: '#/components/schemas/Sandbox'
        error:
          $ref: '#/components/schemas/Error'
    Sandbox:
      required:
        - templateID
        - sandboxID
        - clientID
        - envdVersion
      properties:
        templateID:
          type: string
          description: Identifier of the template from which is the sandbox created
        sandboxID:
          type: string
          description: Identifier of the sandbox
        alias:
          type: string
          description: Alias of the template
        clientID:
          type: string
          deprecated: true
          description: Identifier of the client
        envdVersion:
          $ref: '#/components/schemas/EnvdVersion'
        envdAccessToken:
          type:
            - string
            - 'null'
          description: >-
            Access token for authenticating envd requests to this sandbox. Only
            returned when the sandbox is created with `secure: true`. Null for
            non-secure sandboxes (envd endpoints work without auth).
        trafficAccessToken:
          type:
            - string
            - 'null'
          description: Token required for accessing sandbox via proxy.
        domain:
          type:
            - string
            - 'null'
          description: >-
            Deprecated: always null. Construct sandbox URLs as
            `https://{port}-{sandboxID}.e2b.app`.
          deprecated: true
      type: object
    Error:
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
          description: Error code
        message:
          type: string
          description: Error
      type: object
    EnvdVersion:
      type: string
      description: Version of the envd running in the sandbox
  responses:
    '401':
      description: Authentication error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '404':
      description: Not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '409':
      description: Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '500':
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````