Server API quickstart
Before you start
You should understand why the server exists. Read 01 Embedded SDK vs server if you have not already.
Embedded SDK runs do not require PostgreSQL. The server requires Postgres for POST /v1/runs; without a reachable pool the handler returns 503.
Concept
The HTTP server (arcflow-server) exposes workflow execution to backends, cron jobs, and services that should not embed the SDK. This guide starts the Docker stack, confirms readiness, creates a run with POST /v1/runs, polls until completion, and fetches the execution trace. The sample payload runs without LLM API keys.
The compose file also starts arcflow-relay on port 8090 for browser clients. This quickstart uses direct server curl; Relay is covered in Static site chatbot.
Prerequisites
| Item | Required |
|---|---|
| Docker with Compose v2 | Yes |
curl | Yes (on Windows use curl.exe in PowerShell) |
| Repository clone | Any path; commands assume repo root |
Start the stack
From the repository root:
Services brought up:
| Service | Port | Role |
|---|---|---|
postgres | 5432 | Run persistence and registry |
arcflow-migrate | (init) | Applies schema once Postgres is healthy |
arcflow-server | 8080 | HTTP API |
arcflow-relay | 8090 | Browser proxy (not needed for this guide) |
Development keys: ARCFLOW_SERVER_API_KEY=dev-secret, ARCFLOW_ADMIN_API_KEY=dev-admin. Change these before any non-local deployment.
Migrations run automatically via arcflow-migrate before the server starts. For bare-metal deployment without Docker, run cargo run -p arcflow-cli, migrate up once per schema version (see server/arcflow-server/README.md).
Confirm health and readiness
/health is liveness (process up). /ready returns 200 when Postgres is reachable and migrations are at head; 503 when degraded.
Example: create a run
Save the payload as run-payload.json in your working directory:
Submit the run:
On Windows PowerShell:
Example 201 response:
Copy run_id for polling. Optional: send Idempotency-Key: <uuid> on create to deduplicate identical submissions.
Poll run status
Replace RUN_ID with the value from the create response:
Repeat until status is terminal (Completed, Failed, Cancelled, or Interrupted). Sample workflows typically finish in seconds.
Example 200 when complete:
Poll loop (bash):
Poll loop (PowerShell):
HTTP API status strings use PascalCase. The embedded Python SDK exposes lowercase completed on WorkflowResult; both refer to the same terminal state.
Retrieve the trace
The response is an ExecutionTrace JSON document with metadata-only events (trace data policy). Expect lifecycle kinds such as WorkflowStarted, StepCompleted, and WorkflowCompleted.
From the repo root you can also inspect a run with the CLI:
Auth tiers (summary)
| Routes | Auth |
|---|---|
/health, /ready | None |
/v1/runs, registry, trace | Authorization: Bearer <ARCFLOW_SERVER_API_KEY> or X-ArcFlow-Api-Key |
/v1/admin/* | Bearer ARCFLOW_ADMIN_API_KEY |
/v1/debug/* | Localhost and ARCFLOW_DEBUG=true |
Full route index is in HTTP API reference and HTTP API reference.
SDK client pointing at the server
Save as server_client.py:
Run after the Docker stack is up:
Stop the stack
Add -v only if you intend to wipe the Postgres volume.
Verify
| Check | Expected |
|---|---|
/ready | HTTP 200 |
| Create run | HTTP 201 with run_id |
| Poll | Terminal Completed for sample payload |
| Trace | Lifecycle events present, no prompt text |
Next
| Topic | Link |
|---|---|
| Tutorial with verification checklist | Track B: Server API |
| HITL and external on server | Integrating track |
| Workflow registry and semver | Workflow registry |
| Production compose | docker/docker-compose.prod.yml, Server deployment |
| Full HTTP reference | Server overview |
| Static browser product | Static site chatbot |