Skip to main content
PUT
Set a counter or tag's label, description, icon and category
Replaces the label, description, icon_url, and category of one counter or tag definition. label is required, and a field you leave out is cleared. The request needs no rule-configuration change and does not change how rules or counters behave. A tag with no definition gets one. A counter must already have a definition, because its unit comes from a rule-configuration change. For a counter without one, the request returns 404 state_definition_not_found. icon_url must be an https:// URL.
For examples and the participant read that returns these fields, see Display fields.

Authorizations

Authorization
string
header
default:sk_...
required

Send your API key as Authorization: Bearer <key>.

Path Parameters

scope
enum<string>
required

The entity class whose state the key is.

Available options:
participant,
program,
group
kind
enum<string>
required

Counter or tag.

Available options:
counter,
tag
key
string
required

The counter key or tag name.

Body

application/json

The display fields

How people and apps show a counter or tag. Every field is replaced: a field you leave out is cleared.

label
string
required

The name people see. 1 to 255 characters.

Minimum string length: 1
Example:

"First purchase"

category
string

A group name an app can filter by, for example badges. Lowercase letters, digits, _ and -, at most 64 characters, starting with a letter or digit.

Example:

"badges"

description
string

What the counter or tag means. 1 to 1000 characters.

Example:

"Made a first purchase."

icon_url
string

An HTTPS URL of an image an app can show, for example a badge. At most 2048 characters.

Example:

"https://example.com/badges/first-purchase.png"

Response

The saved definition

A counter or tag written by a rule, with a confirmed label and unit.

category
string

A group name an app can filter by, for example badges. Lowercase letters, digits, _ and -, at most 64 characters, starting with a letter or digit.

Example:

"badges"

description
string

What the counter or tag means, for people. 1 to 1000 characters.

Example:

"Made a first purchase."

icon_url
string

An HTTPS URL of an image an app can show for this key, for example a badge. At most 2048 characters.

Example:

"https://example.com/badges/first-purchase.png"

key
string

The counter key or tag name.

Example:

"first_purchase"

kind
enum<string>

Whether the key is a counter or tag.

Available options:
counter,
tag
label
string

The name people see for this key.

Example:

"First purchase"

scope
enum<string>

The entity class whose state is written.

Available options:
participant,
program,
group
unit
enum<string>

The unit of a counter. Tags have no unit.

Available options:
number,
dollars,
cents
window
object

The periods the counter adds up. Omit it for a counter that keeps one total or resets through reset_period or reset_after. You can add a window only to a counter key that no participant, program or group has yet, even at 0. Rules that write the counter cannot send reset_period or reset_after. A saved window cannot change.