curl --request POST \
--url https://us.api.flexprice.io/v1/analytics/revenue \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"start_time": "2023-11-07T05:31:56Z",
"currency": "<string>",
"customer_ids": [
"<string>"
],
"end_time": "2023-11-07T05:31:56Z",
"group_by": [
"<string>"
],
"include_adjustments": true,
"meter_ids": [
"<string>"
],
"price_ids": [
"<string>"
],
"subscription_ids": [
"<string>"
]
}
'from flexprice import Flexprice
from flexprice.utils import parse_datetime
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.analytics.get_revenue_analytics(start_time=parse_datetime("2026-09-19T08:36:56.747Z"))
# Handle response
print(res)import { Flexprice } from "@flexprice/sdk";
const flexprice = new Flexprice({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await flexprice.analytics.getRevenueAnalytics({
startTime: new Date("2026-09-19T08:36:56.747Z"),
});
console.log(result);
}
run();package main
import(
"context"
flexprice "github.com/flexprice/go-sdk/v2"
"github.com/flexprice/go-sdk/v2/types"
"github.com/flexprice/go-sdk/v2/models/types"
"log"
)
func main() {
ctx := context.Background()
s := flexprice.New(
flexprice.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Analytics.GetRevenueAnalytics(ctx, types.RevenueAnalyticsRequest{
StartTime: types.MustTimeFromString("2026-09-19T08:36:56.747Z"),
})
if err != nil {
log.Fatal(err)
}
if res.RevenueAnalyticsResponse != nil {
// handle response
}
}{
"contains_allocated": true,
"query": {
"start_time": "2023-11-07T05:31:56Z",
"allocation_policy": "billed",
"currency": "<string>",
"customer_ids": [
"<string>"
],
"end_time": "2023-11-07T05:31:56Z",
"granularity": "day",
"group_by": [
"<string>"
],
"include_adjustments": true,
"meter_ids": [
"<string>"
],
"price_ids": [
"<string>"
],
"status": "PROVISIONAL",
"subscription_ids": [
"<string>"
]
},
"rows": [
{
"adjustment_type": "<string>",
"billable_qty": 123,
"day": "<string>",
"entitlement_amount": 123,
"entitlement_qty": 123,
"group": {},
"invoice_discount": 123,
"line_discount": 123,
"net_amount": 123,
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"status": "PROVISIONAL",
"tier_delta": 123,
"usage_at_list_rate": 123
}
]
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Query revenue analytics
Aggregates revenue_facts by the requested dimensions at day/period/total granularity. allocation_policy places whole-period charges on their booked day (billed) or spreads them across the period (amortized); include_adjustments breaks out true-up/overage/revert amounts as labeled rows. Requires the tenant’s revenue analytics setting.
curl --request POST \
--url https://us.api.flexprice.io/v1/analytics/revenue \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"start_time": "2023-11-07T05:31:56Z",
"currency": "<string>",
"customer_ids": [
"<string>"
],
"end_time": "2023-11-07T05:31:56Z",
"group_by": [
"<string>"
],
"include_adjustments": true,
"meter_ids": [
"<string>"
],
"price_ids": [
"<string>"
],
"subscription_ids": [
"<string>"
]
}
'from flexprice import Flexprice
from flexprice.utils import parse_datetime
with Flexprice(
api_key_auth="<YOUR_API_KEY_HERE>",
) as f_client:
res = f_client.analytics.get_revenue_analytics(start_time=parse_datetime("2026-09-19T08:36:56.747Z"))
# Handle response
print(res)import { Flexprice } from "@flexprice/sdk";
const flexprice = new Flexprice({
apiKeyAuth: "<YOUR_API_KEY_HERE>",
});
async function run() {
const result = await flexprice.analytics.getRevenueAnalytics({
startTime: new Date("2026-09-19T08:36:56.747Z"),
});
console.log(result);
}
run();package main
import(
"context"
flexprice "github.com/flexprice/go-sdk/v2"
"github.com/flexprice/go-sdk/v2/types"
"github.com/flexprice/go-sdk/v2/models/types"
"log"
)
func main() {
ctx := context.Background()
s := flexprice.New(
flexprice.WithSecurity("<YOUR_API_KEY_HERE>"),
)
res, err := s.Analytics.GetRevenueAnalytics(ctx, types.RevenueAnalyticsRequest{
StartTime: types.MustTimeFromString("2026-09-19T08:36:56.747Z"),
})
if err != nil {
log.Fatal(err)
}
if res.RevenueAnalyticsResponse != nil {
// handle response
}
}{
"contains_allocated": true,
"query": {
"start_time": "2023-11-07T05:31:56Z",
"allocation_policy": "billed",
"currency": "<string>",
"customer_ids": [
"<string>"
],
"end_time": "2023-11-07T05:31:56Z",
"granularity": "day",
"group_by": [
"<string>"
],
"include_adjustments": true,
"meter_ids": [
"<string>"
],
"price_ids": [
"<string>"
],
"status": "PROVISIONAL",
"subscription_ids": [
"<string>"
]
},
"rows": [
{
"adjustment_type": "<string>",
"billable_qty": 123,
"day": "<string>",
"entitlement_amount": 123,
"entitlement_qty": 123,
"group": {},
"invoice_discount": 123,
"line_discount": 123,
"net_amount": 123,
"period_end": "2023-11-07T05:31:56Z",
"period_start": "2023-11-07T05:31:56Z",
"status": "PROVISIONAL",
"tier_delta": 123,
"usage_at_list_rate": 123
}
]
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}{
"code": "http_client_error",
"http_status_code": 123,
"message": "<string>"
}Body
Revenue analytics request
GroupBy dimensions: revenue_source, source (the event source recorded in meter_usage; requires customer_ids or subscription_ids), customer_id, subscription_id, price_id, meter_id, currency. revenue_source is always applied — every row says what kind of revenue it is — and requested dimensions are added on top.
IncludeAdjustments breaks the non-obvious components — commitment true-ups, overage and revert (contra) rows — out as their own rows, each labeled with its kind in adjustment_type. Off, they fold into their parent buckets (true-up/overage into usage, reverts into their own source) so visible rows read as plain usage/fixed. Totals are identical either way.
Response
OK

