Meters
Create a meter
Changed onDefine how a stream of usage events is aggregated into billable units. The unit label doubles as the display unit and as the credit bucket the meter settles into. A duplicate name within the store is rejected with 409 meter_name_taken.
post/v1/meters
Request
- Base URLhttps://api.creem.io
- AuthAPI key in header x-api-key
- TypeScriptA function with typed inputs. Its response is checked against the schema.
Request body
Example request
{
"name": "Image generations",
"event_name": "image.generated",
"aggregation": "sum",
"aggregation_property": "tokens",
"filter": {
"conjunction": "and",
"clauses": [
{
"property": "tier",
"operator": "equals"
}
]
},
"unit_label": "images"
}Response
Meter created
Example response
{
"id": "mtr_abc123",
"store_id": "sto_abc123",
"name": "Image generations",
"event_name": "image.generated",
"aggregation": "sum",
"aggregation_property": "tokens",
"filter": {
"conjunction": "and",
"clauses": [
{
"property": "tier",
"operator": "equals"
}
]
},
"unit_label": "images",
"status": "active"
}Changes
- info
endpoint added
- info