API Reference

Explore the full Spunto REST API — all endpoints, request bodies, and response schemas.

The Spunto API is a REST API. All endpoints require a Bearer token (except public auth routes).

The full interactive API reference is available at:

https://spunto.net/api/docs

It's generated automatically from the OpenAPI 3.1 spec — always up to date.

All API requests (except /api/auth/*) require:

Authorization: Bearer <token>

Two kinds of token are accepted:

  • Session token — issued when you sign in with Google. The same token is set as an httpOnly session cookie by the auth flow — browser requests include it automatically. Carries full access (no scoping).
  • API key (spk_...) — a scoped, revocable token generated from the dashboard for headless access (scripts, CI, AI agents). See the API Keys page for how to create and use one.

https://spunto.net

All endpoints start with /api/.

PATCH means partial: a request body only touches the fields it names, and everything it leaves out is kept as-is. Renaming a project is {"name": "..."} — its repositories, features and extensions stay where they were.

Which means emptying something has to be said out loud:

  • a list is cleared by sending it explicitly empty — {"forwardPorts": []}
  • a free-text field is cleared by sending "" — {"description": ""} stores null (whitespace counts as empty). Omitting the key keeps the old value; it never means "erase it".

A project's shared secrets ride in the same body, and are partial in the same way — a list of changes, not the desired final state:

PATCH /api/orgs/:orgId/projects/:projectId
{
  "secrets": [
    { "name": "API_TOKEN", "value": "sk-..." },   // write (creates or replaces, by name)
    { "name": "OLD_TOKEN", "value": null }        // remove
  ]
}

Any name you don't mention keeps whatever it had. Values are write-only: they are never returned by any endpoint. Writing them is owner/admin only, and an API key needs the secrets:write scope on top of projects:write — the same gates as the dedicated /secrets routes, which remain available for one-off changes.

GET    /api/orgs              List organizations
POST   /api/orgs              Create organization
GET    /api/orgs/:orgId       Get organization details
GET    /api/orgs/:orgId/members  List members

GET    /api/orgs/:orgId/projects                         List projects
POST   /api/orgs/:orgId/projects                         Create project
GET    /api/orgs/:orgId/projects/:projectId              Get project
PATCH  /api/orgs/:orgId/projects/:projectId              Update project
DELETE /api/orgs/:orgId/projects/:projectId              Delete project

GET    /api/orgs/:orgId/sandboxes                           List sandboxes (?projectId=)
POST   /api/orgs/:orgId/sandboxes                           Create a sandbox { projectId, appId?, machineType?, branch?, fromSnapshot? }
GET    /api/orgs/:orgId/sandboxes/:sandboxId                Get a sandbox
POST   /api/orgs/:orgId/sandboxes/:sandboxId/start          Start a stopped or paused sandbox
POST   /api/orgs/:orgId/sandboxes/:sandboxId/stop           Stop it (/workspace kept)
POST   /api/orgs/:orgId/sandboxes/:sandboxId/pause          Pause it (memory kept, not billed)
POST   /api/orgs/:orgId/sandboxes/:sandboxId/rebuild        Rebuild at the project's current version
POST   /api/orgs/:orgId/sandboxes/:sandboxId/exec           Run a command
GET    /api/orgs/:orgId/sandboxes/:sandboxId/ports          The IDE's URL and listening ports
POST   /api/orgs/:orgId/sandboxes/:sandboxId/snapshots      Snapshot it
DELETE /api/orgs/:orgId/sandboxes/:sandboxId                Destroy it and its storage

POST   /api/orgs/:orgId/projects/:projectId/tasks           Delegate a task { prompt, ... }
GET    /api/orgs/:orgId/tasks                               Every task of the organization
GET    /api/orgs/:orgId/projects/:projectId/tasks/:taskId   Get a task

All task routes: Advanced tasks.

GET    /api/orgs/:orgId/api-keys           List keys
POST   /api/orgs/:orgId/api-keys           Create a key (token shown once)
DELETE /api/orgs/:orgId/api-keys/:keyId    Revoke a key

Session-only — an API key cannot be used to manage other API keys. See API Keys.

GET    /api/users/me            Get current user (dotfilesRepo)
PATCH  /api/users/me            Update user settings
GET    /api/users/me/secrets    List secret names
POST   /api/users/me/secrets    Create / replace secret
DELETE /api/users/me/secrets/:secretId  Delete secret

Anything live is a WebSocket upgrade rather than a REST call. These endpoints are in the OpenAPI spec like the rest of the API — look for (WebSocket) in the summary; each one documents its query parameters and the exact shape of the frames it exchanges.

EndpointDescription
GET /api/sandboxes/:id/terminal?mode=terminalAttach to a persistent terminal session in a sandbox
GET /api/sandboxes/:id/terminal?mode=logsFollow the sandbox's logs
GET /api/sandboxes/:id/prepare/logsA sandbox's setup log

Authenticate the handshake exactly like a REST call — Authorization: Bearer <token>, with a session token, or an API key scoped workers:exec on the sandbox terminal. A browser can't set headers on a WebSocket, so from the browser the session cookie is used instead.

A sandbox terminal is persistent: the program keeps running when you disconnect, and reattaching lands on it with its scrollback — which is what makes it usable from a phone.

GET    /api/orgs/:orgId/sandboxes/:sandboxId/terminals        List sessions
POST   /api/orgs/:orgId/sandboxes/:sandboxId/terminals        Create a session
DELETE /api/orgs/:orgId/sandboxes/:sandboxId/terminals/:name  Kill a session

List the sessions, then attach to one by name. Closing the socket detaches; it doesn't kill it.

const ws = new WebSocket(`wss://spunto.net/api/sandboxes/${sandboxId}/terminal?session=main`)
 
ws.onmessage = (e) => {
  const frame = JSON.parse(e.data)
  // "ready" once attached, then "output" frames — base64-encoded raw bytes.
  if (frame.type === "output") term.write(atob(frame.data))
}
 
ws.send(JSON.stringify({ type: "input", data: btoa("ls -la\n") }))
ws.send(JSON.stringify({ type: "resize", cols: 80, rows: 24 }))

Not part of the API surface — they authenticate with infrastructure tokens, not yours.

EndpointDescription
GET /api/sandbox-agent/connectThe agent inside a sandbox (sandbox token)
GET /api/tunnel/relayProxy ↔ agent relay

Note

For the full interactive reference with request/response schemas and a built-in HTTP client, visit /api/docs.