Skip to main content

Report usage

reportUsage() records usage without checking a limit. Use it when access was already decided, for example to sync counts from a job or to meter work after the fact. To gate an action on a quota, use consume().
string
required
The customer. It must already exist: reportUsage() never creates one.
number
default:"1"
A whole number. Fractions are rejected.
'INCREMENT' | 'SET'
default:"INCREMENT"
SET sets the counter to delta instead of adding to it.
string
A retry with the same key is recorded once.
string
Which machine, project or seat to record against. Optional here: without it, usage goes to the customer’s shared counter. See Dimensions.
object
Stored with the usage event.

Report in batches

Up to 100 events per call:
Each event is recorded on its own: a failing event doesn’t cancel the others, so check status on every result.

Read usage

One record per feature for the current period: { feature_key, value, period_start, period_end, status, ... }. This is the raw counter. For limit and remaining, with overrides and rollover applied, use check(). To refund or reset usage, see usage corrections.