# 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"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.sendstackhq.com/delivery-api/bookings/update-delivery-window.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
