# Conventions

## Base URL

Production environment URL:

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

All API paths start with `/api/v1`:

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

Full production URL:

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

{% hint style="warning" %}
For signature calculation, the `URI` only uses `/api/v1/symbols` — it does NOT include the domain or the `/rwa/trading` path prefix.
{% endhint %}

## Unified Response Structure

All endpoints return a unified structure:

| Field    | Type                  | Description                                                 |
| -------- | --------------------- | ----------------------------------------------------------- |
| `code`   | number                | Business status code. `200` = success, non-`200` = failure. |
| `errMsg` | string                | Error message. Empty string on success.                     |
| `data`   | object / array / null | Business data.                                              |
| `uuid`   | string / null         | Request UUID, may be empty.                                 |
| `t`      | number / null         | Server timestamp, may be empty.                             |

Success response example:

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

### Pagination

Paginated endpoints use the following `data` structure:

| Field   | Type   | Description             |
| ------- | ------ | ----------------------- |
| `total` | number | Total matching records. |
| `rows`  | array  | Current page data.      |

Pagination parameters:

| Parameter | Default | Constraints                            |
| --------- | ------- | -------------------------------------- |
| `page`    | `1`     | Treated as `1` if < 1.                 |
| `limit`   | `10`    | Treated as `10` if < 1; maximum `100`. |

## Error Handling

Business error codes are returned in the response body. Business exceptions typically use HTTP `400`. Clients should use the response body `code` and `errMsg` to determine the business result.

| code    | errMsg                  | Common Cause                                                                                                                                   |
| ------- | ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `401`   | `Unauthorized`          | API key not found, disabled, expired, signature error, nonce duplicate, timestamp out of window, IP not whitelisted, insufficient permissions. |
| `500`   | `Server internal error` | Parameter validation failure, business data not found, on-chain config missing, downstream service failure.                                    |
| `10000` | `Unsupported chainId`   | `x-api-chain-id` not in supported list.                                                                                                        |
| `10001` | `Unsupported product`   | `x-api-p` not in the public product list.                                                                                                      |
| `10002` | `ChainId is missing`    | Missing chain ID.                                                                                                                              |
| `10003` | `Product Id is missing` | Missing product type.                                                                                                                          |


---

# 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-en/getting-started/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.
