REST Countries
restcountries.com · Data
Country data API — official names, capitals, currencies, languages, flags, population, timezones, and calling codes for all 250 countries. No API key required.
Authentication
No authentication requiredFree to use with no key needed.
Sample Requests
GET
Get country by name
Get data for Germany.
https://restcountries.com/v3.1/name/germany
Hover any highlighted part to learn what it does
curl -X GET "https://restcountries.com/v3.1/name/germany"
import requests
response = requests.get(
"https://restcountries.com/v3.1/name/germany",
)
print(response.json())const url = 'https://restcountries.com/v3.1/name/germany'; const response = await fetch(url); const data = await response.json(); console.log(data);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://restcountries.com/v3.1/name/germany"
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://restcountries.com/v3.1/name/germany")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://restcountries.com/v3.1/name/germany";
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));
GET
Get countries by region
Get all European countries.
https://restcountries.com/v3.1/region/europe
Hover any highlighted part to learn what it does
curl -X GET "https://restcountries.com/v3.1/region/europe"
import requests
response = requests.get(
"https://restcountries.com/v3.1/region/europe",
)
print(response.json())const url = 'https://restcountries.com/v3.1/region/europe'; const response = await fetch(url); const data = await response.json(); console.log(data);
package main
import (
"fmt"
"io"
"net/http"
)
func main() {
targetURL := "https://restcountries.com/v3.1/region/europe"
req, _ := http.NewRequest("GET", targetURL, nil)
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}require "net/http"
require "json"
uri = URI("https://restcountries.com/v3.1/region/europe")
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == "https"
req = Net::HTTP::Get.new(uri)
res = http.request(req)
puts JSON.parse(res.body)<?php
$url = "https://restcountries.com/v3.1/region/europe";
$opts = ["http" => [
"method" => "GET",
]];
$ctx = stream_context_create($opts);
$res = file_get_contents($url, false, $ctx);
print_r(json_decode($res, true));Postman Setup Guide
- No API key needed
- Try GET https://restcountries.com/v3.1/name/japan
- By region: GET /v3.1/region/asia
- By currency: GET /v3.1/currency/eur
- Add ?fields=name,capital,population to get only specific fields
What can you build with REST Countries?
REST Countries is a Data API. Developers commonly use data APIs for:
- enriching your app with third-party datasets
- building data pipelines and ETL workflows
- querying and searching large datasets
- powering research, analysis, and reporting tools
- syncing reference data into your own systems
No authentication required. This API is open — no signup or key needed. Ideal for quick prototypes and public-facing features. REST Countries is free to use, making it a low-risk choice to experiment with.
New to APIs? Read our beginner's guide