Tasks
Get Stubbucks Usage
Returns your organization's Stubbucks charges for a date range, totalled or grouped by template, draft or live, context, stub, stubpost, action, charge code, category, day or month. Useful for usage reports, cost alerts and showing what a process costs.
The task reports on the organization of the stub it runs in. It looks back at most 93 days.
For scheduled or large reports, set execution.ephemeral to true. The result is still available to the rest of the action, eg to build a PDF or send a summary, but isn't saved on the stubpost. Otherwise every run of the report is stored on its stubpost.
Basic usage
Total charges per template for November:
Permissions
The user who runs the action needs the view_billing permission in the organization. Actions that aren't run by a user, such as scheduled actions and actions triggered by messages on WhatsApp, email, SMS or webchat, run as the Stubber System user and are always allowed.
Parameters
date_from required string
The start of the range, as a date (2026-11-01) or a date and time without an offset (2026-11-01T08:00), in timezone. It can be at most 93 days ago.
date_to required string
The end of the range, in the same format. A date includes the whole day, a date and time is inclusive.
timezone optional string
The IANA time zone the dates are in, eg Africa/Johannesburg. It also decides where day and month groups start and end.
Default: UTC
group_by optional array
What to group the charges by. Combine several to group by all of them, eg ["template", "day"] gives one row per template per day. Leave it out for one row with the organization's total.
templateuuids, stubrefs, codes, action_names, branches, contexts optional array
Only count charges for these templates, stubs, charge codes or action names. Filters don't change the rows' fields, and they can be combined with any group_by.
limit optional number
The most rows to return, from 1 to 5000. The groups with the highest charges are kept, and the rest are added up in an _other row.
Default: 500
Result
Properties
payload.rows array
One row per group, with the highest charges first. Rows grouped only by day or month are in date order. Each row has the fields of its groups (see group_by above) and these values:
Charges that don't belong to a template or stub, such as platform charges, have null in those fields.
payload.totals object
total_price_msb, total_stubbucks, total_usd, charges and stubs for all the charges in the range, including those in _other.
payload.truncated boolean
true when there were more groups than limit. The last row then has _other in its group fields and holds the remaining charges, so the rows always add up to totals. _other has no stubs count.
payload.action_names_complete_until string
Only when grouping or filtering by action_name, branch or context. These are filled in every 15 minutes, so the most recent charges don't have them yet. They're left out of the rows and totals, and this is the time (in timezone) up to which charges are included.
Charges whose stubpost can't be found, and charges that don't belong to a stubpost, have _unknown as their action name, branch and context. When grouping by stubpost, a stubpost that hasn't been filled in yet has null instead.
Errors
These are conceptual errors.
Reports are cached for 5 minutes, so running the same report again within 5 minutes returns the same result.
Examples
Daily cost of one template this month
What this template costs in production
Leave out draft testing with the branches filter:
Which actions cost the most
Group by action_name and use stubposts for the cost per run: