> For the complete documentation index, see [llms.txt](https://docs.sendstackhq.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sendstackhq.com/delivery-api/bookings/update-delivery-window.md).

# Update Delivery Window

NB: The 'user' field in the request body is the control business id.

## Update delivery window

<mark style="color:green;">`POST`</mark> `{baseUrl}/drops/updateDeliveryWindow`

#### Request Body

| Name                                                     | Type           | Description |
| -------------------------------------------------------- | -------------- | ----------- |
| estimatedPickupWindow<mark style="color:red;">\*</mark>  | Object         |             |
| estimatedDropoffWindow<mark style="color:red;">\*</mark> | Object         |             |
| user                                                     | String         |             |
| dropIds<mark style="color:red;">\*</mark>                | Array\<String> |             |
| pickupDate                                               | String         |             |

{% tabs %}
{% tab title="200 Delivery window updated" %}

```
{
  "status": true,
  "message": "Delivery cancelled",
  "data": {
  }
}
```

{% endtab %}

{% tab title="400: Bad Request Invalid Delivery Id" %}

```
{
    "status": false,
    "message": "Invalid app_id or app_secret",
    "data": {
        "statusCode": 401,
        "message": "Invalid app_id or app_secret",
        "isOperational": true,
    }
}
```

{% endtab %}
{% endtabs %}

```
// Sample Request Information
Url: https://sandbox.sendstack.africa/api/v1/drops/updateDeliveryWindow
Method: POST
Headers: 
 - app_id: "your app_id"
 - app_secret: "your app_secret"
```

### Sample Success Data

```json
// Sample Request body
{
    "estimatedPickupWindow": {
        "date": "2024-09-22 00:00:00",
        "start": "2024-09-22  07:00:00",
        "end": "2024-09-22 13:00:00"
    },
    "estimatedDropoffWindow": {
        "date": "2024-09-22 00:00:00",
        "start": "2024-09-22 13:00:00",
        "end": "2024-09-22 18:00:00"
    },
    "user": "65b78c4e13d8753d300a1c59",
    "dropIds": ["65b8c2c734d8cd1be099fd45"],
    "pickupDate": "2024-09-22"
}
```

<pre class="language-json"><code class="lang-json"><strong>//Sample Response Body - 200 OK
</strong><strong>{
</strong>    "status": true,
    "message": "Delivery window updated",
    "data": [
        {
            "id": "65b8c2c734d8cd1be099fd45",
            "status": "PENDING",
            "paymentStatus": "PENDING",
            "trackingId": "E033LM",
            //...truncated for brevity
        }
    ]
}
</code></pre>

### Sample Error Data

```json
// Sample Request body
{
    "estimatedPickupWindow": {
        "date": "2024-09-22 00:00:00",
        "start": "2024-09-22  07:00:00",
        "end": "2024-09-22 13:00:00"
    },
    "estimatedDropoffWindow": {
        "date": "2024-09-22 00:00:00",
        "start": "2024-09-22 13:00:00",
        "end": "2024-09-22 18:00:00"
    },
    "user": "65b78c4e13d8753d300a1c59",
    "dropIds": ["invalidDropId"],
    "pickupDate": "2024-09-22"
}
```

```json
//Sample Response Body - 400 Bad Request
{
    "status": false,
    "message": "Invalid dropId"
}
```
