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

# Get a fixed exchange quote

> Get a fixed exchange quote for a specific amount, to use with [/v2/exchange/fixed](/api-reference/endpoints/exchange-fixed).

A quote is valid for `fix_period` seconds (until `ts_release`) and for one [/v2/exchange/fixed](https://docs.ca.cryptoprocessing.com/api-reference/endpoints/exchange-fixed.md) request. Getting a quote doesn't check or reserve your balance.

For every error this endpoint returns and what it means, see [API errors: Get a fixed exchange quote](https://docs.ca.cryptoprocessing.com/api-reference/errors.md#get-a-fixed-exchange-quote).


## OpenAPI

````yaml POST /v2/exchange/calculate
openapi: 3.1.0
info:
  title: Merchant Backend V2
  version: '1.0'
  description: Documentation for merchant backend processing endpoints
servers:
  - url: https://app.ca.cryptoprocessing.com/api
security:
  - xProcessingKey: []
tags:
  - name: Status
  - name: Balance
  - name: Currencies
  - name: Deposit addresses
  - name: Withdrawal
  - name: Exchange
  - name: Invoices
  - name: Transactions
paths:
  /v2/exchange/calculate:
    post:
      tags:
        - Exchange
      summary: Get an exchange quote
      description: >-
        Get a fixed exchange quote for a specific amount, to use with
        [/v2/exchange/fixed](/api-reference/endpoints/exchange-fixed).
      operationId: post-exchange-calculate
      parameters:
        - $ref: '#/components/parameters/XProcessingSignatureHeader'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                sender_currency:
                  type: string
                  description: >-
                    Currency to exchange from. For a list of all available
                    currencies, see [API currency
                    codes](/api-reference/currency-codes).
                receiver_currency:
                  type: string
                  description: >-
                    Currency to exchange to. For a list of all available
                    currencies, see [API currency
                    codes](/api-reference/currency-codes).
                sender_amount:
                  oneOf:
                    - type: string
                    - type: number
                  description: >
                    The amount you want to exchange, in `sender_currency`, as a
                    decimal string (for example, `"100"`) or a number. Include
                    either this parameter or `receiver_amount`, not both.


                    Up to 8 decimal places, or fewer for some currency pairs.
                    The minimum is the `min_amount` of `sender_currency` in
                    [/v2/currencies/rates](/api-reference/endpoints/currencies-rates).
                receiver_amount:
                  oneOf:
                    - type: string
                    - type: number
                  description: >
                    The amount you want to receive, in `receiver_currency`,
                    before the exchange fee, as a decimal string (for example,
                    `"100"`) or a number. Include either this parameter or
                    `sender_amount`, not both.


                    Up to 8 decimal places, or fewer for some currency pairs.
                    The minimum is the `min_amount` of `receiver_currency` in
                    [/v2/currencies/rates](/api-reference/endpoints/currencies-rates),
                    for the pair in the opposite direction.
              required:
                - sender_currency
                - receiver_currency
            examples:
              "Get a quote to convert 100\_USDC to USD":
                value:
                  sender_currency: USDC
                  receiver_currency: USD
                  sender_amount: 100
              "Get a quote to receive 100\_USD for USDC":
                value:
                  sender_currency: USDC
                  receiver_currency: USD
                  receiver_amount: 100
              "Get a quote to convert 0.01\_ETH to USDC":
                value:
                  sender_currency: ETH
                  receiver_currency: USDC
                  sender_amount: '0.01'
        description: ''
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      sender_currency:
                        type: string
                        description: The currency being exchanged from.
                      sender_amount:
                        type: string
                        description: >-
                          The amount exchanged from `sender_currency`: the
                          `sender_amount` from the request, or the amount
                          calculated for the `receiver_amount` you sent. It
                          doesn't include the exchange fee (see `fee_amount`).
                      receiver_currency:
                        type: string
                        description: The currency being exchanged to.
                      receiver_amount:
                        type: string
                        description: >-
                          The amount the exchange gives in `receiver_currency`:
                          the `receiver_amount` from the request, or the amount
                          calculated for the `sender_amount` you sent. It's the
                          amount before the exchange fee: if the fee is charged
                          in `receiver_currency`, the amount added to your
                          balance is `receiver_amount` − `fee_amount`.
                      fee_currency:
                        type: string
                        description: >-
                          The currency the exchange fee is charged in:
                          `sender_currency` or `receiver_currency`.
                      fee_amount:
                        type: string
                        description: >-
                          The exchange fee. If it's charged in
                          `sender_currency`, the amount taken from your balance
                          is `sender_amount` + `fee_amount`; if it's charged in
                          `receiver_currency`, the amount added to your balance
                          is `receiver_amount` − `fee_amount`. `0.00000000` when
                          no fee is charged, for example for an exchange between
                          the same currency on different networks.
                      price:
                        type: string
                        description: "The quoted exchange rate: units of `receiver_currency` for\_1\_unit of `sender_currency`, with\_8\_decimal places, so `sender_amount` × `price` can differ slightly from `receiver_amount`. Pass it to `/v2/exchange/fixed` exactly as returned."
                        example: '0.99978134'
                      ts_fixed:
                        type: integer
                        description: >-
                          Unix timestamp, in seconds, when the quote rate was
                          fixed.
                      ts_release:
                        type: integer
                        description: Unix timestamp, in seconds, when the quote expires.
                      fix_period:
                        type: integer
                        description: >-
                          How long the fixed quote remains valid, in seconds.
                          After this period, request a new quote.
              examples:
                "Get a quote to convert 100\_USDC to USD":
                  value:
                    data:
                      sender_currency: USDC
                      sender_amount: '100.00000000'
                      receiver_currency: USD
                      receiver_amount: '99.97813400'
                      fee_currency: USD
                      fee_amount: '0.99978134'
                      price: '0.99978134'
                      ts_fixed: 1782219422
                      ts_release: 1782219482
                      fix_period: 60
                "Get a quote to receive 100\_USD for USDC":
                  value:
                    data:
                      sender_currency: USDC
                      sender_amount: '100.01959184'
                      receiver_currency: USD
                      receiver_amount: '100.00000000'
                      fee_currency: USD
                      fee_amount: '1.00000000'
                      price: '0.99980412'
                      ts_fixed: 1782219490
                      ts_release: 1782219550
                      fix_period: 60
                "Get a quote to convert 0.01\_ETH to USDC":
                  value:
                    data:
                      sender_currency: ETH
                      sender_amount: '0.01000000'
                      receiver_currency: USDC
                      receiver_amount: '24.64107735'
                      fee_currency: USDC
                      fee_amount: '0.02464107'
                      price: '2464.10773508'
                      ts_fixed: 1782219560
                      ts_release: 1782219620
                      fix_period: 60
        '400':
          description: Bad Request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationOrMalformedJson'
              examples:
                Missing sender currency:
                  value:
                    errors:
                      sender_currency: The sender currency field is required.
                Missing fields:
                  value:
                    errors:
                      receiver_currency: The receiver currency field is required.
                      receiver_amount: >-
                        The receiver amount field is required when the sender
                        amount field is not presented.
                Same currency on both sides:
                  value:
                    errors:
                      receiver_currency: >-
                        The receiver currency and sender currency must be
                        different.
                Sender currency doesn't exist:
                  value:
                    errors:
                      sender_currency: The selected sender currency is invalid.
                Receiver currency doesn't exist:
                  value:
                    errors:
                      receiver_currency: The selected receiver currency is invalid.
                Both amounts sent:
                  value:
                    errors:
                      receiver_amount: >-
                        The receiver amount field can not be used when the
                        sender amount field is presented.
                Sender amount not a number:
                  value:
                    errors:
                      sender_amount: The sender amount must be a number.
                Receiver amount not a number:
                  value:
                    errors:
                      receiver_amount: The receiver amount must be a number.
                Sender currency not a string:
                  value:
                    errors:
                      sender_currency: The sender currency must be a string.
                Receiver currency not a string:
                  value:
                    errors:
                      receiver_currency: The receiver currency must be a string.
                Sender amount zero or negative:
                  value:
                    errors:
                      sender_amount: The sender amount must be greater than 0.
                Receiver amount zero or negative:
                  value:
                    errors:
                      receiver_amount: The receiver amount must be greater than 0.
                Sender amount below the minimum:
                  value:
                    errors:
                      sender_amount: The sender_amount must be at least <amount> <currency>
                Receiver amount below the minimum:
                  value:
                    errors:
                      receiver_amount: The receiver_amount must be at least <amount> <currency>
                Sender amount above the maximum:
                  value:
                    errors:
                      sender_amount: >-
                        The sender_amount may not be greater than <amount>
                        <currency>
                Receiver amount above the maximum:
                  value:
                    errors:
                      receiver_amount: >-
                        The receiver_amount may not be greater than <amount>
                        <currency>
                Sender amount with too many decimal places:
                  value:
                    errors:
                      sender_amount: We can process only <decimals> decimal places
                Receiver amount with too many decimal places:
                  value:
                    errors:
                      receiver_amount: We can process only <decimals> decimal places
                Pair not supported or currency not enabled:
                  value:
                    errors:
                      sender_amount: Exchange is unavailable for given currencies
                Exchange unavailable for the amount:
                  value:
                    errors:
                      sender_amount: >-
                        Unable to exchange the requested amount at the moment.
                        Specify a smaller amount or try again later.
                Exchange unavailable for the amount to receive:
                  value:
                    errors:
                      receiver_amount: >-
                        Unable to exchange the requested amount at the moment.
                        Specify a smaller amount or try again later.
                Malformed JSON:
                  value:
                    error: Bad content format
                    code: bad_content_format
        '403':
          $ref: '#/components/responses/HeaderAuthorization'
        '422':
          $ref: '#/components/responses/InternalError'
        '429':
          $ref: '#/components/responses/TooManyRequests'
components:
  parameters:
    XProcessingSignatureHeader:
      name: X-Processing-Signature
      in: header
      required: true
      description: >-
        Hex-encoded HMAC-SHA512 signature of the request body, [generated using
        your secret key](/api-reference/authentication).
      schema:
        type: string
  schemas:
    ValidationOrMalformedJson:
      oneOf:
        - type: object
          title: ValidationError
          description: One or more request parameters failed validation.
          properties:
            errors:
              type: object
              description: >
                A map of request field names to a human-readable validation
                error message for that field. The exact set of possible keys and
                messages is endpoint-specific — see [API
                errors](/api-reference/errors#errors-by-endpoint) for the full
                reference.
              additionalProperties:
                type: string
                description: Human-readable validation error message for this field.
        - type: object
          title: MalformedJson
          description: >-
            The request body is not valid JSON or the Content-Type header is not
            set to `application/json`.
          properties:
            error:
              type: string
            code:
              type: string
  responses:
    HeaderAuthorization:
      description: |
        Forbidden
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                description: Human-readable error message.
              code:
                type: string
                description: Error code.
            description: >-
              Invalid or missing headers, or the API key does not have access to
              the endpoint. Refer to
              [Errors](/api-reference/errors#general-errors) for troubleshooting
              steps.
          examples:
            Bad signature header:
              value:
                error: Bad signature header
                code: bad_header_signature
            API key does not have the required ability:
              value:
                error: The API key does not have access to this endpoint.
                code: api_key_ability_required
            No signature header:
              value:
                error: No signature header
                code: required_header_signature
            No key header:
              value:
                error: No key header
                code: required_header_key
    InternalError:
      description: >
        Unprocessable entity. An internal error occurred during processing. The
        request was understood but could not be completed.


        The `errors` field is an array of error messages. The `error_code` is
        always the string `"internal_error"`.
      content:
        application/json:
          schema:
            type: object
            required:
              - errors
              - error_code
            properties:
              errors:
                type: array
                description: Array of error messages
                items:
                  type: string
              error_code:
                type: string
                description: Error code identifier
          examples:
            Internal error:
              value:
                errors:
                  - Internal error
                error_code: internal_error
            Something went wrong:
              value:
                errors:
                  - Something went wrong. Please try later.
                error_code: internal_error
            Unhandled exception:
              value:
                errors:
                  - Something went wrong.
                error_code: internal_error
    TooManyRequests:
      description: >
        Too Many Requests


        You sent too many requests in a short time. The limit is counted per API
        key, so requests from all your servers that use the same key count
        together. Wait before you send the request again, increasing the delay
        if you get `429` again, and handle this error by its status code, not by
        a particular response body. See [Too many
        requests](/api-reference/errors#too-many-requests-429-too-many-requests).
  securitySchemes:
    xProcessingKey:
      type: apiKey
      description: Your [API key](/merchant-administration/generate-and-activate-api-keys).
      in: header
      name: X-Processing-Key

````

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