About this Project
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.
Important Information
- 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.
REST Countries
You can access API through https://restcountries.com/v3.1/all
Contributing
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.
Donations
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
Fields
You can check the FIELDS.md file to get a description for each field (thanks to @ePascalC!).
API Endpoints
Using this Project
Endpoints
Below are described the REST endpoints available that you can use to search for countries
Latest added Enpoint
Independent
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
All
https://restcountries.com/v3.1/all
Name
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
Full Name
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
Code
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
List of codes
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
Currency
Search by currency code or name
https://restcountries.com/v3.1/currency/{currency}
https://restcountries.com/v3.1/currency/cop
Demonym
Now you can search by how a citizen is called.
https://restcountries.com/v3.1/demonym/{demonym}
https://restcountries.com/v3.1/demonym/peruvian
Language
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
Capital city
Search by capital city
https://restcountries.com/v3.1/capital/{capital}
https://restcountries.com/v3.1/capital/tallinn
Calling code
In version 3, calling codes are in the idd object. There is no implementation to search by calling codes in V3.
Region
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
Subregions
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
Translation
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
Filter Response
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