# Webhooks

Signed events sent to your endpoints.

Related guide: [Webhooks](https://provenanceauth.com/docs/integrate/webhooks.md)

## Endpoints

- `POST /v1/webhook_endpoints`: [Create a webhook endpoint](#post-v1-webhook-endpoints)
- `GET /v1/webhook_endpoints/{id}/deliveries/{delivery_id}`: [Retrieve a webhook delivery](#get-v1-webhook-endpoints-id-deliveries-delivery-id)
- `GET /v1/webhook_deliveries/{id}`: [Retrieve a delivery by ID](#get-v1-webhook-deliveries-id)
- `PATCH /v1/webhook_endpoints/{id}`: [Update a webhook endpoint](#patch-v1-webhook-endpoints-id)
- `GET /v1/webhook_endpoints`: [List webhook endpoints](#get-v1-webhook-endpoints)
- `GET /v1/webhook_endpoints/{id}/deliveries`: [List webhook deliveries](#get-v1-webhook-endpoints-id-deliveries)
- `GET /v1/webhook_deliveries`: [List deliveries across endpoints](#get-v1-webhook-deliveries)
- `DELETE /v1/webhook_endpoints/{id}`: [Delete a webhook endpoint](#delete-v1-webhook-endpoints-id)
- `POST /v1/webhook_endpoints/{id}/rotate_secret`: [Rotate a webhook secret](#post-v1-webhook-endpoints-id-rotate-secret)
- `POST /v1/webhook_endpoints/{id}/test`: [Send a test event](#post-v1-webhook-endpoints-id-test)
- `POST /v1/webhook_deliveries/{id}/resend`: [Resend a webhook delivery](#post-v1-webhook-deliveries-id-resend)
- `POST /v1/webhook_endpoints/{id}/replay`: [Replay events to an endpoint](#post-v1-webhook-endpoints-id-replay)

## The webhook endpoint object

### Attributes

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `endpoint_id` | string | no | ULID. |
| `url` | string | no | A URL. |
| `event_types` | array of strings | no | `["*"]` = all events. |
| `status` | enum | no | The object's current status. One of `active`, `disabled`. |
| `disabled_reason` | string \| null | no | Why the endpoint was disabled; null while active. |
| `api_version` | string | no | The API version this endpoint's deliveries are rendered at, also sent in their `Provenance-Version` header. |
| `created_at` | timestamp | no | When it was created. |
| `secret` | string | no | Signing secret — returned ONCE at create/rotate. |
| `id` | string | no | Unique identifier for the object. |
| `object` | enum | no | The type of object. One of `webhook_endpoint`. |
| `deleted` | boolean | no | Always true for a deleted object. |

### Example

```json
{
  "id": "we_01M7VG2TWS6YA9MAP6NJVS9TJQ",
  "object": "webhook_endpoint",
  "url": "http://localhost:4242/webhooks",
  "event_types": [
    "mandate.approval.approved",
    "mandate.assessment.denied"
  ],
  "status": "active",
  "disabled_reason": null,
  "api_version": "2026-11-30",
  "created_at": "2026-11-20T03:30:27.865Z",
  "secret": "whsec_7L6n4NbZNct2ViiuHADt99AmSp0WrR573EkJgg"
}
```

## Events

Sent to your [webhook endpoints](https://provenanceauth.com/docs/integrate/webhooks.md) when they subscribe:

- `ping`

## Create a webhook endpoint

`POST /v1/webhook_endpoints`

Registers a URL to receive signed events of the types you choose, or all of them. The signing secret is returned once.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `url` | body | string | yes | A URL. |
| `event_types` | body | array of strings | no | The event types, or `*` for all. |
| `api_version` | body | string | no | The API version deliveries are rendered at, such as `2026-11-30`. Defaults to the version this request uses. |

### Returns

The endpoint, with its `secret`. The secret is shown only once. See [the webhook endpoint object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`usage_limit_reached`](https://provenanceauth.com/docs/platform/errors.md#usage_limit_reached)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -X POST "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved",
      "mandate.assessment.denied"
    ]
  }'
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved",
      "mandate.assessment.denied"
    ]
  }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "url": "http://localhost:4242/webhooks",
    "event_types": [
        "mandate.approval.approved",
        "mandate.assessment.denied"
    ]
}).json()
```

### Response 201

```json
{
  "id": "we_01M7VG2TWS6YA9MAP6NJVS9TJQ",
  "object": "webhook_endpoint",
  "url": "http://localhost:4242/webhooks",
  "event_types": [
    "mandate.approval.approved",
    "mandate.assessment.denied"
  ],
  "status": "active",
  "disabled_reason": null,
  "api_version": "2026-11-30",
  "created_at": "2026-11-20T03:30:27.865Z",
  "secret": "whsec_7L6n4NbZNct2ViiuHADt99AmSp0WrR573EkJgg"
}
```

## Retrieve a webhook delivery

`GET /v1/webhook_endpoints/{id}/deliveries/{delivery_id}`

One delivery with the event it carried and every attempt (automatic and resent), each with your endpoint's status, latency, a few headers and the first 4 KB of its response.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The endpoint's ID. |
| `delivery_id` | path | string | yes | The delivery's ID. |

### Returns

The delivery with its attempts. Deliveries and attempts are kept 30 days.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }' > step.json
export ENDPOINT_ID=$(jq -r '.id' step.json)
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints/$ENDPOINT_ID/test" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > step.json
export DELIVERY_ID=$(jq -r '.id' step.json)
curl "$PROVENANCE_API/v1/webhook_endpoints/$ENDPOINT_ID/deliveries/$DELIVERY_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }),
})).json();
const endpointId = step1.id;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}/test`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const deliveryId = step2.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}/deliveries/${deliveryId}`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "url": "http://localhost:4242/webhooks",
    "event_types": [
        "mandate.approval.approved"
    ]
}).json()
endpoint_id = step1["id"]
step2 = httpx.post(f"{api}/v1/webhook_endpoints/{endpoint_id}/test", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
delivery_id = step2["id"]
data = httpx.get(f"{api}/v1/webhook_endpoints/{endpoint_id}/deliveries/{delivery_id}", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "id": "dlv_01M6VQBCVC1XZA70T320CX770E",
  "object": "webhook_delivery",
  "event_id": "evt_01M6VQBCVCG3BXM3WGEA2B4SYY",
  "event_type": "ping",
  "status": "failed",
  "attempts": 1,
  "last_status_code": null,
  "last_error": "connection failed",
  "next_attempt_at": "2026-11-07T19:22:46.604Z",
  "delivered_at": null,
  "created_at": "2026-11-07T19:21:46.604Z",
  "endpoint_id": "we_01M6VQBCVBNAEWF4FBT90GY2QE",
  "payload": {
    "id": "evt_01M6VQBCVCG3BXM3WGEA2B4SYY",
    "object": "event",
    "type": "ping",
    "created_at": "2026-11-07T19:21:46.604Z",
    "environment": "sandbox",
    "account_id": "acct_000000000000000000000000000000a2",
    "data": {
      "message": "This is a test event from Provenance webhooks."
    }
  },
  "delivery_attempts": [
    {
      "id": "wha_01M6VQBCVCJ8J7F5BF6T1Z4NR7",
      "object": "webhook_delivery_attempt",
      "attempt_no": 1,
      "trigger": "automatic",
      "started_at": "2026-11-07T19:21:46.604Z",
      "duration_ms": 0,
      "status_code": null,
      "error": "connection failed",
      "response_headers": {},
      "response_body": null
    }
  ]
}
```

## Retrieve a delivery by ID

`GET /v1/webhook_deliveries/{id}`

One delivery, whichever endpoint it went to, with the event it carried and every attempt (automatic and resent), each with your endpoint's status, latency, a few headers and the first 4 KB of its response.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The delivery's ID. |

### Returns

The delivery with its attempts. Deliveries and attempts are kept 30 days.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }' > step.json
export ENDPOINT_ID=$(jq -r '.id' step.json)
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints/$ENDPOINT_ID/test" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > step.json
export DELIVERY_ID=$(jq -r '.id' step.json)
curl "$PROVENANCE_API/v1/webhook_deliveries/$DELIVERY_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }),
})).json();
const endpointId = step1.id;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}/test`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const deliveryId = step2.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_deliveries/${deliveryId}`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "url": "http://localhost:4242/webhooks",
    "event_types": [
        "mandate.approval.approved"
    ]
}).json()
endpoint_id = step1["id"]
step2 = httpx.post(f"{api}/v1/webhook_endpoints/{endpoint_id}/test", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
delivery_id = step2["id"]
data = httpx.get(f"{api}/v1/webhook_deliveries/{delivery_id}", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "id": "dlv_01M6Z02PKSNMDCKP7T8Z134EJM",
  "object": "webhook_delivery",
  "event_id": "evt_01M6Z02PKSD9RWRTCFQYP1CG77",
  "event_type": "ping",
  "status": "failed",
  "attempts": 1,
  "last_status_code": null,
  "last_error": "connection failed",
  "next_attempt_at": "2026-11-09T01:53:02.169Z",
  "delivered_at": null,
  "created_at": "2026-11-09T01:52:02.169Z",
  "endpoint_id": "we_01M6Z02PKKSD626PT08479ESJR",
  "endpoint_url": "http://localhost:4242/webhooks",
  "payload": {
    "id": "evt_01M6Z02PKSD9RWRTCFQYP1CG77",
    "object": "event",
    "type": "ping",
    "created_at": "2026-11-09T01:52:02.169Z",
    "environment": "sandbox",
    "account_id": "acct_000000000000000000000000000000a2",
    "data": {
      "message": "This is a test event from Provenance webhooks."
    }
  },
  "delivery_attempts": [
    {
      "id": "wha_01M6Z02PKX3G4AWMZE4M9GEXQX",
      "object": "webhook_delivery_attempt",
      "attempt_no": 1,
      "trigger": "automatic",
      "started_at": "2026-11-09T01:52:02.169Z",
      "duration_ms": 4,
      "status_code": null,
      "error": "connection failed",
      "response_headers": {},
      "response_body": null
    }
  ]
}
```

## Update a webhook endpoint

`PATCH /v1/webhook_endpoints/{id}`

Changes an endpoint's URL, event types or status. Set status active to re-enable a disabled endpoint.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The object's ID. |
| `url` | body | string | no | A URL. |
| `event_types` | body | array of strings | no | The event types, or `*` for all. |
| `status` | body | enum | no | The object's current status. One of `active`, `disabled`. |
| `api_version` | body | string | no | The API version deliveries are rendered at, such as `2026-11-30`. |

### Returns

The updated endpoint. See [the webhook endpoint object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`invalid_json`](https://provenanceauth.com/docs/platform/errors.md#invalid_json)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }' > step.json
export ENDPOINT_ID=$(jq -r '.id' step.json)
curl -X PATCH "$PROVENANCE_API/v1/webhook_endpoints/$ENDPOINT_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "event_types": ["*"] }'
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }),
})).json();
const endpointId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}`, {
  method: "PATCH",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "event_types": ["*"] }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "url": "http://localhost:4242/webhooks",
    "event_types": [
        "mandate.approval.approved"
    ]
}).json()
endpoint_id = step1["id"]
data = httpx.patch(f"{api}/v1/webhook_endpoints/{endpoint_id}", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "event_types": [
        "*"
    ]
}).json()
```

### Response 200

```json
{
  "id": "we_01M7VG2X9C4NTC9DX7QNNG7KX4",
  "object": "webhook_endpoint",
  "url": "http://localhost:4242/webhooks",
  "event_types": [
    "*"
  ],
  "status": "active",
  "disabled_reason": null,
  "api_version": "2026-11-30",
  "created_at": "2026-11-20T03:30:30.316Z"
}
```

## List webhook endpoints

`GET /v1/webhook_endpoints`

Lists your account's webhook endpoints, without their secrets.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `q` | query | string | no | Search text. Matches when the endpoint's URL or ID contains it, ignoring case. At most 200 characters. |
| `status` | query | array of enums | no | Only endpoints in these statuses. One value, or several separated by commas. |

### Returns

The webhook endpoints. Secrets aren't returned.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
data = httpx.get(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "object": "list",
  "data": [],
  "has_more": false,
  "next_cursor": null
}
```

## List webhook deliveries

`GET /v1/webhook_endpoints/{id}/deliveries`

Lists an endpoint's delivery attempts, newest first, with each status, response code and error.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The object's ID. |
| `limit` | query | integer | no | The most items to return, from 1 to 100. The default is 20. |

### Returns

The endpoint's deliveries, newest first. Finished deliveries and their attempts are kept 30 days; pending and retrying ones until they finish.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }' > step.json
export ENDPOINT_ID=$(jq -r '.id' step.json)
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints/$ENDPOINT_ID/test" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > /dev/null
curl "$PROVENANCE_API/v1/webhook_endpoints/$ENDPOINT_ID/deliveries" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }),
})).json();
const endpointId = step1.id;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}/test`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}/deliveries`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "url": "http://localhost:4242/webhooks",
    "event_types": [
        "mandate.approval.approved"
    ]
}).json()
endpoint_id = step1["id"]
step2 = httpx.post(f"{api}/v1/webhook_endpoints/{endpoint_id}/test", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
data = httpx.get(f"{api}/v1/webhook_endpoints/{endpoint_id}/deliveries", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "object": "list",
  "data": [
    {
      "id": "dlv_01M6VQBCVAT8K1TERC64STFV8H",
      "object": "webhook_delivery",
      "event_id": "evt_01M6VQBCVAAC18V3P0VFJWP2T4",
      "event_type": "ping",
      "status": "failed",
      "attempts": 1,
      "last_status_code": null,
      "last_error": "connection failed",
      "next_attempt_at": "2026-11-07T19:22:46.602Z",
      "delivered_at": null,
      "created_at": "2026-11-07T19:21:46.602Z"
    }
  ],
  "has_more": false,
  "next_cursor": null
}
```

## List deliveries across endpoints

`GET /v1/webhook_deliveries`

Lists your account's webhook deliveries to every endpoint, newest first, with filters. Each item names the endpoint it went to. Finished deliveries are kept 30 days; pending and retrying ones until they finish.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `limit` | query | integer | no | Page size, 1–100 (default 20). Outside the range → 400 parameter_invalid. |
| `cursor` | query | string | no | Opaque; pass a response's `next_cursor` back to get the next page. |
| `endpoint_id` | query | string | no | Only deliveries to this endpoint. |
| `status` | query | array of enums | no | Only deliveries in these statuses. One value, or several separated by commas. |
| `event_type` | query | array of strings | no | Only deliveries of these event types, such as `mandate.approval.approved` or `ping`. One value, or several separated by commas. |
| `q` | query | string | no | Search text. Matches when the delivery's ID, the event's ID or the event type contains it, ignoring case. At most 200 characters. |
| `created_gte` | query | timestamp | no | Only deliveries created at or after this time. |
| `created_lte` | query | timestamp | no | Only deliveries created at or before this time. |

### Returns

One page of deliveries, newest first.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }' > step.json
export ENDPOINT_ID=$(jq -r '.id' step.json)
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints/$ENDPOINT_ID/test" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > step.json
export DELIVERY_ID=$(jq -r '.id' step.json)
curl "$PROVENANCE_API/v1/webhook_deliveries?status=failed%2Cexhausted" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }),
})).json();
const endpointId = step1.id;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}/test`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const deliveryId = step2.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_deliveries?status=failed%2Cexhausted`, {
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "url": "http://localhost:4242/webhooks",
    "event_types": [
        "mandate.approval.approved"
    ]
}).json()
endpoint_id = step1["id"]
step2 = httpx.post(f"{api}/v1/webhook_endpoints/{endpoint_id}/test", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
delivery_id = step2["id"]
data = httpx.get(f"{api}/v1/webhook_deliveries?status=failed%2Cexhausted", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "object": "list",
  "data": [
    {
      "id": "dlv_01M6Z02FN4PMY8923G1P8RFRZ2",
      "object": "webhook_delivery",
      "event_id": "evt_01M6Z02FN4F8JYCCDFQX6ABMXY",
      "event_type": "ping",
      "status": "failed",
      "attempts": 1,
      "last_status_code": null,
      "last_error": "connection failed",
      "next_attempt_at": "2026-11-09T01:52:55.044Z",
      "delivered_at": null,
      "created_at": "2026-11-09T01:51:55.044Z",
      "endpoint_id": "we_01M6Z02FMZFJ9ZEXW9FP2S57P0",
      "endpoint_url": "http://localhost:4242/webhooks"
    }
  ],
  "has_more": false,
  "next_cursor": null
}
```

## Delete a webhook endpoint

`DELETE /v1/webhook_endpoints/{id}`

Deletes an endpoint. Undelivered events to it are dropped.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | string | yes | The object's ID. |

### Returns

The deleted object. See [the webhook endpoint object](#object).

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }' > step.json
export ENDPOINT_ID=$(jq -r '.id' step.json)
curl -X DELETE "$PROVENANCE_API/v1/webhook_endpoints/$ENDPOINT_ID" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }),
})).json();
const endpointId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}`, {
  method: "DELETE",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "url": "http://localhost:4242/webhooks",
    "event_types": [
        "mandate.approval.approved"
    ]
}).json()
endpoint_id = step1["id"]
data = httpx.delete(f"{api}/v1/webhook_endpoints/{endpoint_id}", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "id": "we_01M6VQBCV3CJFKE4DX5NNAY8Z8",
  "object": "webhook_endpoint",
  "deleted": true
}
```

## Rotate a webhook secret

`POST /v1/webhook_endpoints/{id}/rotate_secret`

Replaces an endpoint's signing secret and returns the new one, once. The old secret stops verifying at once, or, with `previous_secret_expires_in`, keeps signing beside the new one for up to 24 hours.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `id` | path | string | yes | The object's ID. |
| `previous_secret_expires_in` | body | integer | no | Seconds the replaced secret keeps signing beside the new one (up to 24 hours). Leave it out to stop the old secret now. |

### Returns

The endpoint with a new `secret`. It's shown only once.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }' > step.json
export ENDPOINT_ID=$(jq -r '.id' step.json)
curl -X POST "$PROVENANCE_API/v1/webhook_endpoints/$ENDPOINT_ID/rotate_secret" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "previous_secret_expires_in": 86400 }'
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }),
})).json();
const endpointId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}/rotate_secret`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "previous_secret_expires_in": 86400 }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "url": "http://localhost:4242/webhooks",
    "event_types": [
        "mandate.approval.approved"
    ]
}).json()
endpoint_id = step1["id"]
data = httpx.post(f"{api}/v1/webhook_endpoints/{endpoint_id}/rotate_secret", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "previous_secret_expires_in": 86400
}).json()
```

### Response 200

```json
{
  "id": "we_01M7W7Y8NV9N69A2QP1B96CZ1M",
  "object": "webhook_endpoint",
  "url": "http://localhost:4242/webhooks",
  "event_types": [
    "mandate.approval.approved"
  ],
  "status": "active",
  "disabled_reason": null,
  "api_version": "2026-11-30",
  "created_at": "2026-11-20T10:27:23.963Z",
  "secret": "whsec_kste75cSMHDTMgMWLvdRtzXXzrkoRogM4ExRa7",
  "previous_secret_expires_at": "2026-11-21T10:27:23.971Z"
}
```

## Send a test event

`POST /v1/webhook_endpoints/{id}/test`

Sends a signed ping event to the endpoint and returns the delivery.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `id` | path | string | yes | The object's ID. |

### Returns

The test delivery.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }' > step.json
export ENDPOINT_ID=$(jq -r '.id' step.json)
curl -X POST "$PROVENANCE_API/v1/webhook_endpoints/$ENDPOINT_ID/test" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }),
})).json();
const endpointId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}/test`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "url": "http://localhost:4242/webhooks",
    "event_types": [
        "mandate.approval.approved"
    ]
}).json()
endpoint_id = step1["id"]
data = httpx.post(f"{api}/v1/webhook_endpoints/{endpoint_id}/test", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "id": "dlv_01M6VQBCV5QV6WR4AZ4M112MK0",
  "object": "webhook_delivery",
  "event_id": "evt_01M6VQBCV5C17RXAMN3ZGH3049",
  "event_type": "ping",
  "status": "failed",
  "attempts": 1,
  "last_status_code": null,
  "last_error": "connection failed",
  "next_attempt_at": "2026-11-07T19:22:46.597Z",
  "delivered_at": null,
  "created_at": "2026-11-07T19:21:46.597Z"
}
```

## Resend a webhook delivery

`POST /v1/webhook_deliveries/{id}/resend`

Sends a delivery again now, signed fresh, as a new attempt on the same delivery with the same event ID. A failure leaves the automatic retries as they were. 30 a minute per account.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `id` | path | string | yes | The delivery's ID. |

### Returns

The delivery after the attempt, with every attempt.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`webhook_endpoint_disabled`](https://provenanceauth.com/docs/platform/errors.md#webhook_endpoint_disabled)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`webhooks_unavailable`](https://provenanceauth.com/docs/platform/errors.md#webhooks_unavailable)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }' > step.json
export ENDPOINT_ID=$(jq -r '.id' step.json)
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints/$ENDPOINT_ID/test" \
  -H "Authorization: Bearer $PROVENANCE_KEY" > step.json
export DELIVERY_ID=$(jq -r '.id' step.json)
curl -X POST "$PROVENANCE_API/v1/webhook_deliveries/$DELIVERY_ID/resend" \
  -H "Authorization: Bearer $PROVENANCE_KEY"
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.approval.approved"
    ]
  }),
})).json();
const endpointId = step1.id;
const step2 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}/test`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
const deliveryId = step2.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_deliveries/${deliveryId}/resend`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5" },
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "url": "http://localhost:4242/webhooks",
    "event_types": [
        "mandate.approval.approved"
    ]
}).json()
endpoint_id = step1["id"]
step2 = httpx.post(f"{api}/v1/webhook_endpoints/{endpoint_id}/test", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
delivery_id = step2["id"]
data = httpx.post(f"{api}/v1/webhook_deliveries/{delivery_id}/resend", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}).json()
```

### Response 200

```json
{
  "id": "dlv_01M6VQBCVE8BEYMKC9XNH6SSPG",
  "object": "webhook_delivery",
  "event_id": "evt_01M6VQBCVE0EQPYC4CZKRCA12Q",
  "event_type": "ping",
  "status": "failed",
  "attempts": 1,
  "last_status_code": null,
  "last_error": "connection failed",
  "next_attempt_at": "2026-11-07T19:22:46.606Z",
  "delivered_at": null,
  "created_at": "2026-11-07T19:21:46.606Z",
  "endpoint_id": "we_01M6VQBCVDXFGTRWWNQTVTHG22",
  "delivery_attempts": [
    {
      "id": "wha_01M6VQBCVFF26ZBYT28PZC1VV8",
      "object": "webhook_delivery_attempt",
      "attempt_no": 1,
      "trigger": "automatic",
      "started_at": "2026-11-07T19:21:46.606Z",
      "duration_ms": 1,
      "status_code": null,
      "error": "connection failed",
      "response_headers": {},
      "response_body": null
    },
    {
      "id": "wha_01M6VQBCVG3GJXMZ5F3F47WTDG",
      "object": "webhook_delivery_attempt",
      "attempt_no": 2,
      "trigger": "resend",
      "started_at": "2026-11-07T19:21:46.607Z",
      "duration_ms": 1,
      "status_code": null,
      "error": "connection failed",
      "response_headers": {},
      "response_body": null
    }
  ]
}
```

## Replay events to an endpoint

`POST /v1/webhook_endpoints/{id}/replay`

Queues a fresh delivery to the endpoint for every stored event since a time (and before `until`) that the endpoint subscribes to, oldest first: recovery after an outage. Up to 10,000 per call; 10 calls an hour per account.

Auth: an API key, as `Authorization: Bearer <key>`.

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Idempotency-Key` | header | string | no | Retry a create safely: the same key + request returns the stored response (24 h, per caller). |
| `id` | path | string | yes | The endpoint's ID. |
| `since` | body | timestamp | yes | Replay events at or after this time. |
| `until` | body | timestamp | no | Replay events at or before this time (default now). |
| `types` | body | array of strings | no | Only these event types (within the endpoint's subscription). |

### Returns

The deliveries were queued; the worker sends them like any other.

### Errors

- [`authentication_required`](https://provenanceauth.com/docs/platform/errors.md#authentication_required)
- [`parameter_invalid`](https://provenanceauth.com/docs/platform/errors.md#parameter_invalid)
- [`parameter_missing`](https://provenanceauth.com/docs/platform/errors.md#parameter_missing)
- [`resource_missing`](https://provenanceauth.com/docs/platform/errors.md#resource_missing)
- [`webhook_endpoint_disabled`](https://provenanceauth.com/docs/platform/errors.md#webhook_endpoint_disabled)
- [`rate_limit_exceeded`](https://provenanceauth.com/docs/platform/errors.md#rate_limit_exceeded)
- [`webhooks_unavailable`](https://provenanceauth.com/docs/platform/errors.md#webhooks_unavailable)

### Request

**curl**

```bash
export PROVENANCE_KEY=prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5
curl -s -X POST "$PROVENANCE_API/v1/webhook_endpoints" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.intent.revoked"
    ]
  }' > step.json
export ENDPOINT_ID=$(jq -r '.id' step.json)
curl -X POST "$PROVENANCE_API/v1/webhook_endpoints/$ENDPOINT_ID/replay" \
  -H "Authorization: Bearer $PROVENANCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{ "since": "2026-11-01T00:00:00Z", "types": ["mandate.intent.revoked"] }'
```

**Node**

```ts
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({
    "url": "http://localhost:4242/webhooks",
    "event_types": [
      "mandate.intent.revoked"
    ]
  }),
})).json();
const endpointId = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/webhook_endpoints/${endpointId}/replay`, {
  method: "POST",
  headers: { Authorization: "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5", "Content-Type": "application/json" },
  body: JSON.stringify({ "since": "2026-11-01T00:00:00Z", "types": ["mandate.intent.revoked"] }),
})).json();
```

**Python**

```python
import os
import httpx

api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/webhook_endpoints", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "url": "http://localhost:4242/webhooks",
    "event_types": [
        "mandate.intent.revoked"
    ]
}).json()
endpoint_id = step1["id"]
data = httpx.post(f"{api}/v1/webhook_endpoints/{endpoint_id}/replay", headers={"Authorization": "Bearer prv_test_acct_P9xN2vQ7bT4mW8sYd3cFjLh6gAe1kR5"}, json={
    "since": "2026-11-01T00:00:00Z",
    "types": [
        "mandate.intent.revoked"
    ]
}).json()
```

### Response 202

```json
{
  "object": "webhook_replay",
  "endpoint_id": "we_01M6VQBCVH6GYT9GWN41KWK8AF",
  "since": "2026-11-01T00:00:00Z",
  "until": null,
  "types": [
    "mandate.intent.revoked"
  ],
  "queued": 0,
  "max_events": 10000,
  "capped": false,
  "resume_since": null
}
```
