Skip to navigation

write_metering

Ingest usage events. Create, update and delete meter config

Live server: test server (test.mcp.solvimon.com) only.

Ingests usage events and creates, updates and deletes meter configuration.

Actions: create, update, delete (meter config), ingest, batch_ingest (events)

Resource types: meters, meter_values, meter_value_calculations, meter_properties, meter_data, events

Send one event per discrete unit of activity. Do not pre-aggregate. Each event needs a unique reference (its idempotency key), meter_reference or meter_id, customer_id or customer_reference, and the measured amounts under meter_values[] as {reference, number} pairs. There is no flat value field.

Ingest a usage event
{
"action": "ingest",
"resource_type": "events",
"body": {
"reference": "evt-0001",
"meter_reference": "api-calls",
"customer_id": "cust_AbD3DqausjOYiMNDZY11F",
"meter_values": [{"reference": "api-calls-count", "number": "1"}]
}
}
  • A meter property is NUMBER, STRING or ENUM (with enum_values). Pass meter_id to attach it to a meter; on an ACTIVE meter it is created ACTIVE.
  • Updating a meter’s properties or values replaces its list. An update that would drop an existing entry is refused unless the body has "allow_detach": true.
  • On a calculation only name and description can change. Anything that defines what is measured needs a new calculation. The result lists the product items that use it.

Delete in dependency order: meter properties, then meter value calculations, then meter values, then meters. Product items that reference a meter must first be removed from active plan versions. The calculate action is deprecated; use get_metering calculate_cost.