Skip to main content
A usage module joins two objects: the one holding what you sell and the one holding who consumes it. Your application records consumption against it; Custral stores the events on the product and customer records.

Attributes

string
Unique identifier, prefixed umod_.
string | null
What this metered product is called.
string | null
The object holding the things being sold.
string | null
The object holding the people who consume them.
string | null
Optional property an external system identifies products by: a SKU, say.
string | null
Optional property an external system identifies customers by.
string | null
ISO 8601 timestamp.

Two keys, on purpose

Recording usage and reading it back need different keys, and the split is deliberate: track takes a publishable key so it can be called straight from a browser at the moment of consumption. Reading events back is not publishable. A client-side key must never be able to enumerate a workspace’s usage.

Recording usage

Use @custral/js from your app:

Reading it back

With the server SDK, holding usage:read:
Events come back newest first, 50 to a call. That is the one list in the API whose length is set by your own application rather than by anything a person does in the workspace, so it always pages. A call without limit is a page, not the history.
integer
Page size, 1–200. Defaults to 50.
integer
Rows to skip, for the next page.
To total a period, filter it rather than paging to the end: