Skip to main content
POST
Create resource

Authorizations

X-API-KEY
string
header
required

API Key Authentication.

Body

application/json

The name, the type, the aggregation, the aggregated property, the billing model, the item and the filters of the resource to create.

name
string
required

The name of the resource.

Example:

"Emails sent"

type
enum<string>
required

Whether the resource measures usage in units (unit) or in money (currency).

Available options:
unit,
currency
aggregation
enum<string>
required

How the resource turns the events of a charge period into one number from the aggregated property: their sum (sum), the last value (last_during_period) or the count of distinct values (unique).

Available options:
sum,
last_during_period,
unique
aggregateByField
string
required

The aggregated property: the property of the events that the aggregation reads.

Example:

"value"

itemId
string<uuid>
required

The id of the item of the resource, the catalog record that names what a charge on the resource bills.

filters
object[]
required

The event filters of the resource: the event names and the property values that an event must have to count for the resource. The filters of one property match when any of them matches, and the filters of different properties must all match. At least one filter must have the property eventName.

Example:
billingModel
enum<string>

How the resource reads its values in a charge period: in_full takes all the events, and proration weighs each value by the days that it was in effect.

Available options:
in_full,
proration

Response

A resource: a named measure of usage, in units or in money, that says which events count and how they add up. A resource has no price.

id
string<uuid>
required

The unique identifier of the resource in our system.

name
string
required

The name of the resource.

Example:

"Emails sent"

type
enum<string>
required

Whether the resource measures usage in units (unit) or in money (currency).

Available options:
unit,
currency
aggregation
enum<string>
required

How the resource turns the events of a charge period into one number from the aggregated property: their sum (sum), the last value (last_during_period) or the count of distinct values (unique).

Available options:
sum,
last_during_period,
unique
aggregateByField
string
required

The aggregated property: the property of the events that the aggregation reads.

Example:

"value"

billingModel
enum<string>
required

How the resource reads its values in a charge period: in_full takes all the events, and proration weighs each value by the days that it was in effect.

Available options:
in_full,
proration
itemId
string<uuid>
required

The id of the item of the resource, the catalog record that names what a charge on the resource bills.

filters
object[]
required

The event filters of the resource: the event names and the property values that an event must have to count for the resource. The filters of one group match when any of them matches, and every group must match. At least one filter has the property eventName.

Example:
archivedAt
string<date-time> | null
required

When the resource was archived, or null when it is not archived.