Skip to main content

FX API

Introduction​

This API allows merchants to consume currency conversion services, providing both selling and buying rates for various currencies. The rates are refreshed hourly.

Base URL​

The base URL for the FX API is:

Authentication​

API requests must include an Access Token in the header for authentication.

x-access-token: YOUR_ACCESS_TOKEN

You can obtain an access token with your API Keys here:

Method: POST

Request body

{
"consumer_key": "YOUR_CONSUMER_KEY",
"consumer_secret": "YOUR_CONSUMER_SECRET"
}

Response:

{
"access_token":"YOUR_ACCESS_TOKEN",
"expires_in":"ACCESS_TOKEN_TTL"
}

Endpoints​

1. Exchange rates​

GET /v1/fx?base_currency=USD

Base currency can be varied.

Sample Request

curl -X GET -H "x-access-token: YOUR_ACCESS_TOKEN" https://dev.rafikibank.com/v1/fx?base_currency=USD

Response

{
"base_currency": "USD",
"rates": {
"KES": {
"buying": "158.496617",
"selling": "164.509032"
},
"NGN": {
"buying": "908.749572",
"selling": "956.287051"
},
"UGX": {
"buying": "3815.838236",
"selling": "4008.730148"
},
"TZS": {
"buying": "2508.000308",
"selling": "2635.500323"
}
}
}