curl and jq.
1. Request Market Maker API access
Market Maker API access is permissioned. Request it from D1 first: see Getting API access. To follow every step of this guide you need a trading key and trading enabled for your account. With a read key you can do steps 3 to 5, 7 and 8.2. Receive your API key and set up your environment
D1 gives you two things during onboarding:- the API base URL;
- an API key, shown to you once.
3. Check status
200 means the key is valid and your account is active. Before you place orders, check that trading.available is true. If it is false, you can still read and cancel, but new orders are refused. See Trading availability.
4. List markets
priceTick and quantityStep tell you which prices and quantities the market accepts. Markets & Market Data explains every field.
5. Read the order book
6. Place an order
Every order needs aclientOrderId that you generate and store before you send the request. It is how you retry safely. See Idempotency.
201 Created means D1 created the order:
5xx, send exactly the same request again with the same clientOrderId. D1 returns the existing order with 200 and duplicate: true instead of creating a second one.
7. Read the order
{ order, serverTimeMs }, with the same order fields as above. To see all orders still on the book, use GET /mm/v1/orders?state=resting.
8. Reconcile executions
Fills from your orders, whether they fill when placed or later while resting, appear on/executions. Start from after=0 the first time, then from the checkpoint you saved.
nextAfter durably, and use it as after next time. If hasMore is true, request again straight away. See Fills & Executions.
9. Cancel remaining liquidity
Cancel one order:more is true, call cancel-all again.
Next: Building a reliable client
Timeouts, retries, restarts and reconciliation for production bots.