Dispatch
API Reference

REST API Reference

The coordinator exposes a REST API for job submission, status polling, and trust management. Two instances run — Monad testnet on port 4010 and Solana devnet on port 4020. Both expose the same endpoints.

Base URLs

ChainURL
Monad testnethttp://localhost:4010
Solana devnethttp://localhost:4020

Health

GET /v1/health

Returns coordinator status, online worker count, and chain identifier.

Response 200

{
  "status": "ok",
  "workers_online": 3,
  "network": "eip155:10143",
  "timestamp": "2026-02-09T12:00:00.000Z"
}
FieldTypeDescription
status"ok"Always "ok" if the coordinator is running
workers_onlineintegerNumber of workers connected via WebSocket
networkstringChain identifier (e.g., eip155:10143 for Monad)
timestampstringISO 8601 timestamp

Quotes

GET /v1/quote

Get a price quote for a job. This endpoint is free (no x402 payment required).

Query parameters

ParamRequiredTypeDescription
job_typeYesLLM_INFER or TASKThe type of job to quote
policyNoFAST, CHEAP, or AUTOPricing tier. Default: AUTO

Response 200

{
  "price": "$0.010",
  "endpoint": "/v1/jobs/commit/fast",
  "policy_resolved": "FAST",
  "network": "eip155:10143",
  "expires_at": null
}
FieldTypeDescription
pricestringPrice in USD (e.g., "$0.010")
endpointstringThe commit endpoint to use
policy_resolved"FAST" or "CHEAP"Resolved policy (never AUTO)
networkstringChain identifier
expires_atnullReserved for future dynamic pricing

Response 400 — Invalid or missing job_type

{ "error": "Invalid job_type. Use LLM_INFER or TASK" }

Jobs

POST /v1/jobs/commit/fast

Submit a job to the FAST pricing tier. When x402 payment gating is enabled, the first request returns 402 with payment details.

Headers

HeaderRequiredDescription
X-PAYMENTConditionalx402 signed payment. Required when payment gating is enabled.

Request body

{
  "job_type": "LLM_INFER",
  "user_id": "user_abc123",
  "privacy_class": "PUBLIC",
  "payload": {
    "job_type": "LLM_INFER",
    "prompt": "Explain quantum computing in one paragraph.",
    "max_tokens": 256
  }
}
FieldRequiredTypeDescription
job_typeYes"LLM_INFER" or "TASK"Job type
user_idYesstringIdentifier for the requesting user
payloadYesobjectJob payload (see below)
privacy_classNo"PUBLIC" or "PRIVATE"Default: "PUBLIC"

LLM payload

{
  "job_type": "LLM_INFER",
  "prompt": "Your prompt here",
  "max_tokens": 256
}

Task payload

{
  "job_type": "TASK",
  "task_type": "summarize",
  "input": "Text to process"
}

Task types: summarize, classify, extract_json

Response 201 — Job accepted

{ "job_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890" }

Response 400 — Missing or invalid fields

{ "error": "Missing required fields: job_type, payload, user_id" }

Response 402 — Payment required (x402 enabled only)

{
  "error": "X-PAYMENT header is required",
  "accepts": [
    {
      "scheme": "exact",
      "price": "$0.010",
      "network": "eip155:10143",
      "payTo": "0x...",
      "asset": "0x534b..."
    }
  ]
}

Response 422 — No trusted worker for PRIVATE job

{
  "error": "no_trusted_worker",
  "job_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

POST /v1/jobs/commit/cheap

Submit a job to the CHEAP pricing tier. Identical behavior to the FAST endpoint, priced lower.

Same request/response format as /v1/jobs/commit/fast.

GET /v1/jobs/{id}

Poll a job by ID. Returns current status, result (if completed), and receipt.

Path parameters

ParamTypeDescription
idstring (UUID)The job ID returned from commit

Response 200 — Pending job

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "pending",
  "result": null,
  "receipt": null,
  "created_at": "2026-02-09T12:00:00.000Z",
  "completed_at": null
}

Response 200 — Completed job

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "completed",
  "result": {
    "output": "Quantum computing leverages quantum mechanical phenomena..."
  },
  "receipt": {
    "job_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
    "provider_pubkey": "0xabc123...",
    "output_hash": "sha256:abcdef1234567890",
    "completed_at": "2026-02-09T12:00:05.000Z",
    "payment_ref": null,
    "signature": "0xdeadbeef..."
  },
  "created_at": "2026-02-09T12:00:00.000Z",
  "completed_at": "2026-02-09T12:00:05.000Z"
}

Response 200 — Failed job

{
  "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "status": "failed",
  "result": { "error": "no_eligible_worker" },
  "receipt": null,
  "created_at": "2026-02-09T12:00:00.000Z",
  "completed_at": null
}

Response 404 — Job not found

{ "error": "Job not found" }
Status fieldPossible values
statuspending, assigned, running, completed, failed
resultnull while pending/assigned. Object on completion. { error: "..." } on failure.
receiptnull until completed. Contains worker signature and output hash.

Trust Pairing

POST /v1/trust/create

Create a 6-character hex pairing code. The code expires after 1 hour.

Request body

{ "user_id": "user_abc123" }

Response 201

{
  "pairing_code": "A3F2B1",
  "expires_at": "2026-02-09T13:00:00.000Z"
}

POST /v1/trust/claim

Claim a pairing code as a worker to become a trusted provider for the user.

Request body

{
  "pairing_code": "A3F2B1",
  "provider_pubkey": "a1b2c3d4..."
}

Response 200

{
  "user_id": "user_abc123",
  "paired_at": "2026-02-09T12:30:00.000Z"
}

Response 400 — Invalid, claimed, or expired code

{ "error": "invalid_code" }

Possible error values: invalid_code, already_claimed, expired

GET /v1/trust/list

List all trusted workers for a user.

Query parameters

ParamRequiredDescription
user_idYesThe user ID to list trusted providers for

Response 200

{
  "providers": [
    {
      "provider_pubkey": "a1b2c3d4...",
      "paired_at": "2026-02-09T12:30:00.000Z"
    }
  ]
}