Skip to main content
POST
/
meter-usage
/
analytics
Get meter usage analytics
curl --request POST \
  --url https://us.api.flexprice.io/v1/meter-usage/analytics \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '
{
  "aggregation_type": "COUNT",
  "end_time": "2024-02-01T00:00:00Z",
  "external_customer_id": "cust_123",
  "meter_ids": [
    "mtr_abc",
    "mtr_def"
  ],
  "start_time": "2024-01-01T00:00:00Z",
  "billing_anchor": "2023-11-07T05:31:56Z",
  "window_size": "MINUTE"
}
'
{
  "items": [
    {
      "aggregation_type": "COUNT",
      "event_count": 42,
      "meter_id": "mtr_abc",
      "points": [
        {
          "event_count": 10,
          "timestamp": "2024-01-01T00:00:00Z",
          "value": "100.0000"
        }
      ],
      "total_value": "1234.5678"
    }
  ]
}

Authorizations

x-api-key
string
header
required

Enter your API key in the format x-api-key <api-key>*

Body

application/json

Analytics parameters

aggregation_type
enum<string>
required
Available options:
COUNT,
SUM,
AVG,
COUNT_UNIQUE,
LATEST,
SUM_WITH_MULTIPLIER,
MAX,
WEIGHTED_SUM
end_time
string<date-time>
required
Example:

"2024-02-01T00:00:00Z"

external_customer_id
string
required
Example:

"cust_123"

meter_ids
string[]
required
Minimum array length: 1
Example:
["mtr_abc", "mtr_def"]
start_time
string<date-time>
required
Example:

"2024-01-01T00:00:00Z"

billing_anchor
string<date-time>
window_size
enum<string>
Available options:
MINUTE,
15MIN,
30MIN,
HOUR,
3HOUR,
6HOUR,
12HOUR,
DAY,
WEEK,
MONTH,
MONTH

Response

OK

items
object[]