Usage

Get the usage breakdown

What the workspace consumed and was charged over a window, grouped by one dimension per call (by: day, platform or keyword), in USD cents at list price, with the window's totals on every call. range reads a trailing window of UTC days ending today (default 30d); month reads one calendar month (YYYY-MM), the shape a bill or a per-customer margin is reconciled against. Keyword-days come from the daily tick and mention charges from the matches that billed, so a deleted keyword keeps its charges in the keyword rows (keyword.removed) while its mention counts read 0; the same numbers ride on each keyword as stats.cost for the running month. totals.ledgerDebitCents is what the wallet has debited so far for the window's days: mentions settle the morning after their day, so a window ending today lags totals.totalCents by the unsettled ones, and a closed month differs from it only by cumulative rounding. Rows are paged (limit, offset, total); a workspace may read this at most 30 times a minute through its keys and tokens together.

get/v1/usage/breakdown

Request

  • Base URL: https://api.mentio.dev
  • URL: https://api.mentio.dev/v1/usage/breakdown
  • Auth: HTTP bearer

Query parameters

by'day' | 'platform' | 'keyword' | 'group'

The dimension to group by: day (one row per UTC day of the window), platform, keyword (default: the row a margin is computed from), or group (what a customer or a campaign cost).

range'7d' | '30d' | '90d'

Trailing window of UTC days ending today: 7d, 30d, 90d (default 30d). Ignored when month is given.

monthstring

A calendar month (YYYY-MM, UTC) instead of a trailing window: from its first day to its last, or to today for the running month. A future month is a 400.

fromstring

First UTC day of a custom window, YYYY-MM-DD, inclusive; with to (default today). At most 366 days. Wins over range and month.

tostring

Last UTC day of a custom window, YYYY-MM-DD, inclusive; never after today. Needs from.

keywordIdsstring[] nullable

Only these keywords (kw_...), deleted ones included. Repeatable, or comma-separated.

groupIdsstring[] nullable

Only these groups (grp_...): a keyword-day by the group it was metered under, a mention or a comment by its keyword's group as it is now. Repeatable, or comma-separated.

platformsstring[]

Only these platforms. A keyword-day belongs to no platform, so with this filter the keyword line reads 0 and only mentions and comments count. Repeatable, or comma-separated.

limitinteger

Rows per page, 1 to 500 (default 100). Only by=keyword can outgrow a page; a window has at most 90 days and a dozen platforms.

offsetinteger nullable

Skip this many rows.

Response

The window's totals and one page of rows for the dimension

by'day' | 'platform' | 'keyword' | 'group' required

The dimension the rows are grouped by.

filteredboolean required

true when keywordIds, groupIds or platforms narrowed the report: totals and rows count only what passes them, except totals.ledgerDebitCents, which is the whole workspace's.

currency'USD' required

Every amount is in USD cents.

totalinteger required

Rows in the dimension before limit and offset.

Changes

No recorded changes to this operation across all 1 revision of this API.