Which country code systems does the API resolve?
All three ISO 3166-1 systems: alpha-2 (US), alpha-3 (USA), and numeric (840). GET /countries/:code accepts any of them and returns the full record with all identifiers.
Resolve ISO2, ISO3, and numeric identifiers against the full ISO 3166 dataset in a single call. Export all 249 countries as JSON or CSV when you need the reference data locally.
This calls the live Country Codes API. Pass an ISO2, ISO3, or numeric code and get the full record back.
Exact code resolution: ISO2, ISO3, or numeric. Try US, DEU, or 840.
| countryName | iso2 | iso3 | numericCode |
|---|---|---|---|
| Loading live response... | |||
Why Country Codes API
Complete ISO 3166 dataset
249 countries with countryName, iso2, iso3, and numericCode, kept consistent across every endpoint.
Any code system in
/countries/:code resolves ISO2 (US), ISO3 (USA), and numeric (840) identifiers with a single lookup.
Full list in one call
/countries returns all 249 records sorted by name, with a count field for pagination-free consumption.
JSON and CSV export
/export delivers the full dataset as JSON or a CSV attachment for seeding local caches and spreadsheets.
Structured metadata
Every JSON response carries a metadata object with counts, query echo, timestamps, and a correlationId for tracing.
/api/v1/country-codes
Exact code lookup
Resolve ISO2, ISO3, or numeric codes to a full country record in one call.
List all countries
All 249 countries sorted by name, with ISO2, ISO3, and numeric codes.
Partial name search
Requires q. Returns up to 25 partial matches for autocomplete and validation flows. Currently returns 404 in production — do not depend on it yet.
Fuzzy match
Requires q. Exact code match first, then typo-tolerant name matching with a similarity score. Currently returns 404 in production — do not depend on it yet.
Dataset export
Full dataset as JSON by default, or a CSV attachment with format=csv.
Service health
Status, service name, version, timestamp, and uptime.
| Parameter | Type | Required | Description |
|---|---|---|---|
| code | path | for /countries/:code | Country identifier: ISO2 (US), ISO3 (USA), or numeric code text (840). |
| q | string | search, match | Search input. Partial names for /search; codes or misspelled names for /match. Both endpoints are currently unavailable. |
| format | string | no | Export format for /export: "json" (default) or "csv". |
Error reference
Service errors set success: false with an error message and a metadata.correlationId. Gateway auth failures are rejected before the service and return error plus message instead.
Plan quota exhausted. Service responses carry metadata.rate_limit with limit, remaining, and reset so you can back off first.
Missing or invalid API key at the gateway. Send x-api-key or api_key with every request.
No country matched the code lookup, e.g. /countries/XYZ. The error echoes the failing input.
Database or query processing failure. Include the metadata.correlationId when reporting the issue.
Example error response
{
"success": false,
"error": "No country found for input 'XYZ'",
"metadata": {
"correlationId": "req-1788110429275-zr3dbg9ct",
"timestamp": "2026-08-30T17:20:29.296Z",
"processingTime": "5ms",
"api_token_name": null,
"rate_limit": { "limit": 10000, "remaining": 9982, "reset": 1788110914 }
}
}FAQ
All three ISO 3166-1 systems: alpha-2 (US), alpha-3 (USA), and numeric (840). GET /countries/:code accepts any of them and returns the full record with all identifiers.
The API returns HTTP 404 with success false and an error message that echoes the failing input, for example "No country found for input 'XYZ'". Every response also carries a metadata.correlationId for tracing.
Yes. GET /countries returns all 249 records sorted by name, each with countryName, iso2, iso3, and numericCode, plus a count field. There is no pagination to work through.
Yes. GET /export returns all 249 countries as JSON, or set format=csv for a CSV attachment, useful for seeding local caches, spreadsheets, and offline validation.
Send your Datpaq API key as an x-api-key header or an api_key query parameter. Keys are created in the Datpaq dashboard and a free tier is included.
Resolve ISO2, ISO3, and numeric codes with one reference API. Export the full ISO 3166 dataset whenever you need it locally.