Skip to main content

Get FX Rate

Get the foreign exchange rate (two-way bid/ask) for the requesting Merchant.

The API supports three lookup modes:

  • One pair — get the rate of a single currency pair.
  • Several pairs — get the rates of a specific list of pairs.
  • All pairs — get the rates of every pair supported for the Merchant.

Each returned rate carries a quote_code, the last_updated time (freshness) and a valid_until time (validity).

Path

  • URL: /cb-core/api/v1/fx/get-rate
  • Method: POST
  • Description: Get the bid/ask rate for one, several or all currency pairs.

Request

Request table

ParamsData TypeRequiredDescription
request_idstring(50)YesUnique code that identifies the request. Suggested format: MerchantCode + BK + YYYYMMDD + UniqueId
request_timestring(19)YesTime the Merchant sends the request. Format: YYYY-MM-DD HH:MM:SS
merchant_codestring(20)YesMerchant code provided by Baokim before integration
typeint(1)YesLookup mode. 1: one pair, 2: several pairs, 3: all supported pairs
currency_pairstring(255)ConditionalThe currency pair(s) to look up.
When type = 1: a single pair, e.g. USD/VND.
When type = 2: a comma-separated list, e.g. USD/VND,CNY/VND.
When type = 3: not required.

Request Example

{
"request_id": "MERCHANT1234BK202606052",
"request_time": "2026-06-05 10:15:30",
"merchant_code": "MERCHANT1234",
"type": 2,
"currency_pair": "USD/VND,CNY/VND"
}

Response

Response Table

ParamsData TypeRequiredDescription
response_codeint(4)YesResult code from Baokim, as per the Error Codes table
response_messagestring(200)YesDescription of the result code
merchant_codestring(20)YesMerchant code provided by Baokim before integration
dataArray of ObjectsYesList of rate quotes, one per requested pair

Data Array Structure (inside data)

ParamsData TypeDescription
currency_pairstring(10)Currency pair in BASE/QUOTE format (e.g. USD/VND)
biddecimal(18,4)Buying rate — the rate at which the customer sells the foreign currency
askdecimal(18,4)Selling rate — the rate at which the customer buys the foreign currency
quote_codestring(50)Quote code for this rate. Used for reconciliation and reserved for rate-lock
last_updatedstring(19)Time the rate was last refreshed. Format: YYYY-MM-DD HH:MM:SS
valid_untilstring(19)Time until which the quote is valid. May be null in the current phase

Response Example

{
"response_code": 200,
"response_message": "Success",
"merchant_code": "MERCHANT1234",
"data": [
{
"currency_pair": "USD/VND",
"bid": 26450.0000,
"ask": 26510.0000,
"quote_code": "FXQ20260605101530USDVND0001",
"last_updated": "2026-06-05 10:15:00",
"valid_until": "2026-06-05 10:16:00"
},
{
"currency_pair": "CNY/VND",
"bid": 3600.5000,
"ask": 3625.7000,
"quote_code": "FXQ20260605101530CNYVND0002",
"last_updated": "2026-06-05 10:15:00",
"valid_until": "2026-06-05 10:16:00"
}
]
}

Error Code

Response CodeResponse Message
200Success
101System Error
110Merchant Code Invalid
120Invalid Signature
404Currency Pair Not Supported
422Validation Error
423FX Rate Not Available
429Too Many Requests