Webhooks notify your system in real time whenever something happens on Z2Pay (a transaction was paid, a withdrawal was rejected, an invoice was issued, etc.). This page covers webhook management (CRUD) and delivery history (deliveries).
All requests require the x-api-key header. See Authentication .
Endpoints
Webhook configuration
Method Route Description POST/webhooksCreate a webhook GET/webhooksList webhooks (paginated) GET/webhooks/listenersList the available event catalog GET/webhooks/:idFetch a webhook by ID PUT/webhooks/:idUpdate a webhook PATCH/webhooks/:id/statusEnable or disable a webhook DELETE/webhooks/:idRemove a webhook (soft delete)
Delivery history
Method Route Description GET/webhooks/deliveriesList deliveries (paginated, with filters) GET/webhooks/deliveries/:idFetch a delivery by ID POST/webhooks/deliveries/:id/retryRetry a delivery
The webhook URL must use HTTPS and point to a public host. URLs that resolve to
localhost, private IP ranges (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16),
link-local/cloud metadata addresses (169.254.0.0/16, metadata.google.internal), or schemes
other than http/https are rejected with 400. This protects against SSRF attacks.
Create webhook
POST /webhooks
Registers a new webhook. Returns 201 with the created webhook.
Identifying name for the webhook. Between 1 and 255 characters.
Public HTTPS URL that will receive the notifications. Internal/private URLs are rejected (see the warning above).
List of events to subscribe to. Each value must be a code from the
event catalog . If sent empty (or omitted), the webhook
listens to ALL events.
This endpoint accepts the Idempotency-Key header to prevent duplicate creations. See Conventions .
curl -X POST https://api.sandbox.z2pay.com/webhooks \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: 3f1c8a90-2b7d-4d2e-9b1a-6f0e2c5a9d11" \
-d '{
"name": "Notificações de pagamento",
"url": "https://meusite.com/webhooks/z2pay",
"events": ["transaction.paid", "transaction.refunded"],
"secret": "um-segredo-bem-grande"
}'
{
"id" : "whk_8Hk2pQ7rT9vLm3Nx" ,
"companyId" : "comp_4Zp1Yt6Bn0Wq" ,
"name" : "Notificações de pagamento" ,
"url" : "https://meusite.com/webhooks/z2pay" ,
"events" : [ "transaction.paid" , "transaction.refunded" ],
"secret" : "um-segredo-bem-grande" ,
"isActive" : true ,
"createdAt" : "2026-06-24T13:45:00.000Z" ,
"updatedAt" : "2026-06-24T13:45:00.000Z" ,
"deletedAt" : null ,
"version" : 1
}
List webhooks
GET /webhooks
Returns a paginated list of webhooks on your account.
Parameter (query) Type Required Description isActivebooleanNo Filter by active/inactive status. eventstringNo Filter webhooks listening to a specific event (e.g. transaction.paid). pageintegerNo Page number (positive integer). Default 1. limitintegerNo Items per page (positive integer, maximum 100). Default 20.
curl -X GET "https://api.sandbox.z2pay.com/webhooks?isActive=true&page=1&limit=20" \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX"
{
"data" : [
{
"id" : "whk_8Hk2pQ7rT9vLm3Nx" ,
"companyId" : "comp_4Zp1Yt6Bn0Wq" ,
"name" : "Notificações de pagamento" ,
"url" : "https://meusite.com/webhooks/z2pay" ,
"events" : [ "transaction.paid" , "transaction.refunded" ],
"secret" : "um-segredo-bem-grande" ,
"isActive" : true ,
"createdAt" : "2026-06-24T13:45:00.000Z" ,
"updatedAt" : "2026-06-24T13:45:00.000Z" ,
"deletedAt" : null ,
"version" : 1
}
],
"pagination" : {
"page" : 1 ,
"limit" : 20 ,
"total" : 1 ,
"totalPages" : 1
}
}
List available events
GET /webhooks/listeners
Returns the full catalog of events available for subscription. Use the code values in the
events field when creating or updating a webhook. Accepts no parameters.
curl -X GET https://api.sandbox.z2pay.com/webhooks/listeners \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX"
{
"data" : [
{ "code" : "transaction.created" , "description" : "Transação criada" },
{ "code" : "transaction.waiting_payment" , "description" : "Transação aguardando pagamento" },
{ "code" : "transaction.paid" , "description" : "Transação paga" },
{ "code" : "transaction.refused" , "description" : "Transação recusada" },
{ "code" : "transaction.failed" , "description" : "Transação falhou" },
{ "code" : "transaction.canceled" , "description" : "Transação cancelada" },
{ "code" : "transaction.refunded" , "description" : "Transação reembolsada" },
{ "code" : "transaction.chargeback" , "description" : "Transação em chargeback" },
{ "code" : "payment.created" , "description" : "Pagamento criado" },
{ "code" : "payment.waiting_payment" , "description" : "Pagamento aguardando pagamento" },
{ "code" : "payment.paid" , "description" : "Pagamento aprovado" },
{ "code" : "payment.refused" , "description" : "Pagamento recusado" },
{ "code" : "payment.failed" , "description" : "Pagamento falhou" },
{ "code" : "payment.refunded" , "description" : "Pagamento reembolsado" },
{ "code" : "payment.chargeback" , "description" : "Pagamento em chargeback" },
{ "code" : "customer.created" , "description" : "Cliente criado" },
{ "code" : "customer.updated" , "description" : "Cliente atualizado" },
{ "code" : "recipient.created" , "description" : "Recebedor criado" },
{ "code" : "recipient.updated" , "description" : "Recebedor atualizado" },
{ "code" : "recipient.approved" , "description" : "Recebedor aprovado" },
{ "code" : "recipient.refused" , "description" : "Recebedor recusado" },
{ "code" : "recipient.deleted" , "description" : "Recebedor removido" },
{ "code" : "withdrawal.requested" , "description" : "Saque solicitado" },
{ "code" : "withdrawal.paid" , "description" : "Saque pago" },
{ "code" : "withdrawal.rejected" , "description" : "Saque recusado" },
{ "code" : "invoice.issued" , "description" : "Fatura emitida" },
{ "code" : "invoice.payment_attempted" , "description" : "Tentativa de cobrança da fatura" },
{ "code" : "invoice.paid" , "description" : "Fatura paga" },
{ "code" : "invoice.voided" , "description" : "Fatura anulada" },
{ "code" : "invoice.refunded" , "description" : "Fatura reembolsada" },
{ "code" : "invoice.rescheduled" , "description" : "Fatura reagendada" },
{ "code" : "subscription.created" , "description" : "Assinatura criada" },
{ "code" : "subscription.activated" , "description" : "Assinatura ativada" },
{ "code" : "subscription.canceled" , "description" : "Assinatura cancelada" },
{ "code" : "subscription.cycle_advanced" , "description" : "Novo ciclo da assinatura iniciado" },
{ "code" : "subscription.paused" , "description" : "Assinatura pausada" },
{ "code" : "subscription.resumed" , "description" : "Assinatura retomada" }
]
}
Codes follow the resource.action pattern (e.g. transaction.paid). Detailed payload
documentation for each event is available in the Event catalog .
Fetch webhook by ID
GET /webhooks/:id
Returns the data for a specific webhook.
Status When 200Webhook found. 404Webhook not found. See Errors .
curl -X GET https://api.sandbox.z2pay.com/webhooks/whk_8Hk2pQ7rT9vLm3Nx \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX"
{
"id" : "whk_8Hk2pQ7rT9vLm3Nx" ,
"companyId" : "comp_4Zp1Yt6Bn0Wq" ,
"name" : "Notificações de pagamento" ,
"url" : "https://meusite.com/webhooks/z2pay" ,
"events" : [ "transaction.paid" , "transaction.refunded" ],
"secret" : "um-segredo-bem-grande" ,
"isActive" : true ,
"createdAt" : "2026-06-24T13:45:00.000Z" ,
"updatedAt" : "2026-06-24T13:45:00.000Z" ,
"deletedAt" : null ,
"version" : 1
}
Update webhook
PUT /webhooks/:id
Updates the configuration of a webhook. All body fields are optional — only send what you want
to change. Returns 200 with the updated webhook.
New name. Between 1 and 255 characters.
New public HTTPS URL. Internal/private URLs are rejected.
New list of events to subscribe to. If sent empty, the webhook will listen to ALL events.
New secret. Minimum 8 characters.
This endpoint accepts the Idempotency-Key header.
Status When 200Webhook updated. 404Webhook not found.
curl -X PUT https://api.sandbox.z2pay.com/webhooks/whk_8Hk2pQ7rT9vLm3Nx \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX" \
-H "Content-Type: application/json" \
-d '{
"events": ["transaction.paid", "transaction.refused", "transaction.refunded"]
}'
{
"id" : "whk_8Hk2pQ7rT9vLm3Nx" ,
"companyId" : "comp_4Zp1Yt6Bn0Wq" ,
"name" : "Notificações de pagamento" ,
"url" : "https://meusite.com/webhooks/z2pay" ,
"events" : [ "transaction.paid" , "transaction.refused" , "transaction.refunded" ],
"secret" : "um-segredo-bem-grande" ,
"isActive" : true ,
"createdAt" : "2026-06-24T13:45:00.000Z" ,
"updatedAt" : "2026-06-24T14:10:00.000Z" ,
"deletedAt" : null ,
"version" : 2
}
Enable / disable webhook
PATCH /webhooks/:id/status
Toggles the active/inactive status of a webhook. An inactive webhook does not receive new deliveries. Returns 200.
true to enable, false to disable.
This endpoint accepts the Idempotency-Key header.
Status When 200Status updated. 404Webhook not found.
curl -X PATCH https://api.sandbox.z2pay.com/webhooks/whk_8Hk2pQ7rT9vLm3Nx/status \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX" \
-H "Content-Type: application/json" \
-d '{ "isActive": false }'
{
"id" : "whk_8Hk2pQ7rT9vLm3Nx" ,
"companyId" : "comp_4Zp1Yt6Bn0Wq" ,
"name" : "Notificações de pagamento" ,
"url" : "https://meusite.com/webhooks/z2pay" ,
"events" : [ "transaction.paid" , "transaction.refunded" ],
"secret" : "um-segredo-bem-grande" ,
"isActive" : false ,
"createdAt" : "2026-06-24T13:45:00.000Z" ,
"updatedAt" : "2026-06-24T14:20:00.000Z" ,
"deletedAt" : null ,
"version" : 3
}
Remove webhook
DELETE /webhooks/:id
Removes a webhook using soft delete : the entity is not permanently erased, it is simply marked
with a populated deletedAt timestamp. Returns 200 with the removed entity.
This endpoint accepts the Idempotency-Key header.
Status When 200Webhook removed. 404Webhook not found.
curl -X DELETE https://api.sandbox.z2pay.com/webhooks/whk_8Hk2pQ7rT9vLm3Nx \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX"
{
"id" : "whk_8Hk2pQ7rT9vLm3Nx" ,
"companyId" : "comp_4Zp1Yt6Bn0Wq" ,
"name" : "Notificações de pagamento" ,
"url" : "https://meusite.com/webhooks/z2pay" ,
"events" : [ "transaction.paid" , "transaction.refunded" ],
"secret" : "um-segredo-bem-grande" ,
"isActive" : false ,
"createdAt" : "2026-06-24T13:45:00.000Z" ,
"updatedAt" : "2026-06-24T14:25:00.000Z" ,
"deletedAt" : "2026-06-24T14:25:00.000Z" ,
"version" : 4
}
List deliveries
GET /webhooks/deliveries
Returns a paginated list of webhook delivery attempts. Each delivery is a record of a notification
sent (or in the process of being sent) to your URL.
Parameter (query) Type Required Description webhookIdstringNo Filter by deliveries for a specific webhook. eventTypestringNo Filter by event type (e.g. transaction.paid). statusstringNo Filter by status. Values: pending, success, failed, retrying. fromstring (ISO 8601)No Start date of the creation range. tostring (ISO 8601)No End date of the creation range. sortstringNo Sort order. Values: createdAt.asc, createdAt.desc. Default createdAt.desc. pageintegerNo Page number (positive integer). Default 1. limitintegerNo Items per page (positive integer, maximum 100). Default 20.
curl -X GET "https://api.sandbox.z2pay.com/webhooks/deliveries?status=failed&page=1&limit=20" \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX"
{
"data" : [
{
"id" : "whd_5Qm9Rt2pK7vBn1Xz" ,
"companyId" : "comp_4Zp1Yt6Bn0Wq" ,
"webhookId" : "whk_8Hk2pQ7rT9vLm3Nx" ,
"eventId" : "evt_1a2b3c4d5e6f" ,
"eventType" : "transaction.paid" ,
"entityType" : "transaction" ,
"entityId" : "txn_9Lp3Kt7rQ2vMn4Xz" ,
"url" : "https://meusite.com/webhooks/z2pay" ,
"payload" : {
"event" : "transaction.paid" ,
"data" : { "id" : "txn_9Lp3Kt7rQ2vMn4Xz" }
},
"status" : "failed" ,
"attemptCount" : 3 ,
"returnStatus" : 500 ,
"returnData" : { "error" : "internal server error" },
"errorMessage" : "Request failed with status code 500" ,
"lastAttemptAt" : "2026-06-24T13:50:12.000Z" ,
"createdAt" : "2026-06-24T13:46:00.000Z" ,
"updatedAt" : "2026-06-24T13:50:12.000Z"
}
],
"pagination" : {
"page" : 1 ,
"limit" : 20 ,
"total" : 1 ,
"totalPages" : 1
}
}
Fetch delivery by ID
GET /webhooks/deliveries/:id
Returns the full data for a delivery, including the payload sent and the returnData from the
response received — useful for debugging a failed delivery.
Status When 200Delivery found. 404Delivery not found.
Delivery ID (prefix whd_).
ID of the webhook that originated this delivery.
ID of the event that triggered the delivery.
Event type (e.g. transaction.paid).
Type of the related entity (e.g. transaction).
ID of the related entity (e.g. txn_...).
URL to which the delivery was sent.
JSON content sent in the delivery.
Delivery status: pending, success, failed, or retrying.
Number of send attempts already made.
HTTP status code returned by your endpoint on the last attempt.
Response body returned by your endpoint.
Error message from the last attempt, if any.
Date/time of the last attempt (ISO 8601), if any.
Date/time the delivery was created (ISO 8601).
Date/time of the last update (ISO 8601).
curl -X GET https://api.sandbox.z2pay.com/webhooks/deliveries/whd_5Qm9Rt2pK7vBn1Xz \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX"
{
"id" : "whd_5Qm9Rt2pK7vBn1Xz" ,
"companyId" : "comp_4Zp1Yt6Bn0Wq" ,
"webhookId" : "whk_8Hk2pQ7rT9vLm3Nx" ,
"eventId" : "evt_1a2b3c4d5e6f" ,
"eventType" : "transaction.paid" ,
"entityType" : "transaction" ,
"entityId" : "txn_9Lp3Kt7rQ2vMn4Xz" ,
"url" : "https://meusite.com/webhooks/z2pay" ,
"payload" : {
"event" : "transaction.paid" ,
"data" : { "id" : "txn_9Lp3Kt7rQ2vMn4Xz" }
},
"status" : "failed" ,
"attemptCount" : 3 ,
"returnStatus" : 500 ,
"returnData" : { "error" : "internal server error" },
"errorMessage" : "Request failed with status code 500" ,
"lastAttemptAt" : "2026-06-24T13:50:12.000Z" ,
"createdAt" : "2026-06-24T13:46:00.000Z" ,
"updatedAt" : "2026-06-24T13:50:12.000Z"
}
Retry delivery
POST /webhooks/deliveries/:id/retry
Resends a previously failed delivery. Use this after fixing your endpoint to receive the
notification again. Returns 200 with { "ok": true }.
This endpoint accepts the Idempotency-Key header.
Status When 200Delivery resent (queued for reprocessing). 404Delivery not found.
curl -X POST https://api.sandbox.z2pay.com/webhooks/deliveries/whd_5Qm9Rt2pK7vBn1Xz/retry \
-H "x-api-key: SUA_CHAVE_DE_SANDBOX"
Error handling (body format, common status codes such as 400 for validation and 401 for
authentication) is documented in Errors .
See also
Webhooks: overview How delivery works, retry logic, and signature validation.
Event catalog Every event and the payload you receive.
Transactions The source of most webhook events.
Errors Error format and API status codes.