# 接入约定

## Base URL

生产环境访问地址：

```
https://rwa-api.anchored.finance/rwa/trading
```

接口路径均从 `/api/v1` 开始：

```
GET /api/v1/symbols
```

生产环境完整地址：

```
https://rwa-api.anchored.finance/rwa/trading/api/v1/symbols
```

{% hint style="warning" %}
签名时的 `URI` 只使用 `/api/v1/symbols`，不包含域名，也不包含 `/rwa/trading` 路径前缀。
{% endhint %}

## 统一响应结构

所有接口都返回统一结构：

| 字段       | 类型                    | 说明                             |
| -------- | --------------------- | ------------------------------ |
| `code`   | number                | 业务状态码。`200` 表示成功，非 `200` 表示失败。 |
| `errMsg` | string                | 错误信息。成功时为空字符串。                 |
| `data`   | object / array / null | 业务数据。                          |
| `uuid`   | string / null         | 请求 UUID，可能为空。                  |
| `t`      | number / null         | 服务端时间戳，可能为空。                   |

成功响应示例：

```json
{
  "code": 200,
  "errMsg": "",
  "data": {
    "symbol": "AAPL"
  },
  "uuid": null,
  "t": null
}
```

### 分页

分页接口的 `data` 使用以下结构：

| 字段      | 类型     | 说明         |
| ------- | ------ | ---------- |
| `total` | number | 符合条件的记录总数。 |
| `rows`  | array  | 当前页数据。     |

分页参数统一为：

| 参数      | 默认值  | 约束                            |
| ------- | ---- | ----------------------------- |
| `page`  | `1`  | 小于 `1` 时按 `1` 处理。             |
| `limit` | `10` | 小于 `1` 时按 `10` 处理；最大值为 `100`。 |

## 错误处理

业务错误码通过响应体返回。业务异常通常使用 HTTP `400`，调用方应以响应体 `code` 和 `errMsg` 判断业务结果。

| code    | errMsg                          | 常见原因                                                 |
| ------- | ------------------------------- | ---------------------------------------------------- |
| `401`   | `Unauthorized`                  | API key 不存在、禁用、过期、签名错误、nonce 重复、时间戳超窗、IP 不在白名单、权限不足。 |
| `500`   | `Server internal error` 或具体错误信息 | 参数校验失败、业务数据不存在、链上配置缺失、下游服务失败等。                       |
| `10000` | `Unsupported chainId`           | `x-api-chain-id` 不在支持列表内。                            |
| `10001` | `Unsupported product`           | `x-api-p` 不在对外开放的产品列表内。                              |
| `10002` | `ChainId is missing`            | 缺少链 ID。                                              |
| `10003` | `Product Id is missing`         | 缺少产品类型。                                              |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.anchored.finance/trading-api-docs-zh/kuai-su-kai-shi/conventions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
