Skip to main content
The endpoints below return JSON. Send JSON request bodies to POST /prepare-auth, POST /tx-confirm, and POST /finalize; POST /prepare receives multipart/form-data. Set the worker URL once so the examples work with the Kuest endpoint or an operator runtime override:
API errors use this shape (a rejected CORS origin returns plain-text Forbidden):

1. GET /market-config

Reads runtime configuration for the worker.
Use this response to choose the chain, validate images, display required funding, and know which contracts the returned transaction plan will target. Important fields: Budget for every market: multi_multiple pays the standard fee for each independent market, while multi_unique pays the neg-risk fee for each question. Inspect the returned transaction plan before signing; include POL for gas separately.

2. POST /prepare-auth

Creates a short-lived EIP-712 challenge for the exact payload hash.
Response:
expiresAt is a Unix timestamp in milliseconds, and the challenge is valid for 30 minutes. Use the returned domain and types; include chainId in the EIP-712 domain when signing:

3. POST /prepare

Validates the signed payload, processes images, uploads draft metadata to Irys, checks for existing initialized questions, and starts background preparation. Required multipart fields: Save the exact string you hashed as payload.json, and save the returned challenge fields plus your real signature as auth.json. Do not reformat payload.json after hashing it.
Accepted response (202 Accepted):
After this response, poll GET /pending until request.prepared.txPlan is available.

4. GET /pending

Returns a resumable request by requestId or the latest resumable request for a creator.
Query parameters: If no request matches the supplied identifiers, the response is { "request": null }. Persist requestId so recovery targets the intended request instead of whichever request is newest for that creator. Prepared response shape:
The example above abbreviates calldata and uses placeholder hashes; always execute the exact plan returned for your request, including fee-payment transactions. Send each txPlan item in order from the creator wallet, and wait for a successful receipt before sending a dependent transaction:

5. POST /tx-confirm

Persists transaction hashes so the flow can resume. This endpoint checks that transaction IDs belong to the saved plan. Final validation of sender, target, calldata, value, and receipt happens during POST /finalize.
Reusing an ID with the same hash is safe; changing its hash returns 409 with Conflicting tx hash. The prepared status in this endpoint’s response acknowledges saved hashes; use GET /pending to read the workflow status. Response:

6. POST /finalize

Starts or resumes finalization. Send all hashes you have, including hashes already confirmed through POST /tx-confirm.
A finalize_in_progress response uses 202 Accepted; poll GET /pending for the next step. Other successful responses use 200 OK. Possible responses:
When the status is metadata_update_pending, execute every item in metadataUpdateTxPlan, call POST /tx-confirm with the new hashes, then call POST /finalize again. Final response:

Optional Health Check

GET / returns "OK" when the worker is reachable.