Countries and states

Retrieve the list of countries and the states/regions for a selected country — used to populate country and state selectors in address and checkout forms.

The country code is optional: calling GET /geo/country (without a code) auto-detects the country from the caller’s location, falling back to your account’s country. Supplying GET /geo/country/{country_code} forces a specific country. states always reflects the selected country. Use locale to localize the country and state names.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Overview

Retrieve the list of countries and the states/regions for a selected country — typically used to populate country and state selectors in address and checkout forms.

  • The country code is optional: call GET /geo/country to auto-detect the country from the caller's location (falling back to your account's country), or GET /geo/country/{country_code} to force a specific one. An unsupported code falls back to the detected/account country.
  • states always reflects the selected country.
  • Use locale to localize the country and state names — it accepts a full locale (en_US, fr_CA) or an ISO 639-1 code (en, fr), and defaults to en_US.

Example:

curl --request GET \
  --url 'https://www.pelcro.com/api/v1/sdk/geo/country/CA?site_id=1232&locale=fr_CA'
{
  "error": false,
  "data": {
    "selected_country": "CA",
    "countries": { "CA": "Canada", "US": "États-Unis", "FR": "France" },
    "states":    { "QC": "Québec", "ON": "Ontario", "BC": "Colombie-Britannique" }
  }
}
📘

Full lists returned

The countries and states objects are returned in full; the example above is truncated for brevity.

Path Params
string
required

ISO 3166-1 alpha-2 country code (e.g. US, CA). Optional — omit it (call GET /geo/country) to auto-detect. An unsupported code falls back to the detected/account country.

Query Params
int32
required

The unique identifier of the site associated with your account.

string
Defaults to en_US

Optional. Locale used to localize country and state names. Accepts a full locale (e.g. en_US, fr_CA) or an ISO 639-1 code (e.g. en, fr). Defaults to en_US; an unsupported value falls back to en_US.

Responses

Language
Credentials
Query
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json