> 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-api/flash-trade-v2.md).

# Flash Trade V2

Developer documentation for the **Flash Trade v2** API — the Flash perpetuals engine with near-instant, gasless execution. All endpoints are under the `/v2` path prefix.

## What's different from v1

* **One account per wallet.** All positions and orders live in a single per-owner **Basket** (one position per market) — no standalone Position/Order accounts. Identify a position with `(owner, marketSymbol, side)`.
* **Funds lifecycle.** Funds move through **deposit → delegate → trade → withdraw**. Account & funds calls submit to your Solana RPC; trading calls submit to the v2 RPC endpoint.
* **Streaming.** A wallet's state streams as a `basket` snapshot (raw bytes + metrics) rather than separate positions/orders arrays.

See [ProtocolConcepts](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-api/flash-trade-v2/protocolconcepts.md) for the full conceptual model.

## Start here

| Doc                                                                                                                         | What it covers                                                          |
| --------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| [ProtocolConcepts](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-api/flash-trade-v2/protocolconcepts.md)     | The v2 model: baskets, deposit ledger, delegation, withdrawal lifecycle |
| [ApiReference](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-api/flash-trade-v2/apireference.md)             | Every `/v2` endpoint with request/response schemas                      |
| [TransactionFlow](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-api/flash-trade-v2/transactionflow.md)       | End-to-end: set up → deposit → delegate → trade → withdraw              |
| [WebSocketStreaming](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-api/flash-trade-v2/websocketstreaming.md) | The basket snapshot, `basket`/`metrics` messages, connection behavior   |
| [ErrorReference](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-api/flash-trade-v2/errorreference.md)         | HTTP + on-chain errors and v2-specific recovery                         |
| [Workflows](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-api/flash-trade-v2/workflows.md)                   | Integration setup and transaction-building cookbooks                    |

## Quick check

```bash
curl $FLASH_API_URL/v2/health
curl $FLASH_API_URL/v2/tokens
curl $FLASH_API_URL/v2/prices
```


---

# 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-api/flash-trade-v2.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.
