# Orderstatus

## Get status updates for Cottoncast orders

<mark style="color:green;">`POST`</mark> `https://your.store.com/cottoncast/orderstatus`

This url is an example. You can configure your own URL in your Studio account. Each time an order is updated in our system we will make a request to this webhook. For example when we ship an order.

#### Request Body

| Name             | Type   | Description                                     |
| ---------------- | ------ | ----------------------------------------------- |
| status.timestamp | string | The time the status has changed                 |
| status.code      | string | A status code. The letter "C" means Complete.   |
| status           | object | The status of the order                         |
| orderID          | string | The Cottoncast Order ID                         |
| ref              | string | The order reference you have passed along to us |

{% tabs %}
{% tab title="200 Orderstatus successfully updated." %}

```javascript
{
    "status": "ok"
}
```

{% endtab %}

{% tab title="404 Could not find the order" %}

```javascript
{
    "status": "error",
    "message": "Order 41 not found"
}
```

{% endtab %}
{% endtabs %}

### Example request body

```javascript
{
  "orderID" : "3AF7",
  "ref" : "41",
  "status" : {
    "code" : "C",
    "timestamp" : 1622007287
  },
 "shipments":[
   {
     "carrier":"postnl",
     "carrierName":"Postnl",
     "trackingcode":"3SCEBU123456789",
     "trackingurl":"https:\/\/jouw.postnl.nl\/track-and-trace\/3SCEBU123456789-NL-1000AB",
     "new":true
   }
 ]  
}

```

## Status codes

| Code | Label         | Description                                              |
| ---- | ------------- | -------------------------------------------------------- |
| N    | New           | The shipment has just been created                       |
| L    | Label created | A label has been created and printed for the package(s). |
| R    | Ready         | The shipment is ready for collection by the carrier.     |
| C    | Collected     | The shipment is collected by the carrier                 |
| E    | En route      | The shipment is en-route to the customer.                |
| I    | Problem       | There is a problem with the shipment.                    |
| X    | Lost          | The package has been lost by the carrier.                |
| D    | Delivered     | The package is delivered.                                |


---

# 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.cottoncast.com/api-reference/webhooks/orderstatus.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.
