GETapi.synup.com/api/v4/countries
Get a list of supported countries and their states
This API fetches a list of supported countries, including their database IDs, ISO codes, and states. The retrieved ISO codes should be used as input values when creating or updating locations.
Requires an API key. Send it as
Authorization: API <your-key> — see Getting started.Request
Request
curl -X GET 'https://api.synup.com/api/v4/countries' \
-H 'Authorization: API YOUR_API_KEY' \
-H 'Content-Type: application/json'const res = await fetch('https://api.synup.com/api/v4/countries', {
method: 'GET',
headers: {
Authorization: 'API YOUR_API_KEY',
'Content-Type': 'application/json',
},
});
const data = await res.json();import requests
res = requests.get(
"https://api.synup.com/api/v4/countries",
headers={
"Authorization": "API YOUR_API_KEY",
"Content-Type": "application/json",
},
)
data = res.json()req, _ := http.NewRequest("GET", "https://api.synup.com/api/v4/countries", nil)
req.Header.Set("Authorization", "API YOUR_API_KEY")
req.Header.Set("Content-Type", "application/json")
res, err := http.DefaultClient.Do(req)Responses
| Status | Description |
|---|---|
200 | Successfully retrieved the list of countries and their states |
401 | Unauthorized. API key is missing or invalid. |
500 | Internal server error. |
Example response (generated from the schema)
{
"data": {
"supportedCountries": [
{
"databaseId": 13,
"id": "Q291bnRyeToxMw==",
"iso": "AU",
"name": "Australia",
"states": [
{
"countryId": 13,
"id": "136",
"iso": "WA",
"name": "Western Australia"
}
]
}
]
}
}Response body
| Name | Type | Required | Description |
|---|---|---|---|
data | object | optional | |
data.supportedCountries | array of object | optional | List of supported countries |
data.supportedCountries[].databaseId | integer | optional | Unique identifier for the country in the database. |
data.supportedCountries[].id | string | optional | Base64 encoded unique country identifier. |
data.supportedCountries[].iso | string | optional | ISO 3166-1 alpha-2 country code. |
data.supportedCountries[].name | string | optional | Name of the country. |
data.supportedCountries[].states | array of object | optional | List of states within the country (if available). |
data.supportedCountries[].states[].countryId | integer | optional | Unique identifier of the country associated with the state. |
data.supportedCountries[].states[].id | string | optional | Unique identifier for the state. |
data.supportedCountries[].states[].iso | string | optional | State ISO code (if applicable). |
data.supportedCountries[].states[].name | string | optional | Name of the state. |