Skip to main content
PUT
Set a group counter
Sets a counter value on a group directly. The counter is identified by its key in the URL path. If the counter does not exist, it is created. If it already exists, its value is overwritten with the provided amount. This is an absolute set with last-write-wins semantics; to add to a counter atomically, use increment counter. You can optionally include reset_after (a duration string with h, d, or w units, like "24h" or "30d") to configure auto-reset. Pass an empty string to clear an existing reset interval.
For usage patterns and examples, see the State Management guide.

Authorizations

X-API-Key
string
header
required

API key passed in the X-API-Key header.

Path Parameters

id
string<uuid>
required

Group ID

key
string
required

Counter key

Body

application/json

Counter value and optional reset_after

value
string
required

Counter value as a string for precision

Minimum string length: 1
Example:

"42"

reset_after
string

Auto-reset duration (e.g. "24h", "720h"). Empty string removes auto-reset. Omit to leave unchanged

Example:

"720h"

Response

Counter set

key
string

Counter key

Example:

"purchases"

last_reset_at
string<date-time>

When the counter was last reset

Example:

"2024-01-15T10:30:00Z"

reset_after
string

Auto-reset duration, if configured

Example:

"720h"

value
string

Counter value as a string for precision

Example:

"42"