> 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.md).

# Flash Trade V2 API

The Flash Trade v2 API is a REST + WebSocket interface to the Flash perpetuals engine — near-instant, gasless trade execution on Solana. Build trading UIs, bots, and integrations without running your own indexer or transaction builder.

**Base URL:** `https://flashapi.trade`

There's no API key. You read data over plain HTTP and build transactions server-side; every transaction comes back **unsigned**, and you sign and submit it from the client. See [Signing & submitting](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/signing-and-submitting.md).

## Start here

| If you want to…                           | Go to                                                                                         |
| ----------------------------------------- | --------------------------------------------------------------------------------------------- |
| See it work end-to-end                    | [Quickstart](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/quickstart.md)   |
| Understand how it works before you build  | [Core concepts](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/concepts.md)  |
| Do one specific task                      | [Guides](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/guides.md)           |
| Look up an exact endpoint, field, or type | [API reference](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference.md) |
| Handle an error                           | [Errors](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/errors.md)           |

## What you can build

* **Trade** — open, close, increase, decrease, and reverse leveraged positions; market and limit orders.
* **Manage risk** — attach take-profit / stop-loss, add or remove collateral.
* **Move funds** — deposit, delegate, and withdraw through the funds lifecycle.
* **Read state** — prices, markets, pool stats, and a wallet's live positions & orders.
* **Stream** — subscribe to a wallet's basket snapshot over WebSocket.
* **Preview** — compute fees, exit fees, TP/SL PnL, and margin changes without building a transaction.

## How it works in 60 seconds

* **One account per wallet.** All of a wallet's positions and orders live in a single per-owner **Basket** — one position per market. You identify a position by `(owner, marketSymbol, side)`; the backend resolves the rest. → [The Basket model](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/concepts/basket-model.md)
* **Funds lifecycle.** Collateral moves through **deposit → delegate → trade → withdraw**. → [Funds lifecycle](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/concepts/funds-lifecycle.md)
* **Two submit targets.** Account & funds transactions go to your Solana RPC; trading transactions go to the v2 RPC endpoint. → [Signing & submitting](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/signing-and-submitting.md)

## Endpoint map

| Group               | Endpoints                                                                         | Reference                                                                                                                 |
| ------------------- | --------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| Market data         | `health`, `tokens`, `prices`, `pool-data`, `raw/*`                                | [Market data](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/market-data.md)                   |
| Account & positions | `owner/{owner}`, `positions/owner/{owner}`, `orders/owner/{owner}`                | [Account & positions](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/account-and-positions.md) |
| Previews            | `preview/limit-order-fees`, `preview/exit-fee`, `preview/tp-sl`, `preview/margin` | [Previews](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/previews.md)                         |
| Trading             | `open`/`close`/`increase`/`decrease`/`reverse`, collateral, triggers, limits      | [Trading](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/trading.md)                           |
| Account & funds     | `init-*`, `deposit`, `delegate-basket`, `withdraw`, settlement                    | [Account & funds](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/account-and-funds.md)         |
| Streaming           | `owner/{owner}/ws`                                                                | [WebSocket](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/websocket.md)                       |

## Program IDs

| Network | Program                                        |
| ------- | ---------------------------------------------- |
| Mainnet | `FLASH6Lo6h3iasJKWDs2F8TkW2UKf3s15C8PMGuVfgBn` |
| Devnet  | `FTPP4jEWW1n8s2FEccwVfS9KCPjpndaswg7Nkkuz4ER4` |


---

# 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.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.
