> For the complete documentation index, see [llms.txt](https://shiply-integration-apis.gitbook.io/shiply-integration-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shiply-integration-apis.gitbook.io/shiply-integration-documentation/webhook.md).

# Webhook

Webhooks are HTTP callbacks sent from Shiply to an endpoint on your system. They allow you to receive real-time notifications whenever important events occur on our side (e.g., a parcel status change), so you can react accordingly in your application.

Shiply sends a webhook request to the URL you have configured and stored in the system when any of the following events occur:

* **Update parcel information**
* **Update parcel status or position**
* **Delete parcel**

This notification contains a brief description of the status change, along with the associated <mark style="color:blue;">parcel\_code</mark>. You can use this parcel code to call the API [Get Specific Parcel](/shiply-integration-documentation/integration-apis/parcels/get-specific-parcel.md) and retrieve detailed parcel information, allowing you to track the parcel and stay updated on its progress.

The following **JSON** formatted request body is sent to your webhook URL:

{% code lineNumbers="true" %}

```json
{
  "event": "parcel", // event type
  "parcel_code": "asnf-000-4405992", // affected parcel code 
  "parcel_status_id": 5, // new parcel status
  "parcel_position_id": 5, // new parcel position
  "note": null, // parcel note
  "reference_number": null 
}
```

{% endcode %}

{% hint style="info" %}
Ensure that the webhook URL is secured and configured to accept requests only from Shiply.
{% endhint %}

### Update Webhook URL

```php
PUT /customer/webhookURL
```

This API is used to update customer's webhook URL.

#### Headers

<table><thead><tr><th width="374">Key</th><th>Value</th></tr></thead><tbody><tr><td>Accept</td><td>application/json</td></tr><tr><td>Content-Type</td><td>application/json</td></tr></tbody></table>

#### Request body

<table><thead><tr><th width="183">Field Name</th><th width="121">Required</th><th width="93">Type</th></tr></thead><tbody><tr><td>webhook_url</td><td>yes</td><td>string</td></tr></tbody></table>

Request body example:

```json
{
    "webhook_url": "url",
    "Shiply_API_KEY": "your_api_key"
}
```

#### Response body

```json
{
    "success": true,
    "message": "Webhook URL updated successfully"
}
```
