> For the complete documentation index, see [llms.txt](https://docs.terminal.africa/tship/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.terminal.africa/tship/webhooks/simulate-webhook.md).

# Simulate Webhook

## /webhooks

<mark style="color:green;">`POST`</mark> `https://sandbox.terminal.africa/v1/webhooks/simulate`

Queue a webhook notification using the current data for a real resource. Delivery is asynchronous (same path as live webhooks).

#### Headers

{% hint style="info" %}
**Staging only.** This endpoint is not available in production. Use it to fire a webhook event from a live resource you own, without changing that resource’s status.
{% endhint %}

| Name                                            | Type   | Description                      |
| ----------------------------------------------- | ------ | -------------------------------- |
| Authorization<mark style="color:red;">\*</mark> | String | Set value to `Bearer SECRET_KEY` |
| Content-Type                                    | String | Set value to `application/json`  |

#### Request Body

<table data-search="false"><thead><tr><th>Name</th><th>Type</th><th>Description</th></tr></thead><tbody><tr><td>event</td><td>String</td><td>Webhook event to simulate. Required if <code>events</code> is not provided. Must be one of the supported webhook events.</td></tr><tr><td>events</td><td>Array of String</td><td>List of webhook events to simulate in one request. Required if <code>event</code> is not provided. Each event must include the matching resource ID below.</td></tr><tr><td>shipment_id</td><td>String</td><td>Required for <code>shipment.*</code>, <code>reconciliation.*</code>, and <code>regulatory_document.*</code> events.</td></tr><tr><td>address_id</td><td>String</td><td>Required for <code>address.*</code> events.</td></tr><tr><td>packaging_id</td><td>String</td><td>Required for <code>packaging.*</code> events.</td></tr><tr><td>insurance_id</td><td>String</td><td>Required for <code>insurance.*</code> events.</td></tr><tr><td>claim_id</td><td>String</td><td>Required for <code>claim.*</code> events.</td></tr><tr><td>transaction_id</td><td>String</td><td>Required for <code>transaction.*</code> events. Use the wallet <code>transactionId</code>.</td></tr><tr><td>webhook_id</td><td>String</td><td>ID of a specific webhook endpoint (e.g. <code>WA-1234567890ABCDEF</code>). Optional. If provided, that webhook must exist, be active, and be subscribed to the event being simulated. Otherwise the request fails.</td></tr></tbody></table>

#### Resource requirements by event

| Event(s)                                                                                                  | Required field   |
| --------------------------------------------------------------------------------------------------------- | ---------------- |
| `address.created`, `address.updated`, `address.deleted`                                                   | `address_id`     |
| `packaging.created`, `packaging.updated`                                                                  | `packaging_id`   |
| `shipment.created`, `shipment.updated`, `shipment.in-transit`, `shipment.delivered`, `shipment.cancelled` | `shipment_id`    |
| `insurance.success`, `insurance.failed`                                                                   | `insurance_id`   |
| `claim.success`, `claim.failed`                                                                           | `claim_id`       |
| `transaction.success`, `transaction.failed`                                                               | `transaction_id` |
| `reconciliation.flagged`, `reconciliation.billed`                                                         | `shipment_id`    |
| `regulatory_document.pending`, `regulatory_document.uploaded`, `regulatory_document.complete`             | `shipment_id`    |

{% hint style="warning" %}
You must own the resource, and you must have at least one active webhook subscribed to the event. Simulation does **not** update the resource (for example, it will not mark a shipment as delivered).
{% endhint %}

#### Example request

```json
{
  "event": "shipment.delivered",
  "shipment_id": "SH-ABC123"
}
```

#### Example request (multiple events)

```
{
  "events": ["transaction.success", "transaction.failed"],
  "transaction_id": "TXN-9Z8Y7X6W5V4U3T2S"
}
```

{% tabs %}
{% tab title="200: Webhook simulation queued successfully" %}

```
{
  "status": true,
  "message": "Webhook simulation queued successfully",
  "data": {
    "results": [
      {
        "event": "shipment.delivered",
        "resource_type": "shipment",
        "resource_id": "SH-ABC123",
        "queued": true
      }
    ]
  }
}
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.terminal.africa/tship/webhooks/simulate-webhook.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
