v4 Preview
RestCountries v4 has been released. This version is currently in preview and should not be used in production yet. Please report any issues or feature requests through the GitLab issues board.

REST Countries

Get information about countries via a RESTful API

Current version: v3.1 — v4 in preview

4M+ Daily Requests
250+ Countries
Open Source Free to Use

Quick Start

Fields filter: You must specify the fields you need (up to 10 fields) when calling the all endpoint, otherwise you'll get a bad request response. See this issue for more information.
# Get all countries (filtered by fields) https://restcountries.com/v3.1/all?fields=name,capital,currencies # Get country by name https://restcountries.com/v3.1/name/peru # Get country by code https://restcountries.com/v3.1/alpha/co # Filter response fields https://restcountries.com/v3.1/{service}?fields={field},{field},{field}

Check the FIELDS.md file for a description of each field.

API Endpoints

All Countries
Retrieve information about all countries. Must specify fields.
/v3.1/all?fields=name,flags
By Name
Search by country name (common or official value)
/v3.1/name/{name}
e.g. /v3.1/name/eesti
Full Name
Search by country's full name (common or official)
/v3.1/name/{name}?fullText=true
e.g. /v3.1/name/aruba?fullText=true
By Code
Search by cca2, ccn3, cca3 or cioc country code
/v3.1/alpha/{code}
e.g. /v3.1/alpha/co, /v3.1/alpha/col, /v3.1/alpha/170
List of Codes
Search by multiple country codes at once
/v3.1/alpha?codes={code},{code}
e.g. /v3.1/alpha?codes=170,no,est,pe
By Currency
Search by currency code or name
/v3.1/currency/{currency}
e.g. /v3.1/currency/cop
By Language
Search by language code or name
/v3.1/lang/{language}
e.g. /v3.1/lang/spanish
By Capital City
Search by capital city
/v3.1/capital/{capital}
e.g. /v3.1/capital/tallinn
By Region
Filter countries by region
/v3.1/region/{region}
e.g. /v3.1/region/europe
By Subregion
Filter countries by subregion
/v3.1/subregion/{subregion}
e.g. /v3.1/subregion/Northern Europe
By Demonym
Search by how a citizen is called
/v3.1/demonym/{demonym}
e.g. /v3.1/demonym/peruvian
By Translation
Search by any translation name
/v3.1/translation/{translation}
e.g. /v3.1/translation/alemania
Independent
Get all independent (or non-independent) countries
/v3.1/independent?status=true
Combine with fields: ?status=true&fields=languages,capital
Filter Response
Filter the output to include only specified fields
/v3.1/{service}?fields={field},{field}
e.g. /v3.1/all?fields=name,capital,currencies

Contributing & Donations

Any help is always welcome! Just edit the relevant file and create a new Merge Request or you can also donate using Patreon or PayPal.

Requests are growing fast — about 4 million hits each day and 120 GB of bandwidth per day. Please consider making a donation to help cover server costs.

Similar Projects