Countries
Read country metadata for all 54 African countries.
Endpoints
List Countries
GET /v1/countriesBy default, returns the full list. Pagination is optional.
Query Parameters
| Parameter | Type | Description |
|---|---|---|
paginate | boolean | Set true to paginate results |
page | integer | Page number (>= 1) |
per_page | integer | Items per page (1-100) |
region | string | Region alias (north, south, east, west, central) or exact region |
sort | string | name, area, region (prefix with - for descending) |
Example
curl "https://api.africa-api.com/v1/countries?region=west&sort=-area"Success Response
{
"data": [
{
"id": "sn",
"name": "Senegal",
"official_name": "Republic of Senegal",
"capital": "Dakar",
"region": "West Africa",
"subregion": "Western Africa",
"area_km2": 196722,
"currencies": ["XOF"],
"languages": ["fra"],
"flag": "πΈπ³"
}
],
"meta": {
"total": 16,
"page": 1,
"per_page": 16,
"total_pages": 1
}
}Get Country by Code
GET /v1/countries/{country_code}Path Parameters
| Parameter | Type | Description |
|---|---|---|
country_code | string | ISO 3166-1 alpha-2 code, e.g. ng, ke, za |
Example
curl "https://api.africa-api.com/v1/countries/ng"Success Response
{
"data": {
"id": "ng",
"name": "Nigeria",
"official_name": "Federal Republic of Nigeria",
"capital": "Abuja",
"region": "West Africa",
"subregion": "Western Africa",
"area_km2": 923768,
"iso3": "NGA",
"timezone": "Africa/Lagos",
"calling_code": "+234",
"flag": "π³π¬",
"coordinates": {
"latitude": 9.082,
"longitude": 8.6753
},
"borders": ["bj", "cm", "ne", "td"],
"currencies": [
{ "code": "NGN", "name": "Nigerian naira", "symbol": "β¦" }
],
"languages": [
{ "code": "eng", "name": "English" }
]
}
}Caching
List responses include:
ETagCache-Control: public, max-age=300
Send If-None-Match to receive 304 Not Modified when unchanged.