Documentation menu

Event types

Every event a webhook endpoint can receive, and what its data holds.

The envelope#

Every event has the same envelope; data depends on type:

{
  "id": "evt_q4f1x9k2m7c3v8b5n6z0a1s2",
  "object": "event",
  "type": "wallet.balance_low",
  "api_version": "2026-11-25",
  "created_at": "2026-11-25T10:00:00.000Z",
  "environment": "env_k3j9x2m8q1w7e4r5t6y0u2i3",
  "data": {
    "customer": "org_42",
    "wallet_id": "wal_z1x2c3v4b5n6m7l8k9j0h1g2",
    "balance": {
      "purchased_micros": "-2500000",
      "grants_micros": "3000000",
      "total_micros": "500000"
    },
    "threshold_micros": "1000000"
  }
}
FieldMeaning
idThe event's id, the same in every delivery of it: deduplicate on it
typeOne of the types below
api_versionThe version of the envelope and of data's shape. See Versioning
created_atWhen the change that caused the event was made
environmentThe environment it happened in

New fields can appear in data without a new api_version: ignore fields you do not know. Amounts are micro-USD and token counts are integers, both as decimal strings.

Events that name a customer carry customer, your id for it (its external_id), and those that name a member carry member, your id for it too. The customer.* events carry the whole customer instead. Wallet events also carry wallet_id and balance: { purchased_micros, grants_micros, total_micros }, the balance right after the change, except where noted.

Wallet events#

wallet.balance_low#

The balance fell below the environment's low-balance threshold. Sent once per crossing: not again until the balance is back at or above the threshold. No threshold is set by default; set one with PATCH /v1/wallet_settings and {"low_balance_threshold_micros": "1000000"}, or under Credits → Settings. Data: threshold_micros.

wallet.depleted#

The balance reached zero or went below it. Once per crossing, like wallet.balance_low; needs no setting.

wallet.credited#

Credit was written to the ledger: a grant, top-up, auto-refill, adjustment or refund. Data: ledger_entry_id, kind, amount_micros (signed), expires_at (a grant's, else null), idempotency_key, and auto_refill_id for kind auto_refill.

wallet.grant_expired#

What was left of a grant expired. Data: ledger_entry_id, grant_key, expired_micros, expired_at.

wallet.credit_rejected#

The gateway refused a credit for good: the ledger has it, but it cannot be spent until support corrects it. Data: ledger_entry_id, kind, amount_micros, reason. No balance.

wallet.spend_limit_reached#

The customer, or one of its members, was first refused at a spend limit in that limit's window. Once per crossing, not once per refused request. Data: limit_id, window, limit_micros, window_start and window_end (null for a total limit), spent_micros, member (whose member limit it was, or null for the customer's own), request_id (the refused request), reached_at.

wallet.credit_exhausted#

The customer was first refused because its credit cannot cover a request. This is not wallet.depleted: the balance may still be positive while open requests hold part of it, or the request needs more than is left. Data: available_micros (the gateway's balance less what open requests hold), required_micros (the refused request's estimate), request_id, reached_at.

wallet.top_up_succeeded#

A top-up was paid and credited; a wallet.credited is sent beside it. Data: top_up (as GET /v1/top_ups/{id} shows it), ledger_entry_id, amount_micros.

wallet.top_up_failed#

A top-up's payment failed; nothing was credited. Data: customer, top_up. No balance.

wallet.top_up_refunded#

A refund of a top-up took its amount back (amount_micros negative), or a failed refund gave it back (positive). Data: top_up, ledger_entry_id, amount_micros, refund_id, refund_status.

wallet.top_up_disputed#

A top-up's payment was disputed, or its dispute changed. Data: top_up, dispute_id, dispute_status, ledger_entry_id (null when nothing was written), amount_micros.

wallet.auto_refill_failed#

An auto-refill charge was declined. Data: auto_refill, consecutive_failures, retry_after (null once auto-refill was turned off). No balance.

wallet.auto_refill_disabled#

Auto-refill was turned off: three failures in a row (reason: "failures"), a card that cannot be charged again (payment_method) or a dispute (dispute). Data: reason, settings. No balance.

wallet.auto_refill_cap_reached#

A refill was skipped because it would pass the monthly cap. Once per calendar month. Data: auto_refill, monthly_cap_micros, refilled_micros, month (YYYY-MM). No balance.

Customer events#

customer.created#

A customer was created: by you (source: api or dashboard) or by its first request (usage). Data: customer: { id, external_id, name, status, created_at }, source.

customer.blocked#

A customer was blocked. Data: customer.

customer.unblocked#

A blocked customer was let through again. Data: customer.

Key events#

key.created#

Data: key, as GET /v1/keys/{id} shows it. Never the secret.

key.revoked#

Data: key.

key.rotated#

A key was rotated. This event alone is sent, not key.created or key.revoked. Data: previous, key (its successor).

key.spend_limit_reached#

A key reached its own spend limit on a request that named no customer. Once per crossing. Data: key and the limit fields of wallet.spend_limit_reached.

Usage events#

usage.recorded#

A request was recorded: one event per request. Only an endpoint that names it in event_types receives it (* does not include it). Data: usage_event_id, request_id, key_id, customer, member, wallet_id, provider, requested_model, model, endpoint, payer, outcome, mocked, tokens, cost_micros, billed_micros, settlement, started_at, duration_ms, tags, client_token_id. See Usage for what they mean.

Test events#

webhook.test#

Sent only when you ask for a test, to the endpoint you name. Data: endpoint_id, message.