> For the complete documentation index, see [llms.txt](https://rwaperp-1.gitbook.io/rwaperp-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://rwaperp-1.gitbook.io/rwaperp-docs/rwa-perp-b2b-api/rest-api/public-query-api.md).

# Public Query API

Send `POST /v1/public/query` with a body in the form `{"type":"<query_type>", ...}`. Authentication is not required.

**Request example**

```bash
curl -s -X POST "https://api-trade.rwaperp.xyz/v1/public/query" \
  -H "Content-Type: application/json" \
  -d '{"type":"marketDetail","symbol":"PERP_ETH_USDC"}'
```

The response `data` includes the requested symbol and the following datasets:

| Field           | Included fields                                            |
| --------------- | ---------------------------------------------------------- |
| `market_info`   | `mark_price`, `index_price`, `24h_volume`, `open_interest` |
| `orderbook`     | `asks`, `bids`; each entry contains price and quantity     |
| `recent_trades` | `side`, `executed_price`, `executed_quantity`              |
| `candles`       | `open`, `high`, `low`, `close`, `volume`, `timestamp`      |

**Account-state request body**

```json
{"type":"accountState","address":"0x...","broker_id":"rwaperp_xyz"}
```

Authentication is not required. The response `data` contains `address` and an `accounts` array with fields including `account_id`, `free_collateral`, and `margin_ratio`.

| type                                     | Additional request fields        | Response `data` highlights                           |
| ---------------------------------------- | -------------------------------- | ---------------------------------------------------- |
| `marketSummary`                          | Optional `symbols[]`             | Snapshot across multiple pairs                       |
| `marketDetail`                           | `symbol`                         | Market data + depth + trades + candles bundle        |
| `orderbook` / `candles` / `marketTrades` | `symbol` + per-type parameters   | The requested dataset                                |
| `accountState`                           | `address`, `broker_id`           | Account summary                                      |
| `openOrders` / `historicalOrders`        | `address`, `broker_id`           | `{ rows, next_cursor }`                              |
| `positionContext`                        | `address`, `broker_id`, `symbol` | `{ position, open_orders, market, account_summary }` |
| `agentContext`                           | `address`, ...                   | Account + positions + market data bundle             |
| `rateLimitStatus`                        | None                             | Quota for this IP                                    |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://rwaperp-1.gitbook.io/rwaperp-docs/rwa-perp-b2b-api/rest-api/public-query-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
