Total Revenue, Grouped

POST https://api.suger.cloud/ai/org/{orgId}/revenue/record-aggregate

Totals this organization's revenue in the database and returns the grouped amounts, answering "how much" in one call and without summing rows page by page. Narrow with any of partner, productId, entitlementId, buyerId and currency, and bound it with startDate and endDate (YYYY-MM-DD, at most 7305 days apart). Without a startDate it covers only the 30 days before endDate, which defaults to today, so pass both dates for any longer total. Reads only: it is a POST because the filters travel as a body, not because it changes anything.

Parameters

NameInTypeRequiredDescription
orgId path string yes Organization ID

Request Body

Required. Content-Type: application/json · Schema: object

Request body fields:

FieldTypeRequiredDescription
partner string no
productId string no
entitlementId string no
buyerId string no
currency string no
startDate string no
endDate string no

Responses

200 — Legacy Revenue aggregate

Content-Type: application/json

400 — Invalid legacy Revenue request

Content-Type: application/json

Response fields:

FieldTypeRequiredDescription
error string yes
detail string no

403 — Missing Revenue permission

Content-Type: application/json

Response fields:

FieldTypeRequiredDescription
error string yes
detail string no

413 — Request body too large

Content-Type: application/json · Schema: RevenuePayloadTooLargeResponse

RevenuePayloadTooLargeResponse fields:

FieldTypeRequiredDescription
error object yes

500 — Failed to query Revenue records

Content-Type: application/json

Response fields:

FieldTypeRequiredDescription
error string yes
detail string no

Example

The request bodies are this operation's documented examples; the response and error bodies are generated from its schema. Substitute your own ids, and set SUGER_TOKEN to a bearer token from the OAuth client-credentials exchange.

Request

curl -X POST 'https://api.suger.cloud/ai/org/{orgId}/revenue/record-aggregate' \
  -H "Authorization: Bearer $SUGER_TOKEN" \
  -H 'Content-Type: application/json' \
  -d '{
  "partner": "AWS",
  "startDate": "2026-01-01",
  "endDate": "2026-06-30"
}'

Response — 200

{}

Error — 400

{
  "error": "string",
  "detail": "string"
}

View as Markdown · API reference overview

Spotted something wrong or out of date on this page? Tell us and we'll correct it.