Reference
Management API
Read your workspace from a script: workspaces, projects, keys, usage, traces and the ingest log. Tokens are read-only by default. A token with the write scope can also create and revoke write keys. Everything is under /api/v1.
Create a personal access token
Open Settings in your workspace and use Personal access tokens:
- Name the token and choose an expiry from 1 to 365 days, 30 by default.
- Choose an access scope. Read only is the default; choose Write only if a script must also create or revoke keys.
- Select Create token. Your browser makes the token (
stpat_…) and sends the server only its SHA-256. Copy it when it appears: it is shown once and cannot be recovered. - Send it as
X-Supatrace-Key(see below). Revoke it in Settings to stop it at once.
- Read-only by default. A read token can call the
GETendpoints below. It cannot upload, change billing or manage tokens. - Write is opt-in. Choosing Write in Settings, or
POST /api/tokenswithscope: "write", gives the token thewritescope. Without it, key writes are refused403. See Write keys below. - Account-scoped. A token sees what your account can open, with your current role in each workspace. Removing the account from a workspace removes the token's access to it.
- Up to 20 tokens for an account.
Call the API
Send the token in the X-Supatrace-Key header:
curl -H "X-Supatrace-Key: $TOKEN" https://supatrace.dev/api/v1/projectsA server you run yourself also accepts Authorization: Bearer $TOKEN. On supatrace.dev the edge replaces the Authorization header before it reaches the API, so use X-Supatrace-Key there.
Errors are JSON of the form {"error": "code"}. A missing, expired or revoked token is 401. A workspace the account cannot open, or a route its role may not call, is 403. Each token may make 120 requests a minute; 429 carries Retry-After.
Endpoints
| Request | Returns |
|---|---|
GET /api/v1/me | The account and the token making the request |
GET /api/v1/workspaces | Workspaces the account can open, with its role in each |
GET /api/v1/projects | Projects. A workspace has one project |
GET /api/v1/keys | Keys of a workspace environment: id, type, expiry, revoked. Needs a role that may manage keys. Key values are never returned. Up to 100 keys a page; follow next with after |
POST /api/v1/keys | Create a publishable or secret write key. Body {"key_type": "publishable"} with optional expires_in seconds (1 hour to 365 days). Returns the full key once, plus its SHA-256 id, type, scope, project, environment, expiry and creation time. Needs the token's write scope and the owner or admin role; the plan's key cap applies |
DELETE /api/v1/keys/{id} | Revoke the key whose SHA-256 is {id} in the requested workspace, project and environment. Returns {"revoked": true}. Idempotent. 404 when no such key exists there; a key in another environment is 403. Needs the token's write scope and the owner or admin role |
GET /api/v1/usage | Stored bytes, limit and plan state of a workspace |
GET /api/v1/logs | Recorded upload attempts of a workspace environment, newest first, with the reason when one was refused. stream (issues or accepted), route, reason, from, to, limit, after |
GET /api/v1/traces | Traces. limit, offset, sort, dir, q, from, to |
GET /api/v1/traces/{trace_id}/events | The events of one trace, one stored batch per page. Follow next with after |
Workspace endpoints take workspace (defaults to the account's own) and, except usage, environment (defaults to default). A parameter that is not listed for an endpoint is refused with 400.
Write keys
A write token acts only on a workspace its account can open, and only as the owner or an admin. Both key routes take workspace, project and environment query parameters, like the reads.
- Created once, stored as a hash.
POST /api/v1/keysreturns the raw key (st_pub_…orst_sec_…) once and stores only its SHA-256. It is never returned again, and the server never persists the raw value. - Typed and scoped. A
publishablekey iswrite_only; asecretkey isread_write. - Fenced at commit. The write re-checks the token's existence,
writescope and expiry, the workspace role and version, and the project and environment inside the write itself. A revoke, expiry, demotion, removal or retirement that lands between the read and the write refuses it (401/403) and leaves storage unchanged. - Read stays the default. The
writescope adds only the two key routes.
Secret keys
A secret key (st_sec_…, created under API keys) is also accepted on GET /api/v1/traces and GET /api/v1/traces/{trace_id}/events. It reads only the workspace and environment it belongs to. A workspace or environment parameter naming another one, and every other /api/v1 endpoint in the table above, returns 403 key_scope_denied. Ingest keys (st_pub_…) and setup-code keys cannot read. See Keys.
OpenAPI document
GET /api/v1/openapi.json serves the OpenAPI 3.1 description of these endpoints. It needs no token.
Not available yet
- Write operations other than keys: changing workspaces, environments, projects or billing.
- Token scopes narrower than read or write for a whole account, and OAuth apps.
- Rate limits that vary by plan.
- Rendered reference pages for each endpoint. The OpenAPI document is the reference.