> ## 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.

# API 使用说明

> DexBuilder API Reference 的接入地址、路由和通用请求约定。

本文说明 DexBuilder 平台、事件市场和事件合约 API 的共同接入约定。各接口的参数、时间单位、分页方式、响应和错误字段以对应接口页为准。

## 接入地址与接口范围

生产环境 Base URL：

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

| 产品与接口类型 | 路径前缀 | 认证要求 |
| - | - | - |
| DexBuilder 平台 API | `/api/v4/dexbuilder/...` | 使用 Broker API Key 签名；用户级接口还需提供 `X-User-Wallet-Address` |
| 事件市场公开行情 | `/api/v4/prediction/...` | 无需 Broker API Key |
| 事件市场 Broker 私有接口 | `/api/v4/broker/prediction/...` | Broker API Key 签名及 `X-User-Wallet-Address` |
| 事件合约公开行情 | `/api/v4/event_contracts/...` | 无需 Broker API Key |
| 事件合约 Broker 私有接口 | `/api/v4/broker/event_contracts/...` | Broker API Key 签名及 `X-User-Wallet-Address` |

DexBuilder 平台的资产配置查询也使用 Broker API Key，但无需指定终端用户钱包。具体接口清单见[代表用户访问](https://dexbuilder.mintlify.site/api-reference/common/sub-user-wallet.md)。

> [!NOTE]
>
> PerpDEX 目前不支持 Broker API。PerpDEX 接口使用独立的 API Key 和认证规则，详见[PerpDEX 认证与签名](https://dexbuilder.mintlify.site/api-reference/perpdex/authentication.md)。

## 请求约定

* 使用接口页标明的 HTTP 方法、路径、Query 参数和请求体。私有 REST 请求的签名必须依据实际发送的请求内容计算，详见[Broker API Key 与签名](https://dexbuilder.mintlify.site/api-reference/common/broker-authentication.md)。
* `Timestamp` 请求头使用 Unix 秒级时间戳。业务字段的时间单位可能因产品和字段而异，请以接口字段说明为准。
* 请求体、Query 参数的顺序和编码会影响签名。计算签名后，发送请求时保持参与签名的内容不变。
* 列表接口的分页参数和返回结构以对应接口页为准。价格、数量和金额字段应按接口给出的类型处理，涉及精度时使用十进制数。

## 响应与错误

不同产品的业务响应和错误字段可能不同。请先根据 HTTP 状态码判断请求结果，再按照对应接口页及产品错误码页解析响应体。对提交类请求，若网络超时或收到不确定结果，应先查询操作状态，再决定是否重试；有幂等键要求的接口须按接口页提供幂等键。

* [DexBuilder 平台 API 概览](https://dexbuilder.mintlify.site/api-reference/dexbuilder/overview.md)
* [事件市场 API 概览](https://dexbuilder.mintlify.site/zh/event-markets/api/overview.md)与[错误码](https://dexbuilder.mintlify.site/zh/event-markets/error-codes.md)
* [事件合约 API 概览](https://dexbuilder.mintlify.site/zh/event-contracts/api/overview.md)与[错误码](https://dexbuilder.mintlify.site/zh/event-contracts/error-codes.md)


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