Skip to main content
POST
billing.usage.record

Authorizations

Authorization
string
header
required

API key: sk_live_…

Headers

Idempotency-Key
string
required

Required: this capability has an external effect.

Maximum string length: 255
Pramaan-Account
string

Optional. One of your account ids (GET /v1/accounts): run on that account, whatever your routing rules say. The response header X-Pramaan-Account names the account that ran.

Pramaan-End-User
string

Optional. Your own tag for your end user: a sticky: end_user rule keeps them on the account that first served them.

Maximum string length: 256
Pramaan-End-User-Group
string

Optional. Your end user's group, matched by rules with endUserGroup.

Maximum string length: 64

Body

application/json
customerId
string
required

The customer the usage belongs to, as returned by billing.customers.list.

Required string length: 1 - 128
Pattern: ^[A-Za-z0-9_-]+$
event
string
required

Event name the meter listens for, 1 to 100 letters, digits or . _ : - (e.g. "api.request").

Pattern: ^[A-Za-z0-9._:-]{1,100}$
properties
object

Extra details as { key: value }, up to 50 keys; values are strings (max 500), finite numbers or booleans. Put numbers a meter sums here, e.g. { tokens: 1200 }.

timestamp
string

When it happened, ISO 8601. Default now; at most 1 hour in the past or 5 minutes ahead.

Response

The result

recorded
boolean
required

Always true.

duplicate
boolean
required

True when this Idempotency-Key was already recorded; nothing was billed twice.