docs

Endpoints de webhook

Cadastre as URLs que recebem eventos. O guia de webhooks explica o payload, a assinatura e os reenvios.

Cadastrar um endpoint

POSThttps://api.onzepay.com/v1/webhooks/endpoints
webhooks.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

  • 400EVENTS_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]"
}'
Resposta 201
{
  "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

GEThttps://api.onzepay.com/v1/webhooks/endpoints
webhooks.read
curl -X GET "$ONZEPAY_API/v1/webhooks/endpoints" \
  -H "Authorization: Bearer $ONZEPAY_SECRET_KEY"
Resposta 200
{
  "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

GEThttps://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"
Resposta 200
{
  "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

PATCHhttps://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"
  ]
}'
Resposta 200
{
  "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

DELETEhttps://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"

Resposta 204 sem corpo.

Enviar evento de teste

POSThttps://api.onzepay.com/v1/webhooks/endpoints/{id}/test
webhooks.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

  • 400WEBHOOK_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"
Resposta 200
{
  "delivered": true,
  "status": 200,
  "body": "ok"
}

Reenviar uma entrega

POSThttps://api.onzepay.com/v1/webhooks/deliveries/{id}/retry
webhooks.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

  • 409IDEMPOTENCY_CONFLICTEsta entrega já foi concluída.
curl -X POST "$ONZEPAY_API/v1/webhooks/deliveries/evt_034yDL8pA1sD3fG5hJ7kL9/retry" \
  -H "Authorization: Bearer $ONZEPAY_SECRET_KEY"
Resposta 200
{
  "id": "evt_034yDL8pA1sD3fG5hJ7kL9",
  "type": "charge.paid",
  "status": "queued",
  "attemptCount": 2,
  "createdAt": "2026-11-15T21:05:01.000Z",
  "updatedAt": "2026-11-15T21:40:00.000Z"
}