apyhub-logo
5 atoms
Base tier

About

This Utility API lets you query and finds details about a specific country.
This API provides data such as Country, State, Country calling code, Short country name or code, Country flag (as Emoji), and Currency details in JSON format. This API can provide information for a wide range of applications, from geolocation-based services to research and education. This can be used to retrieve specific pieces of data for each country, making it easy to integrate the API into existing applications.

API Playground

API Documentation

country data
GET
https://api.apyhub.com/data/info/country

Request example

1
```cURL
2
3
curl --location --request GET 'https://api.apyhub.com/data/info/country?country=UK' \
4
--header 'apy-token: {{token}}' \
5
--header 'Content-Type: application/json' \
Method: GET
Content Type: application/json
Query Parameter(s)
AttributeTypeMandatoryDescription
countryStringYesThe name of the country for which you want to find the details (country name or country code)
Response
AttributeTypeDescription
data.keyStringCountry code
data.valueStringName of the country
data.cca3StringThree digit country code
data.emojiStringFlag emoji for the country
data.calling_codeArray of IntegersArray of country codes (most often it is just one)
data.subdivisionArrayArray of subdivision elements (states or regions )
data.subdivision[a].codeStringSubdivision code
data.subdivision[a].nameStringName of the subdivision
data.currency.keyStringCurrency code
data.currency.valueStringName of the Currency
data.currency.symbolStringCurrency Symbol
data.currency.emojiStringCurrency emoji for that currency
Sample Response
A successful request returns country informaiton in JSON format. If the request fails, the response contains an error code and a message to help determine what went wrong.
1
{
2
"data": {
3
"value": "United Kingdom",
4
"key": "GB",
5
"cca3": "GBR",
6
"emoji": "🇬🇧",
7
"calling_code": [
8
44
9
],
10
"subdivision": [
11
{
12
"code": "GB-ABC",
13
"name": "Armagh, Banbridge and Craigavon"
14
},
15
{
16
"code": "GB-ABD",
17
"name": "Aberdeenshire"
18
},
19
....
20
],
21
"currency": {
22
"emoji": "💷",
23
"key": "GBP",
24
"symbol": "£",
25
"value": "Pound Sterling"
26
}
27
}
28
}

HTTP Response Codes

The method may return one of the following HTTP status codes:
Status CodeDescription
200The request was successful.
400Invalid input - the country is not provided.
401Required authentication information is either missing or not valid for the resource.
500If any unexpected error occurs while processing the request

Authentication

All API requests to ApyHub services need to be authenticated. Currently we support tokens or basic authentication mechanisms. You can generate and view your existing credentials from your workspace settings (on the left side of the navbar) and go to “API Keys".
Points to note:
  • Credential secrets are generated on the fly and are not stored in plain text, so on generating a credential please save the secrets somewhere safe.
  • Use the apy-token as the header parameter to pass the token.
  • Use the Authorization header to send the basic authentication credentials.

Error codes

1
{
2
"error": {
3
"code": 105,
4
"message": "Invalid URL"
5
}
6
}
To search for a specific error code, enter the code in the search box below. Alternatively, you can click on the button to view a complete list of all error codes.