Exchange Rates API Reference

Use the Exchange Rates API to fetch a real-time exchange rate quote and equivalent amount for a supported currency pair.

All exchange rate requests require a secret key in the Authorization header.


Create Exchange Rate API

API Details

FieldValue
ActionCreate Exchange Rate
MethodPOST
Path/v1/exchange-rates
Auth RequirementSecret key

Business Summary

This endpoint returns the current exchange rate for a currency pair and the equivalent quote amount for the amount supplied.

You can use this API to:

  • Show your customers or internal team an estimated equivalent amount.
  • Preview rates across fiat and crypto currencies supported by Basqet.

Request Parameters

Request Headers

NameTypeRequiredDescription
AuthorizationstringYesBearer token in the form Bearer sec_..., using your secret key.
Content-TypestringYesMust be application/json.
Idempotency-KeystringNoOptional. Reusing the same key within the quote window replays the same response for your account and environment.

Body Parameters

NameTypeRequiredDefaultAllowed ValuesDescription
base_currencystringYes-2-10 character currency slugCurrency slug for the amount you are converting from.
quote_currencystringYes-2-10 character currency slugCurrency slug for the amount you are converting to.
amountnumber/stringYes-Positive numeric valueAmount denominated in base_currency. Strings are accepted when they contain a valid positive number.

Request Example

cURL

curl --request POST \
  --url https://api.basqet.com/v1/exchange-rates \
  --header 'Authorization: Bearer sec_live_xxxxxxxxxxxxx' \
  --header 'Content-Type: application/json' \
  --header 'Idempotency-Key: rate-preview-1024' \
  --data '{
    "base_currency": "USD",
    "quote_currency": "NGN",
    "amount": "100"
  }'

Response Schema

FieldTypeNullableDescription
statusstringNoResponse status. Always success for 2xx responses.
dataobjectNoContainer for the exchange rate quote details.
data.rate_idstringNoUnique exchange rate quote identifier, prefixed with rate_.
data.base_currencystringNoCurrency slug for the source amount.
data.quote_currencystringNoCurrency slug for the equivalent amount.
data.ratenumberNoExchange rate used to calculate quote_amount.
data.base_amountnumberNoAmount submitted in the request.
data.quote_amountnumberNoEquivalent amount in quote_currency.
data.expires_atstringNoISO 8601 timestamp when this rate quote expires.
data.expiry_in_secondsnumberNoNumber of seconds the rate quote is valid for. Currently 30.
data.created_atstringNoISO 8601 timestamp when the rate quote was created.

Sample Response

{
  "status": "success",
  "data": {
    "rate_id": "rate_p8Mz6BnL3rQx2Va",
    "base_currency": "USD",
    "quote_currency": "NGN",
    "rate": 1500,
    "base_amount": 100,
    "quote_amount": 150000,
    "expires_at": "2026-05-15T12:05:30.000Z",
    "expiry_in_seconds": 30,
    "created_at": "2026-05-15T12:05:00.000Z"
  }
}

Same-Currency Example

When the currency pair is the same, Basqet returns a direct 1:1 quote.

{
  "status": "success",
  "data": {
    "rate_id": "rate_V2k8Qp9Lm7Yc4Na",
    "base_currency": "USDT",
    "quote_currency": "USDT",
    "rate": 1,
    "base_amount": 25,
    "quote_amount": 25,
    "expires_at": "2026-05-15T12:05:30.000Z",
    "expiry_in_seconds": 30,
    "created_at": "2026-05-15T12:05:00.000Z"
  }
}

Error Reference

HTTP CodeMessageResolution
400INVALID_REQUESTEnsure base_currency, quote_currency, and amount are present. amount must be a valid positive number.
400CURRENCY_PAIR_UNSUPPORTEDThe currency does not exist on Basqet or the pair cannot currently be quoted. Try a supported pair or contact Basqet support.
401No key providedSend your secret key in the Authorization header.
403Invalid KeyEnsure you are using a valid secret key beginning with sec_.
409Request already processingA request with the same Idempotency-Key is already being processed. Wait and retry with the same key.
502INTERNAL_ERRORBasqet could not fetch the rate from an upstream rate source. Retry shortly.
500INTERNAL_ERRORAn unexpected error occurred while generating the exchange rate. Retry or contact Basqet support.

Validation Error Shape

When request validation fails, Basqet returns field-level errors:

{
  "message": "INVALID_REQUEST",
  "description": "Missing or invalid fields",
  "errors": {
    "amount": {
      "message": "amount must be a valid positive number"
    }
  }
}

Notes

  • Public keys are not accepted for exchange rate requests.
  • Rate quotes are short-lived and should be treated as previews, not permanent pricing.
  • Successful responses are wrapped in a status and data object.
  • Use quote_amount = base_amount * rate as the mental model for displayed conversions.
  • Use the Wallet Conversions API when you need to swap between currencies.
  • Use an Idempotency-Key for retry-safe rate preview requests when your client may retry automatically.