Find countries by name or capital

Finds countries whose name contains the search text.

Request

GEThttps://countries-info.p.apihiver.com/v1/search?q=united
*
String. Part of a country name, e.g. united.
Language
Client
1curl --request GET \
2  --url 'https://countries-info.p.apihiver.com/v1/search?q=united' \
3  --header 'Accept: application/json' \
4  --header 'X-API-Key: YOUR_API_KEY'

Find countries by name or capital: Countries Info API reference

Finds countries whose name contains the search text. This endpoint is part of the Countries Info API: Every country's capital, population, area, currency, calling code, languages, continent and neighbours — by code, name or currency.

Example response (200, application/json)

Success.

1{
2  "count": 4,
3  "countries": [
4    {
5      "tld": ".ae",
6      "code": "AE",
7      "name": "United Arab Emirates",
8      "code3": "ARE",
9      "capital": "Abu Dhabi",
10      "area_km2": 82880,
11      "continent": "Asia",
12      "languages": [
13        "ar-AE",
14        "fa",
15        "en"
16      ],
17      "neighbours": [
18        "SA",
19        "OM"
20      ],
21      "population": 9630959,
22      "calling_code": "+971",
23      "numeric_code": "784",
24      "currency_code": "AED",
25      "currency_name": "Dirham",
26      "continent_code": "AS",
27      "postal_code_format": "##### #####"
28    },
29    {
30      "tld": ".uk",
31      "code": "GB",
32      "name": "United Kingdom",
33      "code3": "GBR",
34      "capital": "London",
35      "area_km2": 244820,
36      "continent": "Europe",
37      "languages": [
38        "en-GB",
39        "cy-GB",
40        "gd"
41      ],
42      "neighbours": [
43        "IE"
44      ],
45      "population": 66488991,
46      "calling_code": "+44",
47      "numeric_code": "826",
48      "currency_code": "GBP",
49      "currency_name": "Pound",
50      "continent_code": "EU",
51      "postal_code_format": "@# #@@|@## #@@|@@# #@@|@@## #@@|@#@ #@@|@@#@ #@@|GIR0AA"
52    },
53    {
54      "tld": ".um",
55      "code": "UM",
56      "name": "United States Minor Outlying Islands",
57      "code3": "UMI",
58      "capital": null,
59      "area_km2": 0,
60      "continent": "Oceania",
61  …

Errors

  • 400 — A required parameter is missing or a value has the wrong format.
    1{
    2  "error": {
    3    "code": "INVALID_INPUT",
    4    "message": "q: Field required"
    5  }
    6}

Gateway errors (missing key, no subscription, rate limits) are listed in Error codes.