sandpi/ platform

Get started

Authentication

Create, scope, rotate and revoke Platform API keys.

On this page

Create an API key

Create keys in the console. A key is displayed once. Store it in your service’s secret manager and send it in the Authorization: Bearer header on authenticated Platform requests.

sh
export SANDPI_API_TOKEN="your-platform-token"

List managed Environments

GET /v1/environments

Authentication: Platform API bearer token

Parameters and headers
FieldType and constraintsRequiredDescription
query: qstring · max length 200NoCase-insensitive literal substring of the Environment name, ID or initialization repository URL.
query: statusstring · values: "ready" | "updating" | "error"NoEnvironment provisioning status; separate from the Sandbox running/paused state.
query: labelarray · max 32 itemsNoRepeat label=key=value for case-sensitive exact matching. Every condition must match. Split each condition at its first equals sign. Conflicting values for one key are invalid.
query: limitinteger · ≥ 1; ≤ 100NoOpt into pagination with a page size of 1–100. Omit to preserve the complete-list behavior. A paginated response may include nextCursor.
query: beforestring · min length 1; max length 200NonextCursor from the prior page. Requires limit and the same search/filter conditions.

Request example

sh
curl \
    "https://api.sandpi.ai/v1/environments" \
    -H "Authorization: Bearer $SANDPI_API_TOKEN"

No request body.

Responses

200 Successful response.
Response body application/json
FieldType and constraintsRequiredDescription
dataarrayYesSuccessful result wrapped by the API. The child fields describe its content.
data[]objectYeseach array itemRun completion settles the file diff and RootFS checkpoint, then immediately requests a memory pause when no Run, rollback, or checkpoint remains. File and other runtime access uses a one-minute inactivity fallback. Queued Runs continue without an intervening pause. The interactive TUI retains its separate fifteen-minute idle policy. On access after a confirmed memory restoration failure, Sandpi automatically requests a durable cold restart from committed files for a qualified stopped source. Processes restart and memory or uncommitted writes may be lost. Pending or uncertain restores retain their original operation.
data[].idstringYeseach array itemResource identifier used to read or manage this resource.
data[].namestringYeseach array itemHuman-readable name for this resource.
data[].statusstring · values: "ready" | "updating" | "error"Yeseach array itemCurrent resource state; inspect the allowed values and the operation’s lifecycle notes.
data[].platformobject · extra fields rejectedYeseach array itemPlatform checkpoint, workspace revision and initialization metadata.
data[].platform.initialCheckpointStatusstring · values: "pending" | "ready" | "failed"Yeseach array itemInitialization checkpoint state. Wait for ready before submitting work.
data[].platform.initialCheckpointSnapshotIdstringNoeach array itemInitial immutable RootFS checkpoint identifier, present after capture succeeds.
data[].platform.initialCheckpointErrorstringNoeach array itemDiagnostic text for initialization checkpoint failure.
data[].platform.workspaceRevisioninteger · ≥ -9007199254740991; ≤ 9007199254740991Yeseach array itemObserved workspace revision used to fence conflicting changes and fork operations.
data[].platform.forkedFromobject · extra fields rejectedNoeach array itemSource Environment and selected fork boundary; present for forked workspaces.
data[].platform.forkedFrom.environmentIdstringYeseach array itemEnvironment identifier. It must belong to the caller’s account or Project.
data[].platform.forkedFrom.modestring · values: "current" | "checkpoint"Yeseach array itemWhether the fork copied current workspace files or a selected immutable checkpoint.
data[].platform.forkedFrom.snapshotIdstringNoeach array itemSandbox0 checkpoint identifier. Use a returned initial or Run checkpoint when pinning a fork.
data[].platform.forkedFrom.revisioninteger · ≥ -9007199254740991; ≤ 9007199254740991Yeseach array itemSource Environment Run revision observed when the fork was created.
data[].platform.repositoryobject · extra fields rejectedNoeach array itemPublic HTTPS Git repository used to initialize the workspace.
data[].platform.repository.urlstring · format: uriYeseach array itemPublic HTTPS Git URL used to initialize the workspace.
data[].platform.repository.refstringNoeach array itemOptional repository branch or tag to clone during initialization.
data[].platform.repository.initializedbooleanYeseach array itemWhether repository initialization has finished.
data[].labelsobject · max 32 keysYeseach array itemUser-defined labels for exact-match filtering. Up to 32 entries. Keys are 1–64 ASCII letters, digits, dots, underscores, slashes or hyphens, beginning with a letter or digit; constructor and prototype are reserved. Values are case-sensitive strings of up to 256 characters, including empty strings.
data[].labels.{key}string · max length 256Noadditional keys—
data[].labelsRevisioninteger · ≥ 0; ≤ 2147483647Yeseach array itemIndependent labels revision. Supply the last read revision when replacing labels; a stale revision returns 409.
data[].networkPolicyobject · extra fields rejectedYeseach array itemEnvironment-wide outbound policy, enforced by Sandbox0. Domain exceptions allow destinations in block-all mode and deny destinations in allow-all mode. Enabled egress credentials also allow their destinations in block-all mode. This policy does not restrict HTTP methods, paths, or local commands.
data[].networkPolicy.modestring · values: "allow-all" | "block-all"Yeseach array itemDefault for outbound traffic not matched by a domain exception or enabled credential destination.
data[].networkPolicy.domainExceptionsarray · max 500 itemsYeseach array itemDomains allowed in block-all mode or denied in allow-all mode. Exact names do not automatically include subdomains.
data[].networkPolicy.domainExceptions[]string · min length 1; max length 255Yeseach array itemExact domain or wildcard suffix such as *.example.com. URLs, paths, ports and IP literals are not supported. Names are normalized to lowercase and deduplicated.
data[].{key}anyNoadditional keys—
nextCursorstringNoPresent only when more matching Environments remain. Use as before with the same filters and limit.
Example
Example
{
  "data": [
    {
      "id": "",
      "name": "",
      "status": "ready",
      "platform": {
        "initialCheckpointStatus": "pending",
        "workspaceRevision": -9007199254740991
      },
      "labels": {},
      "labelsRevision": 0,
      "networkPolicy": {
        "mode": "allow-all",
        "domainExceptions": [
          "example"
        ]
      }
    }
  ]
}
Error responses
401 Missing or invalid Platform API token.

application/json

default Sandpi error.
Error body application/json

Standard error envelope containing a stable code, diagnostic message and request identity.

FieldType and constraintsRequiredDescription
errorobject · extra fields rejectedYesStructured failure information. Inspect the stable code and retain the request ID for investigation.
error.codestringYeswithin errorStable error code used to distinguish failures programmatically.
error.messagestringYeswithin errorHuman-readable diagnostic text.
error.requestIdstringYeswithin errorRequest identifier for correlating diagnostics and support investigations.
error.detailsanyNowithin errorOptional structured error context. Its shape is specific to the service failure.
error.loginUrlstringNowithin errorAuthentication URL supplied when a browser login is required.
error.registrationOpenbooleanNowithin errorWhether new account registration is enabled for this deployment.
Example
Example
{
  "error": {
    "code": "platform_balance_insufficient",
    "message": "Top up Platform credits before submitting a Run.",
    "requestId": "req_example"
  }
}

The public API uses Platform tokens. The console uses a browser login and internal cookie-authenticated routes; your server-to-server client does not need a browser cookie. Your Platform token authenticates requests to Sandpi. Separately, supply your own model API key and compatible provider or gateway base URL in the Session connection. Sandpi encrypts that connection; model requests go directly from the Sandbox to your endpoint.

Personal and Project scope

A personal key accesses its account’s personal resources. A Project key accesses one immutable Team Project scope. Use the same scope for Environment creation and all its subsequent operations. Resource paths do not need a separate Project parameter.

Resource IDs must also belong to the named parent Environment and Session. Inaccessible resources can return 404, so check key scope and parent IDs as well as whether a resource exists.

Public and trigger-authenticated operations

Webhook management uses your Platform token, but inbound event receivers use the trigger’s secret and selected authentication protocol. A webhook secret is separate from a Platform API key. See custom webhook authentication.

The API documentation shows each operation’s authentication requirements from the contract.

Rotate and revoke

Create a replacement key, update your integration, verify it can read the intended resources, then revoke the previous key in the console. Removing a Team member does not revoke existing Project keys; revoke them separately. Token revocation prevents new authenticated requests; it is not a Run stop operation. Use stop and rollback to control admitted work.