Airtime
Search…
Fetch FX Rate by operator ID
The /operators/fx-rate endpoint allows you to fetch an operator's foreign exchange rate for international top-ups
post
https://topups.reloadly.com
/operators/fx-rate
FX Rate

Request samples

cURL
C#
Golang
Java
Node JS
PHP
Python
1
curl --location --request POST 'https://topups.reloadly.com/operators/fx-rate' \
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":"341",
7
"amount":"10"
8
}'
Copied!
1
using System;
2
using System.Threading.Tasks;
3
using System.Net.Http;
4
using System.Text;
5
using Newtonsoft.Json;
6
7
namespace WebAPIClient {
8
class Program {
9
10
static async Task Main(string[] args) {
11
await ApiCall();
12
}
13
14
private static async Task ApiCall() {
15
var json = JsonConvert.SerializeObject(new {
16
operator_id = "1",
17
amount = "1"
18
});
19
20
var message = new HttpRequestMessage(HttpMethod.Post, "https://topups.reloadly.com/operators/fx-rate");
21
22
message.Headers.TryAddWithoutValidation("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE");
23
message.Headers.TryAddWithoutValidation("Accept", "application/com.reloadly.topups-v1+json");
24
message.Headers.TryAddWithoutValidation("Content-Type", "application/json");
25
26
using
27
var httpClient = new HttpClient();
28
var response = await httpClient.SendAsync(message);
29
var responseBody = await response.Content.ReadAsStringAsync();
30
var result = JsonConvert.DeserializeObject < dynamic > (responseBody);
31
32
Console.WriteLine(result);
33
}
34
35
}
36
}
Copied!
1
package main
2
3
import (
4
"fmt"
5
"strings"
6
"net/http"
7
"io/ioutil"
8
)
9
10
func main() {
11
12
url := "https://topups.reloadly.com/operators/fx-rate"
13
method := "POST"
14
15
payload := strings.NewReader(`{
16
"operatorId":"341",
17
"amount":"10"
18
}`)
19
20
client := &http.Client {
21
}
22
req, err := http.NewRequest(method, url, payload)
23
24
if err != nil {
25
fmt.Println(err)
26
return
27
}
28
req.Header.Add("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE")
29
req.Header.Add("Accept", "application/com.reloadly.topups-v1+json")
30
req.Header.Add("Content-Type", "application/json")
31
32
res, err := client.Do(req)
33
if err != nil {
34
fmt.Println(err)
35
return
36
}
37
defer res.Body.Close()
38
39
body, err := ioutil.ReadAll(res.Body)
40
if err != nil {
41
fmt.Println(err)
42
return
43
}
44
fmt.Println(string(body))
45
}
Copied!
1
OkHttpClient client = new OkHttpClient().newBuilder()
2
.build();
3
MediaType mediaType = MediaType.parse("application/json");
4
RequestBody body = RequestBody.create(mediaType, "{\n\t\"operatorId\":\"341\",\n\t\"amount\":\"10\"\n}");
5
Request request = new Request.Builder()
6
.url("https://topups.reloadly.com/operators/fx-rate")
7
.method("POST", body)
8
.addHeader("Authorization", "Bearer YOUR_ACCESS_TOKEN_HERE")
9
.addHeader("Accept", "application/com.reloadly.topups-v1+json")
10
.addHeader("Content-Type", "application/json")
11
.build();
12
Response response = client.newCall(request).execute();
Copied!
1
var request = require('request');
2
var options = {
3
'method': 'POST',
4
'url': 'https://topups.reloadly.com/operators/fx-rate',
5
'headers': {
6
'Authorization': 'Bearer YOUR_ACCESS_TOKEN_HERE',
7
'Accept': 'application/com.reloadly.topups-v1+json',
8
'Content-Type': 'application/json'
9
},
10
body: JSON.stringify({
11
"operatorId": "341",
12
"amount": "10"
13
})
14
15
};
16
request(options, function (error, response) {
17
if (error) throw new Error(error);
18
console.log(response.body);
19
});
Copied!
1
<?php
2
3
$curl = curl_init();
4
5
curl_setopt_array($curl, array(
6
CURLOPT_URL => 'https://topups.reloadly.com/operators/fx-rate',
7
CURLOPT_RETURNTRANSFER => true,
8
CURLOPT_ENCODING => '',
9
CURLOPT_MAXREDIRS => 10,
10
CURLOPT_TIMEOUT => 0,
11
CURLOPT_FOLLOWLOCATION => true,
12
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
13
CURLOPT_CUSTOMREQUEST => 'POST',
14
CURLOPT_POSTFIELDS =>'{
15
"operatorId":"341",
16
"amount":"10"
17
}',
18
CURLOPT_HTTPHEADER => array(
19
'Authorization: Bearer YOUR_ACCESS_TOKEN_HERE',
20
'Accept: application/com.reloadly.topups-v1+json',
21
'Content-Type: application/json'
22
),
23
));
24
25
$response = curl_exec($curl);
26
27
curl_close($curl);
28
echo $response;
Copied!
1
import requests
2
import json
3
4
url = "https://topups.reloadly.com/operators/fx-rate"
5
6
payload = json.dumps({
7
"operatorId": "341",
8
"amount": "10"
9
})
10
headers = {
11
'Authorization': 'Bearer YOUR_ACCESS_TOKEN_HERE',
12
'Accept': 'application/com.reloadly.topups-v1+json',
13
'Content-Type': 'application/json'
14
}
15
16
response = requests.request("POST", url, headers=headers, data=payload)
17
18
print(response.text)
Copied!

Response parameters

Parameter
Type
Description
id
integer
Indicates the ID of the operator
name
string
Indicates the operator's name
fxRate
integer
Indicates the exchange rate of the operator's currency to your account's currency. For example, if your account is in Indian Rupees( INR ) and you are making a top-up to a number registered to Natcom Haiti, the exchange rate returned will be 1.16 ( 1 INR = 1.16 HTG )
currencyCode
string
Indicates the currency symbol of the country where the operator is registered
Export as PDF
Copy link