canonical: https://jentic.com/apis/countrylayer.com/countrylayer

# Countrylayer API

The Countrylayer API is a REST service that returns rich country reference data - names, capitals, regions, languages, currencies, calling codes, regional blocs, and alpha codes - across 9 search and lookup endpoints. Authentication is via an `access_key` query parameter on the v2 base URL. It suits localisation, registration form dropdowns, shipping and tax rules, and any workflow that needs to resolve or validate country attributes without bundling a static dataset into the application.

## For AI agents

Look up countries by name, capital, language, currency, region, regional bloc, calling code, or alpha code, and retrieve canonical country metadata. Returns JSON arrays of matching countries.

## Scope

Does not provide IP geolocation, state or city data, or live political news - use for static country reference metadata only.

## Capabilities

- Retrieve a complete list of countries with metadata in one call
- Search countries by full or partial name match
- Resolve a capital city to its country record
- Filter countries by official or spoken language
- Filter countries by currency code
- Look up countries by ISO alpha-2 or alpha-3 code
- Filter countries by region or regional bloc such as EU or ASEAN

## Use cases

### Localised Registration and Checkout

Populate country dropdowns, format phone numbers, and pick the right currency at signup or checkout by pulling fresh country data from the API rather than shipping a static list. The /all endpoint returns every country in one call which can be cached client-side, while `/alpha/{code}` resolves a stored ISO code back into a display name and calling code at runtime.

Example prompt: Call GET /all and cache the response, then on each checkout call GET `/alpha/{code}` to pull the calling code and currency for the user's stored country

### Tax and Shipping Region Rules

Resolve a customer's country into the regional bloc, currency, and capital required for tax calculation or shipping zone selection. Use GET `/regionalbloc/{regionalbloc}` to enumerate the countries inside a bloc such as EU or NAFTA, or GET `/currency/{currency}` to list every country that uses a particular currency. Useful for e-commerce platforms applying VAT or duty rules.

Example prompt: Call GET `/regionalbloc/EU` and use the resulting list to apply VAT rules for orders shipping inside the European Union

### Country Search and Autocomplete

Power a country search box that handles fuzzy name matches, capital city searches, and language filters. The API exposes `/name/{name}`, `/capital/{capital}`, and `/language/{language}` endpoints that all return JSON arrays of matching country records, so the front end can build a single autocomplete that pivots on whatever the user typed.

Example prompt: On each keystroke, call GET `/name/{partial}` and merge results with GET `/capital/{partial}` to rank country suggestions

### AI Agent Country Enrichment

Let an AI agent enrich an unstructured 'country' string from a CRM record, support email, or scraped form into a canonical country record with currency, language, and calling code. Through Jentic, the agent searches by intent and the access_key is held in the encrypted vault so it never leaks into prompts or logs.

Example prompt: Use Jentic to search 'look up a country by name', load the schema for GET `/name/{name}`, and execute it with the user-supplied string

## Key endpoints

| Method | Path | Description |
| --- | --- | --- |
| GET | `/all` | Get all countries |
| GET | `/name/{name}` | Search by country name |
| GET | `/capital/{capital}` | Search by capital city |
| GET | `/language/{language}` | Search by language |
| GET | `/currency/{currency}` | Search by currency |
| GET | `/regionalbloc/{regionalbloc}` | Search by regional bloc |
| GET | `/callingcode/{callingcode}` | Search by calling code |
| GET | `/alpha/{code}` | Search by ISO alpha code |

## Key resources

- **Countries** — List all countries via GET /all
- **Name Search** — Search countries by name via GET `/name/{name}`
- **Capital Search** — Search countries by capital via GET `/capital/{capital}`
- **Language** — Filter countries by language via GET `/language/{language}`
- **Currency** — Filter countries by currency code via GET `/currency/{currency}`
- **Region** — Filter by region or regional bloc
- **Calling Code** — Look up countries by calling code
- **Alpha Code** — Resolve ISO alpha-2 or alpha-3 codes via GET `/alpha/{code}`

## Why Jentic

- **Setup:** Wiring Countrylayer by hand means handling its access_key query-parameter auth, pinning the v2 host, and coding your own lookups by name, currency, or calling code. Through Jentic you install once, import Countrylayer from the API Directory, store the key once, and your agent calls it.
- **Permission scoping:** Countrylayer is read-only country reference data where names and codes are lookup values in the path, not permissionable resources, so scope by operation: limit the agent to the operations it needs, such as looking up a country by name or currency. You choose the operations it may call, so it stays limited to those reads.
- **Credential handling:** Your Countrylayer access key is stored once, encrypted, by your own Jentic One instance and injected at execution time. It never enters the agent's prompt, logs, or context.
- **Discovery method:** Agents search Jentic by intent such as 'look up a country by name' or 'find countries using a currency', and Jentic returns the matching Countrylayer operation with its input schema so the agent calls the right endpoint without browsing the reference docs.

## Related APIs

- **country.is** — Free no-auth IP-to-country code lookup
- **Country State City API** — Hierarchical country, state, and city dataset
- **ipapi** — Returns rich geolocation including country, currency, and calling code from an IP
- **Abstract Geolocation API** — Commercial geolocation with country, region, and ISP enrichment

## FAQ

### What authentication does the Countrylayer API use?

Countrylayer uses an API access key passed as the `access_key` query parameter on every request. When called via Jentic, the key is stored encrypted in your Jentic One instance and the agent receives a scoped session token rather than the raw key.

### Can I list every country in a single API call?

Yes. GET /all returns the full country dataset including names, capitals, regions, languages, currencies, calling codes, and alpha codes. Cache the response for 24 hours or longer because the underlying dataset changes rarely.

### How do I find every country that uses the euro?

Call GET `/currency/EUR.` The response is a JSON array of country records, each containing the canonical name, capital, region, and other metadata. The same pattern works for any ISO 4217 currency code.

### What are the rate limits for the Countrylayer API?

Rate limits and request quotas are determined by the Countrylayer subscription plan tied to the access_key. Free plans typically cap monthly requests in the low thousands while paid plans raise the cap; check the plan dashboard for exact numbers.

### How do I look up a country by ISO code through Jentic?

Search Jentic for 'look up a country by alpha code', load the schema for GET `/alpha/{code}`, and execute it with the alpha-2 or alpha-3 code. Jentic supplies the access_key from the vault automatically.

### Does Countrylayer return real-time political or border data?

No. The dataset reflects ISO and CIA World Factbook style reference data - names, capitals, currencies, languages, calling codes, and blocs. It is not a live news feed and does not track sanctions, conflicts, or border changes.

### Can I limit what my agent is allowed to do with the Countrylayer API?

Yes. Countrylayer is read-only country reference data, so you scope the agent by operation from your own self-hosted Jentic One instance, where your rules decide which calls and credentials it may use. You can allow only the lookups the task needs, such as GET `/name/{name}` to search by country name or GET `/currency/{currency}` to list countries by currency, while withholding operations like GET /all or GET `/regionalbloc/{regionalbloc}.` The agent stays limited to the reads you permit.
