Skip to main content
PUT
Set participant counter
Sets a counter to a specific value. You can also configure reset_after in the same call to enable auto-reset behavior. The key is passed as a path parameter. This endpoint sets the counter to an absolute value with last-write-wins semantics: concurrent PUTs do not accumulate. Use it for manual corrections or initializing counters from an external data source. To add to a counter atomically, use increment counter. If the counter does not exist, it is created.
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

Participant 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"