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

# Get swap route

> Returns a swap route between two tokens, including amounts, path data, and optional transaction data.

Provide exactly one of `amountIn` (forward quote) or `amountOut` (reverse quote). When `from` equals `to`, the API switches to arbitrage detection mode.

Pass a `sender` address to receive a fully-built transaction object ready for signing, instead of raw `txData`.



## OpenAPI

````yaml /api-reference/aggregator-openapi.json get /api/v1/quote
openapi: 3.1.0
info:
  title: XOXNO DEX Aggregator API
  version: 1.0.0
  description: >-
    Swap routing across xExchange, AshSwap, JEX, and OneDex on MultiversX,
    including split routes and reverse quotes.
servers:
  - url: https://swap.xoxno.com
security: []
paths:
  /api/v1/quote:
    get:
      tags:
        - Quote
      summary: Get swap route
      description: >-
        Returns a swap route between two tokens, including amounts, path data,
        and optional transaction data.


        Provide exactly one of `amountIn` (forward quote) or `amountOut`
        (reverse quote). When `from` equals `to`, the API switches to arbitrage
        detection mode.


        Pass a `sender` address to receive a fully-built transaction object
        ready for signing, instead of raw `txData`.
      operationId: getQuote
      parameters:
        - name: from
          in: query
          required: true
          description: Input token identifier (e.g., `WEGLD-bd4d79`).
          schema:
            type: string
          example: WEGLD-bd4d79
        - name: to
          in: query
          required: true
          description: Output token identifier (e.g., `USDC-c76f1f`).
          schema:
            type: string
          example: USDC-c76f1f
        - name: amountIn
          in: query
          required: false
          description: >-
            Amount to swap in smallest units. Returns maximum achievable output.
            Mutually exclusive with `amountOut`.
          schema:
            type: string
          example: '1000000000000000000'
        - name: amountOut
          in: query
          required: false
          description: >-
            Desired output amount in smallest units. Returns required input.
            Mutually exclusive with `amountIn`.
          schema:
            type: string
        - name: slippage
          in: query
          required: false
          description: Slippage tolerance as a decimal (0.01 = 1%).
          schema:
            type: number
            default: 0.01
        - name: maxSplits
          in: query
          required: false
          description: Maximum number of route splits for the optimizer.
          schema:
            type: integer
            default: 6
        - name: maxHops
          in: query
          required: false
          description: Maximum swaps per individual route path.
          schema:
            type: integer
            default: 6
        - name: includePaths
          in: query
          required: false
          description: >-
            Include detailed path breakdown in response. Set to `true` when you
            need route details; defaults to `false` to reduce response size.
          schema:
            type: boolean
            default: false
        - name: algorithm
          in: query
          required: false
          description: >-
            Split allocation algorithm. `greedy` allocates chunks by marginal
            output, `lagrangian` balances marginal rates across convex AMM
            paths, and `hybrid` runs both and returns the larger output.
          schema:
            type: string
            enum:
              - greedy
              - lagrangian
              - hybrid
            default: hybrid
        - name: sender
          in: query
          required: false
          description: >-
            Sender bech32 address. When provided, the API returns a complete
            `transaction` object ready for signing (fetches nonce, simulates
            gas).
          schema:
            type: string
        - name: referralId
          in: query
          required: false
          description: Referral ID for fee sharing.
          schema:
            type: integer
            default: 0
        - name: maxBuiltinCalls
          in: query
          required: false
          description: Cap on smart contract calls per transaction (gas optimization).
          schema:
            type: integer
        - name: includeLpRoutes
          in: query
          required: false
          description: >-
            Allow LP tokens as intermediate hops. Auto-enabled when `from` or
            `to` is an LP token.
          schema:
            type: boolean
            default: false
        - name: strict
          in: query
          required: false
          description: >-
            Arbitrage mode only: when `true`, applies stricter profitability
            filters. Set to `false` for a broader but noisier cycle search. Only
            used when `from` equals `to`.
          schema:
            type: boolean
            default: true
      responses:
        '200':
          description: Swap route found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuoteResponse'
              example:
                from: WEGLD-bd4d79
                to: USDC-c76f1f
                amountIn: '1000000000000000000'
                amountOut: '42500000'
                amountInShort: 1
                amountOutShort: 42.5
                amountOutMin: '42075000'
                amountOutMinShort: 42.075
                slippage: 0.01
                priceImpact: 0.0012
                rate: 42.5
                rateInverse: 0.0235
                paths: []
                txData: c3dhcEV4YWN0QW1...
                feeBps: 30
                feeAmount: '127500'
                feeAmountShort: 0.1275
        '400':
          description: Invalid parameters (unknown token, both amounts provided, etc.).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: specify either amount_in or amount_out, not both
        '404':
          description: No route found between the requested tokens.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: 'routing failed: no path between tokens'
components:
  schemas:
    QuoteResponse:
      type: object
      description: Swap route and execution details.
      properties:
        from:
          type: string
          description: Input token identifier.
        to:
          type: string
          description: Output token identifier.
        amountIn:
          type: string
          description: Input amount in smallest units.
        amountOut:
          type: string
          description: Output amount in smallest units.
        amountInShort:
          type: number
          description: Human-readable input amount (divided by token decimals).
        amountOutShort:
          type: number
          description: Human-readable output amount.
        amountOutMin:
          type: string
          description: >-
            Minimum output after slippage, in smallest units. Present for
            forward quotes.
        amountOutMinShort:
          type: number
          description: Human-readable minimum output. Present for forward quotes.
        amountInMax:
          type: string
          description: >-
            Maximum input after slippage, in smallest units. Present for reverse
            quotes only.
        amountInMaxShort:
          type: number
          description: Human-readable maximum input. Present for reverse quotes only.
        amountInUsd:
          type: number
          description: USD value of input amount. Omitted if price unavailable.
        amountOutUsd:
          type: number
          description: USD value of output amount. Omitted if price unavailable.
        amountOutMinUsd:
          type: number
          description: >-
            USD value of minimum output after slippage. Omitted if price
            unavailable.
        slippage:
          type: number
          description: Applied slippage tolerance.
        priceImpact:
          type: number
          description: Estimated price impact as a decimal (0.01 = 1%).
        rate:
          type: number
          description: 'Exchange rate: output units per input unit.'
        rateInverse:
          type: number
          description: 'Inverse rate: input units per output unit.'
        paths:
          type: array
          items:
            $ref: '#/components/schemas/RoutePath'
          description: Detailed route breakdown. Present when `includePaths=true`.
        txData:
          type: string
          description: >-
            Hex-encoded transaction data for the aggregator endpoint call.
            Omitted when `transaction` is present.
        feeBps:
          type: integer
          description: Protocol fee in basis points.
        feeAmount:
          type: string
          description: Fee amount in smallest units.
        feeAmountShort:
          type: number
          description: Human-readable fee amount.
        feeToken:
          type: string
          description: Token identifier the fee is charged on.
        transaction:
          $ref: '#/components/schemas/TransactionObject'
          description: >-
            Complete transaction ready for signing. Present only when `sender`
            is provided.
        arbitrage:
          type: object
          description: >-
            Arbitrage metadata. Present only for same-token (`from == to`)
            forward quotes.
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Human-readable error message.
    RoutePath:
      type: object
      description: A single route leg in a split swap.
      properties:
        amountIn:
          type: string
          description: Input amount allocated to this path in smallest units.
        amountOut:
          type: string
          description: Output amount from this path in smallest units.
        amountInShort:
          type: number
          description: Human-readable input amount for this path.
        amountOutShort:
          type: number
          description: Human-readable output amount for this path.
        splitPpm:
          type: integer
          description: >-
            Fraction of total input allocated to this path, in parts per million
            (1,000,000 = 100%).
        swaps:
          type: array
          items:
            $ref: '#/components/schemas/Swap'
          description: Ordered list of individual pool swaps within this path.
    TransactionObject:
      type: object
      description: A complete MultiversX transaction ready for signing.
      properties:
        sender:
          type: string
          description: Sender bech32 address.
        receiver:
          type: string
          description: Receiver bech32 address (aggregator contract).
        value:
          type: string
          description: Native EGLD value in atomic units.
        nonce:
          type: integer
          description: Sender's current nonce.
        data:
          type: string
          description: >-
            Transaction data field (includes ESDT transfer prefix when
            applicable).
        gasLimit:
          type: integer
          description: Gas limit (simulated + buffer).
        gasPrice:
          type: integer
          description: Gas price in atomic units.
        chainID:
          type: string
          description: Chain identifier.
        version:
          type: integer
          description: Transaction version.
    Swap:
      type: object
      description: A single pool swap within a route path.
      properties:
        dex:
          type: string
          description: 'DEX name: `xExchange`, `AshSwap`, `JEX`, or `OneDex`.'
        pairId:
          type: integer
          description: Internal pair identifier.
        address:
          type: string
          description: Pool smart contract bech32 address.
        from:
          type: string
          description: Input token identifier for this swap hop.
        to:
          type: string
          description: Output token identifier for this swap hop.
        amountIn:
          type: string
          description: Input amount in smallest units.
        amountOut:
          type: string
          description: Output amount in smallest units.
        amountInShort:
          type: number
          description: Human-readable input amount.
        amountOutShort:
          type: number
          description: Human-readable output amount.

````