GeoNames country facts
geonames_get_countriesGet GeoNames country facts — ISO alpha-2, alpha-3, and numeric codes, FIPS code, geonameId, capital, population, area in km², continent, languages, currency, postal-code format, and mainland bounding box — for the countries named, a continent, or all 250. The geonameId anchors geonames_get_children (a country's first-level divisions) and geonames_get_hierarchy. The full table is fetched once a day (1 GeoNames credit) and cached.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Maximum entries to return, 1 to 250. Default 50. | |
| offset | No | Entries to skip before the first one returned, for paging. Default 0. | |
| continent | No | Keep only countries on this continent: AF Africa, AN Antarctica, AS Asia, EU Europe, NA North America, OC Oceania, SA South America. Case-insensitive. | |
| countries | No | Countries to return by ISO 3166-1 code: alpha-2 (US), alpha-3 (USA), or three-digit numeric (840), up to 50, as a list or a comma-separated string. Case-insensitive; UK is accepted for GB. Match country names with nameContains instead. | |
| nameContains | No | Keep only countries whose English name contains every word of this text as a substring (niger also matches Nigeria), ignoring case, accents, and punctuation. | |
| geonamesUsername | No | Your own GeoNames username, spent only when the country table is not already cached, so the call uses that account's credit instead of the server's. The account needs free web services enabled on its geonames.org account page. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cap | No | The limit that was applied. | |
| error | No | Present when the call failed. Absent on success. | |
| shown | No | Countries returned on this page. | |
| notice | No | Guidance when nothing matched, the offset is past the end, or more pages remain. | |
| notFound | No | Requested codes that match no GeoNames country; empty when every code matched. | |
| countries | No | Countries on this page, in GeoNames order (by alpha-2 code). | |
| truncated | No | True when more countries remain past this page. | |
| nextOffset | No | Offset of the next page; absent on the last page. | |
| totalCount | No | Countries matching the filters, before paging. |