Skip to content

HTTP and worker API

All JSON models use camelCase and reject unknown fields. Errors use:

{"error":{"code":"stable_code","message":"safe message","retryable":false},"requestId":"..."}

Frontend authentication

The Next.js server signs a short-lived HS256 token containing sub, iss, aud, iat, exp, and jti. Browser clients never see the gateway secret. The API accepts the current or previous key during rotation and checks issuer, audience, clock skew, and maximum lifetime.

Method Route Result
GET /health Process liveness after lifespan startup
GET /ready API readiness, including artifact storage configuration
POST /agentic_generative_ui/ Classify chat intent, enqueue a mission, and stream events
POST /api/mission/start Enqueue a durable mission (202)
GET /api/mission/{missionId}/status Read an owned mission
POST /api/mission/{missionId}/pause Request checkpointed pause (202)
POST /api/mission/{missionId}/resume Resume from the durable checkpoint (202)
POST /api/mission/{missionId}/abort Request terminal cancellation (202)
GET /api/mission/{missionId}/stream Replay and follow ordered SSE events
GET /api/mission/best-results List the caller's completed results
POST /api/competitions/search Search live Kaggle metadata
POST /api/competitions/fetch Resolve an exact Kaggle URL

Kaggle routes return 503 when credentials are not configured; they never invent competitions.

Worker authentication

Worker routes require Authorization: Bearer <worker-token> plus X-Worker-Id. The body worker ID must match the header. Current and previous tokens permit zero-downtime rotation.

Method Route Purpose
POST /api/worker/v1/jobs/claim Atomically claim jobs and receive fenced leases
POST /api/worker/v1/jobs/{jobId}/heartbeat Renew a lease and read control
POST /api/worker/v1/jobs/{jobId}/events Append contiguous ordered events
POST /api/worker/v1/jobs/{jobId}/snapshots Save an immutable resume snapshot
GET /api/worker/v1/jobs/{jobId}/snapshots/{snapshotId} Read a fenced snapshot
GET /api/worker/v1/jobs/{jobId}/control Read pause or cancel state
POST /api/worker/v1/jobs/{jobId}/complete Commit a successful terminal result
POST /api/worker/v1/jobs/{jobId}/fail Commit failure or server-authorized retry
POST /api/worker/v1/jobs/{jobId}/artifacts/upload-url Reserve a checksum-bound upload
POST /api/worker/v1/jobs/{jobId}/artifacts/{artifactId}/complete Verify uploaded bytes
POST /api/worker/v1/jobs/{jobId}/artifacts/{artifactId}/download-url Sign a fenced download
POST /api/worker/v1/migrations Create a legacy-source upload
POST /api/worker/v1/migrations/{migrationId}/complete Verify and queue an import
GET /api/worker/v1/migrations/{migrationId} Read import status and counts

The OpenAPI document is generated by FastAPI from these strict models.