Skip to content

Update Delivery Zone

Description

This API allows merchants to update an existing delivery zone's details, such as its name, fee, estimated delivery time, or the states and areas it covers.

Endpoint

  • URL: /v1/delivery-zones/{id}
  • Method: PUT

Path Parameters

ParameterTypeDescription
idstringThe unique ID of the delivery zone.

Required Headers

json
{
  "Authorization": "Bearer JWT_TOKEN",
  "X-MerchantApiKey": "MERCHANT_API_KEY",
  "Content-Type": "application/json"
}

📥 Request Body

The request body follows the same structure as the Create Delivery Zone API.

DeliveryZoneRequest DTO

FieldTypeRequiredDescription
namestringYesThe updated name of the delivery zone.
estimatedDeliveryTimestringNoUpdated estimated delivery time.
feedoubleYesUpdated delivery fee (must be 0 or greater).
stateAreaslistYesUpdated list of states and areas. More Info

StateAreaRequest DTO

State Area Request
FieldTypeRequiredDescription
statestringYesThe name of the state (e.g., "Lagos").
areaslistYesA list of area names within the state.

Example API Call (Using Fetch)

javascript
fetch('https://api.shopsynch.com/v1/delivery-zones/dz-12345', {
  method: 'PUT',
  headers: {
    'Authorization': 'Bearer JWT_TOKEN',
    'X-MerchantApiKey': 'MERCHANT_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    name: "Lagos Mainland Updated",
    estimatedDeliveryTime: "1 business day",
    fee: 1800.00,
    stateAreas: [
      {
        state: "Lagos",
        areas: ["Ikeja", "Surulere", "Yaba", "Maryland", "Oshodi"]
      }
    ]
  })
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

✅ Sample 200 Response (Success)

json
{
    "status": true,
    "message": "Delivery zone updated successfully",
    "data": {
        "id": "dz-12345",
        "name": "Lagos Mainland Updated",
        "fee": 1800.0,
        "estimatedDeliveryTime": "1 business day",
        "stateAreas": [
            {
                "state": "Lagos",
                "areas": ["Ikeja", "Surulere", "Yaba", "Maryland", "Oshodi"]
            }
        ]
    }
}

❌ Sample 404 Response (Not Found)

json
{
    "status": false,
    "message": "Delivery zone not found"
}

Build with joy