Search…
API Reference
Resources
List all shipping zones
How to fetch a collection of shipping zones via API
To fetch a collection of shipping zones, send a GET request to the /api/shipping_zones endpoint.

Request

GET https://yourdomain.commercelayer.io/api/shipping_zones

Example

Request
Response
The following request fetches a collection of shipping zones:
1
curl -g -X GET \
2
'https://yourdomain.commercelayer.io/api/shipping_zones/' \
3
-H 'Accept: application/vnd.api+json' \
4
-H 'Authorization: Bearer your-access-token'
Copied!
On success, the API responds with a 200 OK status code, returning a paginated collection of resource objects:
1
{
2
"data": [
3
{
4
"id": "xYZkjABcde",
5
"type": "shipping_zones",
6
"links": {
7
"self": "https://yourdomain.commercelayer.io/api/shipping_zones/xYZkjABcde"
8
},
9
"attributes": {
10
"name": "Europe (main countries)",
11
"country_code_regex": "AT|BE|BG|CZ|DK|EE|DE|HU|LV|LT",
12
"not_country_code_regex": "AT|BE|BG|CZ|DK|EE|DE",
13
"state_code_regex": "A[KLRZ]|C[AOT]|D[CE]|FL",
14
"not_state_code_regex": "A[KLRZ]|C[AOT]",
15
"zip_code_regex": "(?i)(JE1|JE2|JE3|JE4|JE5)",
16
"not_zip_code_regex": "(?i)(JE1|JE2|JE3)",
17
"created_at": "2018-01-01T12:00:00.000Z",
18
"updated_at": "2018-01-01T12:00:00.000Z",
19
"reference": "ANY-EXTERNAL-REFEFERNCE",
20
"reference_origin": "ANY-EXTERNAL-REFEFERNCE-ORIGIN",
21
"metadata": {
22
"foo": "bar"
23
}
24
},
25
"relationships": {
26
"attachments": {
27
"links": {
28
"self": "https://yourdomain.commercelayer.io/api/shipping_zones/xYZkjABcde/relationships/attachments",
29
"related": "https://yourdomain.commercelayer.io/api/shipping_zones/xYZkjABcde/attachments"
30
}
31
}
32
},
33
"meta": {
34
"mode": "test"
35
}
36
},
37
{
38
"other": "... 9 shipping_zones (first page)"
39
}
40
],
41
"meta": {
42
"record_count": 140,
43
"page_count": 14
44
},
45
"links": {
46
"first": "https://yourdomain.commercelayer.io/api/shipping_zones?page[number]=1&page[size]=10",
47
"next": "https://yourdomain.commercelayer.io/api/shipping_zones?page[number]=2&page[size]=10",
48
"last": "https://yourdomain.commercelayer.io/api/shipping_zones?page[number]=14&page[size]=10"
49
}
50
}
Copied!

Sortable attributes

The list of shipping zones can be sorted by the following attributes:
  • name
  • id
  • created_at
  • updated_at
  • reference
  • reference_origin
Last modified 20d ago