> 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/concepts/how-transactions-work.md).

# How transactions work

You never assemble instructions by hand. Every write goes through the same shape:

```
POST /transaction-builder/{action}   →   unsigned transactionBase64
        │
        ▼
decode → sign (client-side) → submit to the right RPC → confirm
        │
        ▼
read updated state from the basket snapshot (not the response)
```

The build → sign → submit mechanics — decode code, which RPC, who signs, blockhash expiry — live on [Signing & submitting](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/signing-and-submitting.md). This page covers the ideas behind them.

## Quotes vs. plain builders

* **Quote builders** (`open`, `close`, `reverse`, collateral) return a rich object — projected leverage, entry/liq price, fees — with the transaction under `transactionBase64`.
* **Plain builders** (triggers, limits, most funds ops) return just `{ "transactionBase64": "…" }`.

## Preview before you commit

Two ways to compute without spending anything:

* Omit `owner` on `open-position` → you get the quote back with `transactionBase64: null`.
* Use the [`preview/*`](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/previews.md) endpoints for fees, exit fees, TP/SL PnL, and margin changes — no transaction built at all.

## State is in the basket, not the response

A trade response is a *quote* of what will happen, not confirmed state. After a transaction confirms, read the truth from [`GET /owner/{owner}`](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/account-and-positions.md) or the [WebSocket](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/websocket.md). There can be brief lag between submitting and the committed state appearing.

## Two error surfaces

* **HTTP** errors (`4xx`/`5xx`) return `{ "error": "…" }`.
* **Compute** errors on quote endpoints return `200` with `{ "err": "…" }` in the body — a well-formed request the engine couldn't price.

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


---

# 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/concepts/how-transactions-work.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.
