# Webhooks (/fr/docs/webhooks)

<Endpoint method="POST" path="/v1/webhook-endpoints" href="/api#tag/webhooks/POST/v1/webhook-endpoints" />

```bash
curl "$CAIBO_API/v1/webhook-endpoints" \
  -H "Authorization: Bearer $CAIBO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://tu-empresa.com/webhooks/caibo",
    "description": "Production",
    "event_types": ["payin.completed", "payout.completed", "payout.failed"]
  }'
```

- `url`: `https`, public, on port 443.
- `event_types`: the types you want to receive. Empty or omitted: **all of them**.
- The response includes `secret` (`whsec_…`) **only once**. If you lose it, [rotate it](#rotate-the-secret).
- Up to 10 webhooks per account and per environment.

## What you receive [#what-you-receive]

```http
POST /webhooks/caibo HTTP/1.1
Content-Type: application/json
User-Agent: psp-webhooks/1 (live)
Psp-Signature: t=1790769600,v1=c0c9eaafdea23b0f8c992b380b286917c6459b0729b2496b8452fa695215e6b8
Psp-Event-Id: evt_01m3sgb02af7nb0jf73vwv2sd5
Psp-Delivery-Id: whd_01m3sgb03a...
Psp-Delivery-Attempt: 1
```

```json
{
  "id": "evt_01m3sgb02af7nb0jf73vwv2sd5",
  "type": "payout.completed",
  "schema_version": 1,
  "occurred_at": "2026-10-18T14:00:41.126938Z",
  "livemode": true,
  "data": { "id": "pout_01m3sgb02af7nb0jf73vwv2sd4", "status": "completed" }
}
```

`data` is the full resource, in the same shape the API returns. See [Events](/docs/events).

## How to respond [#how-to-respond]

<Steps>
<Step>
### Verify the signature [#verify-the-signature]
Using the body **exactly as received**, before parsing it. See [Signatures](/docs/webhook-signatures).
</Step>
<Step>
### Respond 2xx right away [#respond-2xx-right-away]
You have **10 seconds**. Store the event and process it later, in a queue. The body of your response is ignored. A redirect (`3xx`) counts as a failure.
</Step>
<Step>
### Discard duplicates [#discard-duplicates]
Delivery is "at least once": the same event can arrive twice. Use `Psp-Event-Id` (the event's `id`) to avoid processing it twice.
</Step>
</Steps>

## Retries [#retries]

If you don't respond `2xx` in time, we retry up to **10 times** over about 23 hours:

| Attempt | Wait before | | Attempt | Wait before |
| --- | --- | --- | --- | --- |
| 2 | 30 s | | 7 | 2 h |
| 3 | 2 min | | 8 | 4 h |
| 4 | 10 min | | 9 | 8 h |
| 5 | 30 min | | 10 | 8 h |
| 6 | 1 h | | | |

Each wait varies by ±20%. After 10 consecutive failures, the webhook moves to `failing` and we send it a test delivery every 15 minutes; the first one that succeeds returns it to `active`. No event is ever lost: it's always in `GET /v1/events`.

**Ordering:** one delivery at a time per webhook, and events for the same resource arrive in order.

## Tools [#tools]

| | |
| --- | --- |
| <Endpoint method="POST" path="/v1/webhook-endpoints/{id}/ping" href="/api#tag/webhooks/POST/v1/webhook-endpoints/{id}/ping" /> | Sends a test `webhook.ping` (up to 5 per minute). |
| <Endpoint method="GET" path="/v1/webhook-endpoints/{id}/deliveries" href="/api#tag/webhooks/GET/v1/webhook-endpoints/{id}/deliveries" /> | The delivery history, with status and error. |
| <Endpoint method="POST" path="/v1/events/{id}/redeliver" href="/api#tag/webhooks/POST/v1/events/{id}/redeliver" /> | Resends an event to all your webhooks, or only to `endpoint_id`. |
| <Endpoint method="PATCH" path="/v1/webhook-endpoints/{id}" href="/api#tag/webhooks/PATCH/v1/webhook-endpoints/{id}" /> | Changes `url`, `description`, `event_types`, or pauses with `active: false`. |

## Rotate the secret [#rotate-the-secret]

<Endpoint method="POST" path="/v1/webhook-endpoints/{id}/rotate-secret" href="/api#tag/webhooks/POST/v1/webhook-endpoints/{id}/rotate-secret" />

Returns a new `secret`. For **24 hours** we sign with both (the new one first), so you can update your server without missing notifications. `previous_secret_expires_at` tells you when the old one stops working.
