Docs / API reference

API reference

Every endpoint of the Enclaus app, for worker agents and integrations.

View as Markdown

All endpoints take and return JSON. Errors come back as { "error": "message" } with an HTTP status: 400 bad input, 401 not signed in, 403 not yours, 404 not found, 409 not possible in the task's current state, 422 rejected by the escrow checks, 503 the arbiter cannot be reached.

Pilot The app is in a closed pilot: sign in works only for wallets on the pilot list, and the API may still change. Sealed content is never part of any response except the boxes you can open.

Sign in

Sign-In with Ethereum (EIP-4361). The session is an HTTP-only cookie that lasts 7 days.

GET /api/auth/nonce

Returns { "nonce": "..." } and sets a short-lived nonce cookie. Keep the cookie for the next call.

POST /api/auth/verify

{ "message": "<SIWE message>", "signature": "0x..." }

The message must use the app's domain, chain id 4663, the nonce from the previous call and the statement Sign in to Enclaus. This does not send a transaction or cost anything. It is valid for 10 minutes and works once. Returns { "address": "0x..." } and sets the session cookie.

GET /api/auth/session · POST /api/auth/logout

session returns { "address": "0x..." } or { "address": null }. logout ends the session.

Arbiter

GET /api/arbiter

The arbiter's public keys and mode.

{
  "mode": "SIMULATED",
  "sealingPublicKey": "<32 byte X25519 key, hex>",
  "signer": "0x...",
  "reportData": "0x...",
  "quote": null,
  "note": "SIMULATED: not running in an enclave. Do not seal real code to this key."
}

Seal terms and exploits to sealingPublicKey. Verdicts are signed by signer (EIP-712, domain "Enclaus Arbiter", chain id 4663).

Stats

GET /api/stats

Public market numbers, the same as the Stats page. No sign in. Recalculated at most every 5 minutes. Tasks involving our own test wallets are left out (excludesInternalWallets says how many wallets).

{
  "tasks": { "posted": 6, "open": 1, "locked": 1, "paid": 3, "closedUnpaid": 1 },
  "money": { "lockedUsdg": "5.00", "paidUsdg": "25.00", "averageBountyUsdg": "7.50" },
  "work": { "exploitsSubmitted": 4, "conditionTrueShare": 0.75, "attemptsPerPaidTask": 1 },
  "people": { "requesters": 5, "workers": 5 },
  "speed": { "medianLockToPayoutHours": 0 },
  "recentPayouts": [{ "id": "40c65a9295f401c3", "bountyUsdg": "5", "paidAt": 1796038282, "releaseTx": "0x..." }]
}

Tasks

A task as the API returns it:

{
  "id": "2c32c49cb565f363",
  "state": "working",
  "requester": "0x...",
  "bountyUsdg": "10",
  "maxAttempts": 3,
  "attemptsUsed": 1,
  "summary": "Exploit check: one vault with deposits and withdrawals",
  "chainId": 4663,
  "deadlineHours": 72,
  "agreementId": "23",
  "agreementExpiresAt": 1796300000,
  "worker": "0x...",
  "lockTx": "0x...",
  "releaseTx": null,
  "createdAt": 1796030000,
  "updatedAt": 1796031000
}

States: open (published), requested (a worker asked), working (locked to that worker), checking, exhausted (no attempts left), paid, refunded, cancelled.

GET /api/tasks?view=open|mine|work

open: published tasks waiting for a worker, no sign in needed. mine: tasks you posted. work: tasks you asked for or hold. Returns { "tasks": [...] }.

GET /api/tasks/:id

{
  "task": { ... },
  "role": "requester | worker | viewer",
  "boxes": { "terms": [...], "verdicts": [...] },
  "attempts": [...]
}

boxes holds only what you can open: the requester gets the terms and the verdict details, the locked worker gets the terms sealed to its key, anyone else gets nothing.

POST /api/tasks (requester)

Creates and publishes a task. The browser does all sealing; the server checks the boxes' shape and recipients.

{
  "id": "<16 hex characters>",
  "commitment": "0x<32 bytes>",
  "bountyUsdg": "10",
  "maxAttempts": 3,
  "deadlineHours": 72,
  "summary": "One public line",
  "requesterKey": "<your X25519 public key>",
  "terms": { "arbiter": { "...sealed box" }, "requester": { "...sealed box" } }
}

Limits: bounty up to 50 USDG, 1 to 10 attempts, deadline 24 to 720 hours, summary 3 to 280 characters.

POST /api/tasks/:id/request (worker)

{ "workerKey": "<your X25519 public key>" }

POST /api/tasks/:id/decline · /cancel (requester)

decline puts a requested task back on the market. cancel removes a task that is not locked yet.

POST /api/tasks/:id/lock/prepare (requester)

Returns the escrow transactions, already checked: { "steps": [{ "to", "data", "value" }], "feeWei", "expiresAt", "payee", "workerKey" }. Send the steps in order.

POST /api/tasks/:id/lock/confirm (requester)

{ "txHash": "0x<the create transaction>", "workerTerms": { "...terms sealed to workerKey" } }

The server reads the receipt from the chain and checks payer, payee, amount and terms hash. Returns 404 until the transaction is mined.

POST /api/tasks/:id/submit (locked worker)

{ "exploit": { "...sealed box to the arbiter, context exploit:<id>:<attempt>" } }

attempt is attemptsUsed + 1. Returns { "task", "verdict", "signature", "signer", "pending"? }. If the verdict is condition-true the payout is attempted in the same call; pending explains why it has not gone through yet.

POST /api/tasks/:id/settle (requester or worker)

Retries a pending payout. Returns 200 when paid, 202 with pending when not.