Countries

Overview

By default, our API endpoints return the complete data object for a country, ensuring you have immediate access to every available field. However, for production applications, we strongly recommend fetching only the specific fields you need.

While convenient, retrieving the full object when you only require specific data points (e.g., just currencySymbol and tld) creates unnecessary overhead.

Why granular requests matter:

  • Network Latency: Smaller payloads travel faster, especially on mobile networks.
  • Bandwidth Usage: Reducing the response body size lowers data consumption for both your server and your user.
  • Serialization Costs: Massive JSON objects take longer for the API to generate and longer for your client to parse.
Always explicitly request only the properties you intend to use. This simple optimization ensures the smallest possible response body and the fastest possible reaction time for your application.

GET /v1/geo/countries/all

Request

Query Parameters: The fields parameter is optional. It accepts a comma-separated list of valid property names to include in the response object.

curl -X GET "https://api.geoapi.net/v1/geo/countries/all?fields=iso2,population,currencyCode,isEu" \
     -H "X-API-HOST: your_api_host" \
     -H "X-API-KEY: your_api_key"

Response

200 OK

The API returns a lightweight array containing only the requested data points:

response example
[
  {
    "iso2": "AF",
    "population": 40218234,
    "currencyCode": "AFN",
    "isEu": false
  },
  {
    "iso2": "AL",
    "population": 2837743,
    "currencyCode": "ALL",
    "isEu": false
  }
  ...
]
If the fields parameter is omitted, the API defaults to returning all available details for every country. This results in a massive payload size and is not recommended for production environments unless you specifically require the full dataset.

GET /v1/geo/countries/{countryCode}

Request

Path Parameters: The countryCode is a mandatory parameter. It accepts either the ISO 3166-1 alpha-2 (2-letter) or alpha-3 (3-letter) code to identify the resource.

Query Parameters: The fields parameter is optional. It accepts a comma-separated list of valid property names to include in the response object.

curl -X GET "https://api.geoapi.net/v1/geo/countries/AL?fields=countryName,population,currencyCode,isEu" \
     -H "X-API-HOST: your_api_host" \
     -H "X-API-KEY: your_api_key"

Response

200 OK

The API will return a single JSON object containing strictly the keys requested in your query.

response example
{
  "countryName": "Albania",
  "population": 2837743,
  "currencyCode": "ALL",
  "isEu": false
}
404 Not Found

Error occurs if you pass non existing country countryCode, or not 2-3 letters long.

response example
{
  "status": 404,
  "message": "Not Found"
}
While the payload for a single country is naturally smaller than a full list, omitting the fields parameter will return every available data point for that country (including complex objects like geo-coordinates, full translation lists, and regex patterns). We strongly recommend requesting only the specific properties you need to ensure the fastest possible response time.

Query Parameters

PropertyTypeDescriptionExample (Switzerland)
iso2StringISO 3166-1 alpha-2 code."CH"
iso3StringISO 3166-1 alpha-3 code."CHE"
isoNumericStringISO 3166-1 numeric code."756"
nameStringCommon country name in English."Switzerland"
nativeNameStringCommon country name in the local language."Schweiz"
officialNameStringOfficial country name in English."Swiss Confederation"
officialNativeNameStringOfficial country name in the local language."Schweizerische Eidgenossenschaft"
capitalStringPrimary capital city."Bern"
currencyCodeStringISO 4217 currency code."CHF"
currencyNameStringFull name of the local currency."Swiss Franc"
currencySymbolStringSymbol used for pricing."CHF"
postalCodeFormatStringThe format string (# for digits)."####"
postalCodeRegexStringRegex string for validation."^\d{4}$"
callingCodesString[]International calling prefixes.["+41"]
tldStringTop-level domain.".ch"
roadSpeedUnitStringUnit used for speed limits."km/h"
roadHeightUnitStringUnit used for height clearances."m"
roadDistanceUnitStringUnit used for road distances."km"
drivingSideStringSide of the road used for driving."right"
isEuBooleanPart of the European Union?false
isUnBooleanMember of the United Nations?true
flagEmojiStringUnicode flag emoji."🇨🇭"
flagVectorStringURL path to SVG flag image."https://flagcdn.com/ch.svg"
continentString2-letter continent code."EU"
regionStringGeographic region."Europe"
subregionStringGeographic subregion."Western Europe"
areaSqKmNumberTotal area in square kilometers.41285
areaSqMiNumberTotal area in square miles.15940
populationNumberEstimated total population.8715494
latitudeNumberLatitude coordinate.46.818
longitudeNumberLongitude coordinate.8.227
bboxNumberBounding box.[8.227, 8.227, 8.227, 8.227]
languagesString[]Official language codes.["de", "fr", "it", "rm"]
alternateNamesObject[]Name translated into official languages.[{ "localeCode": "de", "localeName": "German", "name": "Schweiz" }, { "localeCode": "fr", "localeName": "French", "name": "Suisse" }, { "localeCode": "it", "localeName": "Italian", "name": "Svizzera" }, { "localeCode": "rm", "localeName": "Romansh", "name": "Svizra" }]
neighbouringCountriesString[]ISO2 codes of land Neighbours.["AT", "DE", "FR", "IT", "LI"]

© 2026 GeoAPI