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

> ## Agent Instructions
> To set up offstage cloud from a coding agent, read https://api.offstage.cloud/SKILL.md and follow it. The whole API guide is one file at https://api.offstage.cloud/llms.txt.

# Set the timeout

> Makes the sandbox close `timeoutMs` from now, sooner or later than before, like E2B's `setTimeout`, and returns it; the answer's `timeoutMs` is the new lifetime counted from creation, and `idleTimeoutMs` is lowered to it if it was larger. A sandbox lives at most 24 hours from its creation, and lengthening it reserves the extra time against the credit and the budget. A command still waiting for a place in the sandbox runs for the new life, up to its own `timeoutMs`; one already running keeps the end it started with.



## OpenAPI

````yaml /openapi.json post /v1/sandboxes/{sandboxId}/timeout
openapi: 3.1.0
info:
  title: offstage cloud API
  version: 0.1.0
  summary: Real Macs for AI agents and CI, over HTTP.
  description: >-
    macOS sandboxes driven one call at a time, and fire-and-forget CI tasks, on
    Apple silicon Macs running macOS 27.


    - **Auth.** `Authorization: Bearer sk_offstage_…` (a team API key; one made
    before 2026-10-29 starts with `oc_live_` and still works), or the console's
    `oc_session` cookie. Operations marked `x-console-only: true` take only the
    cookie; an API key gets 403 `console-only`. A cookie request that changes
    something must come from this origin.

    - **Errors.** Every failure is `{"error": {"code", "message", "fix"?,
    "requestId"}}`. Switch on `code`; `fix`, when present, says what to do. Any
    operation can also answer 500 `internal` (a bug; quote the `requestId`), and
    an unknown route is 404 `no-such-route`.

    - **Request ids.** Every response carries an `x-request-id` header, repeated
    as `requestId` in error bodies.

    - **Units.** Times are Unix milliseconds, and durations end in `Ms`. Money
    is US dollars as numbers, exact to the micro-dollar (`costUsd`).

    - **Ids** are prefixed: `sbx_` sandbox, `cmd_` command, `run_` agent run,
    `task_` task, `key_` API key, `req_` request, `team_`, `usr_`, `box_` (a
    fleet Mac), `inv_`.

    - **Lists** are newest first. Pass the previous page's `nextCursor` as
    `cursor`; it is null on the last page.

    - **Bodies.** JSON, except file writes, which send raw bytes. Request
    schemas with `additionalProperties: false` refuse an unknown field with 400
    `unknown-field`.

    - **Limits.** A team may send 120 requests a minute, whatever key or session
    it uses. Every request also counts against its client address: 600 a minute,
    and far fewer on the routes that need no credential (5 sign-ups an hour, 20
    sign-ins and 20 verifications a minute). Over a window is 429 `rate-limit`
    with a `Retry-After` header.

    - **Verification.** A new account's team can sign in and look around, but
    cannot create sandboxes, tasks or API keys (403 `email-unverified`) until
    its owner opens the link emailed at signup.

    - **Holds.** No request is held longer than about 50 s, so default client
    timeouts and 60 s proxy idle timeouts are fine, except large files: a write
    answers once its upload is done, and a read streams for as long as the Mac
    takes to send it.


    The prose reference, with examples, is
    `https://api.offstage.cloud/llms.txt`. The agent setup guide is
    `https://api.offstage.cloud/SKILL.md`.
servers:
  - url: https://api.offstage.cloud
security:
  - apiKey: []
  - consoleSession: []
tags:
  - name: Sandboxes
    description: >-
      A Mac slot (a macOS user account) held for you: run commands, move files,
      take screenshots.
  - name: Tasks
    description: >-
      Fire-and-forget macOS work: clone a public repo, run a command, collect
      artifacts.
  - name: Recordings
    description: >-
      What a gui sandbox or gui task showed and did, kept by the plane: live
      while it runs, a replay after. Open one in the console at `/r/{id}`.
  - name: Capacity
    description: What the fleet can take right now, and whether the plane is up.
  - name: Billing
    description: The price, usage, the bill, the budget and the card.
  - name: Account
    description: Signing in, the team, its members and its API keys.
  - name: GitHub
    description: >-
      GitHub Actions jobs on offstage Macs: connect an organization in the
      console, then `runs-on: offstage-macos`.
  - name: Secrets
    description: Write-only team credentials selected by workload name.
paths:
  /v1/sandboxes/{sandboxId}/timeout:
    post:
      tags:
        - Sandboxes
      summary: Set the timeout
      description: >-
        Makes the sandbox close `timeoutMs` from now, sooner or later than
        before, like E2B's `setTimeout`, and returns it; the answer's
        `timeoutMs` is the new lifetime counted from creation, and
        `idleTimeoutMs` is lowered to it if it was larger. A sandbox lives at
        most 24 hours from its creation, and lengthening it reserves the extra
        time against the credit and the budget. A command still waiting for a
        place in the sandbox runs for the new life, up to its own `timeoutMs`;
        one already running keeps the end it started with.
      operationId: setSandboxTimeout
      parameters:
        - $ref: '#/components/parameters/SandboxId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetTimeoutRequest'
      responses:
        '200':
          description: The sandbox, with its new `timeoutMs` and `expiresAt`.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Sandbox'
        '400':
          description: >-
            `not-an-object`, `unknown-field`, or `bad-timeout` (missing, not a
            positive integer, or past 24 hours from creation; the message says
            how much time is left).
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            `unauthorized`: no credential, an `Authorization` header that is not
            `Bearer …`, a value that is not an `sk_offstage_` (or older
            `oc_live_`) key, a revoked or unknown key, or a box token. The
            message says which.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '402':
          description: >-
            The work's worst case (its `timeoutMs` at the hourly price) does not
            fit. `payment-method-required`: the team has no card and the free
            credit, after the work already in flight, cannot cover it; add a
            card or ask for a shorter `timeoutMs`. `budget-exceeded`: this
            month's spend plus the work in flight plus this request could pass
            the enforced monthly budget; raise or lift it, or ask for a shorter
            `timeoutMs`. `credit-ceiling`: the team has a card, and what it owes
            beyond the free credit (unpaid invoices, usage not invoiced yet, the
            work in flight) plus this request could pass the credit ceiling
            offstage sets; the budget cannot lift it. `payment-failed`: the last
            invoice's charge failed and new work is paused until the card is
            fixed.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: >-
            `forbidden`: a cookie-authenticated request that changes something
            came from another origin.
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: '`not-found`: no such sandbox, or it belongs to another team.'
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: '`sandbox-closed`: the sandbox has already closed.'
          headers:
            x-request-id:
              $ref: '#/components/headers/RequestId'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          $ref: '#/components/responses/BodyTooLarge'
        '429':
          $ref: '#/components/responses/RateLimited'
      security:
        - apiKey: []
        - consoleSession: []
components:
  parameters:
    SandboxId:
      name: sandboxId
      in: path
      required: true
      description: A sandbox id, `sbx_…`.
      schema:
        type: string
  schemas:
    SetTimeoutRequest:
      type: object
      properties:
        timeoutMs:
          type: integer
          description: >-
            Close the sandbox this long from now. At most 24 hours from its
            creation.
          minimum: 1
          maximum: 86400000
      required:
        - timeoutMs
      additionalProperties: false
      description: Unknown fields are refused with 400 `unknown-field`.
    Sandbox:
      type: object
      properties:
        snapshotId:
          type: string
          description: The source snapshot ID when restored.
        id:
          type: string
          description: '`sbx_…`.'
          pattern: ^sbx_
        name:
          type: string
          minLength: 1
          maxLength: 48
          pattern: ^[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$
          description: >-
            What people call it, like `swift-otter`: picked at creation unless
            you choose one, and unique among the team's open sandboxes. Routes
            take the `id`, not the name.
        session:
          $ref: '#/components/schemas/Session'
        state:
          type: string
          enum:
            - pending
            - ready
            - closed
          description: >-
            `pending` until a slot takes it, `ready` while it is held, then
            `closed`.
        createdAt:
          $ref: '#/components/schemas/Millis'
        expiresAt:
          $ref: '#/components/schemas/Millis'
          description: >-
            Current deadline in Unix milliseconds. For a restore, the sandbox
            lifetime starts when setup succeeds.
        timeoutMs:
          type: integer
          description: >-
            Sandbox lifetime, counted from creation or, for a restore, from
            readiness.
          minimum: 1
        idleTimeoutMs:
          type: integer
          description: It closes after this long with no op.
          minimum: 1
        lastActivityAt:
          $ref: '#/components/schemas/Millis'
        boxId:
          type: string
          description: The Mac holding it. Absent until a slot takes it.
          pattern: ^box_
        slot:
          type: integer
          description: The slot on that Mac. Absent until taken.
          minimum: 1
        readyAt:
          $ref: '#/components/schemas/Millis'
          description: When it became `ready`; billing starts here. Absent until then.
        closedAt:
          $ref: '#/components/schemas/Millis'
          description: Absent until it closes.
        closeReason:
          $ref: '#/components/schemas/CloseReason'
          description: Absent until it closes.
        ops:
          type: integer
          description: >-
            Commands, file calls and screenshots run in it so far. The pictures
            the plane takes for its recording are not counted.
          minimum: 0
        runtimeSeconds:
          type: integer
          description: Whole seconds from `ready` to closed (or now). Absent until ready.
          minimum: 0
        costUsd:
          $ref: '#/components/schemas/Usd'
          description: 'What its time on a Mac costs: so far while open, final once closed.'
        createdBy:
          $ref: '#/components/schemas/CreatedBy'
        record:
          type: boolean
          description: >-
            Whether the plane keeps a recording of it: true for a `gui` sandbox
            unless created with `record: false`.
        replayUrl:
          type: string
          description: >-
            Where to watch it, live while it is open and as a replay after: the
            console's `/r/{id}` page. Present when it records.
      required:
        - id
        - name
        - session
        - state
        - createdAt
        - expiresAt
        - timeoutMs
        - idleTimeoutMs
        - lastActivityAt
        - ops
        - costUsd
        - createdBy
      additionalProperties: false
      description: >-
        A sandbox: one Mac slot (a macOS user account) held for the team. Files
        persist between calls. Fields that do not apply yet are absent, not
        null.
      examples:
        - id: sbx_mh3k2f9aQ1xYz0aBcDeFgHiJ
          name: swift-otter
          session: headless
          state: ready
          createdAt: 1793000000000
          expiresAt: 1793001800000
          timeoutMs: 1800000
          idleTimeoutMs: 600000
          lastActivityAt: 1793000040000
          boxId: box_mh3k2f9aQ1xYz0aBcDeFgHiJ
          slot: 3
          readyAt: 1793000000100
          ops: 12
          runtimeSeconds: 40
          costUsd: 0.002733
          createdBy:
            keyName: ci
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              description: >-
                Stable and machine-readable, like `sandbox-closed`. Switch on
                this, not on the message.
            message:
              type: string
              description: What went wrong, for a person.
            fix:
              type: string
              description: What to do about it, when there is something to do.
            requestId:
              type: string
              description: >-
                The same as the `x-request-id` header. Quote it when asking for
                help.
              pattern: ^req_
          required:
            - code
            - message
            - requestId
          additionalProperties: false
      required:
        - error
      additionalProperties: false
      description: >-
        The one error envelope: every 4xx and 5xx the plane itself sends. A
        proxy in front of it may send a 5xx whose body is not JSON.
      examples:
        - error:
            code: sandbox-closed
            message: sandbox sbx_mh3k2f9aQ1xYz0aBcDeFgHiJ is closed (idle)
            fix: create a new sandbox
            requestId: req_mh3k2f9aQ1xYz0aBcDeFgHiJ
    Session:
      type: string
      enum:
        - headless
        - gui
      description: >-
        `headless`: the slot's user with no desktop; every slot takes it from
        boot. `gui`: the slot's logged-in desktop session, remade after every
        customer, so `gui` slots are scarce.
    Millis:
      type: integer
      minimum: 0
      description: A time, in Unix milliseconds.
    CloseReason:
      type: string
      enum:
        - deleted
        - expired
        - idle
        - box-lost
        - plane-restart
        - no-capacity
        - restore-failed
        - secret-unavailable
      description: >-
        `deleted`: killed. `expired`: reached `expiresAt`. `idle`: went
        `idleTimeoutMs` with no op. `box-lost`: its Mac stopped answering for 2
        minutes. `plane-restart`: open when the plane restarted and its Mac did
        not come back with it (rare: a restart keeps open sandboxes `ready`).
        `no-capacity`: no slot took it within 15 minutes, or before its
        `timeoutMs` ran out; it cost nothing. secret-unavailable: selected
        credentials could not be resolved at assignment. Pending idle leases
        also expire; GET on an unclaimed pending sandbox renews that lease.
    Usd:
      type: number
      description: US dollars, exact to the micro-dollar (six decimal places).
    CreatedBy:
      description: >-
        Who started the work: `{keyName}` for an API key, `{email}` for a
        console user.
      oneOf:
        - type: object
          properties:
            keyName:
              type: string
          required:
            - keyName
          additionalProperties: false
        - type: object
          properties:
            email:
              type: string
          required:
            - email
          additionalProperties: false
  headers:
    RequestId:
      description: This request's id, `req_…`. Quote it when asking for help.
      required: true
      schema:
        type: string
        pattern: ^req_
  responses:
    BodyTooLarge:
      description: >-
        The JSON body is over 1 MiB (a `command` is 64 KiB at most; the rest is
        spare).
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: >-
        `rate-limit`: this team has sent more than 120 requests in the last 60
        s, or this client address more than 600 (fewer on the routes that need
        no credential). The `Retry-After` header gives the seconds left in the
        window.
      headers:
        x-request-id:
          $ref: '#/components/headers/RequestId'
        Retry-After:
          schema:
            type: string
          description: Seconds until the window opens again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: >-
        A team API key, `sk_offstage_…`, created in the console. Everything it
        touches belongs to its team.
    consoleSession:
      type: apiKey
      in: cookie
      name: oc_session
      description: >-
        The console's session cookie (httpOnly, SameSite=Lax, 30 days), set by
        `signup` and `login`.

````

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