List all Countries
Use this endpoint to effortlessly retrieve a comprehensive list of countries, providing essential data such as unique identifiers and country names.
Optional query param
-
isPaginate
- boolean
-
Return you the paginated result
-
limit
- integer
-
Limit the countries returned
-
page
- integer
-
Return the contents of that page after pagination
Request
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => '/countries',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => ['X-API-KEY' => 'your-api-key'],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
return "cURL Error #:" . $err;
} else {
$data = json_decode($response);
}
const axios = require("axios");
const options = {
method: 'GET',
url: '/countries',
headers: {
'X-API-KEY': 'your-api-key'
},
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("/countries"),
Headers =
{
{ "X-API-KEY", "your-api-key" }
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("/countries")
.addHeader("X-API-KEY", "your-api-key")
.build();
Response response = client.newCall(request).execute();
Retrive a Country
Retrieve detailed information about a country using its ISO2 code. This endpoint is useful for obtaining specific country data based on the ISO2 standard.
Required parameter
-
ciso2
- string
-
Country iso2 string to retrive a country.
Request
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => '/countries/IN',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => ['X-API-KEY' => 'your-api-key'],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
return "cURL Error #:" . $err;
} else {
$data = json_decode($response);
}
const axios = require("axios");
const options = {
method: 'GET',
url: '/countries/IN',
headers: {
'X-API-KEY': 'your-api-key'
},
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("/countries/IN"),
Headers =
{
{ "X-API-KEY", "your-api-key" }
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
.url("/countries/IN")
.addHeader("X-API-KEY", "your-api-key")
.build();
Response response = client.newCall(request).execute();
Autocomplete country
This endpoint allows you to get all the countries which is like the name you provide, it is useful for the searching of the country in your application.
Required parameter
-
countryName
- string
-
Any Country iso2, iso3, full name can search the country.
Optional query param
-
isPaginate
- boolean
-
Return you the paginated result
-
limit
- integer
-
Limit the countries returned
-
page
- integer
-
Return the contents of that page after pagination
Request
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => '/countries/autoComplete',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_HTTPHEADER => ['X-API-KEY' => 'your-api-key'],
CURLOPT_POSTFIELDS => "countryName='your-search-string'"
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
return "cURL Error #:" . $err;
} else {
$data = json_decode($response);
}
const axios = require("axios");
const encodedParams = new URLSearchParams();
encodedParams.append("countryName", "your-search-string");
const options = {
method: 'POST',
url: '/countries/autoComplete',
headers: {
'X-API-KEY': 'your-api-key'
},
data: encodedParams
};
axios.request(options).then(function (response) {
console.log(response.data);
}).catch(function (error) {
console.error(error);
});
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("/countries/autoComplete"),
Headers =
{
{ "X-API-KEY", "your-api-key" }
},
Content = new FormUrlEncodedContent(new Dictionary
{
{"countryName", "your-search-string"}
}),
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
OkHttpClient client = new OkHttpClient();
RequestBody body = new FormBody.Builder()
.add("countryName", "your-search-string")
.build();
Request request = new Request.Builder()
.url("/countries/autoComplete")
.post(body)
.addHeader("X-API-KEY", "your-api-key")
.build();
Response response = client.newCall(request).execute();