Airtime
Search…
Quickstart

Authorization

The fastest way to get started with the Airtime product is to make a top-up. This section covers how to get started with the Airtime API product. To make a top-up, you will need client credentials which you can get from signing up in the dashboard
On the dashboard, you can get your client credentials by navigating to the Developers > API settings section

Choose your environment

Asides from the live environment, Reloadly provides a sandbox (also called test environment) where you can simulate real-life scenarios and use cases for each API endpoint. If you would like to first work with the test environment, you can check out the virtual sandbox in the DevTools section.

Client Credentials

Parameter
Description
client_id
This is a private identifier for your account
client_secret
This is a private key that should not be shared

Environments

Parameter
Description
Sandbox
Use endpoints in test mode and simulate real-like responses
Live
Work with live credentials to build applications

Get your access token

Once you have your client credentials, the next step is for you to retrieve your access token. Reloadly issues access tokens (also called bearer tokens) that are used to authorize API requests. Make a request to the https://auth.reloadly.com/oauth/token URL to obtain the appropriate access token
cURL
HTTPie
1
curl --location --request POST 'https://auth.reloadly.com/oauth/token' \
2
--header 'Content-Type: application/json' \
3
--data-raw '{
4
"client_id":"YOUR_CLIENT_ID",
5
"client_secret":"YOUR_CLIENT_SECRET",
6
"grant_type":"client_credentials",
7
"audience":"https://topups.reloadly.com"
8
}'
Copied!
1
http https://auth.reloadly.com/oauth/token \
2
client_id=CLIENTID \
3
client_secret=CLIENTSECRET \
4
grant_type=client_credentials \
5
audience='https://topups-sandbox.reloadly.com'
Copied!
Pay attention to the value of the audience parameter: https://topups-sandbox.reloadly.com. This is the corresponding value for the Sandbox environment. When going to production you want to use https://topups.reloadly.com instead
Once successful, you will get response data containing your access token, its privileges, and its lifespan
JSON
1
{
2
"access_token":"eyJraWQiOiIwMDA1YzFmMC0xMjQ3LTRmNmUtYjU2ZC1jM2ZkZDVmMzhhOTIiLCJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9",
3
"scope":"send-topups read-operators read-promotions read-topups-history read-prepaid-balance read-prepaid-commissions",
4
"expires_in":5184000,
5
"token_type":"Bearer"
6
}::Info
Copied!
If you get an response with "errorCode": "INVALID_CREDENTIALS" you're most likely using the wrong set of credentials for the environment from where you want to get a token. Remember: the credentials used for Production are invalid in Sandbox and viceversa.

Make your first top-up

Now you've got your access token, the next step is to make a top-up on a mobile number. Reloadly spans across more than 700 operators in over 140 countries. This ensures you have a lot of options when making your first top-up. To top up a mobile number, you can make a POST request to the /topups endpoint
cURL
HTTPie
1
curl --location --request POST 'https://topups.reloadly.com/topups' \
2
--header 'Authorization: Bearer YOUR_ACCESS_TOKEN_HERE' \
3
--header 'Accept: application/com.reloadly.topups-v1+json' \
4
--header 'Content-Type: application/json' \
5
--data-raw '{
6
"operatorId":"685",
7
"amount":"10",
8
"customIdentifier": "This is example identifier 092",
9
"recipientPhone": {
10
"countryCode": "NG",
11
"number": "08147658721"
12
},
13
"senderPhone": {
14
"countryCode": "CA",
15
"number": "1231231231"
16
}
17
}'
Copied!
1
http 'https://topups.reloadly.com/topups' \
2
'Authorization: Bearer YOUR_ACCESS_TOKEN_HERE' \
3
'Accept: application/com.reloadly.topups-v1+json' \
4
'Content-Type: application/json' \
5
recipientPhone[countryCode]="NG" \
6
recipientPhone[number]="08147658721" \
7
senderPhone[countryCode]="CA" \
8
senderPhone[number]="1231231231"\
9
operatorId=685 \
10
amount=10 \
11
customIdentifier="This is example identifier 092"
Copied!
If this request is successful, you will get a response containing details of your top-up
JSON
1
{
2
"transactionId":2127484,
3
"operatorTransactionId":"2021040116191786605021010",
4
"customIdentifier":null,
5
"recipientPhone":"2348147658720",
6
"recipientEmail":null,
7
"senderPhone":null,
8
"countryCode":"NG",
9
"operatorId":341,
10
"operatorName":"MTN Nigeria",
11
"discount":0,
12
"discountCurrencyCode":"NGN",
13
"requestedAmount":100,
14
"requestedAmountCurrencyCode":"NGN",
15
"deliveredAmount":100,
16
"deliveredAmountCurrencyCode":"NGN",
17
"transactionDate":"2021-04-01 11:19:16",
18
"pinDetail":null,
19
"balanceInfo":{
20
"oldBalance":9790.75,
21
"newBalance":9690.75,
22
"currencyCode":"NGN",
23
"currencyName":"Nigerian Naira",
24
"updatedAt":"2021-04-01 15:19:16"
25
}
26
}
Copied!
You can test these steps out directly on our Postman collection.

Next steps

Great! You have gotten started with Reloadly in the fastest way possible. Feel free to modify the code samples above in order to get more practice with our API. You can also check out the rest of the documentation for a concise understanding of the Airtime product.