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

# Manage Orders

> Query and cancel private Event Contracts orders through the Event Contracts API.

Order queries and cancellations are private operations and require authentication. Production Base URL:

```text theme={null}
https://api.dexbuilder.com
```

## List Orders

```bash cURL theme={null}
curl -G "https://api.dexbuilder.com/api/v4/broker/event_contracts/orders" \
  -H "KEY: ${BROKER_API_KEY}" \
  -H "SIGN: ${SIGN}" \
  -H "Timestamp: ${TIMESTAMP}" \
  -H "X-User-Wallet-Address: ${USER_WALLET}" \
  --data-urlencode "status=open" \
  --data-urlencode "condition_id=<condition_id>" \
  --data-urlencode "limit=20"
```

Common filter parameters include `status`, `condition_id`, `event_id`, `order_id`, `client_order_id`, `from`, `to`, `sort_type`, `limit`, and `cursor`.

`from` and `to` use Unix milliseconds. `sort_type` can sort by `created_at` or `updated_at`.

Response:

```json theme={null}
{
  "items": [
    {
      "order_id": "order-123",
      "client_order_id": "client-order-001",
      "event_id": "event-123",
      "condition_id": "0xabc...",
      "token_id": "token-yes",
      "outcome": "Yes",
      "side": "BUY",
      "price": "0.52",
      "size": "10",
      "size_matched": "4",
      "size_left": "6",
      "order_type": "GTC",
      "order_mode": "LIMIT",
      "status": "open",
      "created_at": 1782753357,
      "updated_at": 1782753357
    }
  ],
  "next_cursor": "eyJvZmZzZXQiOjIwfQ"
}
```

Pass `next_cursor` unchanged as `cursor` for the next page.

## Get an Order

```bash cURL theme={null}
curl "https://api.dexbuilder.com/api/v4/broker/event_contracts/orders/<order_id>" \
  -H "KEY: ${BROKER_API_KEY}" \
  -H "SIGN: ${SIGN}" \
  -H "Timestamp: ${TIMESTAMP}" \
  -H "X-User-Wallet-Address: ${USER_WALLET}"
```

The detail response includes the order identifiers, price, quantity, fill progress, and status from the list response and may also include an `error_code` returned by the order service.

## Cancel an Order

```bash cURL theme={null}
curl -X DELETE "https://api.dexbuilder.com/api/v4/broker/event_contracts/orders/<order_id>" \
  -H "KEY: ${BROKER_API_KEY}" \
  -H "SIGN: ${SIGN}" \
  -H "Timestamp: ${TIMESTAMP}" \
  -H "X-User-Wallet-Address: ${USER_WALLET}"
```

```json theme={null}
{
  "order_id": "order-123",
  "status": "processing",
  "cancel_status": "accepted"
}
```

## Cancel Orders by Condition

```bash cURL theme={null}
curl -X DELETE "https://api.dexbuilder.com/api/v4/broker/event_contracts/orders?condition_id=<condition_id>" \
  -H "KEY: ${BROKER_API_KEY}" \
  -H "SIGN: ${SIGN}" \
  -H "Timestamp: ${TIMESTAMP}" \
  -H "X-User-Wallet-Address: ${USER_WALLET}"
```

```json theme={null}
{
  "batch_id": "batch-123",
  "status": "accepted",
  "total_orders": 3
}
```

> [!NOTE]
>
> Use a Broker API Key and pass a wallet address that belongs to your Broker in `X-User-Wallet-Address`. Calculate `SIGN` from the actual request method, path, query string, and body. See [Broker API key and signing](https://dexbuilder.mintlify.site/en/api-reference/common/broker-authentication.md) and [Access on behalf of a user](https://dexbuilder.mintlify.site/en/api-reference/common/sub-user-wallet.md).


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