curl --request POST \
--url https://us.api.flexprice.io/v1/events/analytics \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"breakdown_bucket": true,
"end_time": "2023-11-07T05:31:56Z",
"expand": [
"<string>"
],
"external_customer_id": "<string>",
"feature_ids": [
"<string>"
],
"group_by": [
"<string>"
],
"include_children": true,
"property_filters": {},
"sources": [
"<string>"
],
"start_time": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://us.api.flexprice.io/v1/events/analytics"
payload = {
"breakdown_bucket": True,
"end_time": "2023-11-07T05:31:56Z",
"expand": ["<string>"],
"external_customer_id": "<string>",
"feature_ids": ["<string>"],
"group_by": ["<string>"],
"include_children": True,
"property_filters": {},
"sources": ["<string>"],
"start_time": "2023-11-07T05:31:56Z"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
breakdown_bucket: true,
end_time: '2023-11-07T05:31:56Z',
expand: ['<string>'],
external_customer_id: '<string>',
feature_ids: ['<string>'],
group_by: ['<string>'],
include_children: true,
property_filters: {},
sources: ['<string>'],
start_time: '2023-11-07T05:31:56Z'
})
};
fetch('https://us.api.flexprice.io/v1/events/analytics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://us.api.flexprice.io/v1/events/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'breakdown_bucket' => true,
'end_time' => '2023-11-07T05:31:56Z',
'expand' => [
'<string>'
],
'external_customer_id' => '<string>',
'feature_ids' => [
'<string>'
],
'group_by' => [
'<string>'
],
'include_children' => true,
'property_filters' => [
],
'sources' => [
'<string>'
],
'start_time' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://us.api.flexprice.io/v1/events/analytics"
payload := strings.NewReader("{\n \"breakdown_bucket\": true,\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"expand\": [\n \"<string>\"\n ],\n \"external_customer_id\": \"<string>\",\n \"feature_ids\": [\n \"<string>\"\n ],\n \"group_by\": [\n \"<string>\"\n ],\n \"include_children\": true,\n \"property_filters\": {},\n \"sources\": [\n \"<string>\"\n ],\n \"start_time\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://us.api.flexprice.io/v1/events/analytics")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"breakdown_bucket\": true,\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"expand\": [\n \"<string>\"\n ],\n \"external_customer_id\": \"<string>\",\n \"feature_ids\": [\n \"<string>\"\n ],\n \"group_by\": [\n \"<string>\"\n ],\n \"include_children\": true,\n \"property_filters\": {},\n \"sources\": [\n \"<string>\"\n ],\n \"start_time\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.flexprice.io/v1/events/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"breakdown_bucket\": true,\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"expand\": [\n \"<string>\"\n ],\n \"external_customer_id\": \"<string>\",\n \"feature_ids\": [\n \"<string>\"\n ],\n \"group_by\": [\n \"<string>\"\n ],\n \"include_children\": true,\n \"property_filters\": {},\n \"sources\": [\n \"<string>\"\n ],\n \"start_time\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"currency": "<string>",
"custom_analytics": [
{
"feature_name": "<string>",
"id": "<string>",
"name": "<string>",
"type": "<string>",
"value": "<string>"
}
],
"items": [
{
"add_on_id": "<string>",
"addon": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"bucket_summaries": [
{
"base_charge": "<string>",
"bucket_id": "<string>",
"commitment_type": "<string>",
"commitment_value": "<string>",
"computed_overage": "<string>",
"computed_true_up": "<string>",
"computed_utilized": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"price_id": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"subscription_line_item_id": "<string>",
"total_usage": "<string>"
}
],
"commitment_info": {
"amount": "<string>",
"computed_commitment_utilized_amount": "<string>",
"computed_overage_amount": "<string>",
"computed_true_up_amount": "<string>",
"is_windowed": true,
"overage_factor": "<string>",
"quantity": "<string>",
"true_up_enabled": true
},
"currency": "<string>",
"event_count": 123,
"event_name": "<string>",
"feature": {
"alert_settings": {
"alert_enabled": true,
"critical": {
"threshold": 123
},
"info": {
"threshold": 123
},
"warning": {
"threshold": 123
}
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter_id": "<string>",
"name": "<string>",
"reporting_unit": {
"conversion_rate": 123,
"unit_plural": "<string>",
"unit_singular": "<string>"
},
"tenant_id": "<string>",
"unit_plural": "<string>",
"unit_singular": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"feature_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"event_name": "<string>",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "<string>",
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"meter_id": "<string>",
"name": "<string>",
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"display_order": 123,
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"plan_id": "<string>",
"points": [
{
"buckets": [
{
"bucket_id": "<string>",
"price_id": "<string>"
}
],
"computed_commitment_utilized_amount": "<string>",
"computed_overage_amount": "<string>",
"computed_true_up_amount": "<string>",
"cost": "<string>",
"discount": "<string>",
"event_count": 123,
"subtotal": "<string>",
"timestamp": "<string>",
"usage": "<string>"
}
],
"price": {
"addon": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"entitlements": [
{
"addon": "<unknown>",
"config_value": {},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"display_order": 123,
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"feature": {
"alert_settings": {
"alert_enabled": true,
"critical": {
"threshold": 123
},
"info": {
"threshold": 123
},
"warning": {
"threshold": 123
}
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"name": "<string>",
"reporting_unit": {
"conversion_rate": 123,
"unit_plural": "<string>",
"unit_singular": "<string>"
},
"tenant_id": "<string>",
"unit_plural": "<string>",
"unit_singular": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"feature_id": "<string>",
"id": "<string>",
"is_enabled": true,
"is_soft_limit": true,
"parent_entitlement_id": "<string>",
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"display_order": 123,
"entitlements": "<array>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"static_value": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"usage_limit": 123
}
],
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"amount": "<string>",
"billing_cadence": "RECURRING",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"display_order": 123,
"entitlements": "<array>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"pricing_unit": {
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"symbol": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"sequence": 123,
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_id": "<string>",
"properties": {},
"reporting_unit": {
"conversion_rate": 123,
"unit_plural": "<string>",
"unit_singular": "<string>"
},
"source": "<string>",
"sources": [
"<string>"
],
"sub_line_item_id": "<string>",
"subscription_id": "<string>",
"subscription_line_item": {
"addon_association_id": "<string>",
"billing_period_count": 123,
"commitment_amount": "<string>",
"commitment_overage_factor": "<string>",
"commitment_quantity": "<string>",
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": 123,
"price_id": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": true
}
],
"commitment_true_up_enabled": true,
"commitment_windowed": true,
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"meter_display_name": "<string>",
"meter_id": "<string>",
"plan_display_name": "<string>",
"price": {
"amount": "<string>",
"billing_cadence": "RECURRING",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"sequence": 123,
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_id": "<string>",
"price_unit": "<string>",
"price_unit_id": "<string>",
"quantity": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"subscription_phase_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"subtotal": "<string>",
"total_cost": "<string>",
"total_discount": "<string>",
"total_usage": "<string>",
"total_usage_display": "<string>",
"unit": "<string>",
"unit_plural": "<string>"
}
],
"subtotal": "<string>",
"total_cost": "<string>",
"total_discount": "<string>"
}{
"http_status_code": 123,
"message": "<string>"
}{
"http_status_code": 123,
"message": "<string>"
}Get usage analytics
Use when building analytics views (e.g. usage by feature or customer over time). Supports filtering, grouping, and time-series breakdown.
curl --request POST \
--url https://us.api.flexprice.io/v1/events/analytics \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"breakdown_bucket": true,
"end_time": "2023-11-07T05:31:56Z",
"expand": [
"<string>"
],
"external_customer_id": "<string>",
"feature_ids": [
"<string>"
],
"group_by": [
"<string>"
],
"include_children": true,
"property_filters": {},
"sources": [
"<string>"
],
"start_time": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://us.api.flexprice.io/v1/events/analytics"
payload = {
"breakdown_bucket": True,
"end_time": "2023-11-07T05:31:56Z",
"expand": ["<string>"],
"external_customer_id": "<string>",
"feature_ids": ["<string>"],
"group_by": ["<string>"],
"include_children": True,
"property_filters": {},
"sources": ["<string>"],
"start_time": "2023-11-07T05:31:56Z"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
breakdown_bucket: true,
end_time: '2023-11-07T05:31:56Z',
expand: ['<string>'],
external_customer_id: '<string>',
feature_ids: ['<string>'],
group_by: ['<string>'],
include_children: true,
property_filters: {},
sources: ['<string>'],
start_time: '2023-11-07T05:31:56Z'
})
};
fetch('https://us.api.flexprice.io/v1/events/analytics', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://us.api.flexprice.io/v1/events/analytics",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'breakdown_bucket' => true,
'end_time' => '2023-11-07T05:31:56Z',
'expand' => [
'<string>'
],
'external_customer_id' => '<string>',
'feature_ids' => [
'<string>'
],
'group_by' => [
'<string>'
],
'include_children' => true,
'property_filters' => [
],
'sources' => [
'<string>'
],
'start_time' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://us.api.flexprice.io/v1/events/analytics"
payload := strings.NewReader("{\n \"breakdown_bucket\": true,\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"expand\": [\n \"<string>\"\n ],\n \"external_customer_id\": \"<string>\",\n \"feature_ids\": [\n \"<string>\"\n ],\n \"group_by\": [\n \"<string>\"\n ],\n \"include_children\": true,\n \"property_filters\": {},\n \"sources\": [\n \"<string>\"\n ],\n \"start_time\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://us.api.flexprice.io/v1/events/analytics")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"breakdown_bucket\": true,\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"expand\": [\n \"<string>\"\n ],\n \"external_customer_id\": \"<string>\",\n \"feature_ids\": [\n \"<string>\"\n ],\n \"group_by\": [\n \"<string>\"\n ],\n \"include_children\": true,\n \"property_filters\": {},\n \"sources\": [\n \"<string>\"\n ],\n \"start_time\": \"2023-11-07T05:31:56Z\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.flexprice.io/v1/events/analytics")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"breakdown_bucket\": true,\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"expand\": [\n \"<string>\"\n ],\n \"external_customer_id\": \"<string>\",\n \"feature_ids\": [\n \"<string>\"\n ],\n \"group_by\": [\n \"<string>\"\n ],\n \"include_children\": true,\n \"property_filters\": {},\n \"sources\": [\n \"<string>\"\n ],\n \"start_time\": \"2023-11-07T05:31:56Z\"\n}"
response = http.request(request)
puts response.read_body{
"currency": "<string>",
"custom_analytics": [
{
"feature_name": "<string>",
"id": "<string>",
"name": "<string>",
"type": "<string>",
"value": "<string>"
}
],
"items": [
{
"add_on_id": "<string>",
"addon": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"bucket_summaries": [
{
"base_charge": "<string>",
"bucket_id": "<string>",
"commitment_type": "<string>",
"commitment_value": "<string>",
"computed_overage": "<string>",
"computed_true_up": "<string>",
"computed_utilized": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"price_id": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"subscription_line_item_id": "<string>",
"total_usage": "<string>"
}
],
"commitment_info": {
"amount": "<string>",
"computed_commitment_utilized_amount": "<string>",
"computed_overage_amount": "<string>",
"computed_true_up_amount": "<string>",
"is_windowed": true,
"overage_factor": "<string>",
"quantity": "<string>",
"true_up_enabled": true
},
"currency": "<string>",
"event_count": 123,
"event_name": "<string>",
"feature": {
"alert_settings": {
"alert_enabled": true,
"critical": {
"threshold": 123
},
"info": {
"threshold": 123
},
"warning": {
"threshold": 123
}
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter_id": "<string>",
"name": "<string>",
"reporting_unit": {
"conversion_rate": 123,
"unit_plural": "<string>",
"unit_singular": "<string>"
},
"tenant_id": "<string>",
"unit_plural": "<string>",
"unit_singular": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"feature_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"event_name": "<string>",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "<string>",
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"meter_id": "<string>",
"name": "<string>",
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"display_order": 123,
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"plan_id": "<string>",
"points": [
{
"buckets": [
{
"bucket_id": "<string>",
"price_id": "<string>"
}
],
"computed_commitment_utilized_amount": "<string>",
"computed_overage_amount": "<string>",
"computed_true_up_amount": "<string>",
"cost": "<string>",
"discount": "<string>",
"event_count": 123,
"subtotal": "<string>",
"timestamp": "<string>",
"usage": "<string>"
}
],
"price": {
"addon": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"entitlements": [
{
"addon": "<unknown>",
"config_value": {},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"display_order": 123,
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"feature": {
"alert_settings": {
"alert_enabled": true,
"critical": {
"threshold": 123
},
"info": {
"threshold": 123
},
"warning": {
"threshold": 123
}
},
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"description": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"name": "<string>",
"reporting_unit": {
"conversion_rate": 123,
"unit_plural": "<string>",
"unit_singular": "<string>"
},
"tenant_id": "<string>",
"unit_plural": "<string>",
"unit_singular": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"feature_id": "<string>",
"id": "<string>",
"is_enabled": true,
"is_soft_limit": true,
"parent_entitlement_id": "<string>",
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"display_order": 123,
"entitlements": "<array>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"plan_id": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"static_value": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>",
"usage_limit": 123
}
],
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"amount": "<string>",
"billing_cadence": "RECURRING",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group": {
"created_at": "2023-11-07T05:31:56Z",
"entity_ids": [
"<string>"
],
"entity_type": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"status": "<string>",
"updated_at": "2023-11-07T05:31:56Z"
},
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter": {
"aggregation": {
"expression": "<string>",
"field": "<string>",
"group_by": "<string>",
"multiplier": "<string>"
},
"created_at": "2024-03-20T15:04:05Z",
"event_name": "api_request",
"filters": [
{
"key": "<string>",
"values": [
"<string>"
]
}
],
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "API Usage Meter",
"status": "published",
"tenant_id": "tenant123",
"updated_at": "2024-03-20T15:04:05Z"
},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"plan": {
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grants": [
{
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"credit_grant_anchor": "2023-11-07T05:31:56Z",
"credits": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"environment_id": "<string>",
"expiration_duration": 123,
"id": "<string>",
"metadata": {},
"name": "<string>",
"period_count": 123,
"plan_id": "<string>",
"priority": 123,
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"tenant_id": "<string>",
"topup_conversion_rate": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
}
],
"description": "<string>",
"display_order": 123,
"entitlements": "<array>",
"environment_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"name": "<string>",
"prices": "<array>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"pricing_unit": {
"base_currency": "<string>",
"code": "<string>",
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"name": "<string>",
"symbol": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"sequence": 123,
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_id": "<string>",
"properties": {},
"reporting_unit": {
"conversion_rate": 123,
"unit_plural": "<string>",
"unit_singular": "<string>"
},
"source": "<string>",
"sources": [
"<string>"
],
"sub_line_item_id": "<string>",
"subscription_id": "<string>",
"subscription_line_item": {
"addon_association_id": "<string>",
"billing_period_count": 123,
"commitment_amount": "<string>",
"commitment_overage_factor": "<string>",
"commitment_quantity": "<string>",
"commitment_time_buckets": [
{
"commitment_value": "<string>",
"end": {
"hour": 12,
"minute": 29
},
"id": "<string>",
"overage_factor": 123,
"price_id": "<string>",
"start": {
"hour": 12,
"minute": 29
},
"true_up_enabled": true
}
],
"commitment_true_up_enabled": true,
"commitment_windowed": true,
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"customer_id": "<string>",
"display_name": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"id": "<string>",
"metadata": {},
"meter_display_name": "<string>",
"meter_id": "<string>",
"plan_display_name": "<string>",
"price": {
"amount": "<string>",
"billing_cadence": "RECURRING",
"billing_period_count": 123,
"conversion_rate": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"created_by": "<string>",
"currency": "<string>",
"description": "<string>",
"display_amount": "<string>",
"display_name": "<string>",
"display_price_unit_amount": "<string>",
"end_date": "2023-11-07T05:31:56Z",
"entity_id": "<string>",
"environment_id": "<string>",
"group_id": "<string>",
"id": "<string>",
"lookup_key": "<string>",
"metadata": {},
"meter_id": "<string>",
"min_quantity": "<string>",
"parent_price_id": "<string>",
"price_unit": "<string>",
"price_unit_amount": "<string>",
"price_unit_id": "<string>",
"price_unit_tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"sequence": 123,
"start_date": "2023-11-07T05:31:56Z",
"tenant_id": "<string>",
"tiers": [
{
"flat_amount": "<string>",
"unit_amount": "<string>",
"up_to": 123
}
],
"transform_quantity": {
"divide_by": 123
},
"trial_period_days": 123,
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"price_id": "<string>",
"price_unit": "<string>",
"price_unit_id": "<string>",
"quantity": "<string>",
"start_date": "2023-11-07T05:31:56Z",
"subscription_id": "<string>",
"subscription_phase_id": "<string>",
"tenant_id": "<string>",
"updated_at": "2023-11-07T05:31:56Z",
"updated_by": "<string>"
},
"subtotal": "<string>",
"total_cost": "<string>",
"total_discount": "<string>",
"total_usage": "<string>",
"total_usage_display": "<string>",
"unit": "<string>",
"unit_plural": "<string>"
}
],
"subtotal": "<string>",
"total_cost": "<string>",
"total_discount": "<string>"
}{
"http_status_code": 123,
"message": "<string>"
}{
"http_status_code": 123,
"message": "<string>"
}Authorizations
Enter your API key in the format x-api-key <api-key>*
Body
Request body
BreakdownBucket when true augments each time-series point with BucketID/PriceID and appends a BucketSummaries rollup to each item. Requires WindowSize to be set and the item to be linked to a subscription line item that has CommitmentTimeBuckets. Default: false (opt-in, backward compatible).
allowed values: "price", "meter", "feature", "subscription_line_item","plan","addon"
ExternalCustomerID is the single external customer ID. Optional when ExternalCustomerIDs is provided; required otherwise.
allowed values: "source", "feature_id", "properties.<field_name>"
IncludeChildren when true folds child customers' usage into the single aggregated total. Default: false.
Property filters to filter the events by the keys in properties field of the event
Show child attributes
Show child attributes
MINUTE, 15MIN, 30MIN, HOUR, 3HOUR, 6HOUR, 12HOUR, DAY, WEEK, MONTH 
