Skip to main content
PATCH
Update a meter

Authorizations

x-api-key
string
header
required

API key for authentication. You can find your API key in the Creem dashboard under Settings > API Keys.

Path Parameters

id
string
required

Query Parameters

dry_run
boolean

Send true to preview the write: the request runs as it would and is rolled back, so nothing is written and Idempotency-Key is neither read nor stored. The answer is the one the real call would give: the same status (201 for a create) and errors, and the meter with write_result.dry_run true. The id of a meter a dry run would create is never stored: a GET of it answers 404. false or no parameter is a real call; any other value answers 400.

Body

application/json
name
string

New meter name. Renaming is allowed even after the meter has processed usage — the name is a label, not part of the definition. Must stay unique within the store. Omit to leave unchanged; null is rejected.

Example:

"Image generations (v2)"

aggregation
enum<string>

New aggregation. Part of the meter definition, so it is only editable while the meter has processed no usage and has no associated purchase. Omit to leave unchanged; null is rejected.

Available options:
count,
sum,
average,
min,
max,
unique
Example:

"sum"

aggregation_property
string | null

New aggregation property. Omit to leave unchanged; send null to clear it (only valid when the resulting aggregation is "count").

Example:

"tokens"

filter
object

New filter. Part of the meter definition (see aggregation). Omit to leave unchanged; null is rejected — to remove a filter, send one with an empty clauses array.

external_id
string | null

Your own key for this meter. Creem never sets it. Unique per store, case-sensitive; 1 to 255 characters: letters, digits, _, -, . and :. Not part of the definition, so it can change also after the meter has processed usage. Omit to leave unchanged; send null to clear it. A key another meter of your store already uses answers 409 with code external_id_taken.

Example:

"image-generations"

Response

Meter updated (write_result.result updated), or already as requested (unchanged)

id
string
required

Meter ID

Example:

"mtr_abc123"

store_id
string
required

Store ID

Example:

"sto_abc123"

name
string
required

Meter name

Example:

"Image generations"

event_name
string
required

Usage event name the meter consumes

Example:

"image.generated"

aggregation
enum<string>
required

Aggregation applied to matching events

Available options:
count,
sum,
average,
min,
max,
unique
Example:

"sum"

aggregation_property
string | null
required

Property the aggregation reduces; null for "count"

Example:

"tokens"

filter
object
required

The meter filter; always present (empty clauses = match all)

unit_label
string
required

Display unit

Example:

"images"

status
enum<string>
required

Whether the meter is active or archived

Available options:
active,
archived
Example:

"active"

external_id
string | null
required

Your own key for this meter (external_id), unique per store. null when the meter has none.

Example:

"image-generations"

locked
boolean
required

Whether the meter is locked. A meter locks once it has processed usage or has an associated purchase; an update that changes a locked meter's definition is refused with 409. A lock freezes the filter and aggregation. event_name and unit_label can't be changed on any meter; name and external_id stay changeable. Aggregation runs asynchronously, so a meter can lock between a read that says false and the next update.

Example:

false

created_at
string
required

Creation timestamp (ISO 8601)

updated_at
string
required

Last update timestamp (ISO 8601)

write_result
object
required

What this write did and should tell you.