> For the complete documentation index, see [llms.txt](https://docs.flash.trade/flash-trade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flash.trade/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/conventions.md).

# Conventions

These apply across the whole API and aren't repeated on each endpoint page.

## Base URL

```
https://flashapi.trade
```

No API key. Reads are plain HTTP; every transaction-builder endpoint returns an **unsigned** transaction you sign client-side. See [Signing & submitting](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/signing-and-submitting.md).

## Units

* **UI units** — human-readable decimal strings (e.g. `"100.0"` USDC, `"148.52"` price). Request bodies and `*Ui` response fields use these. The server converts to native using each token's decimals (including Token-2022 scaling).
* **Native units** — raw integers (e.g. `price` + `exponent`). Apply `value × 10^exponent`.

## Position identity

Trading and preview endpoints identify a position by `(owner, marketSymbol, side)` — e.g. `"SOL"` + `"LONG"`. No position pubkeys. See [The Basket model](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/concepts/basket-model.md).

## Error shapes

Two keys, two surfaces — always check both:

```json
{ "error": "…" }   // HTTP-level failure (4xx / 5xx)
{ "err": "…" }     // compute failure returned inside a 200 body (quote endpoints)
```

## Status codes

| Code  | Meaning                                                        |
| ----- | -------------------------------------------------------------- |
| `200` | Success                                                        |
| `101` | WebSocket upgrade                                              |
| `400` | Bad request / validation error / invalid pubkey                |
| `404` | Resource not found (account, price symbol, pool)               |
| `429` | Too many requests (per-owner WebSocket limit)                  |
| `500` | Internal server error / compute error / blockhash fetch failed |
| `503` | Service unavailable (price missing, global connection limit)   |

Full recovery guidance: [Errors](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/errors.md).

## Enums

**TradeType** (`SCREAMING_SNAKE_CASE`) — `LONG`, `SHORT`. `SWAP` is not supported.

**OrderType** — `MARKET` (executes immediately), `LIMIT` (executes at trigger price).

**MarginAction** — `ADD`, `REMOVE`.

## Transaction responses

| Field               | When                                                 |
| ------------------- | ---------------------------------------------------- |
| `transactionBase64` | Unsigned v0 transaction. `null` in preview-only mode |
| `receipt`           | Receipt PDA to poll (withdrawal/settlement builders) |
| `err`               | Set when a quote computation failed                  |


---

# 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://docs.flash.trade/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/conventions.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.
