Skip to content

Reference

HTTP API

Everything the SDKs do is plain HTTP and JSON. Call the API from any language with an environment API key.

On this page

Base URL#

Control planeURL
Hosted alphahttps://api.bokjoy.dev
On your computerhttp://127.0.0.1:19847

The API reference on these pages is generated from the control plane's OpenAPI 3.1 document. Every control plane also serves it without a token at GET /v1/openapi.json, less the routes only the operator token can call. Its tests check every route, method, credential and answer against the running server.

Authentication#

Send a bearer token in the Authorization header:

Terminal
curl "$BOKJOY_API_URL/v1/tasks" -H "Authorization: Bearer $BOKJOY_API_KEY"
CredentialLooks likeOpens
Environment API keybjk_prod_...GET /v1/tasks, and the /v1/runs, /v1/schedules and /v1/queues routes, in its own environment only.
Operator tokenSet when the control plane startsEvery route except the worker routes, in every environment.
Worker tokenReturned once by POST /v1/workersOnly the /v1/agent routes a worker uses.
Public access tokenbjp_..., from POST /v1/public-tokensGET /v1/runs/{id} and GET /v1/runs/{id}/stream for the runs it names and their descendants, until it expires. Safe to give a browser. See Realtime in the browser.

/health, /ready and /v1/openapi.json need no token. A run, schedule, queue or environment outside an API key's own answers 404, exactly like one that does not exist. A route the credential may not use answers 403.

Requests and answers#

  • Bodies are JSON, sent with Content-Type: application/json. A body is at most 4 MiB for POST /v1/runs, 16 MiB for POST /v1/runs/batch and 1 MiB for any other route.
  • A run's payload is at most 3 MiB of JSON and its output at most 10 MiB. Reading one run returns both whole. A run list carries no payload or output. Its input_ref or output_ref names one stored out of line, over 512 KiB: read the run to get it.
  • Run IDs are UUIDs. Times are RFC 3339 strings in UTC.
  • An error is a JSON object with one field, {"error": "..."}, that says why. Malformed JSON, a bad UUID or a bad query value answers with plain text instead.
StatusMeaning
200, 202Done, or accepted. A new run answers 202.
400Invalid request, including a run larger than its environment allows (the reason says asks for more CPU or memory than).
401No token, or a wrong or revoked one.
403The credential may not use this route.
404No such resource, or one outside an API key's environment.
409A conflict: an idempotency key reused with a different request, an event ID reused with a different event, an event for a finished run, or an archived environment.
413The body is over its route's limit.

The SDKs never follow a redirect, since it would carry the key elsewhere. Call the control plane at the address it serves on.

Retrying safely#

POST /v1/runs and POST /v1/runs/batch require an idempotency key, so retrying either is always safe: the same request returns the runs it already started. POST /v1/runs/{id}/events deduplicates by event_id. See Idempotency.

Reference#

  • Runs: start, list, read, cancel and follow runs, and send them events. API keys can use all of these.
  • Schedules API: create, list, read, change, pause and delete recurring schedules. API keys can use all of these.
  • Queues API: list queues and read one, with its limit and how many of its runs are running and waiting. API keys can use both.
  • Tasks and status: the environment's tasks, health checks and this document.
  • Operator routes: environments, variables, API keys and workers. Operator token only.

The worker protocol under /v1/agent is in the OpenAPI document too. It is internal and can change between releases.