Fetch Purchase Quotes

Use the Purchase Quotes API to calculate how much cryptocurrency or fiat currency a customer is expected to receive before creating a Ramp transaction.

Quotes are calculated using the live exchange rate available when the request is made. The returned amount is an estimate and may change before the transaction is initiated or refreshed.

The quote endpoint does not create a transaction, reserve an exchange rate, or move funds.

How fees are applied

The API returns the applicable fee in data.fee.

This fee has already been deducted from data.to_amount. Therefore, data.to_amount is the final estimated amount the customer will receive.

Do not subtract data.fee from data.to_amount again.

Authentication

Include your private API key in the x-private-key request header.

x-private-key: YOUR_PRIVATE_KEY

Keep your private key secure. Do not expose it in frontend applications or client-side code.

Base URL

https://ramp-be.quidax.io/api/v1/merchants

Buy Quotes

Use a Buy Quote to calculate how much cryptocurrency a customer is expected to receive for a specified fiat amount.

For example, you can calculate how much USDT a customer will receive when they spend NGN 20,000.

Endpoint

GET /purchase_quotes/buy

Request example

curl --request GET \
  --url "https://ramp-be.quidax.io/api/v1/merchants/purchase_quotes/buy?currency=ngn&token=usdt&fiat_amount=20000&token_network=celo" \
  --header "accept: application/json" \
  --header "x-private-key: YOUR_PRIVATE_KEY"

Query parameters

FieldTypeRequiredDescription
currencystringYesThe fiat currency the customer will pay. Supported values include ngn and ghs.
tokenstringYesThe cryptocurrency the customer will receive. Supported values include usdt, usdc, xaut, and usat.
fiat_amountstringYesThe amount of fiat currency the customer wants to spend. For example, 20000 means NGN 20,000 when currency is ngn.
token_networkstringYesThe blockchain network used to deliver the cryptocurrency. Supported values include celo, polygon, erc20, bep20, lsk, solana, base, ton, and trc20.

The selected network must support the requested token.

Successful response

{
  "status": "ok",
  "message": "Crypto currency amount retrieved",
  "data": {
    "fee": "0.5",
    "to_amount": "11.93"
  }
}

Response fields

FieldTypeDescription
statusstringIndicates whether the request was successful. A successful request returns ok.
messagestringA description of the result returned by the API.
dataobjectContains the calculated quote.
data.feestringThe fee applied to the Buy Quote. This fee has already been deducted from data.to_amount.
data.to_amountstringThe final estimated cryptocurrency amount the customer will receive after the fee has been deducted.

In this example, the customer is estimated to receive 11.93 units of the requested token.

The fee shown in data.fee has already been applied. Do not calculate the customer’s expected amount as data.to_amount - data.fee.

Use data.to_amount directly as the estimated cryptocurrency amount to display to the customer.

Buy Quote calculation

The API calculates the quote using:

  • The fiat amount provided
  • The current exchange rate
  • The requested cryptocurrency
  • The selected blockchain network
  • The applicable fee

The result returned in data.to_amount is the estimated amount after the fee has been deducted.

Important considerations

A Buy Quote is informational and does not lock the exchange rate.

The final cryptocurrency amount may change because of market movements or pricing updates before the transaction is initiated or refreshed.

Request a new quote when the customer changes any of the following:

  • Fiat currency
  • Fiat amount
  • Token
  • Blockchain network

Sell Quotes

Use a Sell Quote to calculate how much fiat currency a customer is expected to receive for a specified cryptocurrency amount.

For example, you can calculate how much NGN a customer will receive when they sell 10 USDT.

Endpoint

GET /purchase_quotes/sell

Request example

curl --request GET \
  --url "https://ramp-be.quidax.io/api/v1/merchants/purchase_quotes/sell?token=usdt&currency=ngn&token_amount=10&token_network=celo" \
  --header "accept: application/json" \
  --header "x-private-key: YOUR_PRIVATE_KEY"

Query parameters

FieldTypeRequiredDescription
tokenstringYesThe cryptocurrency the customer wants to sell. For example, usdt.
currencystringYesThe fiat currency the customer wants to receive. For example, ngn.
token_amountstringYesThe amount of cryptocurrency the customer wants to sell. For example, 10 means 10 USDT when token is usdt.
token_networkstringYesThe blockchain network the customer will use to send the cryptocurrency. Supported values include celo, polygon, erc20, bep20, lsk, solana, base, ton, and trc20.

The selected network must support the requested token.

Successful response

{
  "status": "ok",
  "message": "Fiat currency amount retrieved",
  "data": {
    "fee": "50.0",
    "to_amount": "15947.94"
  }
}

Response fields

FieldTypeDescription
statusstringIndicates whether the request was successful. A successful request returns ok.
messagestringA description of the result returned by the API.
dataobjectContains the calculated quote.
data.feestringThe fee applied to the Sell Quote. This fee has already been deducted from data.to_amount.
data.to_amountstringThe final estimated fiat amount the customer will receive after the fee has been deducted.

In this example, the customer is estimated to receive NGN 15,947.94.

The NGN 50.00 fee shown in data.fee has already been deducted from the payout.

Do not subtract the fee again. Use data.to_amount directly as the estimated fiat amount to display to the customer.

Sell Quote calculation

The API calculates the quote using:

  • The cryptocurrency amount provided
  • The current exchange rate
  • The requested fiat currency
  • The selected blockchain network
  • The applicable fee

The result returned in data.to_amount is the estimated fiat payout after the fee has been deducted.

Important considerations

A Sell Quote is informational. It does not create an off-ramp transaction or reserve the exchange rate.

The final fiat amount may change because of market movements, pricing updates, or a refreshed transaction quote.

Request a new quote when the customer changes any of the following:

  • Token
  • Token amount
  • Fiat currency
  • Blockchain network

The customer must send the cryptocurrency through the same blockchain network used for the transaction.


Error responses

The Buy and Sell Quote endpoints can return the following errors.

Invalid currency

This error is returned when the fiat currency is missing, invalid, or unsupported.

{
  "status": "bad_request",
  "message": "Invalid currency",
  "data": null
}

Invalid amount

This error is returned when fiat_amount or token_amount is missing, incorrectly formatted, or invalid.

{
  "status": "bad_request",
  "message": "Invalid amount",
  "data": null
}

Invalid network

This error is returned when the selected blockchain network is invalid or unsupported.

{
  "status": "bad_request",
  "message": "Invalid network",
  "data": null
}

Invalid private key

This error is returned when the x-private-key header is missing or invalid.

{
  "status": "forbidden",
  "message": "Invalid private key",
  "data": null
}

Confirm that you are using the correct private key for the environment and that it is being sent through the x-private-key header.


Recommended Buy integration flow

  1. Collect the fiat currency, fiat amount, token, and blockchain network from the customer.
  2. Request a Buy Quote.
  3. Display data.to_amount as the estimated cryptocurrency amount the customer will receive.
  4. Display data.fee separately when you need to show the fee breakdown.
  5. Do not subtract data.fee from data.to_amount.
  6. Initiate the Buy transaction using the same currency, amount, token, and network.
  7. Use the transaction response, refresh endpoint, requery endpoint, and webhooks as the source of truth for the final amount and transaction status.

Recommended Sell integration flow

  1. Collect the token, token amount, fiat currency, and blockchain network from the customer.
  2. Request a Sell Quote.
  3. Display data.to_amount as the estimated fiat payout.
  4. Display data.fee separately when you need to show the fee breakdown.
  5. Do not subtract data.fee from data.to_amount.
  6. Initiate the Sell transaction using the same currency, amount, token, and network.
  7. Use the transaction response, refresh endpoint, requery endpoint, and webhooks as the source of truth for the final payout and transaction status.

Quote limitations

Quotes are based on live exchange rates and may change.

A quote is not a completed transaction or a guaranteed exchange rate. Request a new quote when the customer changes the amount, currency, token, or network, or when a significant amount of time has passed before the transaction is initiated.

Always treat data.to_amount as the estimated amount the customer will receive. The fee returned in data.fee has already been deducted from this amount.


Did this page help you?