Analytics query cookbook
Copy-paste recipes for common questions. Each is the query value you send to
POST /query. See the Schema reference for every column.
Reminder: monetary columns are integer cents (divide by 100), and
UInt64/Int64 results come back as JSON strings.
Usage & signals
Total signals in the last 30 days
Signal volume by type
Daily signal time-series
Signals by customer (resolving names)
Querying signal metadata
Signals carry a free-form JSON data payload. Access a field with
data.<path> and cast it to a type. First discover available keys with
GET /signals/metadata, then filter or group on them.
Casting a missing key with ::String yields an empty string (''), not
NULL — so a '' bucket in a grouped result represents signals that don’t
carry that key.
Group by a string metadata field
Filter on a metadata field
Aggregate a numeric metadata field
AI cost
Total spend (dollars) by vendor
Spend by model with token usage
Daily cost trend
Cost by customer
Cost per signal (joining usage and cost)
Signals and costs share a trace_id, so you can attribute AI cost to the
signal that incurred it.
Revenue
Monthly revenue (posted invoices)
Revenue by customer
Revenue by product (invoice lines → order lines → products)
Outstanding / overdue invoices
Payments / cash flow
Billed usage
Which signals drive billed revenue
Overage (usage above the included allowance)
Credits
Net credit flow by currency
Top credit-spending signals
Delivered value
Value delivered by type
Value vs. cost (ROI) by customer
Paginating large result sets
Results are capped at 10,000 rows. For larger extracts, page with a WHERE
filter on an ordered column (keyset pagination) rather than a large OFFSET: