API
Last updated: 26 November 2026 · API v1 (beta)
The hadronbox API lets you manage machines, snapshots, templates and usage from your own code. The CLI uses the same API.
Beta note: v1 is published with the beta label. If there is a breaking change, it is announced at least 30 days in advance in the changelog and by email. When the beta ends, a "v1 stable" entry is added to the changelog; after that, the notice period for a breaking change is 6 months. hadronbox is in a closed beta, so running machines is not open to everyone yet; these pages describe the contract. For the current status, see the Introduction.
Pages
- Endpoints: 41 endpoints, parameters, bodies and responses.
- Error codes: the public error codes and their messages.
- Webhooks: events, payload format, signature verification and redelivery.
- Changelog: the version log and deprecation notices.
Base URL
https://api.hadronbox.tr/v1
All endpoints are called with the /v1 prefix. The old paths without a prefix (/sandboxes) keep working as aliases during the transition; do not use them in new code. Panel and administration operations are not under /v1 and cannot be called with an API key.
Authentication
Send the API key in the Authorization header as a Bearer token. You create the key in the panel; for how to store it, see the API keys page.
curl https://api.hadronbox.tr/v1/me \
-H "Authorization: Bearer $HADRONBOX_API_KEY"
- If the key starts with
hb_live_but is invalid, revoked or expired, the response is401with the codeINVALID_API_KEY. - If there is no
Authorizationheader, if it carries a scheme other thanBearer, or if its value does not start withhb_live_(a typo, another prefix, a pasted session token), the response is401with the codeUNAUTHENTICATED:{ "statusCode": 401, "error": "Unauthorized", "code": "UNAUTHENTICATED", "message": "…" }. - Every
401response has acodefield. Catch an authentication failure by the HTTP status401, not by a single code; use thecodevalue (INVALID_API_KEY,UNAUTHENTICATED, the account state codes) as detail. - A request to an endpoint that does not accept keys (one that is called only with a session) returns
403andSESSION_REQUIRED. - Always use the key on the server side; do not embed it in browser code or in a mobile app.
Response format
The body of a successful response has the form { "data": …, "meta": { "timestamp": … } }. Lists also carry pagination; the machine list additionally carries quota. A 204 response has no body. Timestamps are in ISO 8601 (UTC).
{
"data": [{ "name": "ubuntu-dev", "status": "running" }],
"pagination": { "page": 1, "limit": 20, "total": 1, "totalPages": 1 },
"meta": { "timestamp": "2026-11-25T12:00:00.000Z" }
}
Pagination
List endpoints take the page (starting at 1) and limit query parameters. limit is 20 by default and 100 at most. The pagination object of the response carries the page, limit, total and totalPages fields. Increase page until you reach totalPages. List endpoints can also take search, sortBy and sortOrder (asc or desc); see the Endpoints page for details.
Rate limits
Every response carries headers that show your remaining allowance:
If you exceed the limit, the response is 429 with the code RATE_LIMITED. Wait for Retry-After seconds and try again. Limits differ by endpoint. Requests made with an API key are counted per key: every key has its own bucket; clients that share the same egress IP (for example CI jobs behind the same NAT) do not use up each other's allowance. Two keys of the same user are also counted separately. On top of that there is a shared ceiling for all keys of an organization: on one endpoint, the keys of an organization together can make at most 5 times that endpoint's per-key limit; creating a new key or rotating a key does not raise this ceiling. The X-RateLimit-* headers show whichever of the key bucket and the organization ceiling has less left. Requests made with an invalid key or without a key are counted per source IP address. Today's defaults per minute: general requests 120, running commands 30, reading and writing files 120, machine and snapshot lifecycle operations (create, pause, resume, delete, bulk operations) 20 per endpoint. These values may change; base your code on the X-RateLimit-* headers, not on a fixed number.
Output streaming
The output of a command (GET /v1/sandboxes/{id}/executions/{executionId}/output) streams as Server-Sent Events (text/event-stream): stdout, stderr, exit and error events. While the stream is open, the server sends a : ping comment line every 15 seconds. SSE parsers do not surface a comment line as an event; it only says that the connection is alive. So even for a command that produces no output for a long time, you can use a short idle timeout (for example 60 seconds); if no byte arrives in that time, the connection has dropped. If you write your own parser, ignore the lines that start with :.
Error format
Most error responses have this form:
{
"statusCode": 404,
"error": "Not Found",
"code": "SANDBOX_NOT_FOUND",
"message": "Machine not found.",
"details": {}
}
codeis the contract: it is stable, is not renamed and is not reused with another meaning. Write your code against it.messageis for people and is not part of the contract; its text may change. Do not parse it. It is not always a string: in aVALIDATION(400) response,messageis an array of strings (one line for every invalid field), for example["name must be a string"].- The code of a
401response for a missing or unrecognisedAuthorizationheader isUNAUTHENTICATED(see Authentication). The general rule: if there is nocode(for example an error page of a proxy in between) or it is a value you do not know, fall back to the HTTP status class. detailsis present only for some codes; its keys are on the Error codes page.
Client rules
The following are not breaking changes; your client must tolerate them:
- Ignore unknown fields in responses. New fields can be added to a response.
- Treat unknown enum values (for example a machine
statusvalue) as "other". - For an unknown error code, fall back to the HTTP status class:
4xxis permanent, while429and5xxare temporary and can be retried.
Versioning and deprecation
- The version is only the major version (
v1,v2) and is part of the path. Changes that are not breaking are published in the same version and written to the changelog with their date. - A breaking change: removing or renaming an endpoint, a field or an event, changing the type or meaning of a field, adding a new required field to a request, changing defaults, changing the status of an error code, narrowing authentication. A new endpoint, a new optional field, a new field in a response, a new error code, a new enum value and a new event type are not breaking.
- Notice period: at least 30 days until v1 is stable; after that at least 6 months for a single field, endpoint or event; for a whole major version at least 12 months after the new version is published. For changes that are required because of a security vulnerability, there is no notice period; they are written to the log on the same day.
- Notice channels: the changelog, an email to the owners and admins of the organizations that used an API key in the last 30 days, and, for a deprecated endpoint, the response headers
Deprecation,Sunsetand aLink(rel="deprecation") that points to the entry in the changelog. If you see the headers, read the entry in the log and plan the migration. - The version of the webhook payload is independent of the HTTP API version; see Webhooks.
OpenAPI document
The machine-readable form of the contract can be downloaded in OpenAPI 3 format: openapi.json (opens in a new tab). You can use it to generate an SDK or to validate requests. The endpoints page is generated from this document.