This project is inspired on restcountries.eu by Fayder Florez. Although the original project has now moved to a subscription base API, this project is still Open Source and Free to use.
- The structure of V2 has been reverted to its original form from the Original Project to maintain compatibility.
- Only the latest version will receive updates and improvements.
You can access API through https://restcountries.com/v3.1/all
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.
This are getting out of control. As I stated here, the server is not going to hold much longer. I'm getting about 4 million hits each day and that means CPU ussage (99%) and also bandwidth consumption (120 GB per day!) so costs have obviously increased. Please, consider making a donation on Patreon or PayPal. This will help me pay the server's bills
You can check the FIELDS.md file to get a description for each field (thanks to @ePascalC!).
Below are described the REST endpoints available that you can use to search for countries
Now you can get all independent (or not independent) countries by calling this endpoint:
https://restcountries.com/v3.1/independent?status=true
If you don't specify the status, true will be taken as default. You can mix it with the fields
filter like this:
https://restcountries.com/v3.1/independent?status=true&fields=languages,capital
https://restcountries.com/v3.1/all
Search by country name. If you want to get an exact match, use the next endpoint. It can be the common or official value
https://restcountries.com/v3.1/name/{name}
https://restcountries.com/v3.1/name/eesti
https://restcountries.com/v3.1/name/deutschland
Search by country's full name. It can be the common or official value
https://restcountries.com/v3.1/name/{name}?fullText=true
https://restcountries.com/v3.1/name/aruba?fullText=true
Search by cca2, ccn3, cca3 or cioc country code (yes, any!)
https://restcountries.com/v3.1/alpha/{code}
https://restcountries.com/v3.1/alpha/co
https://restcountries.com/v3.1/alpha/col
https://restcountries.com/v3.1/alpha/170
Search by cca2, ccn3, cca3 or cioc country code (yes, any!)
https://restcountries.com/v3.1/alpha?codes={code},{code},{code}
https://restcountries.com/v3.1/alpha?codes=170,no,est,pe
Search by currency code or name
https://restcountries.com/v3.1/currency/{currency}
https://restcountries.com/v3.1/currency/cop
Now you can search by how a citizen is called.
https://restcountries.com/v3.1/demonym/{demonym}
https://restcountries.com/v3.1/demonym/peruvian
Search by language code or name
https://restcountries.com/v3.1/lang/{currency}
https://restcountries.com/v3.1/lang/cop
https://restcountries.com/v3.1/lang/spanish
Search by capital city
https://restcountries.com/v3.1/capital/{capital}
https://restcountries.com/v3.1/capital/tallinn
In version 3, calling codes are in the idd object. There is no implementation to search by calling codes in V3.
Search by region (replace X with the version you want to use)
https://restcountries.com/v3.1/region/{region}
https://restcountries.com/v3.1/region/europe
You can search by subregions (replace X with the version you want to use)
https://restcountries.com/v3.1/subregion/{subregion}
https://restcountries.com/v3.1/subregion/Northern Europe
You can search by any translation name
https://restcountries.com/v3.1/translation/{translation}
https://restcountries.com/v3.1/translation/germany
https://restcountries.com/v3.1/translation/alemania
https://restcountries.com/v3.1/translation/Saksamaa
You can filter the output of your request to include only the specified fields.
https://restcountries.com/v3.1/{service}?fields={field},{field},{field}
https://restcountries.com/v3.1/all?fields=name,capital,currencies