Know Your Country API
"Every country have their uniques languages, currency, borders, culture and more."
Overview
"Know your country" API is an API that provides information about a country. There are various APIs available that provide different types of information about a country. But we have extended this information to further more, and continuously improving and gathering the deep knowledge of every country in every aspects. Some of the common data points that our "Know your country" API may provide include:
- Country information: The API may provide basic information about the country, such as its name, flag, capital city, and population.
- Geographical information: The API may provide information about the country's geography, such as its location, area, and borders.
- Demographic information: The API may provide information about the country's demographics, such as its age distribution, gender ratio, and ethnic groups.
- Economic information: The API may provide information about the country's economy, such as its GDP, inflation rate, and major industries.
- Social information: The API may provide information about the country's social indicators, such as its literacy rate, healthcare system, and crime rate.
This API allows developers or users to get the list of country data such as country names, population, map, flag, speaking languages, supported currencies, etc. information. You can use this information for your project. This "know your county" API will update and add new information on a regular basis.
Your API Authentication Key
We use API keys to authenticate all the requests. You can view and manage your API keys in the My Account -> My APIs Center page. Your API keys can be used to access our all the APIs, So be sure to keep them secure. Do not share your secret API keys in publicly accessible areas such as GitHub, client-side code, and so forth.
XXXX-XXXX-XXXX-XXXX (login to see your free API Key)
API Base URL and Endpoints
The API Base URL serves as the foundation or root of the API's endpoints. It represents the common prefix shared by all API endpoints. An Endpoint URL represents a specific operation or resource provided by the API. It is appended to the API Base URL to form a complete URL for a particular API call.
Base URL:
https://zerosack.org/marketplace/apis/v1
Endpoint for Know your countries list:
GET /kyc
API Request Method GET
This API use GET HTTP method to get data from our server. All API requests must be made over HTTPS ("S" stands for secure). Calls made over plain HTTP or without authentication key will not allowed.
Request Parameters
An API endpoint is a URL (Uniform Resource Locator) that is used to access a specific resource on a web server. API endpoints are the URLs that clients use to interact with a web API, and they typically consist of a base URL followed by a path that identifies a specific resource or action.
For know your countries data
Parameter | Description |
---|---|
key required |
This is your authentication api key to get requested data from our servers. This is mandatory parameter otherwise data request will be failed. Go to API Key. |
country_code optional |
This is ALPHA-2 / ALPHA-3 country code to get any desired country information. (For example Alpha-2 code = IN, Alpha-3 code = IND for INDIA country). This is a optional parameter, if you pass this parameter you will get desired country information, otherwise you will get all countries list data. |
Example Request URL
https://zerosack.org/marketplace/apis/v1/kyc?key=XXXX-XXXX-XXXX-XXXX (login to see your free API Key)
Response Format
API response format refers to the format in which data is returned from an API endpoint after a request is made. We use JSON format for API response data. JSON (JavaScript Object Notation): JSON is a lightweight data interchange format that is easy to read and write. It is widely used for API response data because it is easy to parse and manipulate in many programming languages.
Example Response
Know your country response data in JSON format
{
"status": 1,
"status_message": "success",
"body": [
{
"name": "India",
"officialName": "Republic of India",
"nativeName": {
"eng": {
"official": "Republic of India",
"common": "India"
},
"hin": {
"official": "\u092d\u093e\u0930\u0924 \u0917\u0923\u0930\u093e\u091c\u094d\u092f",
"common": "\u092d\u093e\u0930\u0924"
},
"tam": {
"official": "\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0b95\u0bcd \u0b95\u0bc1\u0b9f\u0bbf\u0baf\u0bb0\u0b9a\u0bc1",
"common": "\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe"
}
},
"topLevelDomain": [
".in"
],
"alpha2Code": "IN",
"alpha3Code": "IND",
"numericCode": "356",
"cioc": "IND",
"independent": true,
"status": "officially-assigned",
"unMember": true,
"currencies": {
"INR": {
"name": "Indian rupee",
"symbol": "\u20b9"
}
},
"idd": {
"root": "+9",
"suffixes": [
"1"
]
},
"capital": [
"New Delhi"
],
"altSpellings": [
"IN",
"Bh\u0101rat",
"Republic of India",
"Bharat Ganrajya",
"\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe"
],
"region": "Asia",
"subregion": "Southern Asia",
"languages": {
"eng": "English",
"hin": "Hindi",
"tam": "Tamil"
},
"translations": {
"ara": {
"official": "\u062c\u0645\u0647\u0648\u0631\u064a\u0629 \u0627\u0644\u0647\u0646\u062f",
"common": "\u0627\u0644\u0647\u0646\u062f"
},
"bre": {
"official": "Republik India",
"common": "India"
},
"ces": {
"official": "Indick\u00e1 republika",
"common": "Indie"
},
"cym": {
"official": "Republic of India",
"common": "India"
},
"deu": {
"official": "Republik Indien",
"common": "Indien"
},
"est": {
"official": "India Vabariik",
"common": "India"
},
"fin": {
"official": "Intian tasavalta",
"common": "Intia"
},
"fra": {
"official": "R\u00e9publique de l'Inde",
"common": "Inde"
},
"hrv": {
"official": "Republika Indija",
"common": "Indija"
},
"hun": {
"official": "Indiai K\u00f6zt\u00e1rsas\u00e1g",
"common": "India"
},
"ita": {
"official": "Repubblica dell'India",
"common": "India"
},
"jpn": {
"official": "\u30a4\u30f3\u30c9\u5171\u548c\u56fd",
"common": "\u30a4\u30f3\u30c9"
},
"kor": {
"official": "\uc778\ub3c4 \uacf5\ud654\uad6d",
"common": "\uc778\ub3c4"
},
"nld": {
"official": "Republiek India",
"common": "India"
},
"per": {
"official": "\u062c\u0645\u0647\u0648\u0631\u06cc \u0647\u0646\u062f\u0648\u0633\u062a\u0627\u0646",
"common": "\u0647\u0646\u062f"
},
"pol": {
"official": "Republika Indii",
"common": "Indie"
},
"por": {
"official": "Rep\u00fablica da \u00cdndia",
"common": "\u00cdndia"
},
"rus": {
"official": "\u0420\u0435\u0441\u043f\u0443\u0431\u043b\u0438\u043a\u0430 \u0418\u043d\u0434\u0438\u044f",
"common": "\u0418\u043d\u0434\u0438\u044f"
},
"slk": {
"official": "Indick\u00e1 republika",
"common": "India"
},
"spa": {
"official": "Rep\u00fablica de la India",
"common": "India"
},
"srp": {
"official": "\u0420\u0435\u043f\u0443\u0431\u043b\u0438\u043a\u0430 \u0418\u043d\u0434\u0438\u0458\u0430",
"common": "\u0418\u043d\u0434\u0438\u0458\u0430"
},
"swe": {
"official": "Republiken Indien",
"common": "Indien"
},
"tur": {
"official": "Hindistan Cumhuriyeti",
"common": "Hindistan"
},
"urd": {
"official": "\u062c\u0645\u06c1\u0648\u0631\u06cc\u06c1 \u0628\u06be\u0627\u0631\u062a",
"common": "\u0628\u06be\u0627\u0631\u062a"
},
"zho": {
"official": "\u5370\u5ea6\u5171\u548c\u56fd",
"common": "\u5370\u5ea6"
}
},
"latlng": [
20,
77
],
"landlocked": false,
"borders": [
"BGD",
"BTN",
"MMR",
"CHN",
"NPL",
"PAK"
],
"area": "3287590",
"demonyms": {
"eng": {
"f": "Indian",
"m": "Indian"
},
"fra": {
"f": "Indienne",
"m": "Indien"
}
},
"flag": "\ud83c\uddee\ud83c\uddf3",
"maps": {
"googleMaps": "https:\/\/goo.gl\/maps\/WSk3fLwG4vtPQetp7",
"openStreetMaps": "https:\/\/www.openstreetmap.org\/relation\/304716"
},
"population": "1380004385",
"gini": {
"2011": 35.7
},
"fifa": "IND",
"carDriving": {
"signs": [
"IND"
],
"side": "left"
},
"timezones": [
"UTC+05:30"
],
"continents": [
"Asia"
],
"flags": {
"png": "https:\/\/flagcdn.com\/w320\/in.png",
"svg": "https:\/\/flagcdn.com\/in.svg",
"alt": "The flag of India is composed of three equal horizontal bands of saffron, white and green. A navy blue wheel with twenty-four spokes \u2014 the Ashoka Chakra \u2014 is centered in the white band."
},
"coatOfArms": {
"png": "https:\/\/mainfacts.com\/media\/images\/coats_of_arms\/in.png",
"svg": "https:\/\/mainfacts.com\/media\/images\/coats_of_arms\/in.svg"
},
"startOfWeek": "monday",
"capitalInfo": {
"latlng": [
28.6,
77.2
]
},
"postalCode": {
"format": "######",
"regex": "^(\d{6})$"
}
},
{ ..... },
{ ..... },
{ ..... }
]
}
In this response "status": 1
means data request response received successfully. In this case your APIs credit call/request count as 1,
Otherwise in fail condition or any other condition you will receive "status": 0
,
In this case API credit calls/request count as 0.
Response Explanation
name
- common name in englishofficialName
- official name in englishnativeName
- list of all native names- key: three-letter ISO 639-3 language code
- value: name object
- key: official - official name translation
- key: common - common name translation
- country code top-level domain (
topLevelDomain
) - code ISO 3166-1 alpha-2 (
cca2
) - code ISO 3166-1 alpha-3 (
cca3
) - code ISO 3166-1 numeric (
ccn3
) - code International Olympic Committee (
cioc
) - ISO 3166-1 independence status (
independent
) (denotes the country is considered a sovereign state) - ISO 3166-1 assignment status (
status
) - United nation member status (
unMember
) currencies
- list of all currencies- key: ISO 4217 currency code
- value: currency object
- key:
name
name of the currency - key:
symbol
symbol of the currency
- key:
- International Direct Dialing info (
idd
)root
- the root geographical code prefix. e.g. +6 for New Zealand, +4 for UK.suffixes
- list of all suffixes assigned to this country. 4 for NZ, 809, 829, and 849 for Dominican Republic.
- capital city(ies) (
capital
) - alternative spellings (
altSpellings
) - region
- subregion
- list of official languages (
languages
)- key: three-letter ISO 639-3 language code
- value: name of the language in english
- list of name translations (
translations
)- key: three-letter ISO 639-3 language code
- value: name object
- key: official - official name translation
- key: common - common name translation
- latitude and longitude (
latlng
) demonyms
- name of residents, translated & genderized- key: three-letter ISO 639-3 language code
- value: genderized demonym object
- key:
f
(female) orm
(male) - value: genderized demonym translation
- key:
- landlocked status (
landlocked
) - land borders (
borders
) - land area in kmĀ² (
area
) - Emoji flag (
flag
) - County maps urls object (
maps
) - County population (
population
) - Gini coefficient, also known as the Gini index or Gini ratio (
gini
) - official codes used by FIFA (
fifa
) - Car driving sign and sides object (
carDriving
) - Timezones offset list (
timezones
) - Continents list (
continents
) - Country flags urls object (
flags
) - Coat Of Arms or national emblem object (
coatOfArms
) - Starting day of the week (
startOfWeek
) - County capital coordinates object (
capitalInfo
) - Postal code or pincode object (
postalCode
)
Sample Code
You can use our api with any programming language as well which can handle http GET requests. Here are some sample code snippets for making a GET request to an API endpoint in multiple programming languages:
fetch('YOUR API REQUEST URL WITH REQUIRED PARAMETERS')
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error(error));
$response = file_get_contents("YOUR API REQUEST URL WITH REQUIRED PARAMETERS");
if ($response !== false) {
$data = json_decode($response, true);
var_dump($data);
} else {
echo "Error: Request failed";
}
import requests
url = 'YOUR API REQUEST URL WITH REQUIRED PARAMETERS'
response = requests.get(url)
if response.status_code == requests.codes.ok:
data = response.json()
print(data)
else:
print('Error: Request failed with status code ' + str(response.status_code))
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Get, "YOUR API REQUEST URL WITH REQUIRED PARAMETERS");
var response = await client.SendAsync(request);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());
Also you can use Postman platform which enables you to create mock servers to assist with API development and testing. A mock server simulates the behavior of a real API server by accepting requests and returning responses. By adding a mock server to your collection and adding examples to your requests, you can simulate the behavior of a real API.
Do you Need Help? Contact us.
Disclaimers: This APIs is provided "as is" without warranty of any kind. If you have issue / feedback / bug report regarding the same, You can reach out to us.