Usage Analytics
The analytics endpoint is how you read usage data back out of MarginFront. It returns rolled-up numbers for any customer, agent, or time window you specify. Use it to:- Power “current period usage” widgets in your own product
- Build cost dashboards that show your customers what they’ve used this month
- Project a customer’s end-of-month bill before the invoice is generated
- Feed data into your own BI tools
The endpoint
Method & URL:x-api-key header.
Query parameters
All optional. If you don’t specify any, you get a roll-up for the whole org over the default time window.| Param | Type | Description |
|---|---|---|
startDate | ISO date | Start of the time window (inclusive). |
endDate | ISO date | End of the time window (inclusive). |
customerId | UUID | Filter to a single customer. Use MarginFront’s internal customer UUID (not your externalId). |
agentId | UUID | Filter to a single agent. |
signalId | UUID | Filter to a single signal. |
groupBy | string | Time-bucket size for timeSeriesData. One of "daily", "weekly", "monthly". Default: "daily". |
breakdownBy | string | Add a dimensionBreakdown section broken out by one of "customer", "signal", "agent". When omitted, the response has no dimensionBreakdown field. |
groupBy or breakdownBy value, the API returns 400 Bad Request with a message listing the accepted values.
Example curl calls
Get everything for April 2026:What you get back (200 OK)
breakdownBy, an additional dimensionBreakdown field appears at the top level:
Understanding the response
summary— totals across the entire date range. This is what most dashboards want. Fields:totalEvents,totalQuantity,totalCost,avgCostPerEvent.timeSeriesData— one row per time bucket (daily,weekly, ormonthlydepending ongroupBy). Good for drawing charts. Note the row field iseventCount(nottotalEvents).metadata— lookup dictionaries mapping UUIDs to human-readable names for signals, customers, and agents referenced in the results. Use it to render labels without a second round-trip.dimensionBreakdown— present only when you passbreakdownBy=customer|signal|agent. An object withdimensionType, asummaryarray (one row per dimension with totals across the window), and atimelinearray (per-bucket rows tagged with the dimension).dateRangeandfilters— echo back what you queried so the response is self-describing.filterscontains only the keys you actually passed (it’s{}when you passed no filters).
GET /v1/events, where usageCost and quantity are strings. Analytics values are already rolled up, so sub-cent precision only shows up in averages.
Common errors
400 Bad Request— A query parameter is in the wrong format (e.g.,startDateisn’t a valid ISO date).401 Unauthorized— API key missing or wrong.
Using the Node SDK
What this endpoint is for (and what it isn’t)
Use this for:- Live dashboards, projections, “usage so far this month” displays
- Triggering alerts when a customer hits a usage threshold
- Feeding simple BI reports
- Actual invoice data — use invoices for that. Analytics tells you “here’s the raw usage roll-up,” but invoices are the finalized billing documents that include discounts, taxes, prorations, etc.
- High-resolution per-event drill-down — this endpoint returns aggregates. If you need event-level detail, use the signal-events listing endpoint at
GET /v1/events.

