Skip to content

Countries

The Countries resource provides fake country data with names, codes, capitals, currencies, languages, and geographic information.

MethodEndpointDescription
GET/v1/countriesList all countries
GET/v1/countries/:idGet a specific country
GET/v1/countries/:id/citiesGet country's cities
{
"id": 1,
"name": "United States",
"code": "US",
"slug": "united-states",
"capital": "Washington, D.C.",
"currency": "USD",
"language": "English",
"population": 331002651,
"area": 9833520,
"timezone": "America/New_York",
"flag": "https://example.com/flags/us.png",
"createdAt": "2026-01-15T10:30:00.000Z",
"updatedAt": "2026-01-15T10:30:00.000Z"
}
Field Type Description
id number Unique identifier
name string Country name
code string ISO country code (e.g. US)
slug string URL-friendly unique slug
capital string Capital city name
currency string Currency code (e.g. USD)
language string Primary language
population number Population count
area number Area in square kilometers
timezone string Primary timezone
flag string Flag image URL
createdAt string ISO 8601 timestamp
updatedAt string ISO 8601 timestamp
Terminal window
curl https://api.phantomjson.app/v1/countries
Parameter Type Default Description
page number 1 Page number
limit number 20 Items per page (max: 100)
sort string Sort field and direction
q string Search query
fields string Fields to return
code string Filter by country code
currency string Filter by currency code
language string Filter by language
{
"data": [
{
"id": 1,
"name": "United States",
"code": "US",
"slug": "united-states",
"capital": "Washington, D.C.",
"currency": "USD"
}
],
"meta": {
"total": 50,
"page": 1,
"limit": 20,
"totalPages": 3
}
}
Terminal window
curl https://api.phantomjson.app/v1/countries/1
{
"data": {
"id": 1,
"name": "United States",
"code": "US",
"slug": "united-states",
"capital": "Washington, D.C.",
"currency": "USD",
"language": "English",
"population": 331002651,
"area": 9833520,
"timezone": "America/New_York"
}
}
Terminal window
curl https://api.phantomjson.app/v1/countries/1/cities
{
"data": [
{
"id": 1,
"countryId": 1,
"name": "New York",
"slug": "new-york",
"population": 8336817
}
],
"meta": {
"total": 10,
"page": 1,
"limit": 20,
"totalPages": 1
}
}
Terminal window
curl "https://api.phantomjson.app/v1/countries?q=united"
Terminal window
curl "https://api.phantomjson.app/v1/countries?code=US"
Terminal window
curl "https://api.phantomjson.app/v1/countries?currency=EUR"
Terminal window
curl "https://api.phantomjson.app/v1/countries?language=Spanish"
Terminal window
# Smallest first
curl "https://api.phantomjson.app/v1/countries?sort=population:asc"
# Largest first
curl "https://api.phantomjson.app/v1/countries?sort=population:desc"
Terminal window
curl "https://api.phantomjson.app/v1/countries?fields=id,name,capital,currency"
  • Cities — Each country has many cities (access via /v1/countries/:id/cities)
  • Airlines — Each country may have many airlines