> ## Documentation Index
> Fetch the complete documentation index at: https://docs.d1.exchange/llms.txt
> Use this file to discover all available pages before exploring further.

# API Reference

> Request and response reference for the D1 Market Maker API (/mm/v1).

This section lists the exact parameters and response schema for every public endpoint. To learn how to integrate, start with the [Market Makers guides](https://docs.d1.exchange/market-makers/introduction.md).

> [!NOTE]
>
> The Market Maker API is a dedicated machine-to-machine trading interface for authorized market makers. Only the endpoints listed here are part of its contract.

## Base URL

D1 provides the base URL during onboarding. The examples use an environment variable:

```bash theme={null}
export D1_API_URL="<provided-by-d1>"
```

All paths are relative to it, for example `$D1_API_URL/mm/v1/status`. Keep the base URL in configuration rather than hard-coding it.

## Authentication

Send your API key as a Bearer token on every request. `GET` endpoints require the `mm:read` scope. `POST` endpoints require `mm:trade`, and placing a new order also requires trading to be [available](https://docs.d1.exchange/market-makers/trading-rules.md#trading-availability) for your account.

```bash theme={null}
curl "$D1_API_URL/mm/v1/status" \
  -H "Authorization: Bearer $D1_MM_API_KEY"
```

See [Authentication](https://docs.d1.exchange/market-makers/authentication.md).

## Endpoints

| Method | Path | Description |
| - | - | - |
| `GET` | `/mm/v1/status` | Key identity and permissions |
| `GET` | `/mm/v1/markets` | List markets |
| `GET` | `/mm/v1/markets/{instrumentId}` | One market and its settlement |
| `GET` | `/mm/v1/markets/{instrumentId}/orderbook` | Aggregated order book |
| `GET` | `/mm/v1/balances` | USDC balance |
| `GET` | `/mm/v1/positions` | Positions |
| `GET` | `/mm/v1/orders` | Orders and their lifecycle |
| `GET` | `/mm/v1/orders/{orderId}` | One order |
| `POST` | `/mm/v1/orders` | Place a limit order |
| `POST` | `/mm/v1/orders/{orderId}/cancel` | Cancel one order |
| `POST` | `/mm/v1/orders/cancel-all` | Cancel all resting orders |
| `GET` | `/mm/v1/executions` | Sequenced execution feed |
| `GET` | `/mm/v1/fills` | Fill history |

## Shared conventions

| Topic | Where it is described |
| - | - |
| Exact numbers (`{ units, decimals }`) | [Exact numbers](https://docs.d1.exchange/market-makers/market-data.md#exact-numbers) |
| Cursor pagination | [Pagination](https://docs.d1.exchange/market-makers/market-data.md#pagination) |
| Idempotent placement (`clientOrderId`) | [Orders](https://docs.d1.exchange/market-makers/orders.md#clientorderid-and-idempotency) |
| Sell-to-close and order limits | [Trading Rules](https://docs.d1.exchange/market-makers/trading-rules.md) |
| Execution checkpoints | [Fills & Executions](https://docs.d1.exchange/market-makers/executions.md#sync-semantics) |
| Error envelope and codes | [Errors](https://docs.d1.exchange/market-makers/errors.md) |
| Request budgets | [Rate Limits](https://docs.d1.exchange/market-makers/rate-limits.md) |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.