Skip to main content
POST
Send a usage event

Authorizations

Authorization
string
header
required

Use a Bouclay secret key (sk_test_..., sk_live_...) or restricted key (rk_test_..., rk_live_...).

A secret key can call every endpoint. A restricted key can only call the endpoints its scopes cover. A scope is {resource}:{access}, for example customers:read or refunds:write, and write includes read. GET requests need read access and everything else needs write, except POST /subscriptions/{id}/items/{item}/preview, which only needs subscriptions:read. A request outside the key's scopes gets 403 permission_denied naming the missing scope, and its Idempotency-Key is not used up.

Publishable keys (pk_...) are rejected by server-side API endpoints. A key's mode scopes what it can see and charge: a test key can never reach a live card.

Body

application/json
eventName
string
required

The meter's event name. event_name is accepted too.

Example:

"api.request"

customer
string
required

A Bouclay customer ID, or the externalRef you gave the customer.

Example:

"ctm_123"

identifier
string
required

Your unique ID for this event. Resending it is safe.

Maximum string length: 255
Example:

"req_01J8ZQ"

timestamp
string<date-time>

When it happened. Defaults to now; at most 5 minutes in the future.

value
integer
default:1

The amount, for sum, max, and last meters that read value. Whole numbers only; pick a unit that makes it one. A meter with a valueKey reads that property instead, under the same bounds.

Required range: 0 <= x <= 1000000000000
properties
object | null

Response

Meter event response. 201 when stored, 200 when the identifier was already stored.

data
object
required
meta
object
required