API

Responses and errors

Every response is {"ok": true, …} or {"ok": false, "error": "…", "code": "…"}. error is a sentence meant for a person; branch on code. A code's status can differ by route, and the table gives the ones you'll see.

code status what it means
no_token 401 no Authorization: Bearer header
bad_token, token_expired, token_orphaned 401 the token isn't valid, passed its lifetime, or its creator left. Mint a new one
owner_only 403 the token has a Dev's role; an owner's or admin's token is needed
workspace_token, workspace_token_only 403 this needs a workspace token, not a project token
workspace_required, no_workspace, ambiguous_workspace, ambiguous_project 400, 404, 400, 400 a personal token: name the workspace with Ridgeline-Workspace, that workspace isn't one of yours, two of yours have that name (use its id), or two of your workspaces have a project of that name
project_required, no_project, wrong_project 400, 404, 403 name the project, that project doesn't exist, or this token reaches a different one
not_found 404 no such resource, deploy or path
rate_limited 429 too many writes; wait for Retry-After
too_large 413 request bodies are capped at 1 MB; a whole /stacks call is a few KB
bad_body, bad_request 400 not a JSON object, a field of the wrong type, or the action doesn't apply to this service
name, key, action, bad_range, emails, rules, webhook 400 that field or parameter is wrong; error says how
confirm 400 a restore's confirm isn't the resource's name
too_many 400 more than ten resources in one /stacks call
reference 400 a ${{…}} that can't resolve; the message names what to add and where
no-plan 400, 403 billing isn't set up for this workspace
unpaid 400, 409, 503 resources are paused until the workspace's bill is settled
plan-limit 403 past the workspace's service limit, or a service's custom domains
guest-repo 403 a Dev can't choose a service's repository
guest 403 a Dev's token can't do this
unprovisioned 409 the service hasn't finished its first setup
idle 400, 409 nothing is running, or no run is in progress
taken 409 that name or address is in use
paused 409 the project is paused
busy 400, 409 it changed or another write ran at the same moment; try again
custom-domains, no-active-domain, several-records, no-connection 409 see Custom domains
agent 503 the server running the project didn't answer; try again shortly
webhook_failed 422 your webhook didn't accept the test

A warning on a successful write (variables also say "applied": false) means the change is saved but not running yet. Read it before doing anything else: "didn't answer" may clear on its own, so try again in a few minutes; "hit an error" will not — sending the same change again fails the same way, and our team has already been alerted. Never loop on a write. A variables write also returns brokenElsewhere: other services' references that this change left unresolvable.

A path that isn't a route answers a JSON 404 (code: "not_found").

Something wrong or missing here? Tell us and a person will answer.