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

# Get api quote

> GET quote for aggregation swap



## OpenAPI

````yaml /openapi.yaml get /api/{blockchain}/quote
openapi: 3.1.0
info:
  title: swap-8dx
  description: ''
  license:
    name: ''
  version: 0.1.0
servers:
  - url: https://swap.ggp.gg
  - url: https://8dx.io
security: []
tags:
  - name: swap
    description: Swap API endpoints
  - name: approve
    description: Approve (Permit) API endpoints
  - name: explorer
    description: Explorer API endpoints
  - name: order
    description: Limit Order API endpoints
  - name: healthcheck
    description: Health Check API endpoints
paths:
  /api/{blockchain}/quote:
    get:
      tags:
        - swap
      description: GET quote for aggregation swap
      operationId: get_quote
      parameters:
        - name: blockchain
          in: path
          required: true
          schema:
            type: string
            enum:
              - ethereum
              - bsc
              - arbitrum
        - name: addressTokenIn
          in: query
          description: Source token contract address (ERC20 or native token)
          required: true
          schema:
            type: string
          style: form
        - name: addressTokenOut
          in: query
          description: Destination token contract address (ERC20 or native token)
          required: true
          schema:
            type: string
          style: form
        - name: amountIn
          in: query
          description: >-
            Amount of source token to swap (in token's normalized unit, e.g.,
            eth for ETH).

            Ignored when `amountInWei` is provided.
          required: false
          schema:
            type: string
          style: form
        - name: amountInWei
          in: query
          description: >-
            Amount of source token in the smallest unit (wei). Takes precedence
            over `amountIn`

            - useful for callers that don't account for token decimals.
          required: false
          schema:
            type: string
          style: form
        - name: apiKey
          in: query
          description: Partner API key. Header `X-Api-Key` takes precedence.
          required: false
          schema:
            type: string
          style: form
      responses:
        '200':
          description: Quote for aggregation swap through POST /{blockchain}/swap
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuoteResponse'
        '400':
          description: Bad request error from HTTP server
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                BadRequest:
                  summary: Bad request
                  value:
                    code: 400
                    error: string
        '404':
          description: Not found error from HTTP server
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                NotFound:
                  summary: Not found
                  value:
                    code: 404
                    error: string
        '408':
          description: Request timeout error from HTTP server
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                RequestTimeout:
                  summary: Request timeout
                  value:
                    code: 408
                    error: string
        '500':
          description: Internal server error from HTTP server
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                Internal:
                  summary: Internal
                  value:
                    code: 500
                    error: string
components:
  schemas:
    QuoteResponse:
      type: object
      required:
        - aggregatorAddress
      properties:
        aggregatorAddress:
          type: string
          description: |-
            Address to send the swap transaction to.
            Use this for `tx.to` when building the transaction.
        data:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/ResultPath'
        tokenApprovalAddress:
          type:
            - string
            - 'null'
          description: >-
            Address that the user must approve for ERC20 spending before calling
            /swap.

            Null when the input token is native.
    ErrorResponse:
      type: object
      required:
        - error
        - code
      properties:
        code:
          type: integer
          format: int32
          minimum: 0
        error:
          type: string
    ResultPath:
      allOf:
        - $ref: '#/components/schemas/OptimalRoute'
        - type: object
          required:
            - addressTokenIn
            - addressTokenOut
            - amountIn
            - amountInUsd
            - amountOutUsd
            - usdDifference
          properties:
            addressTokenIn:
              type: string
              description: Source token contract address (ERC20 or native token)
            addressTokenOut:
              type: string
              description: Destination token contract address (ERC20 or native token)
            amountIn:
              type: string
              description: >-
                Amount of source token to swap (in token's smallest unit, e.g.,
                wei for ETH)
            amountInUsd:
              type: number
              format: double
              description: Amount of source token to swap in USD
            amountOutUsd:
              type: number
              format: double
              description: Expected amount of destination token to receive in USD
            usdDifference:
              type: integer
              format: int32
              description: Difference in USD between source and destination tokens
    OptimalRoute:
      type: object
      required:
        - steps
        - totalAmountOut
        - totalPriceImpact
        - rawTotalGasEstimate
      properties:
        rawTotalGasEstimate:
          type: integer
          format: int64
          description: Approximate gas cost of the quote
          minimum: 0
        steps:
          type: array
          items:
            type: array
            items:
              $ref: '#/components/schemas/ResultPathStep'
        totalAmountOut:
          type: string
          description: >-
            Expected amount of destination token to receive (in token's smallest
            unit, e.g., wei for ETH)
        totalPriceImpact:
          type: integer
          format: int32
          description: Price impact of the quote in bps
          minimum: 0
    ResultPathStep:
      allOf:
        - $ref: '#/components/schemas/Action'
        - type: object
          required:
            - tokenIn
            - tokenOut
            - percentBps
            - amountIn
            - amountOut
          properties:
            amountIn:
              type: string
              description: >-
                Input amount for this routing step (in the token's smallest
                unit)
            amountOut:
              type: string
              description: >-
                Expected output amount for this routing step (in the token's
                smallest unit)
            percentBps:
              type: integer
              format: int32
              description: Percentage of the input allocated to this route in bps
              minimum: 0
            priceImpact:
              type:
                - integer
                - 'null'
              format: int32
              description: Price impact of step path in bps
              minimum: 0
            tokenIn:
              type: string
              description: Input token contract address for this step
            tokenOut:
              type: string
              description: Output token contract address for this step
    Action:
      oneOf:
        - type: object
          required:
            - exchanger
          properties:
            exchanger:
              $ref: '#/components/schemas/ExchangerData'
        - type: object
          required:
            - wrap
          properties:
            wrap:
              $ref: '#/components/schemas/WrapData'
    ExchangerData:
      type: object
      required:
        - name
        - address
        - poolType
        - fee
      properties:
        address:
          type: string
          description: Pool contract address of the pool
        fee:
          type: integer
          format: int32
          description: Fee of the pool in bps
          minimum: 0
        name:
          type: string
          description: Name of the pool
        poolType:
          $ref: '#/components/schemas/PoolType'
          description: Type of the pool
    WrapData:
      type: object
      required:
        - isWrap
        - wrapperType
        - name
      properties:
        isWrap:
          type: boolean
          description: Whether the action is a wrap
        name:
          type: string
          description: Name of the wrap token
        wrapperType:
          $ref: '#/components/schemas/WrappedType'
          description: Type of the wrap token
    PoolType:
      type: string
      enum:
        - UniswapV2
        - UniswapV3
        - UniswapV4
        - SushiSwapV2
        - PancakeSwapV2
        - PancakeSwapV3
        - CurveStable
        - CurveCrypto
        - CurveNG
        - CurveMeta
        - BalancerV2
        - BalancerV3
        - FluidT1
        - FluidLite
    WrappedType:
      type: string
      enum:
        - WETH
        - LidoWstETH
        - RocketPoolRETH
        - FraxSfrxETH
        - Custom

````