Countries
This list of country codes may not reflect the latest geopolitical changes. Please verify with official sources if accuracy is critical.
GET
[]
Docs
API to query country information from a local dataset.
Endpoint
GET /api/countries?q={query}
Query Parameters
Value | Description |
---|---|
"exact" | Exact match (case-sensitive) for name , alpha2 , alpha3 , localName , or numeric . |
@observer | Returns only UN observer countries (UN_observer: true ). |
@null | Returns countries with any field set to null . |
@repeat | Returns countries with repeated values in any field. |
any other string | Partial, case-insensitive match in any field (name , alpha2 , alpha3 , localName , numeric ). |
Response
Content-Type: application/json
Body: Array of country objects
[
{
"name": "Spain",
"alpha2": "ES",
"alpha3": "ESP",
"localName": "España",
"numeric": 724,
"UN_observer": false
}
]
Sorting
- Non-UN observers first, then UN observers.
- Within each group, sorted alphabetically by
name
.
Example Requests
Partial match:
GET /api/countries?q=esp
Returns all countries whose name, code, or numeric value contains "esp"(case-insensitive).
UN observers only:
GET /api/countries?q=@observer
Returns only UN observer countries.
Credits
Documentation generated automatically by ChatGPT (GPT-5).
Source:Ministerio de Justicia (Spain)Wikipedia (ES) Wikipedia (EN)