Skip to main content
POST
Create a unit

Authorizations

Authorization
string
header
required

A project key (Developers → API keys). Keep it on your server, not in an app.

Headers

traceparent
string

W3C Trace Context; joins your trace to ours

Idempotency-Key
string
required

A retry with the same key and body returns the first response

Required string length: 1 - 255

Body

application/json
name
string
required

The unit's name, 1 to 80 characters: Beans, XP

Required string length: 1 - 80
group
enum<string>
required

The tab the unit sits in: points, progress, badge or perk. A label for how people think of it; what it can do comes from its switches

Available options:
points,
progress,
badge,
perk
key
string

Lowercase letters, numbers, - and _, starting with a letter, up to 64 characters. Defaults to a slug of the name. Must not be taken by another unit

Pattern: ^[a-z][a-z0-9_-]{0,63}$
singular
string

One of it, 1 to 80 characters. Defaults to the name

Required string length: 1 - 80
shows_as
enum<string>

Defaults to amount

Available options:
amount,
thing,
level
color
enum<string>

Defaults to none: the app picks its own

Available options:
blue,
green,
amber,
red,
purple,
pink,
teal,
gray
switches
object

Anything left out is the default: up and down, no cap, floor 0, no supply, no expiry, not usable, not sendable (100 a day if it is made so), no reset

Response

Create a unit

id
string
required

The unit_… ID

key
string
required

The unit's key: lowercase letters, numbers, - and _, starting with a letter, up to 64 characters. Rules and calls name the unit by it

Pattern: ^[a-z][a-z0-9_-]{0,63}$
name
string
required

The unit's name, as people see it: Beans, XP

singular
string
required

One of it: Bean, day, Free drink

group
enum<string>
required

The tab the unit sits in: points, progress, badge or perk. A label for how people think of it; what it can do comes from its switches

Available options:
points,
progress,
badge,
perk
shows_as
enum<string>
required

amount: a token and a number. thing: its own art, like a badge. level: a hexagon with the level in it

Available options:
amount,
thing,
level
color
enum<string> | null
required

The color apps draw it in (a level's hexagon, a chart's line). Null until one is chosen: the app picks its own

Available options:
blue,
green,
amber,
red,
purple,
pink,
teal,
gray,
null
switches
object
required

What the unit allows. Each setting is checked on every change to a balance

stats
object
required

Totals across everyone, kept up to date by Lurk

created_at
string<date-time>
required

When it was created: UTC, ISO 8601

updated_at
string<date-time>
required

When it last changed: UTC, ISO 8601