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

# Activate a sandbox

> Returns the sandbox with a fresh access token. If the sandbox is paused, it is resumed first; a pause still finishing is waited out briefly, then resumed. Idempotent — calling it on an active sandbox just returns a new token.




## OpenAPI

````yaml https://api.superserve.ai/openapi.yaml post /sandboxes/{sandbox_id}/activate
openapi: 3.1.0
info:
  title: Superserve API
  version: 0.1.0
  description: >
    Superserve provides sandbox infrastructure to run AI agents in the cloud.
    Powered by Firecracker MicroVMs.


    ## Sandbox lifecycle


    ```

    active <--> paused --> deleted

    ```


    A sandbox is `active` when running and `paused` after being paused. Resuming

    a paused sandbox returns it to `active`. Deleting releases all resources.


    | Endpoint | What it does |

    |----------|-------------|

    | `POST /sandboxes` | Create a new sandbox (optionally `from_template`) |

    | `PATCH /sandboxes/:id` | Partially update a running sandbox (e.g. network
    rules) |

    | `POST /sandboxes/:id/pause` | Snapshot full state, suspend the VM |

    | `POST /sandboxes/:id/resume` | Restore from snapshot, continue where it
    left off |

    | `DELETE /sandboxes/:id` | Delete sandbox and all resources |


    ## Sandbox environment


    By default sandboxes boot from the curated `superserve/base` template
    (Ubuntu 24.04,

    1 vCPU, 1 GB RAM, 8 GB disk, with Python 3.12, Node.js 22, npm, git, curl,

    and build-essential pre-installed). Callers can override with any template

    name (e.g. `superserve/python-3.11`, `superserve/node-22`) or a team-owned
    template UUID

    via the `from_template` field on `POST /sandboxes`.


    ## Files and commands


    `/files`, `/exec`, and `/exec/stream` run against a single sandbox and use

    its `X-Access-Token` (returned by create, resume, and activate), not the

    team API key. Two host forms reach them:


    - `https://sandbox.superserve.ai/...` with `X-Superserve-Sandbox-Id:
    <sandbox_id>`.

    - `https://boxd-{sandbox_id}.sandbox.superserve.ai/...` — no routing header
    needed.
  contact:
    name: Superserve Team
  license:
    name: Proprietary
servers:
  - url: https://api.superserve.ai
    description: Production
security: []
paths:
  /sandboxes/{sandbox_id}/activate:
    parameters:
      - $ref: '#/components/parameters/SandboxId'
    post:
      tags:
        - Sandboxes
      summary: Activate a sandbox
      description: >
        Returns the sandbox with a fresh access token. If the sandbox is paused,
        it is resumed first; a pause still finishing is waited out briefly, then
        resumed. Idempotent — calling it on an active sandbox just returns a new
        token.
      operationId: activateSandbox
      responses:
        '200':
          description: The sandbox is active.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SandboxResponse'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '402':
          $ref: '#/components/responses/BillingRequired'
        '404':
          $ref: '#/components/responses/NotFound'
        '409':
          description: >-
            `sandbox_pausing` — the pause is still finishing after the wait;
            retry after `Retry-After` seconds. `secret_change_in_progress` — a
            secret change to the sandbox is still running after the wait; retry
            after `Retry-After` seconds. `conflict` — the sandbox is in a state
            that cannot be activated (for example `failed`).
          headers:
            Retry-After:
              description: >-
                Seconds to wait before retrying; sent with `sandbox_pausing` and
                `secret_change_in_progress`.
              schema:
                type: integer
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            `too_many_sandboxes` — auto-resuming a paused sandbox would exceed
            the active sandbox limit; free a slot or contact support to raise
            it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - apiKey: []
components:
  parameters:
    SandboxId:
      name: sandbox_id
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/PublicSandboxId'
      description: The unique identifier of the sandbox.
  schemas:
    SandboxResponse:
      description: >-
        Single-sandbox shape — `SandboxListItem` plus `access_token` and bound
        secrets.
      allOf:
        - $ref: '#/components/schemas/SandboxListItem'
        - type: object
          properties:
            routing_hint:
              type: string
              description: |
                Optional signed logical-owner routing hint. Send on data-plane
                requests as X-Superserve-Routing-Hint, or as a route.<hint>
                WebSocket subprotocol alongside the unchanged access token.
                Refresh after resume/activate; absent or invalid hints retain
                ownership lookup fallback. This does not authorize access.
            access_token:
              type: string
              description: |
                Per-sandbox access token for data-plane operations (file
                upload/download, terminal). Pass as the `X-Access-Token`
                header.
            secrets:
              type: array
              description: >
                Credentials bound to this sandbox. Each entry maps an env-var
                name visible to the agent to the secret name it resolves to.
                `revoked=true` when the underlying secret has been soft-deleted
                (the env var still holds the now-useless proxy token).
              items:
                type: object
                required:
                  - env_key
                  - secret_name
                properties:
                  env_key:
                    type: string
                  secret_name:
                    type: string
                  revoked:
                    type: boolean
                    default: false
    Error:
      type: object
      description: >
        Error envelope. `error.code` is a stable, machine-readable identifier

        (e.g. `bad_request`, `not_found`, `conflict`, `sandbox_pausing`,

        `rate_limited`, `too_many_builds`, `too_many_templates`,
        `too_many_sandboxes`,

        `image_pull_failed`, `step_failed`, `snapshot_failed`,

        `start_cmd_failed`, `ready_cmd_failed`, `capacity_unavailable`,

        `build_timed_out`, `infrastructure_failed`, `build_failed`,

        `trial_exhausted`, `trial_unavailable`, `trial_check_unavailable`,

        `free_allowance_exhausted`, `sandbox_exceeds_plan_limits`,

        `billing_ineligible`).

        `error.message` is human-readable and may change between releases;

        clients should branch on `code`, not `message`.
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            action_url:
              type: string
              format: uri
              example: https://console.superserve.ai/plan-usage
              description: >
                Where to resolve the error, when there is a next step. Sent with
                `trial_exhausted`, `trial_unavailable` and
                `trial_check_unavailable`: the page where the team adds a card
                and chooses a plan.
    PublicSandboxId:
      type: string
      pattern: >-
        ^(sb-[a-z0-9]+-)?[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$
      description: >
        Public sandbox ID: a bare UUID, or the region-tagged form
        `sb-<region>-<uuid>` (e.g. `sb-use-1b4e28ba-…`). Treat as an opaque
        string; the tagged form routes the request to the sandbox's home region.
        Endpoints accept both forms interchangeably.
    SandboxListItem:
      description: Sandbox shape returned by list endpoints.
      type: object
      properties:
        id:
          $ref: '#/components/schemas/PublicSandboxId'
        name:
          type: string
        status:
          type: string
          enum:
            - active
            - pausing
            - paused
            - resuming
            - migrating
            - failed
          description: >
            Current state of the sandbox. `active` means running; `paused` means
            paused and awaiting resume. `pausing`, `resuming` and `migrating`
            are transient states observed while the platform pauses, restores,
            or relocates a sandbox (e.g. after a `202` from `/pause`, or
            auto-resume on `/exec`); clients should poll or retry shortly.
            `failed` means the sandbox can no longer be resumed.
        vcpu_count:
          type: integer
        memory_mib:
          type: integer
        memory_max_mib:
          type: integer
          description: Memory ceiling for live growth; absent when memory is fixed.
        snapshot_id:
          type: string
          format: uuid
          description: ID of the latest snapshot (present after a pause).
        source_snapshot_id:
          type: string
          format: uuid
          description: The saved snapshot the sandbox was created from, when it was.
        created_at:
          type: string
          format: date-time
        timeout_seconds:
          type: integer
          format: int32
          description: >
            Auto-pause timeout in seconds, if configured. Absent when auto-pause
            is disabled.
        idle_timeout_seconds:
          type: integer
          format: int32
          description: >
            Idle timeout in seconds, if configured. Absent when the sandbox is
            never paused for being idle.
        auto_delete_seconds:
          type: integer
          format: int32
          description: >
            Garbage-collection window for the paused state, if configured.
            Absent when auto-delete is disabled.
        auto_delete_at:
          type: string
          format: date-time
          description: >
            When the sandbox will be deleted. Present only while the sandbox is
            paused with `auto_delete_seconds` configured. The deadline is armed
            when the sandbox pauses (or when the setting is applied to an
            already-paused sandbox) and cleared on resume.
        network:
          $ref: '#/components/schemas/NetworkConfig'
          description: >
            Current egress allow/deny rules, if any have been configured. Absent
            when the sandbox uses default network settings.
        metadata:
          type: object
          additionalProperties:
            type: string
          description: >
            User-supplied tags attached at creation. Always present — sandboxes
            created without metadata return `{}` rather than being absent.
          example:
            env: prod
            owner: agent-7
        preview_access:
          type: string
          enum:
            - legacy_public
            - public
            - private
          description: |
            Default access for newly published ports. `public` and `private`
            are strict modes; existing published rows keep their own access.
            `legacy_public` may be returned for an older sandbox and preserves
            all-port behavior until updated to a strict mode.
    NetworkConfig:
      type: object
      description: >
        Egress network rules for a sandbox. `allow_out` accepts CIDRs (e.g.
        `8.8.8.8/32`) and domain names (e.g. `api.openai.com`, `*.github.com`).
        `deny_out` accepts CIDRs only. Private ranges (10/8, 172.16/12,
        192.168/16, 127/8, 169.254/16) are always blocked regardless of rules.
      properties:
        allow_out:
          type: array
          items:
            type: string
          description: CIDRs or domains to allow.
          example:
            - api.openai.com
            - '*.github.com'
            - 8.8.8.8/32
        deny_out:
          type: array
          items:
            type: string
          description: >-
            CIDRs to deny. Use `0.0.0.0/0` to block all traffic not in
            `allow_out`.
          example:
            - 0.0.0.0/0
  responses:
    Unauthorized:
      description: Missing or invalid API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    BillingRequired:
      description: |
        Billing blocks the operation. The operation can start again once the
        cause is resolved. The `error.code` distinguishes:
        - `trial_exhausted` — the free trial credit is used up. Add a card and
          choose a plan at `error.action_url` to keep using sandboxes.
        - `trial_unavailable` — the free trial is not available for this
          account. Add a card and choose a plan at `error.action_url` to use
          sandboxes.
        - `trial_check_unavailable` — the free trial could not be confirmed
          for this account because a required check did not complete. This is
          not a decision that the account is ineligible. Add a card and choose
          a plan at `error.action_url` to use sandboxes.
        - `free_allowance_exhausted` — the team is on a legacy Free plan and
          its daily compute allowance is used up; `error.resets_at` is when it
          resets. New accounts start on the free trial instead.
        - `sandbox_exceeds_plan_limits` — the sandbox is larger than the
          plan allows; use a smaller template or upgrade.
        - `billing_ineligible` — sandbox usage is unavailable until billing is
          active. Check the team's billing in the console.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: X-API-Key

````

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