For the complete documentation index, see llms.txt. This page is also available as Markdown.

Withdraw funds

Pull collateral back out with the single-call withdraw flow.

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

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:

    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:

A lower-level request-withdrawal performs just the request step (also requires feePayerowner). Most integrations should use withdraw.

→ Full fields: API reference › Account & funds · Background: Funds lifecycle

Last updated

Was this helpful?