Skip to content

Countries

Countries are the catalog of nations available for billing/shipping addresses, taxes, and storefront scoping. Each country may have one or more sub-divisions ("states", "provinces", "territories" — generically called country states in this API).

Endpoints

MethodPathPurpose
GET/api/shop/countriesPaginated list of countries
GET/api/shop/countries/{id}Single country by ID

Use the example switcher above to flip between the two.

Request Headers

HeaderRequiredDescription
AcceptYesapplication/json
X-STOREFRONT-KEYYesStorefront API key (pk_storefront_…)
X-LocaleNoOverride request locale

Query Parameters (collection only)

ParameterTypeDefaultDescription
pageinteger1Page number (1-based)
per_pageinteger10Items per page. Max 50.

Pagination headers (X-Total-Count, X-Page, X-Per-Page, X-Total-Pages) are emitted on the collection. See Pagination.

Country Object Fields

Both endpoints return the same shape — the collection wraps an array of these objects, the single endpoint returns one.

FieldTypeDescription
idintegerCountry primary key
codestringISO 3166-1 alpha-2 country code (AF, CA, US, IN, …)
namestringDefault English name
statesarrayInline list of country states for this country. Empty [] for countries with no sub-divisions in Bagisto's data
translationsarrayAll locale translations as inline objects: { id, countryId, locale, name }

⚠️ Unlike Attribute / Channel / Category, translations on Country is returned as inline objects (not IRI strings). This avoids an extra round-trip per locale. There is no translation field for the request locale — pick the entry that matches your X-Locale.

Inline states[] shape

Each entry has the same fields as /country-states/{id} — see the Country States page.

Use Cases

  • Populate a country dropdown in a checkout / address form.
  • Look up a country by ISO code (?code=US) is not supported — fetch the full list and filter client-side, or use the GraphQL query for a single lookup.
  • Resolve a country's localized display name from translations[] based on the customer's locale.
  • Chain to the country's states for a country/state cascade picker (use the nested states endpoint to skip refetching the country payload).

Released under the MIT License.