Skip to main content
This guide walks through the full lifecycle of one order:
The examples use 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.
A trading key can move funds on your account. Keep it out of source control, logs, tickets and URLs. See Keeping your key safe.

3. Check status

A 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 a clientOrderId 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:
If the request times out or you get a 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

The response is { 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.
Process the page, save 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:
Or cancel every resting order on your account:
If more is true, call cancel-all again.

Next: Building a reliable client

Timeouts, retries, restarts and reconciliation for production bots.