Skip to content

API Reference

Sandboxes are managed with the OpenSandbox Sandbox Lifecycle API (server v0.2.0), served by the Nirvana API. OpenSandbox SDKs work unchanged when pointed at the base URL below.

Sandbox clusters, the clusters sandboxes run on, are managed with the Nirvana API’s own endpoints. See Sandbox Clusters.

https://api.nirvanalabs.io/v1

Sandbox endpoints are under /v1/sandboxes.

Use a Nirvana organization API key. See Authentication. Send it in either header:

Terminal window
-H "OPEN-SANDBOX-API-KEY: $NIRVANA_API_KEY"
# or
-H "Authorization: Bearer $NIRVANA_API_KEY"

OpenSandbox SDKs send OPEN-SANDBOX-API-KEY. There is no separate sandbox key.

The key needs the sandbox permission on the project of the sandbox cluster: read to list and get sandboxes, edit for everything else. A key scoped to some projects only sees sandboxes on clusters in those projects.


POST /v1/sandboxes

Body:

{
"image": {
"uri": "python:3.12-slim"
},
"entrypoint": ["python3", "-m", "http.server", "8000"],
"resourceLimits": {
"cpu": "2",
"memory": "2Gi"
},
"extensions": {
"nirvana.sandbox_cluster_id": "123e4567-e89b-12d3-a456-426614174000"
}
}

extensions["nirvana.sandbox_cluster_id"] is required. It is the ID of the sandbox cluster to create the sandbox on, and the cluster’s status must be ready.

Nirvana enforces these rules on top of OpenSandbox:

  • Only pvc volumes are accepted. host and ossfs volumes are rejected. See Persistence & Storage.
  • snapshotId is rejected. Creating sandboxes from snapshots is not supported.
  • Secure access is always on. Ports can only be reached through signed endpoints.

Response:

{
"id": "0b9e1c2d-3f4a-4b5c-8d6e-7f8091a2b3c4",
"image": {
"uri": "python:3.12-slim"
},
"status": {
"state": "Running",
"reason": "DependenciesReady",
"message": "Pod is Ready; Service Exists",
"lastTransitionAt": "2026-07-02T10:37:23Z"
},
"extensions": {
"nirvana.sandbox_cluster_id": "123e4567-e89b-12d3-a456-426614174000",
"nirvana.region": "us-sva-2"
},
"createdAt": "2026-07-02T10:37:16Z"
}

Every sandbox returned by the API carries nirvana.sandbox_cluster_id and nirvana.region in its extensions.


GET /v1/sandboxes/{sandbox_id}

Returns the sandbox with its current status.


GET /v1/sandboxes

Lists sandboxes on every ready sandbox cluster in the projects your key can read. It takes OpenSandbox’s state, metadata, page and pageSize query parameters. There is no filter by cluster. To find a cluster’s sandboxes, use extensions["nirvana.sandbox_cluster_id"] in the response, or tag your sandboxes with metadata and filter on it.

Response:

{
"items": [
{ /* sandbox object */ },
{ /* sandbox object */ }
],
"pagination": {
"page": 1,
"pageSize": 20
}
}

PATCH /v1/sandboxes/{sandbox_id}/metadata

Changes the sandbox’s metadata.


POST /v1/sandboxes/{sandbox_id}/renew-expiration

Body:

{
"expiresAt": "2026-07-02T12:00:00Z"
}

expiresAt is required, as an RFC 3339 timestamp. The response returns the new expiresAt.


DELETE /v1/sandboxes/{sandbox_id}

Terminates the sandbox and cleans up its resources.


GET /v1/sandboxes/{sandbox_id}/endpoints/{port}?expires={unix_seconds}

Returns a signed endpoint for a port of the sandbox: the sandbox cluster’s gateway hostname, and the headers to send with every request to it:

{
"endpoint": "gw.0123456789ab.nirvanacloud.net",
"headers": {
"OpenSandbox-Ingress-To": "<sandbox_id>-8080-<token>"
}
}

expires is optional, as Unix epoch seconds in the future. Without it, the endpoint expires with the sandbox, or after 1 hour if the sandbox doesn’t expire. An endpoint never lasts more than 24 hours.

Send requests over HTTPS to endpoint with the returned headers. Requests without them are rejected. Use endpoint and headers exactly as returned and don’t build the routing yourself; how the gateway routes requests may change. See Access Sandbox Endpoints.


These OpenSandbox operations are not available through the Nirvana API:

  • POST /v1/sandboxes/{sandbox_id}/pause and /resume return 409 SANDBOX_PAUSE_NOT_SUPPORTED.
  • Creating sandboxes from snapshots.
  • host and ossfs volumes.

  • Pending: the sandbox is starting.
  • Running: the sandbox is active and ready.
  • Failed: the sandbox failed to start or crashed.
  • Terminated: the sandbox was deleted.

Errors on /v1/sandboxes use OpenSandbox’s error shape:

{
"code": "ERROR_CODE",
"message": "Human-readable error message"
}

Errors on /v1/sandbox_clusters use the Nirvana API’s usual error shape.