> 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/guides/withdraw-funds.md).

# Withdraw funds

Withdrawals are a single call, but two things make them different from a normal transaction: they need a **separate fee payer**, and the funds settle **asynchronously**.

## 1. Build the withdrawal

```bash
curl -X POST $FLASH_API_URL/transaction-builder/withdraw -d '{
  "owner": "<WALLET>", "tokenSymbol": "USDC", "amount": "12.5", "feePayer": "<FEE_PAYER>"
}'
```

* **`feePayer` must differ from `owner`** — the delegation program rejects `owner == feePayer`. The client holds this keypair and co-signs the transaction.
* Optionally pass `feePayerTopUpLamports` to prepend an `owner → feePayer` transfer that covers the escrow rent.

## 2. Handle the response

The response includes `receipt`, `custodySettlementRequired`, and `isNativeSol`.

* **`custodySettlementRequired: true`** → the trade vault can't cover the amount yet. Settle first, then retry `withdraw`:

  ```bash
  curl -X POST $FLASH_API_URL/transaction-builder/custody-settlement -d '{
    "owner": "<WALLET>", "tokenSymbol": "USDC"
  }'
  ```

## 3. Submit and wait

Sign (owner + fee payer), submit to your **Solana RPC**, then poll until the escrow `receipt` account closes — that means the funds landed in your ATA.

* **`isNativeSol: true`** → the funds arrive as WSOL; unwrap the WSOL account back to native SOL.
* If the withdrawal doesn't finalize on its own, resume it:

  ```bash
  curl -X POST $FLASH_API_URL/transaction-builder/withdrawal-settle -d '{
    "owner": "<WALLET>", "tokenMint": "<MINT>"
  }'
  ```

> A lower-level `request-withdrawal` performs just the request step (also requires `feePayer` ≠ `owner`). Most integrations should use `withdraw`.

→ Full fields: [API reference › Account & funds](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/reference/account-and-funds.md#withdraw) · Background: [Funds lifecycle](/flash-trade/flash-trade-protocol/build-on-flash/flash-trade-v2/concepts/funds-lifecycle.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/guides/withdraw-funds.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.
