Recoup

Get started with Recoup.

API REFERENCE

List sandboxes

On this page
GET/api/sandboxes

List all sandboxes associated with the authenticated account and their current statuses. Returns sandbox details including lifecycle state, timeout remaining, and creation timestamp. Authentication is handled via the x-api-key header or Authorization Bearer token.

Set metadata_only=true when you only need the existing saved metadata. This skips live sandbox status lookups and returns an empty sandboxes array alongside snapshot_id, github_repo and filetree, preserving their existing nullable behavior. Stored metadata reads and the optional GitHub filetree lookup still run. The empty array in this mode does not establish whether any sandbox is running.

Omitting metadata_only or sending literal false preserves normal live-status behavior. Authentication, account access checks and sandbox filters remain the same in either mode. Supplied values must be literal lowercase true or false; other values, including an empty value, return 400 through query validation.

Omit account_id to read the authenticated account. An explicit UUID must pass the existing account-access policy: the caller itself, an organization the caller belongs to, a shared-organization account, or existing Recoup administrative access. Invalid UUIDs return 400; denied targets return 403 before snapshot or repository lookup. A target read never falls back to the caller's repository. Successful explicit-target reads echo account_id; omitted-target responses do not add that field. This delegates reads only, not upload, replacement or deletion rights.

Authentication

See the authentication guide for API key and account access requirements.

Request

cURL
curl --request GET \
  --url 'https://api.recoupable.dev/api/sandboxes' \
  --header 'x-api-key: YOUR_API_KEY'

Replace the YOUR_ placeholders with your values. Required query parameters are included; optional parameters are listed below.

Try it

Fill in the fields, send the request from your browser, and read the live response. The curl below updates as you type.

Kept in this browser tab only and cleared when it closes.

cURL for this request
curl --request GET \
  --url 'https://api.recoupable.dev/api/sandboxes'

Parameters

Query parameters

sandbox_idstring

Filter by a specific sandbox ID. When provided, returns only the sandbox matching this ID. Must be a sandbox that your account or organization is an admin of.

account_idstring

Optional target account UUID authorized by the existing account-access policy. Omit for the authenticated account. Successful explicit-target reads echo this value as account_id; this does not grant file-write access.

metadata_onlyboolean

Send literal lowercase true to skip live sandbox status lookups and return the existing metadata with an empty sandboxes array. Omitted or false retains live-status lookups. Database metadata reads and optional GitHub filetree retrieval still run; authentication, access checks and sandbox filters are unchanged. Other supplied values, including an empty value, return 400.

Default: false

Responses

200Sandboxes retrieved successfully. In metadata_only mode, sandboxes is empty while the existing saved metadata fields are retained. Explicit authorized account_id requests echo that account_id; omitted-target requests keep the existing response shape.

application/json

statusstring · enumrequired

Status of the request

Values: "success", "error"

sandboxesarray<Sandbox>required

Array of sandbox objects

Item properties for sandboxes
sandboxIdstringrequired

Unique identifier for the sandbox

Example: "sbx_abc123def456"

sandboxStatusstring · enumrequired

Current lifecycle state of the sandbox

Values: "pending", "running", "stopping", "stopped", "failed"

Example: "running"

timeoutintegerrequired

Milliseconds remaining before the sandbox stops automatically

Example: 300000

createdAtstringrequired

ISO 8601 timestamp when the sandbox was created

Example: "2024-01-15T10:30:00.000Z"

format: date-time

runIdstring

Unique identifier for the command execution run. Only present if a command was provided when creating the sandbox. Use this with GET /api/tasks/runs to check the status and retrieve results.

Example: "run_xyz789abc123"

snapshot_idstringnullable

The account's saved snapshot ID used for creating new sandboxes. Null if no snapshot has been saved.

Example: "snap_abc123def456"

github_repostringnullable

The GitHub repository URL associated with the account's sandbox environment. Used as the filesystem source when restoring sandboxes.

Example: "https://github.com/username/repo"

filetreearray<FileTreeEntry>nullable

The recursive file tree of the account's GitHub repository. Null if no github_repo is set or if the fetch fails.

Item properties for filetree
pathstringrequired

The file or directory path relative to the repository root

Example: "src/index.ts"

typestring · enumrequired

The type of entry: blob for files, tree for directories

Values: "blob", "tree"

shastringrequired

The SHA hash of the entry

Example: "abc123def456"

sizeinteger

The size of the file in bytes. Only present for blob entries.

Example: 1024

errorstring

Error message (only present if status is error)

account_idstring

On successful GET reads only: the explicitly requested, authorized target account UUID. Present even for an explicit self target; absent when account_id was omitted. This is read scope, not write authorization.

Example: "11111111-1111-4111-8111-111111111111"

format: uuid

Authenticated account metadata (metadata_only=true)

ownMetadata
{
  "status": "success",
  "sandboxes": [],
  "snapshot_id": null,
  "github_repo": null,
  "filetree": null
}

Authorized explicit account metadata (account_id and metadata_only=true)

targetMetadata
{
  "status": "success",
  "sandboxes": [],
  "snapshot_id": null,
  "github_repo": null,
  "filetree": null,
  "account_id": "11111111-1111-4111-8111-111111111111"
}

400Invalid query parameters, including an invalid account_id UUID or a supplied metadata_only value other than literal lowercase true or false.

application/json

errorstringrequired

Error message describing what went wrong

Example: "Failed to create sandbox"

401Unauthorized - invalid or missing API key

application/json

errorstringrequired

Error message describing what went wrong

Example: "Failed to create sandbox"

403Access denied to the explicit account_id. No target snapshot/repository lookup or fallback to the caller's repository occurs.

application/json

errorstringrequired

Error message describing what went wrong

Example: "Failed to create sandbox"

Full specification

Download the OpenAPI file for complete schemas, constraints, and examples.

Download content.json
View operation source
json
{
  "operationId": "getSandboxes",
  "description": "List all sandboxes associated with the authenticated account and their current statuses. Returns sandbox details including lifecycle state, timeout remaining, and creation timestamp. Authentication is handled via the x-api-key header or Authorization Bearer token.\n\nSet `metadata_only=true` when you only need the existing saved metadata. This skips live sandbox status lookups and returns an empty `sandboxes` array alongside `snapshot_id`, `github_repo` and `filetree`, preserving their existing nullable behavior. Stored metadata reads and the optional GitHub filetree lookup still run. The empty array in this mode does not establish whether any sandbox is running.\n\nOmitting `metadata_only` or sending literal `false` preserves normal live-status behavior. Authentication, account access checks and sandbox filters remain the same in either mode. Supplied values must be literal lowercase `true` or `false`; other values, including an empty value, return 400 through query validation.\n\nOmit `account_id` to read the authenticated account. An explicit UUID must pass the existing account-access policy: the caller itself, an organization the caller belongs to, a shared-organization account, or existing Recoup administrative access. Invalid UUIDs return 400; denied targets return 403 before snapshot or repository lookup. A target read never falls back to the caller's repository. Successful explicit-target reads echo `account_id`; omitted-target responses do not add that field. This delegates reads only, not upload, replacement or deletion rights.",
  "parameters": [
    {
      "name": "sandbox_id",
      "in": "query",
      "required": false,
      "description": "Filter by a specific sandbox ID. When provided, returns only the sandbox matching this ID. Must be a sandbox that your account or organization is an admin of.",
      "schema": {
        "type": "string",
        "example": "sbx_abc123def456"
      }
    },
    {
      "name": "account_id",
      "in": "query",
      "description": "Optional target account UUID authorized by the existing account-access policy. Omit for the authenticated account. Successful explicit-target reads echo this value as account_id; this does not grant file-write access.",
      "required": false,
      "schema": {
        "type": "string",
        "format": "uuid"
      },
      "example": "11111111-1111-4111-8111-111111111111"
    },
    {
      "name": "metadata_only",
      "in": "query",
      "required": false,
      "description": "Send literal lowercase true to skip live sandbox status lookups and return the existing metadata with an empty sandboxes array. Omitted or false retains live-status lookups. Database metadata reads and optional GitHub filetree retrieval still run; authentication, access checks and sandbox filters are unchanged. Other supplied values, including an empty value, return 400.",
      "schema": {
        "type": "boolean",
        "default": false
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Sandboxes retrieved successfully. In metadata_only mode, sandboxes is empty while the existing saved metadata fields are retained. Explicit authorized account_id requests echo that account_id; omitted-target requests keep the existing response shape.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/SandboxesResponse"
          },
          "examples": {
            "ownMetadata": {
              "summary": "Authenticated account metadata (metadata_only=true)",
              "value": {
                "status": "success",
                "sandboxes": [],
                "snapshot_id": null,
                "github_repo": null,
                "filetree": null
              }
            },
            "targetMetadata": {
              "summary": "Authorized explicit account metadata (account_id and metadata_only=true)",
              "value": {
                "status": "success",
                "sandboxes": [],
                "snapshot_id": null,
                "github_repo": null,
                "filetree": null,
                "account_id": "11111111-1111-4111-8111-111111111111"
              }
            }
          }
        }
      }
    },
    "400": {
      "description": "Invalid query parameters, including an invalid account_id UUID or a supplied metadata_only value other than literal lowercase true or false.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/SandboxErrorResponse"
          }
        }
      }
    },
    "401": {
      "description": "Unauthorized - invalid or missing API key",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/SandboxErrorResponse"
          }
        }
      }
    },
    "403": {
      "description": "Access denied to the explicit account_id. No target snapshot/repository lookup or fallback to the caller's repository occurs.",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/SandboxErrorResponse"
          }
        }
      }
    }
  }
}