Groundwork / api
API reference
Everything the cockpit does goes through this HTTP API — the
browser holds no privileges a script can't have. Your own instance serves
the same reference interactively at /docs (Swagger over the
live schema) and as a curated walkthrough in the API tab, with examples
templated for your install.
Authentication
Two credentials, one rule each. A session cookie is a person —
sign in through the UI or POST /api/login. An API key
(Authorization: Bearer gw_…) is a script or another machine,
minted in the cockpit and scoped:
| Scope | May do |
read | GET only |
train (default) | GET plus a whitelist of write paths: runs, exports, counting, auto-label, machine pairing |
full | everything a session can do except account/key management and machine registration — those stay session-only, so a leaked key can be revoked but never used to mint its successor or point your datasets at a new machine |
Failed logins are throttled (delays, never lockouts), and
every sign-in, refusal and key change lands in an append-only audit
trail.
The project rule
Almost every route is project-scoped and the project is never
implicit: pass ?project=<slug>. A missing project
is a 422, not a fallback — no request can silently operate on the wrong
dataset. Machine-level routes (/api/machines…,
/api/overview, /healthz) take no project.
Worked examples
BASE=http://localhost:8000
AUTH="Authorization: Bearer gw_…" # minted in the cockpit
# What is serving, and how good is it?
curl -s "$BASE/api/state?project=widgets" -H "$AUTH" | jq .served
# Add photos to the fix queue
curl -s -X POST "$BASE/api/upload?project=widgets" -H "$AUTH" \
-F "files=@bench1.jpg" -F "files=@bench2.jpg"
# Count one image with the serving model (count + overlay URL back)
curl -s -X POST "$BASE/api/count?project=widgets" -H "$AUTH" \
-F "image=@bench1.jpg"
# Start a training run (model × machine × card)
curl -s -X POST "$BASE/api/train?project=widgets" -H "$AUTH" \
-H 'Content-Type: application/json' \
-d '{"model":"yolov8n","machine":"here","epochs":250}'
The catalog — every route
Generated from the live application (app.openapi()),
not written by hand — in the repo, CI fails if this table goes stale.
As of v0.3.0 · 100 routes.
audit1 route
| Route | Methods | What it does |
/api/audit | GET | Audit Trail |
bots8 routes
| Route | Methods | What it does |
/api/bots | GET,POST | List Bots |
/api/bots/{key} | DELETE | Unregister Bot |
/api/bots/{key}/allowed | POST | Set Allowed |
/api/bots/{key}/install | POST | Install |
/api/bots/{key}/probe | POST | Probe Bot |
/api/bots/{key}/project | POST | Move Project |
/api/bots/{key}/service | POST | Service |
/api/bots/{key}/token | POST | Set Token |
bucket-vocab1 route
| Route | Methods | What it does |
/api/bucket-vocab | GET,PATCH | Get Vocab |
buckets2 routes
| Route | Methods | What it does |
/api/buckets | GET | Buckets |
/api/buckets/{stem} | POST | Set Bucket |
collect1 route
| Route | Methods | What it does |
/api/collect | GET | Collect Overview |
count1 route
| Route | Methods | What it does |
/api/count | POST | Count |
crop1 route
| Route | Methods | What it does |
/api/crop/{collection}/{stem} | POST | Crop |
dedup1 route
| Route | Methods | What it does |
/api/dedup | GET | Dedup |
engine1 route
| Route | Methods | What it does |
/api/engine | GET,POST | Engine |
export4 routes
| Route | Methods | What it does |
/api/export | GET,POST | Start |
/api/export/artifacts | GET | Artifacts |
/api/export/cards | GET | Cards |
/api/export/formats | GET | Formats |
healthz1 route
| Route | Methods | What it does |
/healthz | GET | Healthz |
image1 route
| Route | Methods | What it does |
/api/image/{collection}/{stem} | DELETE | Delete |
images1 route
| Route | Methods | What it does |
/api/images/{collection} | GET | Images |
img/{collection}/{stem}1 route
| Route | Methods | What it does |
/img/{collection}/{stem} | GET | Image |
join1 route
| Route | Methods | What it does |
/api/join/bundle | GET | Bundle |
join.sh1 route
| Route | Methods | What it does |
/join.sh | GET | Join Script |
keys3 routes
| Route | Methods | What it does |
/api/keys | GET,POST | List Keys |
/api/keys/scopes | GET | Key Scopes |
/api/keys/{kid} | DELETE | Delete Key |
la2 routes
| Route | Methods | What it does |
/api/la | DELETE,GET | Status |
/api/la/{collection}/{stem} | POST | Start |
lab8 routes
| Route | Methods | What it does |
/api/lab/img | GET | Lab Img |
/api/lab/log | GET | Log |
/api/lab/runs | GET | Runs |
/api/lab/runs/{run}/detail | GET | Detail |
/api/lab/score | POST | Score |
/api/lab/status | GET | Status |
/api/lab/train | DELETE,POST | Train |
/api/lab/vis | GET | Vis |
lab_status1 route
| Route | Methods | What it does |
/api/lab_status | GET | Lab Status |
label_audit2 routes
| Route | Methods | What it does |
/api/label_audit | GET,POST | Label Audit Start |
/api/label_audit/{collection}/{stem} | POST | Label Audit Points |
login1 route
| Route | Methods | What it does |
/api/login | POST | Login |
logout1 route
| Route | Methods | What it does |
/api/logout | POST | Logout |
machine5 routes
| Route | Methods | What it does |
/api/machine/cards | GET | Cards |
/api/machine/pair | POST | Accept Pair |
/api/machine/pairing-code | POST | Mint Pairing Code |
/api/machine/self | GET | Self Info |
/api/machine/status | GET | Machine Status |
machines8 routes
| Route | Methods | What it does |
/api/machines | GET,POST | List Machines |
/api/machines/join | POST | Join |
/api/machines/join-token | POST | Mint Join Token |
/api/machines/pair | POST | Hq Pair |
/api/machines/{key} | DELETE | Remove Machine |
/api/machines/{key}/probe | POST | Probe |
/api/machines/{key}/sync | POST | Sync Now |
/api/machines/{key}/test | POST | Test Data Plane |
me3 routes
| Route | Methods | What it does |
/api/me | GET | Me |
/api/me/password | POST | Change Password |
/api/me/username | POST | Change Username |
model1 route
| Route | Methods | What it does |
/api/model/activate | DELETE,POST | Activate |
models1 route
| Route | Methods | What it does |
/api/models | GET | Models |
overview1 route
| Route | Methods | What it does |
/api/overview | GET | Overview |
points1 route
| Route | Methods | What it does |
/api/points/{collection}/{stem} | GET,POST | Get Points |
projects3 routes
| Route | Methods | What it does |
/api/projects | GET,POST | List Projects |
/api/projects/{slug} | GET | Get Project |
/api/projects/{slug}/classes | GET,PATCH | Get Classes |
promote1 route
| Route | Methods | What it does |
/api/promote/{stem} | POST | Promote |
promote_testset1 route
| Route | Methods | What it does |
/api/promote_testset/{stem} | POST | Promote Testset |
retrain1 route
| Route | Methods | What it does |
/api/retrain | DELETE,GET,POST | Start |
root1 route
| Route | Methods | What it does |
/ | GET | Index |
runs9 routes
| Route | Methods | What it does |
/api/runs | GET | Runs |
/api/runs/{run} | GET | Run Detail |
/api/runs/{run}/curve | GET | Run Curve |
/api/runs/{run}/images | GET | Run Images |
/api/runs/{run}/log | GET | Run Log |
/api/runs/{run}/note | POST | Set Note |
/api/runs/{run}/peek | GET | Run Peek |
/api/runs/{run}/restore/{stem} | POST | Restore |
/api/runs/{run}/snapshot | GET | Snapshot |
sessions3 routes
| Route | Methods | What it does |
/api/sessions | GET | List Sessions |
/api/sessions/revoke-others | POST | Revoke Other Sessions |
/api/sessions/{sid} | DELETE | Revoke Session |
setup6 routes
| Route | Methods | What it does |
/api/setup/claim | POST | Claim |
/api/setup/extras/la | POST | Extras La |
/api/setup/extras/stack | POST | Extras Stack |
/api/setup/facts | GET | Facts |
/api/setup/instance | POST | Instance |
/api/setup/status | GET | Status |
state1 route
| Route | Methods | What it does |
/api/state | GET | State |
testset1 route
| Route | Methods | What it does |
/api/testset/{stem} | DELETE,POST | To Testset |
train2 routes
| Route | Methods | What it does |
/api/train | DELETE,POST | Start |
/api/train/options | GET | Options |
truth1 route
| Route | Methods | What it does |
/api/truth/{stem} | POST | Set Truth |
upload1 route
| Route | Methods | What it does |
/api/upload | POST | Upload |
users3 routes
| Route | Methods | What it does |
/api/users | GET,POST | List Users |
/api/users/stats | GET | User Stats |
/api/users/{username} | DELETE | Delete User |
version1 route
| Route | Methods | What it does |
/api/version | GET | Version |