The Get Countries API allows you to retrieve a list of countries along with their corresponding information.
Endpoint details:
| Method | POST |
|---|---|
| Production Environment URL | https://api.kloudship.com/api/v1/MetaData/Country |
| Test Environment URL | https://api-ppd.kloudship.com:960/api/v1/MetaData/Country |
| Content-Type | application/json |
cURL:
curl --location 'https://api-ppd.kloudship.com:960/api/v1/MetaData/Country' \ --header 'Authorization: ••••••'
Request body:
The Get Countries API does not require any request parameters.
Response fields:
The API responds with a JSON array containing objects representing countries. Each country object has the following properties:
- `id` (string): The unique identifier of the country.
- `phoneCode` (string): The country phone code.
- `mobileNumberRegex` (string): pattern to match the mobile code based on country.
- `currency` (object): Consists currency name, code of country also formatted display name of currency name and code.
- `name` (string): The name of the country.
- `code` (string): Country code
- `displayName` (string): A formatted display name of the country, including the code and name.
Example Response
[
{
"id": "66b9e15b4940ec25af6a6b87",
"phoneCode": "+376",
"mobileNumberRegex": "^(?:1|6[0-9])[0-9]{7}|[135-9][0-9]{5}$",
"currency": {
"name": "Euro",
"code": "EUR",
"displayName": "EUR - Euro"
},
"name": "Andorra",
"code": "AD",
"displayName": "AD - Andorra"
},
{
"id": "66b9e15b4940ec25af6a6c5e",
"phoneCode": "+971",
"mobileNumberRegex": "^(?:[4-7][0-9]|9[0-689])[0-9]{7}|800[0-9]{2,9}|[2-4679][0-9]{7}$",
"currency": {
"name": "United Arab Emirates Dirham",
"code": "AED",
"displayName": "AED - United Arab Emirates Dirham"
},
"name": "United Arab Emirates",
"code": "AE",
"displayName": "AE - United Arab Emirates"
},
//....more countries
]GET: Country by country code
The Get Country by Country Code API allows you to retrieve information about various states and union territories in the country, along with their respective codes and display names. This information can be useful for mapping and displaying state-related data in your application.Endpoint details:
{countryCode}: The country code for which you want to retrieve the list of states of country
cURL:
curl --location 'https://api-ppd.kloudship.com:960/api/v1/MetaData/Country/IN' \ --header 'Authorization: ••••••'
Response fields:
The response will be a JSON array containing objects with the following fields:
- states: All states of country with name, code and display name
- phoneCode: Phone code of country
- mobileNumberRegexr: regex pattern to validate the phone code of country
- currency: Currency of country with name, code and display name.
- code: The code representing the country.
- name: The name of country.
- displayName: The display name of the country in the format "Code - Name".
Response example:
{
"id": "66b9e15b4940ec25af6a6be4",
"states": [
{
"name": "Andhra Pradesh",
"code": "AP",
"displayName": "AP - Andhra Pradesh"
},
{
"name": "Arunachal Pradesh",
"code": "AR",
"displayName": "AR - Arunachal Pradesh"
},
{
"name": "Assam",
"code": "AS",
"displayName": "AS - Assam"
},
//....More states
],
"phoneCode": "+91",
"mobileNumberRegex": "^(?:000800|[2-9][0-9][0-9])[0-9]{7}|1[0-9]{7,12}$",
"currency": {
"name": "Indian Rupee",
"code": "INR",
"displayName": "INR - Indian Rupee"
},
"name": "India",
"code": "IN",
"displayName": "IN - India"
}GET: Country states by Country Code
The Get Country States by Country Code API allows you to retrieve information about various states and union territories in the country along with their respective codes and display names. This information can be useful for mapping and displaying state-related data in your application.
Endpoint details:
{countryCode}: The country code for which you want to retrieve the list of states of country
cURL:
curl --location 'https://api-ppd.kloudship.com:960/api/v1/MetaData/Country/IN/States' \ --header 'Authorization: ••••••'
Response fields:
The response will be a JSON array containing objects with the following fields:
- code: The code representing the state or union territory.
- name: The name of the state or union territory.
- displayName: The display name of the state or union territory in the format "Code - Name".
Example Response:
[
{
"code": "AN",
"name": "Andaman and Nicobar Islands",
"displayName": "AN - Andaman and Nicobar Islands"
},
{
"code": "AP",
"name": "Andhra Pradesh",
"displayName": "AP - Andhra Pradesh"
},
{
// ... Other state/union territory objects ...
}
]Not Yet Signed Up?
- Get started with KloudShip - This article explains steps like signing up, KYC, and adding balance to your account
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article