List countries
Free during preview · test keys only
Request
limit=1codes=CA,US
Result · First page: codes=CA,US&limit=1
Q0E=
List the 249 ISO 3166-1 countries and territories in stable alpha-2 order. Free during preview; scoped test keys must allow data.countries. No balance or payment is required.
Pagination: limit defaults to 50 (1–250). When has_more is true, pass next_cursor unchanged as cursor, keeping the same filters. Cursors are opaque, not offsets; they mark an exclusive alpha-2 boundary. A valid cursor remains a boundary even if filters change. The final or empty page has has_more false and next_cursor null. Filters combine with AND; codes selects any listed code.
English display names, code mappings, regions and currencies come from Unicode CLDR JSON 48.2.1 (CLDR 48.2), Unicode License v3. Currency arrays contain legal tender on 2026-10-14, not historical or non-tender entries, and may be empty. Region/subregion follow CLDR containment, including Antarctica under Oceania / Outlying Oceania. Flags are Unicode regional-indicator pairs. Official names and calling codes are omitted because they are not sourced here. XK (Kosovo), AC, CP, CQ, DG, EA, IC and TA, macroregions, deprecated and other user-assigned codes are excluded.
Parameters
- Name
limit- Type
- integer · query
- Required
- Optional
- Default
- Default
50 - Description
- Maximum items per page, an integer from 1 to 250. Default 50.
- Name
cursor- Type
- string · query
- Required
- Optional
- Description
- Opaque next_cursor from a previous page. Omit on the first page; do not decode, construct or increment it.
- Name
region- Type
- string · query
- Required
- Optional
- Description
- UN M49 continent, region or subregion: CLDR English name (case- and accent-insensitive) or three-digit code, e.g. Americas / 019 or Northern America / 021. Includes 003 (North America), 202 (Sub-Saharan Africa) and 419 (Latin America). Not EU/EZ/UN political groupings.
- Name
currency- Type
- string · query
- Required
- Optional
- Description
- ISO 4217 code recognized by the CLDR snapshot, case-insensitive, e.g. CAD. Recognized historical/non-tender codes such as BGN or XAU return an empty list when no country uses them on the snapshot date. Unknown codes and CLDR's non-ISO CNH alias are invalid.
- Name
q- Type
- string · query
- Required
- Optional
- Description
- Nonempty case- and accent-insensitive English name, alpha-2, alpha-3 or numeric code prefix, e.g. COTE matches Côte d’Ivoire. Not a substring search.
- Name
codes- Type
- string · query
- Required
- Optional
- Description
- Comma-separated ISO 3166-1 alpha-2 codes. Case-insensitive; whitespace around each code and duplicates are accepted. Unknown/non-ISO codes are invalid. Results still use alpha-2 order.
Make a call
curl --request GET 'https://api.butter.pub/v1/data/countries?limit=1&codes=CA%2CUS' \
--header "Authorization: Bearer $APIBUTTER_TEST_KEY"use Illuminate\Support\Facades\Http;
$response = Http::withToken($key)
->get('https://api.butter.pub/v1/data/countries', ['limit' => 1, 'codes' => 'CA,US']);
$result = $response->throw()->json();const url = new URL('https://api.butter.pub/v1/data/countries');
url.search = new URLSearchParams({
"limit": 1,
"codes": "CA,US"
}).toString();
const response = await fetch(url, {
method: 'GET',
headers: { Authorization: `Bearer ${key}` },
});
if (!response.ok) throw await response.json();
const result = await response.json(); Use your test key as $APIBUTTER_TEST_KEY or key. Keep it out of source control.
Or ask your agent
Call data_countries on the authenticated MCP server at https://mcp.butter.pub/mcp.
Tool errors carry the same problem in structured content and JSON text, with isError: true.
{
"name": "data_countries",
"arguments": {
"limit": 1,
"codes": "CA,US"
}
}Responses
200A country list, including empty results. The next cursor is present only when another page exists. Nothing is charged. · application/json
- Name
object- Type
- string · always "list"
- Required
- Required
- Name
data- Type
- array of Country
- Required
- Required
- Name
has_more- Type
- boolean
- Required
- Required
- Name
next_cursor- Type
- string | null
- Required
- Required
{
"object": "list",
"data": [
{
"object": "country",
"id": "CA",
"alpha2": "CA",
"alpha3": "CAN",
"numeric": "124",
"name": "Canada",
"region": "Americas",
"subregion": "Northern America",
"currencies": [
"CAD"
],
"flag": "🇨🇦"
}
],
"has_more": true,
"next_cursor": "Q0E="
}{
"object": "list",
"data": [
{
"object": "country",
"id": "US",
"alpha2": "US",
"alpha3": "USA",
"numeric": "840",
"name": "United States",
"region": "Americas",
"subregion": "Northern America",
"currencies": [
"USD"
],
"flag": "🇺🇸"
}
],
"has_more": false,
"next_cursor": null
}{
"object": "list",
"data": [],
"has_more": false,
"next_cursor": null
}401Missing, invalid or revoked bearer key.1 example
application/problem+json
{
"type": "https://apibutter.com/docs/errors/unauthorized",
"title": "Unauthorized",
"status": 401,
"detail": "A valid, unrevoked bearer API key is required.",
"code": "unauthorized",
"param": null,
"errors": null,
"request_id": "req_01jbz8c6m3x4v9t2q7w5n8r0ka"
}403Live keys are refused; scoped test keys must allow data.countries.2 examples
application/problem+json
{
"type": "https://apibutter.com/docs/errors/test_keys_only",
"title": "Forbidden",
"status": 403,
"detail": "This operation is free during preview and accepts abk_test_ keys only.",
"code": "test_keys_only",
"param": null,
"errors": null,
"request_id": "req_01jbz8c6m3x4v9t2q7w5n8r0ka"
}{
"type": "https://apibutter.com/docs/errors/forbidden",
"title": "Forbidden",
"status": 403,
"detail": "The API key does not allow this operation.",
"code": "forbidden",
"param": null,
"errors": null,
"request_id": "req_01jbz8c6m3x4v9t2q7w5n8r0ka"
}422An invalid filter, limit or cursor. The detail names the parameter to correct.1 example
application/problem+json
{
"type": "https://apibutter.com/docs/errors/invalid_parameter",
"title": "Unprocessable Content",
"status": 422,
"detail": "The limit parameter must be an integer from 1 to 250.",
"code": "invalid_parameter",
"param": "limit",
"errors": {
"limit": [
"The limit parameter must be an integer from 1 to 250."
]
},
"request_id": "req_01jbz8c6m3x4v9t2q7w5n8r0ka"
}When a call fails
| Code | Status | Meaning |
|---|---|---|
| unauthorized | 401 | A valid, unrevoked bearer API key is required. |
| test_keys_only | 403 | This operation is free during preview and accepts abk_test_ keys only. |
| forbidden | 403 | The API key does not allow this operation. |
| invalid_parameter | 422 | The limit parameter must be an integer from 1 to 250. |