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>"
]
}
'import requests
url = "https://us.api.flexprice.io/v1/analytics/revenue"
payload = {
"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>"]
}
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({
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>']
})
};
fetch('https://us.api.flexprice.io/v1/analytics/revenue', 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/analytics/revenue",
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([
'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>'
]
]),
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/analytics/revenue"
payload := strings.NewReader("{\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"currency\": \"<string>\",\n \"customer_ids\": [\n \"<string>\"\n ],\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"group_by\": [\n \"<string>\"\n ],\n \"include_adjustments\": true,\n \"meter_ids\": [\n \"<string>\"\n ],\n \"price_ids\": [\n \"<string>\"\n ],\n \"subscription_ids\": [\n \"<string>\"\n ]\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/analytics/revenue")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"currency\": \"<string>\",\n \"customer_ids\": [\n \"<string>\"\n ],\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"group_by\": [\n \"<string>\"\n ],\n \"include_adjustments\": true,\n \"meter_ids\": [\n \"<string>\"\n ],\n \"price_ids\": [\n \"<string>\"\n ],\n \"subscription_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.flexprice.io/v1/analytics/revenue")
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 \"start_time\": \"2023-11-07T05:31:56Z\",\n \"currency\": \"<string>\",\n \"customer_ids\": [\n \"<string>\"\n ],\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"group_by\": [\n \"<string>\"\n ],\n \"include_adjustments\": true,\n \"meter_ids\": [\n \"<string>\"\n ],\n \"price_ids\": [\n \"<string>\"\n ],\n \"subscription_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"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>"
]
}
'import requests
url = "https://us.api.flexprice.io/v1/analytics/revenue"
payload = {
"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>"]
}
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({
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>']
})
};
fetch('https://us.api.flexprice.io/v1/analytics/revenue', 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/analytics/revenue",
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([
'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>'
]
]),
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/analytics/revenue"
payload := strings.NewReader("{\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"currency\": \"<string>\",\n \"customer_ids\": [\n \"<string>\"\n ],\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"group_by\": [\n \"<string>\"\n ],\n \"include_adjustments\": true,\n \"meter_ids\": [\n \"<string>\"\n ],\n \"price_ids\": [\n \"<string>\"\n ],\n \"subscription_ids\": [\n \"<string>\"\n ]\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/analytics/revenue")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"start_time\": \"2023-11-07T05:31:56Z\",\n \"currency\": \"<string>\",\n \"customer_ids\": [\n \"<string>\"\n ],\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"group_by\": [\n \"<string>\"\n ],\n \"include_adjustments\": true,\n \"meter_ids\": [\n \"<string>\"\n ],\n \"price_ids\": [\n \"<string>\"\n ],\n \"subscription_ids\": [\n \"<string>\"\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://us.api.flexprice.io/v1/analytics/revenue")
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 \"start_time\": \"2023-11-07T05:31:56Z\",\n \"currency\": \"<string>\",\n \"customer_ids\": [\n \"<string>\"\n ],\n \"end_time\": \"2023-11-07T05:31:56Z\",\n \"group_by\": [\n \"<string>\"\n ],\n \"include_adjustments\": true,\n \"meter_ids\": [\n \"<string>\"\n ],\n \"price_ids\": [\n \"<string>\"\n ],\n \"subscription_ids\": [\n \"<string>\"\n ]\n}"
response = http.request(request)
puts response.read_body{
"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>"
}Authorizations
Enter your API key in the format x-api-key <api-key>*
Body
Revenue analytics request
StartTime/EndTime bound the day range (inclusive days derived in UTC). EndTime is optional and defaults to now.
billed, amortized Filters restrict the rows before aggregation.
day, period, total 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.
PROVISIONAL, FINAL Response
OK
ContainsAllocated is true when any bucket includes whole-period amounts spread across days (amortized) or booked on a single day (billed) — i.e. the day view carries period-shaped charges, not only true daily accruals.
Show child attributes
Show child attributes
Show child attributes
Show child attributes

