Skip to main content

Get All Shipping Zones

Endpoint

  • URL: /shippingZone/all
  • Method: GET
  • Headers:
    • accessToken: Required. This is your access token for authenticating the request.

Description

This API endpoint retrieves all shipping zones available in the system, including details about their status, associated countries, and shipping methods.

Sample Request

curl --location '<BASE-URL>/shippingZone/all' \
--header 'accessToken: <ACCESS-TOKEN>'

Successful Response

The API returns a JSON object containing the success status, data about shipping zones, and pagination details.

Response Fields

KeyTypeDescription
successBooleanIndicates if the request was successful.
dataArray of ObjectsA list of shipping zones.
paginationArray of ObjectsContains details about the paginated response.

Shipping Zone Object

Each object in the data array represents a shipping zone with the following fields:

FieldTypeDescription
idstringUnique identifier of the shipping zone.
namestringName of the shipping zone.
activebooleanIndicates if the shipping zone is active.
typestringType of the zone (e.g., country).
countryobjectContains name and countryCode of the country.
statesarrayList of associated states.
zipcodesarrayList of associated zip codes.
shippingMethodsarrayDetails of shipping methods available within the zone.
createdAtstringDate and time when the zone was created.
updatedAtstringDate and time when the zone was last updated.

Shipping Method Object

Each object in the shippingMethods array contains:

FieldTypeDescription
shippingMethodstringUnique identifier of the shipping method.
namestringName of the shipping method.
labelstringDisplay label for the shipping method.
activebooleanIndicates if the shipping method is active.
connectedbooleanIndicates if the shipping method is connected.
setupobjectConfiguration details, varies by method type.
_idstringUnique identifier for the setup of shipping method.

Pagination

  • pagination: object
    • Contains details about the paginated response.
FieldTypeDescription
pagenumberCurrent page number.
totalnumberTotal number of shipping zones returned.
countnumberNumber of shipping zones on the current page.

Example Response

{
"success": true,
"data": [
{
"_id": "66d2eafaf57178681728366a",
"name": "India",
"active": true,
"type": "country",
"country": {
"name": "India",
"countryCode": "IN"
},
"states": [],
"zipcodes": [],
"shippingMethods": [
{
"shippingMethod": "663a0afe4587085935a4fa0f",
"name": "ups",
"label": "UPS",
"active": true,
"connected": false,
"setup": {
"clientId": "233323",
"clientSecret": "kfjfjjf",
"accountNumber": "3"
},
"_id": "66d42cc091bfe4160114d152"
}
// Additional shipping methods
],
"createdAt": "2024-08-31T10:05:46.132Z",
"updatedAt": "2024-09-01T08:58:40.202Z",
"id": "66d2eafaf57178681728366a"
}
// Additional shipping zones
],
"pagination": {
"page": 1,
"total": 2,
"count": 2
}
}

Notes

  • Ensure proper handling of the access token as it authorizes the request to access the API.
  • The response might include multiple shipping zones and shipping methods based on the data available in the system.