creditCapReachedEvent
Webhook

Credit cap reached

​

Fires when a customer unit's credit spend in its current cap period reaches the cap set on it: once per cap version and period. A signal can reach the caps of several units on its branch (the unit it names and the units above it), and each fires its own event. From then until the period ends, usage from the capped unit and the units beneath it that would spend credits in that currency is held: it spends no credits and isn't billed. Like the other credit events, it isn't sent for replays or for backfilled signals more than a week old. data.breachedUnit is the unit with the cap and data.cap the cap: its limit, what the unit and the units beneath it have spent in the period, the period (periodStart and periodEnd, and again as window) and the cap version in force (policy).

Headers

  • t=<timestamp>,s=<signature>. t is when the delivery was signed, in Unix milliseconds; each attempt is signed afresh, so a retry has a new t. s is the Base64 (standard alphabet, padded) HMAC-SHA256 of the string <t>.<raw request body>, keyed with your signing secret: the whole whsec_… string as UTF-8. To verify, recompute it over the raw body exactly as received and compare in constant time, then reject a t too far from now (5 minutes is a good limit) so an old delivery can't be replayed. s can end in =, so split each part on its first = only.

Body

required
application/json

Every delivery's body.

Responses

  • Return any 2xx to acknowledge. Any other status, a redirect (redirects aren't followed), or no answer within 5 seconds is a failed attempt, recorded in the webhook's lastStatus. A failed delivery is retried 1 minute, 5 minutes, 30 minutes, 2 hours and then 12 hours after each failed attempt in turn (retries are sent by a sweep that runs every minute, so each can be up to a minute later), and dropped after the sixth failed attempt. A retry carries the same id and timestamp and goes to the webhook's current URL; a delivery whose webhook has since been switched off is dropped. Because of retries, an event can arrive more than once or after a later one: use id to ignore repeats. The response body is ignored.

Request Example for postbilling-credit-cap-reached
{
  "id": "whd_Jr6Lw9Cv2Tm5Pk8D",
  "event": "billing-credit-cap-reached",
  "timestamp": "2026-11-18T11:26:37.415Z",
  "isTest": false,
  "data": {
    "breachedUnit": {
      "id": "cu_r4ZEX1e1QvYkxM8e",
      "externalId": "litigation",
      "customerId": "cus_Q2x9vB7mK4pT1sLw",
      "customerExternalId": "acme-legal",
      "name": "Litigation team",
      "externalType": "team",
      "status": "ACTIVE",
      "parentExternalId": "acme-legal",
      "isRoot": false,
      "billable": true,
      "effectiveBillable": true,
      "metadata": null,
      "createdAt": "2026-10-02T09:41:17.552Z",
      "updatedAt": "2026-10-02T09:41:17.552Z",
      "externalCustomerId": "acme-legal"
    },
    "cap": {
      "creditsCurrencyId": "cc_jC18u1xkf7CdKYcL",
      "creditsCurrencyKey": "credits",
      "limit": 100,
      "used": 100,
      "periodStart": "2026-11-01T00:00:00.000Z",
      "periodEnd": "2026-12-01T00:00:00.000Z",
      "window": {
        "start": "2026-11-01T00:00:00.000Z",
        "end": "2026-12-01T00:00:00.000Z"
      },
      "policy": {
        "amount": 100,
        "frequency": "MONTHLY",
        "schedule": {
          "type": "CALENDAR"
        },
        "effectiveFrom": "2026-10-02T09:45:00.000Z",
        "effectiveUntil": null,
        "createdAt": "2026-10-02T09:45:00.000Z",
        "source": "api"
      }
    }
  }
}
No Body