Skip to main content
Every other page in this reference documents one endpoint. This one runs the whole sequence in order, so you can see how the calls fit together before you build.

0. Before you start

You need an account and an API key — every private call below is HMAC-signed with it (X-Auth-Apikey, X-Auth-Nonce, X-Auth-Signature). See Authentication.
Check signature_type first. Authentication proves who you are; it does not let your client sign an order. A passkey wallet (3) signs only in a browser on a device that holds the passkey — to trade from a script, add a signing key you hold the key for. Your own wallet (2) is scriptable as it is.

1. Read your wallet config

GET /api/v2/atlas/account/wallet safe_status reports what Calibri has recorded (see The Safe). A new account reads deposit_required: fund the Safe first (step 2). Without ?setup=1, safe_setup is null; ask for it only in step 3 — before your first deposit ?setup=1 is refused with 409 wallet.deposit_required. This is the entry point to everything on-chain: it tells you which Safe is yours, what owns it, which contracts you are trading against, and whether you are ready to trade.
Read every address from here rather than hard-coding it — domain_name in particular is hashed into every order signature.

2. Fund the Safe

Send USDC on Polygon to proxy_address from any wallet or exchange. There is nothing to call — the deposit is an ordinary on-chain transfer, and it is credited once it confirms. GET /api/v2/atlas/account/balances/usdc
balance_safe is your tradeable USDC — the mirror of what your Safe holds on-chain. See Balances. Calibri creates your Safe after this first deposit: safe_status moves from deposit_required to deploying, then to setup_required once the Safe exists.

3. Make the Safe trade-ready

If safe_status is setup_required, the Safe still owes its approvals. Read GET /api/v2/atlas/account/wallet?setup=1: each entry in safe_setup.calls is { to, data, operation, nonce, hash }: sign it as a Safe SafeTx (EIP-712) with the Safe’s owner, then relay it. POST /api/v2/atlas/account/wallet/relay
nonce is the call’s own nonce, the one you signed. The operator executes it and pays the gas; you get back { "tx": "0x…", "status": "mined", "state": "pending", … } — status can also be unconfirmed (sent, not mined yet) or reverted — and the change applies once its block is final. Calls may arrive batched as one MultiSend call (operation: 1) or as several at sequential nonces — relay those in order. Re-read the config (without ?setup=1, which answers 409 wallet.state_pending until the relay is final) until safe_status is ready.
Do not place orders on setup_required. The order is rejected with 422 Member safe is not settlement-ready. Only ready can trade. Full detail in The Safe.

4. Pick a market

Public, no authentication:
  • q searches event titles, descriptions, categories, tags and market titles. Paging is page / limit (up to 100), with the Total header.
  • A rolling series (a five-minute crypto window, say) is listed as one event by default. expand_series=true lists every window as its own event.
  • /public/events/{…} takes the slug or the numeric event id that markets, orders and positions carry.
  • token_id finds the live market holding that outcome token (yes_token_id / no_token_id, exactly as published); [] when none.
  • Every market carries its limits (min_amount, amount_precision, min_price, max_price) and open_interest.

5. Sign and place an order

Read the market’s CTF config — the same funding config plus the market’s on-chain identifiers: GET /api/v2/atlas/account/wallet/markets/{id} → adds condition_id, yes_token_id, no_token_id. Build the EIP-712 Order, sign it, and post it: POST /api/v2/atlas/account/orders
Returns 201 with the order object. Up to 20 orders go in one request with POST /api/v2/atlas/account/orders/batch, and POST /api/v2/atlas/account/orders/{id}/replace swaps a resting order for a new one in one step. The struct, the unit rules, the signature types, batch and replace are in Signed orders — five things catch people out:
  • market_id is the numeric market id (12), not a slug — read it from the id of a market in the public event or market payload.
  • Units are 6-decimal. On a buy, takerAmount = volume × 1e6, makerAmount = price × volume × 1e6; a sell swaps the two and signs side: 1.
  • Sign the served domain_name, never a copied constant.
  • On a passkey Safe (signature_type: 3), sign the SafeMessage — not the order hash. Safe re-wraps the hash before checking it, so signing orderHash directly is rejected as Invalid signed_order signature, even though the signature recovers to your key when you check it yourself. Recipe under type 3 in Authentication.
  • Placing a buy locks stake plus the maximum taker fee the fill could incur (a post-only buy reserves no fee); the unused reserve is released when the order fills, rests or is cancelled. Budget stake + max fee, not just the stake. A sell locks the shares it offers, and its fee comes out of the proceeds — see Fees.

6. Follow the order

GET /api/v2/pythia/orders?state=wait — your resting orders. GET /api/v2/pythia/orders?state=wait,done,cancel,reject — every order, in any state. Open orders are read live; a list that includes a finished state is read from order history. GET /api/v2/pythia/orders/{id} — one order, open or terminal. Timestamps are RFC 3339 in UTC. Cancel with POST /api/v2/pythia/orders/{id}/cancel → { "id": 1420, "state": "cancel" }. Cancel everything with POST /api/v2/pythia/orders/cancel (optionally ?market_id= and/or ?side=yes|no, or the same as a JSON body); the response lists the cancelled orders. Then the results of the fill:
Each fill on /account/contracts carries order_id — your own order on that fill — so you can attribute fills to orders (or filter with ?order_id=). It also says whether you were taker_or_maker, the fee you paid (a maker pays none), and the token_id of your side. ?time_from= (inclusive) and ?time_to= (exclusive), in Unix seconds, bound the list. Positions carry token_id too. price, avg_price, volume, funds_spent, proceeds and taker_fee_amount are decimal strings; parse them as decimals, not floats.
Orders are placed through /atlas (so the signature is validated and attached) and read back from /pythia. Listing and cancelling are the same calls for every order, however it was placed.

7. Stream it instead of polling

One connection carries public and private streams together:
Each message is keyed by the stream name, so one handler switches on the key:
order, contract, balance and position replace the order, fill, balance and position polls in step 6. Pending rewards have no stream.
Order-book increments carry a sequence, one more than the last. If it is anything else — a skip, or a drop to a lower number — unsubscribe and subscribe to {market}.ob-inc again to get a fresh snapshot. A client that ignores it quotes against a book that no longer exists.
Full channel list and payloads: WebSocket streams.

The whole flow, once more

1

Authenticate

Mint an API key; HMAC-sign every private request. Check signature_type.
2

Wallet config

GET /account/wallet — Safe address, contracts, domain, safe_status.
3

Fund

Send USDC on Polygon to proxy_address; watch balance_safe. The Safe is created after this first deposit.
4

Approvals

?setup=1, sign each safe_setup.calls entry as a SafeTx; relay until ready.
5

Place

Per-market config → EIP-712 Order → POST /account/orders.
6

Follow

GET /pythia/orders/{id}, or subscribe to order / contract / balance.

Authentication

HMAC signing, and why it is not authorisation to trade.

The Safe

Deploy, approve and fund — step 1–3 in full.

Signed orders

The EIP-712 domain, the Order struct, and the unit rules.

WebSocket streams

Every channel, payload and reconnection rule.

Models

The exact shape of everything the calls above return.