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

# Webhooks

Programmatic management of webhook subscriptions. See [Webhooks & Events](/agents-and-automation/webhooks-and-events.md) for the event catalog and payload format.

***

## Create a webhook subscription

```
POST /v1/webhooks
```

### Request body

```json
{
  "url": "https://yourapp.com/hooks/shadowpay",
  "events": ["transfer.confirmed", "agent.transaction.pending_approval"]
}
```

### Response

```json
{
  "webhook_id": "wh_2c9f1a",
  "url": "https://yourapp.com/hooks/shadowpay",
  "events": ["transfer.confirmed", "agent.transaction.pending_approval"],
  "secret": "whsec_xxxxxxxxxxxxxxxxxxxx",
  "created_at": "2026-07-02T09:00:00Z"
}
```

The `secret` is shown once. Use it to verify the `X-ShadowPay-Signature` header on incoming deliveries.

***

## List webhook subscriptions

```
GET /v1/webhooks
```

***

## Delete a webhook subscription

```
DELETE /v1/webhooks/{webhook_id}
```

Deletion is immediate. No further deliveries will be attempted for that subscription.

***

## Verifying a delivery

Every delivery includes an `X-ShadowPay-Signature` header, an HMAC-SHA256 of the raw request body, signed with your webhook secret.

```python
import hmac
import hashlib

def verify_signature(payload_bytes, signature_header, secret):
    expected = hmac.new(
        secret.encode(),
        payload_bytes,
        hashlib.sha256
    ).hexdigest()
    return hmac.compare_digest(expected, signature_header)
```

Reject any delivery whose signature doesn't match before processing it.

***

## Replaying a missed delivery

```
POST /v1/webhooks/{webhook_id}/replay/{event_id}
```

Useful if your endpoint was briefly down and you want to manually recover a specific event rather than waiting for the automatic retry schedule.

***

## Delivery log

```
GET /v1/webhooks/{webhook_id}/deliveries
```

Returns the recent delivery history for a subscription, including response status codes and retry counts, for debugging failed integrations.


---

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