Skip to main content
Meter usage tracking lets you record consumption events against named meters and retrieve aggregated summaries over a date range. Use it to monitor resource usage, track billable activity, or build internal dashboards around any metric you define. Each usage entry captures a meter name, a numeric usage amount, and an optional timestamp. Sailia stores every entry and aggregates totals per meter when you query a summary.

How it works

  1. Record usage — send a usage entry with a meter name and amount whenever a billable or trackable event occurs.
  2. Query summaries — retrieve aggregated usage and event counts grouped by meter for a given date range.
All timestamps are handled as Unix seconds. If you omit the timestamp when recording, Sailia uses the current server time.

Record a usage entry

Send a POST request to the meter usage endpoint with the following body:
A successful request returns a 201 response with the created entry:

Validation

  • Meter must be a non-empty string.
  • Usage must be numeric and greater than 0.
  • OccurredAt, if provided, must be a valid Unix timestamp integer.
Validation errors return a 422 response with details about which fields failed.

Get a usage summary

Send a GET request to the meter usage endpoint with from and to query parameters in YYYY-MM-DD format:
The response includes totals per meter, along with the overall usage and event count for the period:

Query parameters

The to date must be on or after the from date. Both parameters are required — omitting either returns a 422 error.

Built-in meters

Sailia automatically records usage entries for certain platform events. These meters appear in your usage summaries alongside any custom meters you define — no additional setup is required.

Example summary with built-in meters

Built-in meter entries include an ExtraInfo field with a JSON-encoded payload containing contextual identifiers. You can use these to cross-reference events with other parts of the system.

Error handling

All error responses follow the standard problem detail format:
Common error scenarios: