OverviewPlatformsAPI Reference
Usage

Get the usage breakdown

Returns what the workspace used and was charged over a period, in US cents at list price. Each call groups rows by one by value, day, platform or keyword, and always includes the totals. range reads the past UTC days up to today (30d by default). month reads one calendar month (YYYY-MM), which is what you match against a bill or a per-client margin. Keyword-days come from the daily run and mention charges from billed matches. So a deleted keyword keeps its charges in the keyword rows (keyword.removed), while its mention counts show 0. Each keyword carries the same numbers for the current month as stats.cost. totals.ledgerDebitCents is what the balance has been debited so far for the period's days. Mentions settle the morning after, so a period ending today is below totals.totalCents by the unsettled ones, and a finished month differs only by cumulative rounding. Rows come in pages (limit, offset, total). A workspace can call this 30 times a minute across all its keys and tokens.


GET
/v1/usage/breakdown

Authorization

bearerAuth
AuthorizationBearer <token>

An API key from POST /v1/api-keys. Keys start with ref_.

In: header

Query Parameters

by?string

How to group the rows. day gives one row per UTC day, then platform, keyword (the default, used to work out margins), or group (the cost of a client or campaign).

Default"keyword"

Value in

  • "day"
  • "platform"
  • "keyword"
  • "group"
range?string

How many UTC days back from today to read. One of 7d, 30d or 90d, 30d by default. Ignored when you send month.

Value in

  • "7d"
  • "30d"
  • "90d"
month?string

A calendar month (YYYY-MM, UTC) to read instead of a range. It covers the month's first to last day, or up to today for the current month. A future month returns 400.

Match^\d{4}-(0[1-9]|1[0-2])$
limit?integer

How many rows to return, from 1 to 500, 100 by default. Only by=keyword can need more than one page, since a period has at most 90 days and there are only a dozen platforms.

Range1 <= value <= 500
Default100
offset?|

How many rows to skip.

Range0 <= value
Default0

Response Body

application/json

application/json

application/json

application/json

curl -X GET "https://example.com/v1/usage/breakdown"
{  "window": {    "from": "string",    "to": "string",    "days": 0,    "keywordDaysFrom": "string"  },  "by": "day",  "currency": "USD",  "totals": {    "keywordDays": 0,    "keywordCents": 0,    "matchedMentions": 0,    "billableMentions": 0,    "mentionCents": 0,    "totalCents": 0,    "unclassifiedMentions": 0,    "ledgerDebitCents": 0,    "unattributedBillable": 0  },  "data": [    {      "key": "string",      "label": "string",      "keyword": {        "id": "string",        "term": "string",        "removed": true      },      "group": {        "id": "string",        "name": "string",        "removed": true      },      "keywordDays": 0,      "keywordCents": 0,      "matchedMentions": 0,      "billableMentions": 0,      "mentionCents": 0,      "totalCents": 0    }  ],  "total": 0}
Was this page helpful?