Managing webhook subscriptions via the API
In addition to the web app control panel, you can create and manage webhook subscriptions programmatically through the public API using your API key.
AuthenticationAll endpoints below require your API key. Add the token as the
Authorizationheader value directly, with noBearerprefix (the same way as the rest of the public API — see Starting with the API). For example:Authorization: <your-token>.
Supported eventsThe public API currently supports two events:
invoice_status(event ID6) andpayment_status_changed(event ID1). TheselectedEventsfield accepts an array of these event IDs.
List available events
Returns the webhook events you can subscribe to via the public API.
GET /api/v1/webhooks/events
Example response
{
"events": [
{
"id": 6,
"name": "invoice_status",
"description": "status of the invoice and details of the invoice"
},
{
"id": 1,
"name": "payment_status_changed",
"description": "status changes for payments, including direct payments"
}
]
}Create a webhook subscription
POST /api/v1/webhooks/subscriptions
Request body
| Name | Type | Description | Required |
|---|---|---|---|
| url | string | The HTTPS URL that will receive webhook deliveries | yes |
| secret | string | A secret used to generate the HMAC SHA-256 signature for delivered payloads | no |
| selectedEvents | number[] | Event IDs to subscribe to (6 = invoice_status, 1 = payment_status_changed) | yes |
| isActive | boolean | Whether the subscription is active | yes |
Example request
{
"url": "https://your-app.com/webhooks/snaprefund",
"secret": "your-secret-key",
"selectedEvents": [6],
"isActive": true
}Example response
{
"id": 1,
"url": "https://your-app.com/webhooks/snaprefund",
"isSecretExists": true,
"isActive": true,
"selectedEvents": [6]
}List your webhook subscriptions
GET /api/v1/webhooks/subscriptions
Returns a paginated list of the webhook subscriptions belonging to your account.
Get a webhook subscription by ID
GET /api/v1/webhooks/subscriptions/{id}
Update a webhook subscription
PUT /api/v1/webhooks/subscriptions/{id}
Accepts the same body as create. Use this to change the url, rotate the secret, toggle isActive, or update selectedEvents.
Delete a webhook subscription
DELETE /api/v1/webhooks/subscriptions/{id}
Example response
{
"message": "Webhook subscription deleted successfully",
"deletedSubscription": {
"id": 1,
"url": "https://your-app.com/webhooks/snaprefund"
}
}