> ## 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.

# Build bridge transactions

> Takes the quote unchanged plus sender and recipient, re-quotes, and returns ordered unsigned steps (evm, stellar_xdr or solana_v0). A step with status rebuild_after_previous needs another build after the previous one lands. 409 Quote stale, 400 Recipient not ready, 428 CREATE_TRUSTLINE.



## OpenAPI

````yaml POST /bridge/build
openapi: 3.0.0
info:
  title: Soroswap API
  description: >+

    # 🚀 Soroswap API


    **Soroswap.Finance** is both an **Automated Market Maker (AMM)** and a **DEX
    Aggregator** on the Stellar blockchain.


    It aggregates liquidity from Soroban DEXes (**Soroswap, Phoenix, Aqua and
    Comet(TBA)**), and the **Stellar Classic DEX** — giving you **the best trade
    routes, liquidity tools, and real-time market data**.


    ---


    ## 📋 What You Can Do


    - 🔄 **Quote** – Get the best trade route between two assets with
    split-routing logic across AMMs and SDEX.  

    - 🧱 **Build** – Generate and simulate unsigned transactions (XDR) for swaps
    or liquidity actions.  

    - 🚀 **Send** – Submit signed transactions via Soroban RPC or Horizon.

    - ⚡ **Gasless Trustlines** – Use `gaslessTrustline` in `/quote` to open
    trustlines for users without requiring them to hold XLM or deal with
    trustline setup themselves.

    - 💰 **Platform Fees** – Add your own fee to user swaps with
    `platformFee`.  

    - 💧 **Liquidity** – Create LPs, add liquidity, remove liquidity.  

    - 💲 **Price** – Get real-time token prices.  

    - 🧠 **Pools** – View detailed pool information for Soroswap AMM.


    📮 **[Downnload the Postman Collection
    here](https://drive.google.com/drive/folders/1G-LQYE2EojPWP1CSuuS_tDb9vjYbFR6E?usp=drive_link)**


    ---


    ## 🔑 Authentication


    Send `Authorization: Bearer <credential>`: an API key (`sk_...`) or the JWT
    access token from `POST /login`. Each operation's `security` says whether it
    needs one; `security: []` means it is public.


    - **401**: no credential, or an invalid API key. The body says where to get
    a key, and `WWW-Authenticate` is set.

    - **403**: an expired or invalid JWT, or a valid credential without the
    required role.

    - `POST /send` answers **403** for any missing or invalid credential.

  version: '1.0'
  contact: {}
  x-logo:
    url: https://links.paltalabs.io/soroswap-full.svg
    backgroundColor: '#0e0e0e'
    altText: Soroswap Logo
    href: https://soroswap.finance
servers: []
security: []
tags: []
paths:
  /bridge/build:
    post:
      tags:
        - Bridge
      summary: Build bridge transactions
      description: >-

        Re-quotes the posted quote with the sender and recipient and returns the
        unsigned transactions to

        sign in order. 409 when the fresh quote is worse (EXACT_IN delivers
        less, EXACT_OUT costs more).

        A step with status `rebuild_after_previous` has no transaction yet: call
        build again once the step

        before it landed.
      operationId: BridgeController_build
      parameters:
        - name: network
          required: false
          in: query
          description: Mainnet only; testnet answers 400
          schema:
            enum:
              - testnet
              - mainnet
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BridgeBuildDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BridgeBuildResponse'
        '400':
          description: >-
            Invalid body, unknown chain or route, invalid sender or recipient
            (EVM addresses must pass EIP-55; a Solana recipient must be a
            wallet, see /bridge/quote), testnet, amount out of limits, recipient
            not ready (no trustline), a Solana sender without a USDC token
            account or enough SOL, USDT from Solana, or the source chain refused
            the transaction (simulation reverted)
        '401':
          description: >-
            No credential, an invalid API key, or a valid JWT of a disabled
            account. Except for the disabled account, the answer carries
            `WWW-Authenticate` and a `registerUrl`.
        '403':
          description: >-
            An expired or invalid JWT, or a valid credential without the
            required role.
        '409':
          description: Quote stale
        '428':
          description: >-
            Action required: the Stellar sender has no trustline to the asset
            (`action: CREATE_TRUSTLINE`). `actionData.xdr` is an unsigned
            changeTrust transaction for the sender to sign and submit before
            building again.
        '503':
          description: Iris, LayerZero or a chain RPC could not answer
      security:
        - bearer: []
components:
  schemas:
    BridgeBuildDto:
      type: object
      properties:
        quote:
          description: The /bridge/quote response, as received
          allOf:
            - $ref: '#/components/schemas/PostedBridgeQuoteDto'
        sender:
          type: string
          description: Source-chain address that signs (a G… account on Stellar)
        recipient:
          type: string
          description: Destination-chain address
      required:
        - quote
        - sender
        - recipient
    BridgeBuildResponse:
      type: object
      properties:
        quote:
          description: The fresh quote the steps were built from
          allOf:
            - $ref: '#/components/schemas/BridgeQuoteResponse'
        steps:
          description: In order; each one after the previous landed
          type: array
          items:
            $ref: '#/components/schemas/BridgeStep'
      required:
        - quote
        - steps
    PostedBridgeQuoteDto:
      type: object
      properties:
        asset:
          type: string
          enum:
            - USDC
            - USDT
        sourceChain:
          type: string
        destinationChain:
          type: string
        tradeType:
          type: string
          enum:
            - EXACT_IN
            - EXACT_OUT
        speed:
          type: string
          enum:
            - standard
            - fast
        amount:
          type: string
          description: The requested amount the quote echoed
        amountIn:
          type: string
        amountOut:
          type: string
      required:
        - asset
        - sourceChain
        - destinationChain
        - tradeType
        - amountIn
        - amountOut
    BridgeQuoteResponse:
      type: object
      properties:
        asset:
          type: string
          enum:
            - USDC
            - USDT
        sourceChain:
          type: string
          example: base
        destinationChain:
          type: string
          example: stellar
        tradeType:
          type: string
          enum:
            - EXACT_IN
            - EXACT_OUT
        speed:
          type: string
          enum:
            - standard
            - fast
          description: The speed actually quoted (fast falls back to standard)
        amount:
          type: string
          description: The requested amount, echoed; /bridge/build re-quotes with it
        amountIn:
          type: string
          example: '10000000'
          description: Source units sent (a Stellar amount floored to 6 decimals)
        amountOut:
          type: string
          example: '99998700'
          description: Destination units, the guaranteed minimum received
        decimalsIn:
          type: number
          example: 6
        decimalsOut:
          type: number
          example: 7
        maxFee:
          type: string
          description: 'USDC: the burn maxFee cap, source units'
        fees:
          type: array
          items:
            $ref: '#/components/schemas/BridgeFee'
        nativeFee:
          description: 'USDT: LayerZero fee in the source native token'
          allOf:
            - $ref: '#/components/schemas/BridgeNativeFee'
        limits:
          $ref: '#/components/schemas/BridgeLimits'
        recipient:
          $ref: '#/components/schemas/BridgeRecipientCheck'
        claimRequired:
          type: boolean
          description: 'USDC into Stellar: someone must submit mint_and_forward on Stellar'
        expiresAt:
          type: string
          example: '2026-11-27T12:00:30.000Z'
      required:
        - asset
        - sourceChain
        - destinationChain
        - tradeType
        - speed
        - amount
        - amountIn
        - amountOut
        - decimalsIn
        - decimalsOut
        - fees
        - limits
        - recipient
        - claimRequired
        - expiresAt
    BridgeStep:
      type: object
      properties:
        id:
          type: string
          example: bridge
        kind:
          type: string
          enum:
            - approval
            - reset_approval
            - bridge
            - claim
        chain:
          type: string
          example: base
          description: Chain id the transaction runs on
        status:
          type: string
          enum:
            - ready
            - rebuild_after_previous
        description:
          type: string
        tx:
          oneOf:
            - $ref: '#/components/schemas/StellarXdrTx'
            - $ref: '#/components/schemas/EvmTx'
            - $ref: '#/components/schemas/SolanaV0Tx'
      required:
        - id
        - kind
        - chain
        - status
        - description
    BridgeFee:
      type: object
      properties:
        type:
          type: string
          enum:
            - cctp_protocol
            - cctp_forward
            - oft_protocol
            - layerzero_messaging
        amount:
          type: string
          example: '1300'
          description: Smallest units of `token`
        token:
          type: string
          example: USDC
        decimals:
          type: number
          example: 6
        bps:
          type: number
          example: 1.3
          description: Basis points of the amount; Circle quotes fractions
        paidSeparately:
          type: boolean
          description: Paid on top of the amount, in the native token (not taken from it)
      required:
        - type
        - amount
        - token
        - decimals
    BridgeNativeFee:
      type: object
      properties:
        amount:
          type: string
          example: '531234'
          description: Quoted messaging fee, smallest native units
        token:
          type: string
          example: XLM
        decimals:
          type: number
          example: 7
      required:
        - amount
        - token
        - decimals
    BridgeLimits:
      type: object
      properties:
        minAmountIn:
          type: string
          description: Source units
        maxAmountIn:
          type: string
          description: Source units
    BridgeRecipientCheck:
      type: object
      properties:
        checked:
          type: boolean
          description: Whether a recipient was given and checked
        ready:
          type: boolean
          nullable: true
          description: Whether the recipient can receive now; null when not checked
        reason:
          type: string
      required:
        - checked
        - ready
    StellarXdrTx:
      type: object
      properties:
        format:
          type: string
          enum:
            - stellar_xdr
        xdr:
          type: string
          description: Base64 transaction envelope, simulated and assembled, unsigned
      required:
        - format
        - xdr
    EvmTx:
      type: object
      properties:
        format:
          type: string
          enum:
            - evm
        chainId:
          type: number
          example: 8453
        to:
          type: string
          example: '0x28b5a0e9C621a5BadaA536219b3a228C8168cf5d'
        data:
          type: string
          description: 0x-prefixed calldata
        value:
          type: string
          example: '0'
          description: Wei, decimal string
      required:
        - format
        - chainId
        - to
        - data
        - value
    SolanaV0Tx:
      type: object
      properties:
        format:
          type: string
          enum:
            - solana_v0
        serialized:
          type: string
          description: Base64 serialized v0 transaction, unsigned
        additionalSigners:
          type: array
          items:
            $ref: '#/components/schemas/SolanaAdditionalSigner'
        recentBlockhash:
          type: string
        lastValidBlockHeight:
          type: string
          description: u64 as a decimal string
      required:
        - format
        - serialized
        - additionalSigners
        - recentBlockhash
        - lastValidBlockHeight
    SolanaAdditionalSigner:
      type: object
      properties:
        role:
          type: string
          enum:
            - messageSentEventData
        publicKey:
          type: string
          description: Base58 public key
        secretKey:
          type: string
          description: >-
            Base58 secret key of a throwaway keypair. It only signs the creation
            of the CCTP event account and controls nothing afterwards.
      required:
        - role
        - publicKey
        - secretKey
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````

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