> ## Documentation Index
> Fetch the complete documentation index at: /docs/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.

Anona: the sandbox is frozen only while its memory delta is written (about 0.1 s, longer right after it has touched a lot of memory) and then keeps running with its own ID and expiration. Each fork is a new sandbox: it takes a slot of your concurrent-sandbox limit and is billed like any other sandbox, and the forks inherit the source sandbox's template, metadata, timeout policy and network policy, with the `timeout` of this request. `count` above the room left in your plan is not an error for the whole request: the forks that fit are created and each of the others carries `429` `plan_limit_exceeded` (with `limit_name`, `limit`, `current` and `plan`) in its own result entry, while a platform at capacity reports `503` per fork. A source sandbox that is not running is `409`, and nothing is forked.



## OpenAPI

````yaml /api-reference/e2b-openapi.yaml post /sandboxes/{sandboxID}/fork
openapi: 3.0.0
info:
  title: Anona Compute API (E2B-compatible routes)
  version: 0.1.0
  description: >-
    The E2B-compatible API operations the Anona Compute gateway serves, for use
    with the E2B SDK.
servers:
  - url: https://api.compute.anonalabs.com
security: []
tags:
  - name: sandboxes
paths:
  /sandboxes/{sandboxID}/fork:
    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.


        Anona: the sandbox is frozen only while its memory delta is written
        (about 0.1 s, longer right after it has touched a lot of memory) and
        then keeps running with its own ID and expiration. Each fork is a new
        sandbox: it takes a slot of your concurrent-sandbox limit and is billed
        like any other sandbox, and the forks inherit the source sandbox's
        template, metadata, timeout policy and network policy, with the
        `timeout` of this request. `count` above the room left in your plan is
        not an error for the whole request: the forks that fit are created and
        each of the others carries `429` `plan_limit_exceeded` (with
        `limit_name`, `limit`, `current` and `plan`) in its own result entry,
        while a platform at capacity reports `503` per fork. A source sandbox
        that is not running is `409`, and nothing is forked.
      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'
        '429':
          $ref: '#/components/responses/429'
        '500':
          $ref: '#/components/responses/500'
        '503':
          $ref: '#/components/responses/503'
        '507':
          description: >-
            Snapshot storage is full (error_code
            `sandbox_snapshot_storage_full`); retrying does not help
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      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'
    Error:
      required:
        - code
        - message
      properties:
        code:
          type: integer
          format: int32
          description: Error code
        error_code:
          type: string
          description: >-
            Machine-readable error code. Not a closed set; the gateway sends
            plan_limit_exceeded (a plan limit; the body also has limit_name,
            limit, current and plan), rate_limited (a rate limit, with
            Retry-After), sandbox_quota_exceeded (a platform cap that is not a
            plan limit: fork checkpoints, builds in progress), credit_exhausted
            (the credit is spent), sandbox_snapshot_storage_full (pause and fork
            cannot store a snapshot; retrying does not help),
            template_not_found, template_not_ready (the template exists but
            cannot start a sandbox), sandbox_capacity_unavailable,
            sandbox_engine_starting and sandbox_engine_unavailable (retry after
            Retry-After), sandbox_create_failed (retry), sandbox_create_refused,
            invalid_request and internal_server_error.
        message:
          type: string
          description: 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
          description: Access token used for envd communication
        trafficAccessToken:
          type: string
          nullable: true
          description: Token required for accessing sandbox via proxy.
        domain:
          type: string
          nullable: true
          description: Base domain where the sandbox traffic is accessible
    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'
    '429':
      description: Too many requests
      headers:
        Retry-After:
          description: >-
            When present, the number of seconds to wait before retrying the
            request.
          required: false
          schema:
            type: integer
            minimum: 0
          example: 30
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '500':
      description: Server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    '503':
      description: Service unavailable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.