Skip to main content
GET
/
api
/
v2
/
storefront
/
countries
/
{iso}
Retrieve a Country
const options = {method: 'GET'};

fetch('https://demo.spreecommerce.org/api/v2/storefront/countries/{iso}', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
{
  "data": {
    "id": "1",
    "type": "country",
    "attributes": {
      "iso": "US",
      "iso3": "USA",
      "iso_name": "UNITED STATES",
      "name": "United States",
      "states_required": true,
      "zipcode_required": true,
      "default": true
    },
    "relationships": {
      "states": {
        "data": [
          {
            "abbr": "NY",
            "name": "New York"
          }
        ]
      }
    }
  },
  "included": [
    {
      "abbr": "NY",
      "name": "New York"
    }
  ]
}

Documentation Index

Fetch the complete documentation index at: https://spreecommerce.org/docs/llms.txt

Use this file to discover all available pages before exploring further.

Path Parameters

iso
string
required

Provide a Country ISO US or ISO3 USA code.

Example:

"GB"

Query Parameters

include
string

Specify the related resources you would like to receive in the response body. More Information.

fields[country]
string

Specify the fields you would like returned in the response body. More information.

Response

200 Success - Returns the country object.

data
Country · object
required

Countries within Spree are used as a container for states. Countries can be zone members, and also link to an address. The difference between one country and another on an address record can determine which tax rates and shipping methods are used for the order.Read more about Countries in Spree

included
Country Includes · object[]