Skip to content

HTTP API conventions#

The Flask HTTP API is the operator console's backend and a supported local automation surface. It exposes JSON status/configuration endpoints, queued-job submissions, and bounded file downloads.

Base URL and trust model#

The default development base URL is:

http://127.0.0.1:5000

The server has no end-user authentication. It is intended for localhost or a trusted lab network. Do not publish it directly to the internet. The optional cluster-controller token remains server-side and is never part of an API response.

Content types#

  • JSON requests use Content-Type: application/json and require an object unless the endpoint says otherwise.
  • Catalogue CAD uploads and BOP result imports use multipart/form-data.
  • Image, PDF, CSV, JSON-report, and managed-asset endpoints return files.
  • Job logs return text/plain.

Most successful JSON responses include the domain object plus identifiers such as run_root, job_id, attempt_id, or result_id. Persist those identifiers instead of parsing the human-readable output field.

Run-root parameter#

Run-scoped reads normally accept run_root as a query parameter:

curl --fail-with-body --get http://127.0.0.1:5000/run-config \
  --data-urlencode run_root=working_data/example

Mutations normally place it in the JSON body:

{
  "run_root": "working_data/example"
}

Relative paths resolve below the default repository working_data/ root. Absolute and relative values are canonicalized and must remain below an approved web run root. See Architecture and boundaries.

Read, write, and queue semantics#

Pattern Typical status Meaning
GET 200 Inspect current or computed state; does not authorize robot motion
bounded POST/PUT/PATCH 200 or 201 Validate and commit metadata/report state
queued POST 202 Accepted by LocalJobRunner; follow job_id through /jobs/<job_id>
DELETE 200 or 202 Retire metadata immediately; physical cleanup may be queued

Navigation does not cancel a 202 job. Poll the job resource or use the console's Jobs page.

Errors#

The common error envelope is:

{
  "output": "human-readable failure reason"
}

Some validation endpoints return structured errors, blockers, issues, or preflight fields in addition to output. Clients should branch on the HTTP status and preserve the full body for diagnosis.

Status Usual meaning
400 Invalid JSON, field, path, state transition, or unsupported option
404 Unknown identifier or required artifact absent
409 Resource busy, stale compare-and-swap input, failed readiness gate, or conflicting state
413 Upload exceeds its endpoint limit
422 Structured calibration-target validation failure
503 Optional worker/controller/runtime unavailable

Boolean and execution-gate rules#

Execution acknowledgement fields must be literal JSON booleans. In particular, allow_cameras and allow_real_robot reject strings and do not persist as future authorization. See Safety and authorization.

Safe discovery example#

These calls inspect status and create a non-executing plan; they do not start a physical capture:

curl --fail-with-body http://127.0.0.1:5000/robot/status
curl --fail-with-body http://127.0.0.1:5000/sensors/status
uv run python scripts/plan_capture.py working_data/example --json

Reference organization#

The route index is generated from Flask and tested for drift. Domain pages describe behavioral contracts and important payloads. Payload schema versions inside artifacts remain authoritative when a response embeds a persisted artifact.