Get unlimited access and stop wasting time with maintaining third party libraries. Country API provides you with an extensive and reliable Country Data REST API.
Get a free API key in minutes and try it for yourself.
Our Rest API features all the functions to implement and utilise data for your use case.
We believe that developers should focus on their code and therefore provide them tools that are easy to integrate and well maintained.
var settings = {
"url": "https://countryapi.io/api/all",
"method": "GET",
"timeout": 0,
"headers": {
"Authorization": "Bearer YOUR-APIKEY"
},
};
$.ajax(settings).done(function (response) {
console.log(response);
});
import requests
import requests
url = "https://countryapi.io/api/all"
payload={}
headers = {
'Authorization': 'YOUR-APIKEY',
}
response = requests.request("GET", url, headers=headers, data=payload)
print(response.text)
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://countryapi.io/api/all',
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
'Authorization: Bearer YOUR-APIKEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
require "uri"
require "uri"
require "net/http"
url = URI("https://countryapi.io/api/all")
http = Net::HTTP.new(url.host, url.port);
request = Net::HTTP::Get.new(url)
request["Authorization"] = "YOUR-APIKEY"
response = http.request(request)
puts response.read_body
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
Request request = new Request.Builder()
.url("https://countryapi.io/api/all")
.method("GET", null)
.addHeader("Authorization", "YOUR-APIKEY")
.build();
Response response = client.newCall(request).execute();
package main
import (
"fmt"
"net/http"
"io/ioutil"
)
func main() {
url := "https://countryapi.io/api/all"
method := "GET"
client := &http.Client {
}
req, err := http.NewRequest(method, url, nil)
if err != nil {
fmt.Println(err)
return
}
req.Header.Add("Authorization", "YOUR-APIKEY")
res, err := client.Do(req)
if err != nil {
fmt.Println(err)
return
}
defer res.Body.Close()
body, err := ioutil.ReadAll(res.Body)
if err != nil {
fmt.Println(err)
return
}
fmt.Println(string(body))
}
}
curl "https://countryapi.io/api/all?apikey=YOUR-APIKEY"