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

> ## Agent Instructions
> Soroswap Aggregator API: base URL https://api.soroswap.finance, pick the network with ?network=mainnet or ?network=testnet (omitted means mainnet).
> Auth: Authorization: Bearer sk_... on every call. Get a key at https://console.soroswap.finance/register. A missing or invalid key returns 401 with code and registerUrl (POST /send returns 403 instead); an expired JWT or a missing role returns 403. Free plan 1 request/s; see https://docs.soroswap.finance/api/plans.md.
> Flow: POST /quote (assetIn, assetOut as C... contract addresses, amount as an integer string in the smallest unit, tradeType, protocols) -> POST /quote/build with the unchanged quote and from -> the user signs the XDR -> POST /send. Build right after quoting: a Soroban XDR is valid for 180 seconds. Submit it as is, never re-simulate it.
> Partner id: every account has one (9 hex chars, permanent). Read partnerId from GET /partner, or in the console at https://console.soroswap.finance under Fees & payouts. The partner fee itself is switched on by Soroswap; see https://docs.soroswap.finance/api/fees.md.
> AI tools: docs MCP at https://docs.soroswap.finance/mcp (claude mcp add --transport http soroswap-docs https://docs.soroswap.finance/mcp), skill with npx skills add https://docs.soroswap.finance. Other clients: https://docs.soroswap.finance/api/build-with-ai.md.
> Units and Stellar pitfalls: https://docs.soroswap.finance/api/stellar-gotchas.md. Errors and retries: https://docs.soroswap.finance/api/errors.md.

# Quote, build and sign

> Mainnet only. POST /bridge/quote prices a USDC or USDT transfer and checks the recipient; POST /bridge/build returns the unsigned steps to sign in order, as evm, stellar_xdr or solana_v0 transactions. Amounts in the chain's smallest units.

This page takes a transfer from a quote to signed transactions on the source chain. Start with
the [Overview](https://docs.soroswap.finance/api/bridge.md) for the flow and the chain list.

## Quote

```bash theme={null}
curl -X POST "https://api.soroswap.finance/bridge/quote?network=mainnet" \
  -H "Authorization: Bearer $SOROSWAP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "asset": "USDC",
    "sourceChain": "base",
    "destinationChain": "stellar",
    "amount": "10000000",
    "tradeType": "EXACT_IN",
    "recipient": "G..."
  }'
```

| Field | Required | Meaning |
| - | - | - |
| `asset` | Yes | `USDC` or `USDT`. |
| `sourceChain`, `destinationChain` | Yes | Chain ids from `/bridge/routes`. |
| `amount` | Yes | Positive integer string in the token's smallest units: of the source for `EXACT_IN`, of the destination for `EXACT_OUT`. |
| `tradeType` | Yes | `EXACT_IN` (send this much) or `EXACT_OUT` (receive this much). |
| `speed` | No | USDC only. `standard` (default) or `fast`. Fast falls back to standard when the source has no Fast Transfer. |
| `sender` | No | The source-chain address that will sign. On Stellar it must be a `G...` account. |
| `recipient` | No | The destination-chain address. With it, the quote checks that the recipient can receive. |

> [!WARNING]
>
> Decimals differ by chain. Stellar tokens have **7** decimals and every other chain's USDC and USDT
> have **6**. 10 USDC is `"10000000"` on Base and `"100000000"` on Stellar.

A successful quote returns `201`:

```json theme={null}
{
  "asset": "USDC",
  "sourceChain": "base",
  "destinationChain": "stellar",
  "tradeType": "EXACT_IN",
  "speed": "standard",
  "amount": "10000000",
  "amountIn": "10000000",
  "amountOut": "100000000",
  "decimalsIn": 6,
  "decimalsOut": 7,
  "maxFee": "0",
  "fees": [
    { "type": "cctp_protocol", "amount": "0", "token": "USDC", "decimals": 6, "bps": 0 }
  ],
  "limits": { "minAmountIn": "1" },
  "recipient": { "checked": true, "ready": true },
  "claimRequired": true,
  "expiresAt": "2026-12-01T08:08:48.184Z"
}
```

* `amountIn` is what leaves the sender, in source units. `amountOut` is the **guaranteed minimum**
  the recipient gets, in destination units. For USDC that is `amountIn` minus `maxFee`, the most
  Circle can keep.
* `fees` lists what the transfer pays:
  * `cctp_protocol`: Circle's fee, in `bps`. It is `0` for a standard transfer and charged on Fast
    Transfers.
  * `cctp_forward`: Circle's Forwarding Service fee, when Circle mints on the destination for the
    user (every USDC route except into Stellar).
  * `oft_protocol`: the USDT0 fee.
  * `layerzero_messaging`: the LayerZero fee in the source chain's native token (ETH, XLM...),
    marked `paidSeparately: true`. It is not taken from the amount: the user pays it as gas.
* `recipient.ready` is `false` when the recipient can't receive yet, with a `reason`. A Stellar
  `G...` account needs a trustline to the asset. Without a `recipient`, `checked` is `false`.
* `claimRequired: true` means the transfer ends with a claim on Stellar (USDC into Stellar).
* `limits.minAmountIn` is the smallest amount that covers the fees. A smaller amount returns `400`
  `Amount too small`.
* `expiresAt` is 30 seconds out. `/bridge/build` quotes again anyway.

Show the user `amountOut` and the fees before they sign.

## Build

Send the quote back unchanged, with the addresses that will sign and receive:

```bash theme={null}
curl -X POST "https://api.soroswap.finance/bridge/build?network=mainnet" \
  -H "Authorization: Bearer $SOROSWAP_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "quote": { ...the quote... }, "sender": "0x...", "recipient": "G..." }'
```

The response is `{ quote, steps }`. `quote` is the fresh quote the steps were built from. If the
route now delivers less (`EXACT_IN`) or costs more (`EXACT_OUT`) than the quote you posted, the
build returns `409` `Quote stale`: quote again and show the user the new numbers.

`steps` are in order. Each one has a `kind` (`reset_approval`, `approval`, `bridge` or `claim`),
the `chain` it runs on, a human `description` and a `status`:

* `ready`: sign and send `tx` now.
* `rebuild_after_previous`: no `tx` yet. Once the previous step has landed, call `/bridge/build`
  again to get it.

Every step must land before the next one is sent.

### Signing each kind of transaction

`tx.format` tells you how to sign it.

> [tab] EVM
>
> `{ format: "evm", chainId, to, data, value }`. Send it from the sender's wallet on `chainId`,
> as is. `value` is in wei: `"0"` for USDC, the LayerZero fee for USDT.
>
> ```ts theme={null}
> const hash = await walletClient.sendTransaction({
>   to: tx.to,
>   data: tx.data,
>   value: BigInt(tx.value),
> })
> ```
>
> All EVM steps come back `ready` together: an `approval` for exactly the amount when the
> allowance is short, then the `bridge`. USDT on Ethereum may add a `reset_approval` first,
> because that token requires the allowance to go to zero before it changes. The API does not
> check balances; the wallet's own estimate does.

> [tab] Stellar
>
> `{ format: "stellar_xdr", xdr }`. The XDR is already simulated and assembled, with the sender
> as source. Sign it with the wallet and submit it to the network.
>
> USDC from Stellar can take two steps: Circle's contract pulls the USDC with an allowance, and
> a Stellar transaction holds only one contract call. When the allowance is short you get an
> `approval` (`ready`) and a `bridge` (`rebuild_after_previous`). Submit the approval, then call
> `/bridge/build` again for the burn. The approval is valid for 500 ledgers, about 40 minutes,
> and an allowance that already covers the amount skips it.
>
> A sender without a trustline to the asset gets `428` `CREATE_TRUSTLINE` with an unsigned
> trustline transaction in `actionData.xdr`, the same as on [`/quote/build`](https://docs.soroswap.finance/api/errors).

> [tab] Solana
>
> `{ format: "solana_v0", serialized, additionalSigners, recentBlockhash, lastValidBlockHeight }`.
> One v0 transaction, USDC only.
>
> It needs two signatures: the user's wallet and a throwaway key in `additionalSigners`
> (`role: "messageSentEventData"`), which only signs the creation of Circle's event account and
> controls nothing afterwards. **Sign with the wallet first**, then add the throwaway signature
> to the transaction the wallet returned, then send it. Wallets can change the transaction while
> signing, so a signature added before the wallet's would be invalid.
>
> The transaction expires at `lastValidBlockHeight`, about a minute. Build again for a fresh
> one.

## Rules worth knowing

* **Recipients on Stellar.** USDC goes to a `G...` account with a USDC trustline, a `C...`
  contract or an `M...` address. USDT goes to a `G...` account with a `USDT0` trustline only. A
  recipient that can't receive returns `400` `Recipient not ready` at build.
* **Recipients on Solana.** Use the wallet address, never a token account. A wallet with no USDC
  token account yet is fine: Circle creates it and the quote's fee includes that.
* **EVM addresses** must have a valid EIP-55 checksum, or be all lowercase. A mistyped
  mixed-case address returns `400` before anything is burned.
* **Stellar amounts** have 7 decimals and CCTP has 6. A 7th decimal is rounded down before the
  burn, and `amountIn` shows the rounded value.
* **Solana senders** need a USDC token account (`400` `Sender not ready` otherwise) and enough SOL
  for the fee and Circle's event account rent. The sender can reclaim that rent from Circle later.

Once the `bridge` step has landed, follow it with [Status and claim](https://docs.soroswap.finance/api/bridge-status.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.