> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flashnet.xyz/llms.txt
> Use this file to discover all available pages before exploring further.

# Quotes

> Deposit-driven swaps

A quote supplies deposit instructions and pricing valid for 2 minutes, subject to slippage. Choose a destination in the source asset's `route.to` set. Orchestra detects funding, creates the order, and delivers to `recipientAddress` without a separate confirm call.

## Prerequisites

* An Orchestra account. Create one in the [dashboard](https://orchestra.flashnet.xyz/dashboard). Flashnet reviews new accounts before enabling API access.
* A server key (`fn_...`) from **API keys** in the dashboard. Keep it on your backend. For browsers and apps, use a scoped client key (`fnp_...`); see [Authentication](/api/authentication).

## Flow

<Steps>
  <Step title="Estimate">
    Call `GET /v1/orchestration/estimate` with the four route fields and `amount` on every input change. It is public and stateless.
  </Step>

  <Step title="Quote">
    Lock the price with `POST /v1/orchestration/quote`. Stablecoin on Base into BTC on Spark:

    <CodeGroup>
      ```bash curl theme={null}
      curl -X POST "https://orchestration.flashnet.xyz/v1/orchestration/quote" \
        -H "Authorization: Bearer SERVER_KEY" \
        -H "Content-Type: application/json" \
        -H "X-Idempotency-Key: $(uuidgen)" \
        -d '{
          "sourceChain": "base",
          "sourceAsset": "USDC",
          "destinationChain": "spark",
          "destinationAsset": "BTC",
          "amount": "50000000",
          "recipientAddress": "RECIPIENT_ADDRESS"
        }'
      ```

      ```typescript TypeScript theme={null}
      const res = await fetch("https://orchestration.flashnet.xyz/v1/orchestration/quote", {
        method: "POST",
        headers: {
          Authorization: "Bearer SERVER_KEY",
          "Content-Type": "application/json",
          "X-Idempotency-Key": crypto.randomUUID(),
        },
        body: JSON.stringify({
          sourceChain: "base",
          sourceAsset: "USDC",
          destinationChain: "spark",
          destinationAsset: "BTC",
          amount: "50000000",
          recipientAddress: "RECIPIENT_ADDRESS",
        }),
      });
      const quote = await res.json();
      ```
    </CodeGroup>

    <Info>
      Replace `SERVER_KEY` with your `fn_...` key. Use a new `X-Idempotency-Key` for each operation and reuse it when retrying that same request. Amounts are integer strings in the asset's smallest unit: `"100000"` is 0.001 BTC; `"50000000"` is 50 USDC on Base. Read each asset's `decimals` from `/routes`.
    </Info>

    Another pair uses the same request shape: 0.001 BTC on Spark into USDC on Solana.

    ```bash theme={null}
    curl -X POST "https://orchestration.flashnet.xyz/v1/orchestration/quote" \
      -H "Authorization: Bearer SERVER_KEY" \
      -H "Content-Type: application/json" \
      -H "X-Idempotency-Key: $(uuidgen)" \
      -d '{
        "sourceChain": "spark",
        "sourceAsset": "BTC",
        "destinationChain": "solana",
        "destinationAsset": "USDC",
        "amount": "100000",
        "recipientAddress": "RECIPIENT_ADDRESS"
      }'
    ```
  </Step>

  <Step title="Pay">
    Send `amountIn` of the source asset to `depositAddress` before `expiresAt`. Include `depositMemo` when returned. Eligible late funding uses refreshed pricing without the original guarantee; some expired submissions are rejected. See [Pricing](/orchestra/pricing).
  </Step>

  <Step title="Watch">
    Poll `GET /v1/orchestration/order?quoteId=QUOTE_ID` with a server key until `order` is non-null, then follow the order on [Status](/orchestra/status) by webhook, SSE, or `GET /v1/orchestration/status?id=ORDER_ID`.
  </Step>
</Steps>

## Deposit address by source chain

<Tabs>
  <Tab title="EVM">
    Send the quoted token or native asset on the source chain. If detection misses, submit the transaction:

    ```json theme={null}
    { "quoteId": "QUOTE_ID", "txHash": "0x...", "sourceAddress": "0x..." }
    ```

    `sourceAddress` is optional except on shared deposit addresses, where it identifies the sender.
  </Tab>

  <Tab title="Solana">
    `depositAddress` is a Solana address. Deposits are detected through Helius webhooks. Fallback submit body:

    ```json theme={null}
    { "quoteId": "QUOTE_ID", "txHash": "<base58 signature>", "sourceAddress": "<sender>" }
    ```
  </Tab>

  <Tab title="Spark">
    `depositAddress` is a Spark address. Deposits are detected by the Spark ingress scan. Fallback submit body:

    ```json theme={null}
    { "quoteId": "QUOTE_ID", "sparkTxHash": "<transfer id>", "sourceSparkAddress": "<sender>" }
    ```

    Spark USDB uses a quote-scoped sell address. Use the address returned for each quote. `sourceSparkAddress` is required for shared deposit addresses and optional otherwise.
  </Tab>

  <Tab title="Bitcoin">
    `depositAddress` is an L1 address. Deposits are detected over ZMQ from a Bitcoin node. Fallback submit body:

    ```json theme={null}
    { "quoteId": "QUOTE_ID", "bitcoinTxid": "<64 hex>", "bitcoinVout": 0 }
    ```

    Set `bitcoinVout` to the output paying `depositAddress`; `0` is only an example. Include it because some routes require it. L1 deposits may receive a [ZeroConf offer](/orchestra/zeroconf).
  </Tab>

  <Tab title="Lightning">
    `depositAddress` is a BOLT11 invoice and the quote also returns `lightningReceiveRequestId`. Paying the invoice creates the order. Fallback submit body:

    ```json theme={null}
    { "quoteId": "QUOTE_ID", "lightningReceiveRequestId": "<from the quote>" }
    ```

    Orchestra populates the id from the quote. Lightning funding is detected automatically; for cross-chain quotes, `/submit` can return an existing order but cannot create one before detection. Keep polling if it returns `409 xchain_lightning_submissionless`.
  </Tab>
</Tabs>

For TON, Tron, XRP, Litecoin, Zcash, and Hedera, use the returned address and memo or tag exactly. Transfer the quoted asset: native coins use native transfers, tokens and TON jettons use their token transfer operation. Submit the source transaction id as `txHash`, with `sourceAddress` when required for a shared address.

## When to call /submit

`POST /v1/orchestration/submit` reports funding when detection misses it or you have the transaction id already. Authenticate with the quote's partner key and send the body for its source chain. Repeating the same deposit returns the existing order.

An order id is not guaranteed at broadcast. Bitcoin and TON paths can require observed deposit proof. After a definitive verification rejection, wait for evidence and use a new idempotency key for the next recovery attempt. Reuse the same key after a timeout or 5xx; see [Idempotency](/api/overview#idempotency). Keep polling and do not send another payment. On success, use the returned `orderId` and `status`, plus `readToken` for client keys.

## Quote response

* `quoteId`: `q_...`; use it for `/order` and `/submit`.
* `depositAddress`: where the user sends the source asset. Use this quote's instructions.
* `depositMemo`: memo or tag the deposit must carry; present only on provider routes that require one.
* `amountIn`: source amount the price is based on.
* `estimatedOut`: destination output; fixed delivery commits to it with timely, full funding. See [funding conditions](/orchestra/pricing).
* `feeAmount`, `feeBps`: platform fee in `feeAsset` units and its rate.
* `totalFeeAmount`: sum of `feeAmount`, `roundingFeeAmount`, `appFeeAmount`, `sweepFeeAmount`, and `networkCostAmount`.
* `feeAsset`: denomination of every fee field; see [Fees](/orchestra/fees).
* `route`: path labels, which may be symbols or asset ids. Do not use them as catalog keys.
* `expiresAt`: ISO timestamp, 2 minutes after creation.
* `priceLockMode`, `lockedMinAmountOut`: optional price-lock policy and output floor. A price lock is separate from fixed delivery.
* `readToken`: client keys only; bound to this quote and passed on status reads as `readToken` or `X-Read-Token`.
* Exact-out quotes add `amountMode`, `targetAmountOut`, `requiredAmountIn`, `maxAcceptedAmountIn`, and `inputBufferBps`.
* Lightning sources add `lightningReceiveRequestId`.

## Rules

* Use each quote's returned deposit instructions; do not reuse cached instructions.
* A quote is bound to the partner that created it. Only a key from the same partner can submit it.
* `affiliateId` and `affiliateIds` require `Authorization`.
* Send `refundAddress` whenever you can. It is required for exact-out, for Lightning destinations, and for deposits from BNB, native TON, Tron, XRP, Litecoin, and Zcash. Without it, Orchestra refunds to the detected source address only when that is safe, and never to an exchange's shared sender address.
