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

# Get exchange rate

> Get the exchange rate and fees between a source currency and destination currency



## OpenAPI

````yaml https://api.fernhq.com/json get /exchange-rates
openapi: 3.1.1
info:
  title: Fern Developer API
  description: >-
    Fern is a seamless currency conversion and payments API that enables
    developers to integrate onramps, offramps, and third-party fiat/crypto
    payments into their applications. 


    Fern works with licensed liquidity providers and financial institutions to
    offer global currency support in one standardized API. 
  termsOfService: https://fernhq.com/terms
  version: 1.0.0
  contact:
    name: Fern API Support
    url: https://support.fernhq.com
    email: support@fernhq.com
servers:
  - url: https://api.fernhq.com
    description: API Server
security:
  - bearerAuth: []
tags:
  - name: Customers
    description: >-
      Use Customers API to create a customer, update their details, and get
      their details.
  - name: Payment Accounts
    description: >-
      Use Payment Accounts API to add, update and get bank accounts for an
      existing customer. Currently, only USD bank accounts with domestic
      ACH/wire routing numbers are supported.
  - name: Quotes
    description: >-
      Use Quotes API to create and fetch quotes for transactions. Currently,
      onramp and offramp transaction types are supported and will be inferred
      from the source and destination. 


      Before you can create a transaction, you must create a quote. Quotes
      enable you to specify important information about the transaction, such as
      the source and destination currencies and accounts and your developer
      fees. Quotes also provide useful information that you can use to display
      in your application, such as exchange rates and total fees. 


      - **Quotes expire after 5 minutes** 

      - You must create a quote before you create a transaction, and you will
      use the quote ID when creating a transaction. 

      - Quotes can only be created for verified customers. /n- Once you create a
      transaction with a quote, that quote can no longer be used. To generate a
      new transaction, you will have to create a new quote.
  - name: Transactions
    description: >-
      Use Transactions API to create and get transactions for a customer and a
      quote. Requires the creation of a quote beforehand per transaction.
  - name: Automation Rules
    description: >-
      Use Automation Rules API to create and manage automation rules for a
      customer.
  - name: Webhooks
    description: >-
      Use Webhooks API to manage webhook endpoints and view recent webhook
      deliveries.
paths:
  /exchange-rates:
    get:
      tags:
        - Payment Accounts
      summary: Get exchange rate
      description: >-
        Get the exchange rate and fees between a source currency and destination
        currency
      operationId: getExchangeRate
      parameters:
        - schema:
            type: string
          examples:
            USD:
              value: USD
            USDC:
              value: USDC
            '0x1234567890abcdef1234567890abcdef12345678':
              value: '0x1234567890abcdef1234567890abcdef12345678'
          in: query
          name: sourceCurrency
          required: true
          description: Currency label or contract address.
        - schema:
            title: Source Payment Method Schema
            anyOf:
              - enum:
                  - ACH
                  - WIRE
                  - SEPA
                  - AE_UAEFTS
                  - AR_TRANSFERS_3
                  - AU_BECS
                  - BD_BEFTN
                  - BO_RTGS
                  - BR_TED_DOC_PIX
                  - CA_INTERAC
                  - CL_TEF
                  - CN_CNAPS
                  - CO_ACH
                  - CR_SINPE
                  - CZ_CERTIS
                  - DK_NEMKONTO_FI
                  - DO_ACH
                  - EC_LOCAL
                  - EG_RTGS_IPN
                  - GB_BACS_CHAPS_FPS
                  - GH_GHIPSS
                  - GT_ACH
                  - HK_HKICL_CHATS_ECG
                  - HU_GIRO
                  - ID_SKN_RTGS
                  - IL_ZAHAV
                  - IN_NEFT_RTGS_IMPS
                  - JM_LOCAL
                  - JO_ACH
                  - JP_ZENGIN
                  - KE_KIBBS_PESALINK
                  - KR_LOCAL
                  - LK_LOCAL
                  - MX_SPEI
                  - MY_IBG_RENTAS
                  - NG_NIBSS_NEFT
                  - NO_NICS
                  - NP_LOCAL
                  - NZ_LOCAL
                  - PE_CCE
                  - PH_INSTAPAY_PESONET
                  - PK_RAAST_IBFT
                  - PL_ELIXIR_BLUE_CASH
                  - QA_QPS
                  - RO_RTGS
                  - SA_MADA
                  - SE_BANKGIROT
                  - SG_FAST_MEPS
                  - SV_LOCAL
                  - SWIFT
                  - TH_BAHTNET_PROMPTPAY
                  - TR_FAST_EFT
                  - TZ_RTGS
                  - VN_IBPS
                  - ZA_RTGS_EFT
                  - ACH_SAME_DAY
                title: Fiat Payment Method
                description: The payment method for the source funds (fiat)
                type: string
              - enum:
                  - ARBITRUM
                  - BASE
                  - ETHEREUM
                  - OPTIMISM
                  - POLYGON
                  - SOLANA
                title: Crypto Payment Method
                description: The payment method for the source funds (crypto)
                type: string
          example: ACH
          in: query
          name: sourcePaymentMethod
          required: true
          description: The payment method for the source exchangeRate
        - schema:
            type: string
            title: Source Amount Schema
          example: '100.00'
          in: query
          name: sourceAmount
          required: false
          description: >-
            The amount to be sent. If provided fern fees and destination amount
            will be returned
        - schema:
            title: Destination Payment Method Schema
            anyOf:
              - enum:
                  - ACH
                  - WIRE
                  - SEPA
                  - AE_UAEFTS
                  - AR_TRANSFERS_3
                  - AU_BECS
                  - BD_BEFTN
                  - BO_RTGS
                  - BR_TED_DOC_PIX
                  - CA_INTERAC
                  - CL_TEF
                  - CN_CNAPS
                  - CO_ACH
                  - CR_SINPE
                  - CZ_CERTIS
                  - DK_NEMKONTO_FI
                  - DO_ACH
                  - EC_LOCAL
                  - EG_RTGS_IPN
                  - GB_BACS_CHAPS_FPS
                  - GH_GHIPSS
                  - GT_ACH
                  - HK_HKICL_CHATS_ECG
                  - HU_GIRO
                  - ID_SKN_RTGS
                  - IL_ZAHAV
                  - IN_NEFT_RTGS_IMPS
                  - JM_LOCAL
                  - JO_ACH
                  - JP_ZENGIN
                  - KE_KIBBS_PESALINK
                  - KR_LOCAL
                  - LK_LOCAL
                  - MX_SPEI
                  - MY_IBG_RENTAS
                  - NG_NIBSS_NEFT
                  - NO_NICS
                  - NP_LOCAL
                  - NZ_LOCAL
                  - PE_CCE
                  - PH_INSTAPAY_PESONET
                  - PK_RAAST_IBFT
                  - PL_ELIXIR_BLUE_CASH
                  - QA_QPS
                  - RO_RTGS
                  - SA_MADA
                  - SE_BANKGIROT
                  - SG_FAST_MEPS
                  - SV_LOCAL
                  - SWIFT
                  - TH_BAHTNET_PROMPTPAY
                  - TR_FAST_EFT
                  - TZ_RTGS
                  - VN_IBPS
                  - ZA_RTGS_EFT
                  - ACH_SAME_DAY
                title: Fiat Payment Method
                description: The payment method for the source funds (fiat)
                type: string
              - enum:
                  - ARBITRUM
                  - BASE
                  - ETHEREUM
                  - OPTIMISM
                  - POLYGON
                  - SOLANA
                title: Crypto Payment Method
                description: The payment method for the source funds (crypto)
                type: string
          example: ETHEREUM
          in: query
          name: destinationPaymentMethod
          required: true
          description: The payment method for the destination exchangeRate
        - schema:
            type: string
            title: Destination Currency Schema
          examples:
            USD:
              value: USD
            USDC:
              value: USDC
            '0x1234567890abcdef1234567890abcdef12345678':
              value: '0x1234567890abcdef1234567890abcdef12345678'
          in: query
          name: destinationCurrency
          required: true
          description: Currency label or contract address.
      responses:
        '200':
          description: Response Schema for retrieving the exchangeRate of a payment account
          content:
            application/json:
              schema:
                type: object
                properties:
                  exchangeRate:
                    type: string
                    description: >-
                      The rate at which the source currency is multiplied to
                      determine the equivalent amount in the destination
                      currency
                    example: '1000.00'
                  destinationAmount:
                    type: string
                    description: >-
                      The amount that will be received excluding fern fees.
                      Equivalent to setting developer fee to 0
                    example: '100'
                  feeComponents:
                    type: array
                    items:
                      type: object
                      properties:
                        feeType:
                          type: string
                          description: The type of fee this fee component describes
                          enum:
                            - FLAT
                            - PERCENTAGE
                          example: FLAT
                        feeCurrency:
                          $ref: '#/components/schemas/CurrencySchema'
                        feeAmount:
                          type: string
                          description: Amount of this fee that was applied
                          example: '5.45'
                      required:
                        - feeType
                        - feeAmount
                      additionalProperties: false
                      title: Fees Component Schema
                      description: Fee structure for an exchange rate
                  fees:
                    $ref: '#/components/schemas/ComputedFeesSchema'
                required:
                  - exchangeRate
                  - feeComponents
                additionalProperties: false
                title: Get ExchangeRate Response Schema
                description: >-
                  Response Schema for retrieving the exchangeRate of a payment
                  account
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                description: Bad Request
                type: object
                properties:
                  message:
                    type: string
                    description: Human-readable error message
                    example: Invalid input provided
                  code:
                    type: string
                    description: Error code for programmatic handling
                    example: VALIDATION_ERROR
                  details:
                    description: Additional error context
                required:
                  - message
                additionalProperties: false
              examples:
                example1:
                  value:
                    code: BAD_REQUEST
                    message: ''
                    statusCode: 400
                example2:
                  value:
                    code: VALIDATION_ERROR
                    message: Invalid body data
                    details:
                      - path: []
                        message: ''
                        location: body
                    statusCode: 400
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                description: Unauthorized
                type: object
                properties:
                  message:
                    type: string
                    description: Human-readable error message
                    example: Invalid input provided
                  code:
                    type: string
                    description: Error code for programmatic handling
                    example: VALIDATION_ERROR
                  details:
                    description: Additional error context
                required:
                  - message
                additionalProperties: false
              example:
                code: UNAUTHORIZED
                message: Missing API Key
                statusCode: 401
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                description: Forbidden
                type: object
                properties:
                  message:
                    type: string
                    description: Human-readable error message
                    example: Invalid input provided
                  code:
                    type: string
                    description: Error code for programmatic handling
                    example: VALIDATION_ERROR
                  details:
                    description: Additional error context
                required:
                  - message
                additionalProperties: false
              example:
                code: FORBIDDEN
                message: ''
                statusCode: 403
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                description: Not Found
                type: object
                properties:
                  message:
                    type: string
                    description: Human-readable error message
                    example: Invalid input provided
                  code:
                    type: string
                    description: Error code for programmatic handling
                    example: VALIDATION_ERROR
                  details:
                    description: Additional error context
                required:
                  - message
                additionalProperties: false
              example:
                code: NOT_FOUND
                message: >-
                  Customer not found with id
                  9eb88b00-f04f-409b-9df7-7dcc9003bc35
                statusCode: 404
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                description: Internal Server Error
                type: object
                properties:
                  message:
                    type: string
                    description: Human-readable error message
                    example: Invalid input provided
                  code:
                    type: string
                    description: Error code for programmatic handling
                    example: VALIDATION_ERROR
                  details:
                    description: Additional error context
                required:
                  - message
                additionalProperties: false
              example:
                code: INTERNAL_SERVER_ERROR
                message: INTERNAL_SERVER_ERROR
                statusCode: 500
components:
  schemas:
    CurrencySchema:
      title: Currency Schema
      description: Schema representing either a fiat or crypto currency
      anyOf:
        - type: object
          properties:
            label:
              type: string
            chain:
              enum:
                - ARBITRUM
                - BASE
                - ETHEREUM
                - OPTIMISM
                - POLYGON
                - SOLANA
              title: Crypto Chain
              description: The chain the crypto currency is on
              type: string
            contractAddress:
              type: string
            currencyDecimals:
              type: number
          required:
            - label
        - type: object
          properties:
            label:
              type: string
          required:
            - label
      example:
        label: USDC
        chain: ETHEREUM
        contractAddress: '0x123456789abcd123456789abcd123456789abcd'
        currencyDecimals: 18
    ComputedFeesSchema:
      type: object
      properties:
        feeCurrency:
          $ref: '#/components/schemas/CurrencySchema'
        fernFee:
          $ref: '#/components/schemas/FeeSchema'
      required:
        - feeCurrency
        - fernFee
      additionalProperties: false
      title: Fees Schema
      description: Fee structure for an exchange rate
    FeeSchema:
      title: Fee Schema
      description: Fee Amount in USD and in the fee currency
      type: object
      properties:
        feeAmount:
          type: string
          title: Fee Amount Schema
          description: Amount of this fee that was applied
          example: '5.45'
        feeUSDAmount:
          type: string
          title: Fee USD Amount Schema
          description: Amount of this fee that was applied in USD
          example: '5.45'
      required:
        - feeAmount
        - feeUSDAmount
      additionalProperties: false
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: To authenticate server-side requests

````