> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prava.space/llms.txt
> Use this file to discover all available pages before exploring further.

# Webhook API

> Manage endpoints and retrieve retained events with a server-side secret key.

> [!NOTE]
>
> Configuration, test and replay mutations return `WEBHOOKS_DISABLED` while delivery is disabled. Authenticated GET routes keep returning retained events and delivery history for recovery.

Manage endpoints and recover events from your own server with your application's secret key. For each operation's parameters, request body and response fields, see the [Webhooks API reference](https://docs.prava.space/api-reference/webhooks/overview.md).

## Authentication

| Environment | Base URL |
| - | - |
| Sandbox | `https://sandbox.api.prava.space` |
| Production | `https://api.prava.space` |

Send `Authorization: Bearer YOUR_APPLICATION_SECRET_KEY`. The key identifies the application, so you can't choose a different owner in a request body.

A secret key grants control over its application's webhook configuration. Dashboard role restrictions apply only to dashboard users, so don't give application secret keys to read-only team members.

## Operations

| Method | Path | Purpose |
| - | - | - |
| GET | `/v1/webhook-event-types` | [Supported events, schemas, examples and schema version](https://docs.prava.space/api-reference/webhooks/list-event-types.md) |
| GET / POST | `/v1/webhook-endpoints` | [List](https://docs.prava.space/api-reference/webhooks/list-endpoints.md) / [create](https://docs.prava.space/api-reference/webhooks/create-endpoint.md) endpoints |
| GET / PATCH / DELETE | `/v1/webhook-endpoints/{endpointId}` | [Inspect](https://docs.prava.space/api-reference/webhooks/get-endpoint.md) / [update](https://docs.prava.space/api-reference/webhooks/update-endpoint.md) / [delete](https://docs.prava.space/api-reference/webhooks/delete-endpoint.md) |
| POST | `/v1/webhook-endpoints/{endpointId}/verify` | [Send a signed nonce challenge](https://docs.prava.space/api-reference/webhooks/verify-endpoint.md) |
| POST | `/v1/webhook-endpoints/{endpointId}/test` | [Send a test for a subscribed event](https://docs.prava.space/api-reference/webhooks/send-test-event.md) |
| POST | `/v1/webhook-endpoints/{endpointId}/rotate-secret` | [Rotate with a 24-hour overlap](https://docs.prava.space/api-reference/webhooks/rotate-signing-secret.md) |
| GET | `/v1/webhook-endpoints/{endpointId}/deliveries` | [Newest-first history, 50 per page](https://docs.prava.space/api-reference/webhooks/list-deliveries.md) |
| GET | `/v1/webhook-deliveries/{deliveryId}` | [Delivery details and safe attempts](https://docs.prava.space/api-reference/webhooks/get-delivery.md) |
| POST | `/v1/webhook-deliveries/{deliveryId}/replay` | [Replay a retained event](https://docs.prava.space/api-reference/webhooks/replay-delivery.md) |
| GET | `/v1/events` | [Event recovery in recorded order, 50 per page](https://docs.prava.space/api-reference/webhooks/list-events.md) |
| GET | `/v1/events/{eventId}` | [Retrieve one retained event](https://docs.prava.space/api-reference/webhooks/get-event.md) |

## Create an endpoint

```bash theme={null}
curl https://sandbox.api.prava.space/v1/webhook-endpoints \
  -H 'Authorization: Bearer YOUR_SECRET_KEY' \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: register-receiver-0001' \
  -d '{"name":"Payments","url":"https://api.example.com/prava/webhooks","events":["payment.succeeded","payment.failed"]}'
```

Creation returns `{ "endpoint": { ... }, "signing_secret": "whsec_..." }`. The endpoint starts paused and unverified; you must verify it before enabling it.

## Request conventions

| Topic | Rule |
| - | - |
| Idempotency | Create, rotate and replay require an `Idempotency-Key` header of 8–120 letters, digits, underscores or hyphens. Reuse the same key when you retry. Reusing a key for a create with changed input fails with a conflict. |
| Signing secrets | Returned only on the original successful create or rotate response. Retries report completion without showing the secret again. |
| Update | PATCH accepts any of `name`, `url`, `events` and `enabled`. |
| Test | Accepts `{ "type": "payment.succeeded" }`. |
| Other POST controls | Accept an empty body. For operations without a payload, omit `Content-Type: application/json`; send it only when you send JSON. |
| Pagination | History APIs return `next_cursor` or `null`. Send the cursor back unchanged on the next request. |
| Errors | `{ "error": { "code": "...", "message": "..." } }` |

## Errors

| Status | Meaning |
| - | - |
| `404` | The resource doesn't exist for this application. |
| `409` | The operation isn't supported in the current state, for example before verification. |
| `409 WEBHOOK_CHALLENGE_FAILED` | The signed verification challenge wasn't echoed in a complete JSON response. Echo the exact `challenge` value with `2xx`. |
| `422 WEBHOOK_RECEIVER_UNAVAILABLE` | Verify or Send test couldn't reach the public receiver securely. Check its public DNS, HTTPS certificate and availability before retrying. |

Outages on Prava's side return platform errors.

## Recover events

Filter `/v1/events` with:

| Filter | Value |
| - | - |
| `type` | An event type |
| `resource_id` | `txn_...`, `ses_...`, `qreq_...` or `mdt_...`. Underscores are allowed; at most 120 characters. |
| `from` | Inclusive ISO timestamp |
| `to` | Exclusive ISO timestamp. With `from`, use an increasing range of at most 30 days. |

Keep the same filters while you advance `cursor`. Events stay scoped to the authenticated application and environment.

## Check queued delivery

For a non-financial check of queued delivery, activate the verified endpoint and send `{ "type": "card_enrollment.completed", "queued": true }` to the test route. It returns `{ "queued": true, "event_id": "evt_..." }`; inspect delivery history for acceptance and retries.

Every synthetic payload has `test: true` and contains example data. This verifies delivery, not enrollment or financial provider behavior.

## Endpoint health

Endpoint responses include a nullable `blocked_reason`. See [Endpoint health reasons](https://docs.prava.space/webhooks/delivery.md#endpoint-health-reasons) for `RECEIVER_UNACKNOWLEDGED`, `DELIVERY_FAILURE_LIMIT`, `HTTP_GONE` and `DESTINATION_BLOCKED`.

* Endpoints paused automatically for health keep new subscribed events within the original retry window.
* An explicit manual pause stops new events from being queued for that endpoint.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.