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

> Best route across Soroswap, Aquarius, SushiSwap V3, Comet and SDEX. assetIn and assetOut are C... addresses, amount an integer string in stroops, protocols required. Returns amountOut, otherAmountThreshold, routePlan and platform. 400 No path found.



## OpenAPI

````yaml POST /quote
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:
  /quote:
    post:
      tags:
        - Quote
      summary: Quote
      description: >

        Calculates the best price for a given swap by aggregating liquidity from
        multiple protocols on the Stellar blockchain.  


        It finds the optimal path to execute the swap through the Soroswap
        Aggregator, splitting the trade across several routes to secure the best
        rate.  


        #### ⚡ Gasless Trustline Feature:

        This feature lets your users open a trustline without needing to
        understand what a trustline is or how much it costs. Then, the /build
        endpoint will create the transaction with all the needed operations.


        When enabled, the Soroswap API will return a quote that includes an
        additional swap to purchase 0.5 XLM to cover the trustline creation
        cost. 


        The quote will also include the trustline cost expressed in both assetIn
        and assetOut, so you can display this information to the user if desired
        (see the response schema for details).


        On mainnet, an EXACT_OUT quote against the Soroswap Aggregator sizes a
        fixed spend rather than an exact output: `amountIn` and
        `otherAmountThreshold` both become the amount that will actually be
        spent, and `amountOut` is the minimum you will receive, with any surplus
        delivered on top. SDEX quotes and every testnet quote are unaffected —
        EXACT_OUT there still means an exact output behind a slipped maximum
        input.
      operationId: SwapController_quote
      parameters:
        - name: network
          required: false
          in: query
          description: Network on which the operation will be performed
          schema:
            enum:
              - testnet
              - mainnet
            type: string
      requestBody:
        required: true
        description: Data required to perform the swap
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuoteDto'
            examples:
              exactIn:
                value:
                  assetIn: CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA
                  assetOut: CDTKPWPLOURQA2SGTKTUQOWRCBZEORB4BWBOMJ3D3ZTQQSGE5F6JBQLV
                  amount: '10000000'
                  tradeType: EXACT_IN
                  protocols:
                    - soroswap
                    - aqua
                  slippageBps: '50'
                  parts: 10
                  maxHops: 2
                  assetList:
                    - SOROSWAP
                    - STELLAR_EXPERT
                  gaslessTrustline: create
      responses:
        '200':
          description: Found quote
          content:
            application/json:
              schema:
                oneOf:
                  - title: Regular Quote Response
                    type: object
                    properties:
                      assetIn:
                        type: string
                        example: >-
                          CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75
                        description: Input asset contract address
                      assetOut:
                        type: string
                        example: >-
                          CDTKPWPLOURQA2SGTKTUQOWRCBZEORB4BWBOMJ3D3ZTQQSGE5F6JBQLV
                        description: Output asset contract address
                      amountIn:
                        type: string
                        example: '10000000'
                        description: Expected input amount in stroops
                      amountOut:
                        type: string
                        example: 9067253
                        description: Expected output amount in stroops
                      otherAmountThreshold:
                        type: number
                        example: 9067253
                        description: >-
                          Minimum output (exact_in) or maximum input (exact_out)
                          considering slippage protection
                      tradeType:
                        type: string
                        example: EXACT_IN
                        enum:
                          - EXACT_IN
                          - EXACT_OUT
                        description: >-
                          Type of trade: EXACT_IN = input fixed; EXACT_OUT =
                          output fixed
                      priceImpactPct:
                        type: string
                        example: '0.50'
                        description: >-
                          Estimated price impact of the trade, as a percentage
                          string
                      platform:
                        type: string
                        enum:
                          - router
                          - aggregator
                          - sdex
                        example: aggregator
                        description: >-
                          Indicates where the trade is routed: "router" (only
                          Soroswap), "aggregator" (aggregating more DEXes on
                          Soroban), or "sdex" (The Stellar Classic DEX
                      rawTrade:
                        type: object
                        description: >-
                          Data needed to execute the trade; structure varies by
                          platform. For "aggregator" quotes on mainnet,
                          `amountIn` is the post-fee amount that gets routed and
                          each `distribution` entry carries its `share` of it
                          (shares add up to `amountIn`) plus `hops`, the venue,
                          pool, tokens and amounts of every hop (`poolHash` on
                          Aquarius hops). `protocol_id` names only the first
                          hop's venue, so read venues from `hops`.
                        example:
                          amountIn: '9990000'
                          amountOutMin: '963312902408200487'
                          distribution:
                            - protocol_id: sushi
                              path:
                                - >-
                                  CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75
                                - >-
                                  CBI7UCH5KGSVQRO5H4SUCZUTZABCITZLRHQQZTWL2TK4RZ72TAR6IHRV
                              parts: 10
                              is_exact_in: true
                              poolIds:
                                - >-
                                  CDMJRRH5MAJLB7T5SQAWQOOL7UJ3BABGTURSVKIE6AEDSXESDDJIBVCT
                              share: '9990000'
                              hops:
                                - poolId: >-
                                    CDMJRRH5MAJLB7T5SQAWQOOL7UJ3BABGTURSVKIE6AEDSXESDDJIBVCT
                                  protocol: sushi
                                  tokenIn: >-
                                    CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75
                                  tokenOut: >-
                                    CBI7UCH5KGSVQRO5H4SUCZUTZABCITZLRHQQZTWL2TK4RZ72TAR6IHRV
                                  amountIn: '9990000'
                                  amountOut: '973043293419438491'
                                  feeBps: 5
                      routePlan:
                        type: array
                        description: >-
                          Array of route steps (e.g., AMMs, pools) with
                          associated splits and paths. The sum of the
                          percentages should be 100.
                        items:
                          type: object
                          properties:
                            swapInfo:
                              type: object
                              properties:
                                protocol:
                                  type: string
                                  example: soroswap
                                path:
                                  type: array
                                  items:
                                    type: string
                                  example:
                                    - >-
                                      CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75
                                    - >-
                                      CD25MNVTZDL4Y3XBCPCJXGXATV5WUHHOWMYFF4YBEGU5FCPGMYTVG5JY
                                    - >-
                                      CDTKPWPLOURQA2SGTKTUQOWRCBZEORB4BWBOMJ3D3ZTQQSGE5F6JBQLV
                            percent:
                              type: string
                              example: '100'
                      platformFee:
                        type: object
                        properties:
                          feeBps:
                            type: number
                            example: 50
                          feeAmount:
                            type: number
                            example: 50000
                        description: >-
                          Platform fee details. Present only when your partner
                          rate applies (see GET /partner); absent for
                          protocol-only swaps.
                  - title: Gasless Trustline Swap Quote Response
                    type: object
                    properties:
                      assetIn:
                        type: string
                        example: >-
                          CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75
                        description: Input asset contract address
                      assetOut:
                        type: string
                        example: >-
                          CDTKPWPLOURQA2SGTKTUQOWRCBZEORB4BWBOMJ3D3ZTQQSGE5F6JBQLV
                        description: Output asset contract address
                      amountIn:
                        type: string
                        example: '10000000'
                        description: >-
                          Expected input amount in stroops, including trustline
                          costs
                      amountOut:
                        type: string
                        example: '8567253'
                        description: Expected amount user receives after trustline costs
                      otherAmountThreshold:
                        type: string
                        example: '8467253'
                        description: >-
                          Minimum output (exact_in) or maximum input (exact_out)
                          considering slippage protection and trustline costs
                      tradeType:
                        type: string
                        example: EXACT_IN
                        description: >-
                          Type of trade: EXACT_IN = input fixed; EXACT_OUT =
                          output fixed
                      priceImpactPct:
                        type: string
                        example: '0.50'
                        description: >-
                          Estimated price impact of the trade, as a percentage
                          string
                      platform:
                        type: string
                        example: sdex
                        description: >-
                          Indicates where the trade is routed, for gasless
                          trustline swaps, it will always be "sdex" (The Stellar
                          Classic DEX)
                      gaslessTrustline:
                        type: string
                        enum:
                          - create
                        example: create
                        description: >-
                          Indicates if this is a gasless trustline swap quote.
                          Only use this if you are sure that the user does not
                          have a trustline for the output asset and if you have
                          an sponsor account.
                      rawTrade:
                        type: object
                        description: SDEX horizon path with trustline operation details
                        properties:
                          source_asset_type:
                            type: string
                            example: credit_alphanum12
                          source_amount:
                            type: string
                            example: '10000000'
                          destination_asset_type:
                            type: string
                            example: credit_alphanum12
                          destination_amount:
                            type: string
                            example: '9067253'
                          path:
                            type: array
                            items:
                              type: object
                          trustlineOperation:
                            type: object
                            description: Details for trustline repayment operation
                          netAmount:
                            type: string
                            example: '8567253'
                            description: Net amount after trustline costs
                          otherNetAmountThreshold:
                            type: string
                            example: '8467253'
                            description: Minimum net amount with slippage
                      trustlineInfo:
                        type: object
                        properties:
                          trustlineCostAssetIn:
                            type: string
                            example: '0.5000000'
                            description: Trustline cost in input asset terms
                          trustlineCostAssetOut:
                            type: string
                            example: '0.5000000'
                            description: Trustline cost in output asset terms
                        description: Trustline cost breakdown for UI display
                      routePlan:
                        type: array
                        description: >-
                          Array of route steps with associated splits and
                          paths. 
                        items:
                          type: object
                          properties:
                            swapInfo:
                              type: object
                              properties:
                                protocol:
                                  type: string
                                  example: sdex
                                path:
                                  type: array
                                  items:
                                    type: string
                            percent:
                              type: string
                              example: '100'
        '400':
          description: Error in input parameters or route not found
        '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.
      security:
        - bearer: []
components:
  schemas:
    QuoteDto:
      type: object
      properties:
        assetIn:
          type: string
          example: CAS3J7GYLGXMF6TDJBBYYSE3HQ6BBSMLNUQ34T6TZMYMW2EVH34XOWMA
          description: Input asset contract address
        assetOut:
          type: string
          example: CCW67TSZV3SSS2HXMBQ5JFGCKJNXKZM7UQUWUZPUTHXSTZLEO7SJMI75
          description: Output asset contract address
        amount:
          format: int64
          type: integer
          example: '10000000'
          description: Expected input amount in stroops
        tradeType:
          type: string
          example: EXACT_IN
          enum:
            - EXACT_IN
            - EXACT_OUT
          description: 'Type of trade: EXACT_IN = input fixed; EXACT_OUT = output fixed'
        protocols:
          example:
            - soroswap
            - aqua
          description: Array of protocols to aggregate liquidity from
          type: array
          items:
            type: array
        parts:
          type: number
          example: 10
          description: >-
            Number of route splits for optimization. Higher values improve price
            discovery but increase latency. Max: 1000..
        slippageBps:
          type: number
          example: '50'
          description: >-
            Slippage tolerance in basis points (bps). 10000 = 100%, 100 = 1%, 50
            = 0.5%. Default is 50 bps (0.5%)
        maxHops:
          type: number
          example: 2
          description: Maximum number of hops to aggregate liquidity from
        assetList:
          example:
            - SOROSWAP
            - STELLAR_EXPERT
            - AQUA
            - LOBSTR
          description: >-
            Restricts intermediate tokens to a specific list. Only useful for
            Soroban transactions (Router and Aggregator). Not useful for SDEX.
          type: array
          items:
            type: string
        feeBps:
          type: number
          example: 50
          description: >-
            Ignored. Your fee rate lives in your partner profile (see GET
            /partner). Kept for wire compatibility; the value you send is
            recorded so Soroswap can seed your profile.
        gaslessTrustline:
          type: string
          example: true
          description: >-
            Whether to use gasless trustline swap. Only use this if you are sure
            that the user does not have a trustline for the output asset and if
            you have an sponsor account.
      required:
        - assetIn
        - assetOut
        - amount
        - tradeType
        - protocols
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````

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