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

# Estimate Rate

> Returns the estimated receive amount for a swap



## OpenAPI

````yaml POST /rate
openapi: 3.1.0
info:
  title: Bestflow API
  description: >-
    Bestflow is a cryptocurrency exchange aggregator that provides cross-chain
    swap capabilities without any additional fees. It aggregates multiple
    exchanges to offer users the best rates and seamless cryptocurrency swaps
    across different networks.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.bestflow.xyz
security:
  - {}
  - bearerAuth: []
paths:
  /rate:
    post:
      description: Returns the estimated receive amount for a swap
      requestBody:
        description: Rate estimation request details
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RateRequest'
        required: true
      responses:
        '200':
          description: Rate estimation from supported exchanges
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RateResponse'
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          $ref: '#/components/responses/ServiceUnavailableError'
components:
  schemas:
    RateRequest:
      type: object
      required:
        - from
        - to
        - fromNetwork
        - toNetwork
        - amount
      properties:
        from:
          type: string
          description: Source currency ticker
          example: BTC
        to:
          type: string
          description: Destination currency ticker
          example: ETH
        fromNetwork:
          type: string
          description: Source network identifier
          example: BTC
        toNetwork:
          type: string
          description: Destination network identifier
          example: ETH
        amount:
          type: number
          exclusiveMinimum: 0
          description: Amount to swap
          example: 0.5
    RateResponse:
      type: object
      required:
        - from
        - to
        - fromNetwork
        - toNetwork
        - amount
        - rates
      properties:
        from:
          type: string
        to:
          type: string
        fromNetwork:
          type: string
        toNetwork:
          type: string
        amount:
          type: number
        rates:
          type: array
          description: >-
            Rate estimates per exchange, sorted descending by estReceive (best
            rate first). Exchanges with unavailable rates appear last.
          items:
            $ref: '#/components/schemas/ExchangeRate'
    Error:
      type: object
      required:
        - error
        - message
      properties:
        error:
          type: string
          description: Error code
          enum:
            - VALIDATION_ERROR
            - INVALID_FORMAT
            - UNKNOWN_EXCHANGE
            - SWAP_ERROR
            - SWAP_NOT_FOUND
            - UNAUTHORIZED
            - RATE_LIMITED
            - SERVICE_UNAVAILABLE
        message:
          type: string
          description: Human-readable error message
    ExchangeRate:
      type: object
      required:
        - exchange
        - estReceive
        - eta
        - minAmount
        - maxAmount
      properties:
        exchange:
          type: string
          description: Exchange identifier
          example: swapter
          enum:
            - swapter
            - etzswap
            - pegasusswap
        estReceive:
          type:
            - number
            - 'null'
          description: Estimated amount to receive. Null means rate is unavailable.
        eta:
          type:
            - string
            - 'null'
          description: Estimated processing time. Null means no info.
        minAmount:
          type:
            - number
            - 'null'
          description: >-
            Minimum swap amount for this pair. Null means unavailable or no
            minimum.
        maxAmount:
          type:
            - number
            - 'null'
          description: >-
            Maximum swap amount for this pair. Null means unavailable or no
            maximum.
  responses:
    UnauthorizedError:
      description: Invalid or unknown API key
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: UNAUTHORIZED
            message: Invalid API key
    ServiceUnavailableError:
      description: Auth dependency unavailable
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: SERVICE_UNAVAILABLE
            message: Auth service unavailable
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Optional Bearer authentication using an API key provided as a Bearer
        token. Required for unlimited requests and revenue sharing.

````