Skip to main content

Get Exchange Rate

Fetch the exchange rate between the specified currency and HKD.

Endpoint

GET /v1/exchangeRate/get

Request

Header Parameters


ParameterTypeRequiredExampleDescription
AuthorizationstringYesBearer YOUR_ACCESS_TOKENBearer access token used for authentication.

Query Parameters

currency_code required
string
The source currency code.
Must be HKD if target_currency is not HKD.
Example: USD
target_currency required
string
The target currency code.
Must be HKD if currency_code is not HKD.
Example: HKD

Example request

curl -X GET "${API_URL}/v1/exchangeRate/get?currency_code=USD&target_currency=HKD" \
-H "Authorization: Bearer <ACCESS_TOKEN>"

Responses

200 Success

200 Success

Response schema: application/json
data
object
Exchange rate result.
Expand for fields.
currency_code
string
Source currency code, uppercased.
Example: USD
target_currency
string
Target currency code, uppercased.
Example: HKD
rate
string
Exchange rate: 1 unit of currency_code equals this many units of target_currency.
Example: "7.842"

Response sample

{
"data": {
"currency_code": "USD",
"target_currency": "HKD",
"rate": "7.842",
"message": "OK"
}
}

400 Bad Request

400 Bad Request

Response schema: application/json
code
string
Error code returned by the API.
Example: 400000
code_reason
string
Machine-readable error reason.
Example: BAD_REQUEST
message
string
Summary of the error.
Example: Bad Request
error_trace
array
List of validation errors.
field
string
Request field that failed (dot notation).
code
number
Specific error code.
message
string
Human-readable explanation for this error.

Response sample

{
"error": {
"code": "400000",
"code_reason": "BAD_REQUEST",
"message": "Bad Request",
"error_trace": [
{
"field": "currency_code",
"code": 400431,
"message": "One of currency_code or target_currency must be HKD."
}
]
}
}

401 Unauthorized

401 Unauthorized

Response schema: application/json
code
string
Error code (e.g. 401000).
Example: 401000
code_reason
string
Machine-readable reason.
Example: UNAUTHORIZED
message
string
Human-readable message.
Example: Unauthorized

Response sample

{
"error": {
"code": "401000",
"code_reason": "UNAUTHORIZED",
"message": "Unauthorized"
}
}

500 Failure

500 Failure

Response schema: application/json
code
string
Error code returned by the API.
Example: 500999
code_reason
string
Machine-readable error reason.
Example: API_ERROR
message
string
Human-readable message.
Example: Api Error, please contact customer service

Response sample

{
"error": {
"code": "500999",
"code_reason": "API_ERROR",
"message": "Api Error, please contact customer service"
}
}