Endpoints de webhook
Cadastre as URLs que recebem eventos. O guia de webhooks explica o payload, a assinatura e os reenvios.
Cadastrar um endpoint
POST
https://api.onzepay.com/v1/webhooks/endpointswebhooks.writeIdempotency-Key
Corpo
urlstringobrigatório- URL HTTPS que recebe o POST.
eventsarrayobrigatório- Eventos assinados (ao menos um).
errorNotificationEmailstringobrigatório- E-mail de contato técnico do endpoint.
autoPauseOnFailureboolean- Pausa o endpoint depois de falhas seguidas. Padrão
true. isPausedboolean- Cria já pausado.
headersarray- Headers extras
{ key, value }enviados em cada entrega.
Erros
- 400
EVENTS_REQUIREDNenhum evento informado.
curl -X POST "$ONZEPAY_API/v1/webhooks/endpoints" \
-H "Authorization: Bearer $ONZEPAY_SECRET_KEY" \
-H "Idempotency-Key: $(uuidgen)" \
-H "Content-Type: application/json" \
-d '{
"url": "https://seu-sistema.com.br/webhooks/onzepay",
"events": [
"charge.paid",
"charge.expired",
"pix.refund.failed",
"med.opened",
"med.updated"
],
"errorNotificationEmail": "[email protected]"
}'const res = await fetch(`${process.env.ONZEPAY_API}/v1/webhooks/endpoints`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ONZEPAY_SECRET_KEY}`,
'Idempotency-Key': crypto.randomUUID(),
'Content-Type': 'application/json'
},
body: JSON.stringify({
"url": "https://seu-sistema.com.br/webhooks/onzepay",
"events": [
"charge.paid",
"charge.expired",
"pix.refund.failed",
"med.opened",
"med.updated"
],
"errorNotificationEmail": "[email protected]"
})
})
const data = await res.json()
if (!res.ok) throw new Error(`${data.code}: ${data.message}`)import os, uuid
import requests
res = requests.post(
f"{os.environ['ONZEPAY_API']}/v1/webhooks/endpoints",
headers={"Authorization": f"Bearer {os.environ['ONZEPAY_SECRET_KEY']}", "Idempotency-Key": str(uuid.uuid4())},
json={
"url": "https://seu-sistema.com.br/webhooks/onzepay",
"events": ["charge.paid", "charge.expired", "pix.refund.failed", "med.opened", "med.updated"],
"errorNotificationEmail": "[email protected]",
},
timeout=30,
)
res.raise_for_status()
data = res.json(){
"id": "whk_034yDL6mN8bV0cX2zL4kJ6",
"url": "https://seu-sistema.com.br/webhooks/onzepay",
"events": [
"charge.paid",
"charge.expired",
"pix.refund.failed",
"med.opened",
"med.updated"
],
"errorNotificationEmail": "[email protected]",
"autoPauseOnFailure": true,
"isPaused": false,
"status": "active",
"createdAt": "2026-11-15T20:00:00.000Z",
"updatedAt": "2026-11-15T20:00:00.000Z"
}Listar endpoints
GET
https://api.onzepay.com/v1/webhooks/endpointswebhooks.read
curl -X GET "$ONZEPAY_API/v1/webhooks/endpoints" \
-H "Authorization: Bearer $ONZEPAY_SECRET_KEY"const res = await fetch(`${process.env.ONZEPAY_API}/v1/webhooks/endpoints`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.ONZEPAY_SECRET_KEY}`
}
})
const data = await res.json()
if (!res.ok) throw new Error(`${data.code}: ${data.message}`)import os
import requests
res = requests.get(
f"{os.environ['ONZEPAY_API']}/v1/webhooks/endpoints",
headers={"Authorization": f"Bearer {os.environ['ONZEPAY_SECRET_KEY']}"},
timeout=30,
)
res.raise_for_status()
data = res.json(){
"data": [
{
"id": "whk_034yDL6mN8bV0cX2zL4kJ6",
"url": "https://seu-sistema.com.br/webhooks/onzepay",
"events": [
"charge.paid",
"charge.expired",
"pix.refund.failed",
"med.opened",
"med.updated"
],
"errorNotificationEmail": "[email protected]",
"autoPauseOnFailure": true,
"isPaused": false,
"status": "active",
"createdAt": "2026-11-15T20:00:00.000Z",
"updatedAt": "2026-11-15T20:00:00.000Z"
}
]
}Consultar um endpoint
GET
https://api.onzepay.com/v1/webhooks/endpoints/{id}webhooks.read
Parâmetros de caminho
idstringobrigatório- Id do endpoint (
whk_…).
curl -X GET "$ONZEPAY_API/v1/webhooks/endpoints/whk_034yDL6mN8bV0cX2zL4kJ6" \
-H "Authorization: Bearer $ONZEPAY_SECRET_KEY"const res = await fetch(`${process.env.ONZEPAY_API}/v1/webhooks/endpoints/whk_034yDL6mN8bV0cX2zL4kJ6`, {
method: 'GET',
headers: {
Authorization: `Bearer ${process.env.ONZEPAY_SECRET_KEY}`
}
})
const data = await res.json()
if (!res.ok) throw new Error(`${data.code}: ${data.message}`)import os
import requests
res = requests.get(
f"{os.environ['ONZEPAY_API']}/v1/webhooks/endpoints/whk_034yDL6mN8bV0cX2zL4kJ6",
headers={"Authorization": f"Bearer {os.environ['ONZEPAY_SECRET_KEY']}"},
timeout=30,
)
res.raise_for_status()
data = res.json(){
"id": "whk_034yDL6mN8bV0cX2zL4kJ6",
"url": "https://seu-sistema.com.br/webhooks/onzepay",
"events": [
"charge.paid",
"charge.expired",
"pix.refund.failed",
"med.opened",
"med.updated"
],
"errorNotificationEmail": "[email protected]",
"autoPauseOnFailure": true,
"isPaused": false,
"status": "active",
"createdAt": "2026-11-15T20:00:00.000Z",
"updatedAt": "2026-11-15T20:00:00.000Z"
}Alterar um endpoint
PATCH
https://api.onzepay.com/v1/webhooks/endpoints/{id}webhooks.write
Envie só os campos que mudam. isPaused: false reativa um endpoint pausado.
Parâmetros de caminho
idstringobrigatório- Id do endpoint (
whk_…).
curl -X PATCH "$ONZEPAY_API/v1/webhooks/endpoints/whk_034yDL6mN8bV0cX2zL4kJ6" \
-H "Authorization: Bearer $ONZEPAY_SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{
"isPaused": false,
"events": [
"pix.in.received",
"pix.refund.completed",
"pix.refund.failed"
]
}'const res = await fetch(`${process.env.ONZEPAY_API}/v1/webhooks/endpoints/whk_034yDL6mN8bV0cX2zL4kJ6`, {
method: 'PATCH',
headers: {
Authorization: `Bearer ${process.env.ONZEPAY_SECRET_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"isPaused": false,
"events": [
"pix.in.received",
"pix.refund.completed",
"pix.refund.failed"
]
})
})
const data = await res.json()
if (!res.ok) throw new Error(`${data.code}: ${data.message}`)import os
import requests
res = requests.patch(
f"{os.environ['ONZEPAY_API']}/v1/webhooks/endpoints/whk_034yDL6mN8bV0cX2zL4kJ6",
headers={"Authorization": f"Bearer {os.environ['ONZEPAY_SECRET_KEY']}"},
json={
"isPaused": False,
"events": ["pix.in.received", "pix.refund.completed", "pix.refund.failed"],
},
timeout=30,
)
res.raise_for_status()
data = res.json(){
"id": "whk_034yDL6mN8bV0cX2zL4kJ6",
"url": "https://seu-sistema.com.br/webhooks/onzepay",
"events": [
"pix.in.received",
"pix.refund.completed",
"pix.refund.failed"
],
"errorNotificationEmail": "[email protected]",
"autoPauseOnFailure": true,
"isPaused": false,
"status": "active",
"createdAt": "2026-11-15T20:00:00.000Z",
"updatedAt": "2026-11-15T20:00:00.000Z"
}Remover um endpoint
DELETE
https://api.onzepay.com/v1/webhooks/endpoints/{id}webhooks.write
Parâmetros de caminho
idstringobrigatório- Id do endpoint (
whk_…).
curl -X DELETE "$ONZEPAY_API/v1/webhooks/endpoints/whk_034yDL6mN8bV0cX2zL4kJ6" \
-H "Authorization: Bearer $ONZEPAY_SECRET_KEY"const res = await fetch(`${process.env.ONZEPAY_API}/v1/webhooks/endpoints/whk_034yDL6mN8bV0cX2zL4kJ6`, {
method: 'DELETE',
headers: {
Authorization: `Bearer ${process.env.ONZEPAY_SECRET_KEY}`
}
})
if (!res.ok) throw new Error(`HTTP ${res.status}`)import os
import requests
res = requests.delete(
f"{os.environ['ONZEPAY_API']}/v1/webhooks/endpoints/whk_034yDL6mN8bV0cX2zL4kJ6",
headers={"Authorization": f"Bearer {os.environ['ONZEPAY_SECRET_KEY']}"},
timeout=30,
)
res.raise_for_status()Resposta 204 sem corpo.
Enviar evento de teste
POST
https://api.onzepay.com/v1/webhooks/endpoints/{id}/testwebhooks.write
Envia um webhook.test assinado para a URL e devolve o status HTTP que ela respondeu. Limite próprio: 10 por minuto.
Parâmetros de caminho
idstringobrigatório- Id do endpoint (
whk_…).
Erros
- 400
WEBHOOK_TEST_FAILEDA URL não respondeu (DNS, TLS ou tempo esgotado).
curl -X POST "$ONZEPAY_API/v1/webhooks/endpoints/whk_034yDL6mN8bV0cX2zL4kJ6/test" \
-H "Authorization: Bearer $ONZEPAY_SECRET_KEY"const res = await fetch(`${process.env.ONZEPAY_API}/v1/webhooks/endpoints/whk_034yDL6mN8bV0cX2zL4kJ6/test`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ONZEPAY_SECRET_KEY}`
}
})
const data = await res.json()
if (!res.ok) throw new Error(`${data.code}: ${data.message}`)import os
import requests
res = requests.post(
f"{os.environ['ONZEPAY_API']}/v1/webhooks/endpoints/whk_034yDL6mN8bV0cX2zL4kJ6/test",
headers={"Authorization": f"Bearer {os.environ['ONZEPAY_SECRET_KEY']}"},
timeout=30,
)
res.raise_for_status()
data = res.json(){
"delivered": true,
"status": 200,
"body": "ok"
}Reenviar uma entrega
POST
https://api.onzepay.com/v1/webhooks/deliveries/{id}/retrywebhooks.write
Coloca a entrega (evt_…, o mesmo id do evento recebido) de volta na fila.
Parâmetros de caminho
idstringobrigatório- Id do evento (
evt_…).
Erros
- 409
IDEMPOTENCY_CONFLICTEsta entrega já foi concluída.
curl -X POST "$ONZEPAY_API/v1/webhooks/deliveries/evt_034yDL8pA1sD3fG5hJ7kL9/retry" \
-H "Authorization: Bearer $ONZEPAY_SECRET_KEY"const res = await fetch(`${process.env.ONZEPAY_API}/v1/webhooks/deliveries/evt_034yDL8pA1sD3fG5hJ7kL9/retry`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ONZEPAY_SECRET_KEY}`
}
})
const data = await res.json()
if (!res.ok) throw new Error(`${data.code}: ${data.message}`)import os
import requests
res = requests.post(
f"{os.environ['ONZEPAY_API']}/v1/webhooks/deliveries/evt_034yDL8pA1sD3fG5hJ7kL9/retry",
headers={"Authorization": f"Bearer {os.environ['ONZEPAY_SECRET_KEY']}"},
timeout=30,
)
res.raise_for_status()
data = res.json(){
"id": "evt_034yDL8pA1sD3fG5hJ7kL9",
"type": "charge.paid",
"status": "queued",
"attemptCount": 2,
"createdAt": "2026-11-15T21:05:01.000Z",
"updatedAt": "2026-11-15T21:40:00.000Z"
}