Analytics
Query analytics: revenue, orders, AOV, LTV, conversion rate, MRR, subscriptions, refunds — as totals, time series, or attribution breakdowns
Runs an analytics query for the merchant account.
groupBy 'interval' returns a day/week/month time series. groupBy a dimension breaks orders-family metrics down by attribution source.
Metrics (13 total): Orders family (support dimension breakdowns): revenue, orders, aov, customers, conversion_rate, ltv Subscriptions family (interval only): active_subscriptions, new_subscriptions, churned_subscriptions, mrr Billing family (interval only): refunds, refund_count, failed_payments
Dimensions (7): channel, utm_source, utm_medium, utm_campaign, utm_term, utm_content, referring_domain
compare: pass 'previous_period' for automatic period-over-period comparison, or a custom { start, end } object for an explicit comparison window.
Dates must be UTC ISO 8601 (e.g. '2026-04-13T00:00:00Z'). Call get_analytics_capabilities for the full metric/dimension/groupBy compatibility matrix.
Example — revenue last month vs previous period: { "object":"account", "groupBy":"interval", "grouping":"day", "metrics":["revenue"], "period":{"start":"2026-06-01T00:00:00Z","end":"2026-06-30T23:59:59Z"}, "compare":"previous_period" }
Account API key authentication. Pass an API key as a Bearer token in the Authorization header. An account may have multiple named keys; any of them grants full access to all endpoints — equivalent to all OAuth scopes.
Query scope: 'account' for account-wide analytics, or 'checkout' to scope to a single checkout (requires objId). 'product' is not yet supported.
Id of the scoped object. Required when object is 'checkout'; omit for 'account'.
Metric keys to return (e.g. ['revenue', 'mrr', 'refunds']). Omit for the default orders-family set. See get_analytics_capabilities for all keys and their groupBy compatibility.
'interval' for a time series, or a dimension key (channel, utm_source, utm_medium, utm_campaign, utm_term, utm_content, referring_domain) for an attribution breakdown — see get_analytics_capabilities.
Optional comparison window: 'previous_period' for the automatically-derived preceding window of equal length, or a custom {start, end} object (UTC ISO 8601). Adds a previous value to every metric cell.
Bucket size when groupBy is 'interval'. Defaults to 'day'.
Attribution touch for dimension breakdowns: 'last' (default) groups by the last-touch snapshot, 'first' by the first-touch snapshot. Ignored for groupBy 'interval'; conversion_rate is visit-grain and unaffected.
Successful response
Bad Request - The request was invalid or malformed
Unauthorized - Authentication is required or has failed
Forbidden - You do not have permission to access this resource
Internal Server Error - An unexpected error occurred
POST /v2/analytics/query HTTP/1.1
Host: api.spiffy.co
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 171
{
"object": "account",
"objId": "text",
"metrics": [
"text"
],
"groupBy": "text",
"period": {
"start": "text",
"end": "text"
},
"compare": "previous_period",
"grouping": "day",
"touch": "first"
}{
"groupBy": "text",
"period": {
"start": "text",
"end": "text"
},
"comparison": {
"start": "text",
"end": "text"
},
"groups": [
{
"key": "text",
"label": "text",
"meta": "text",
"metrics": {
"ANY_ADDITIONAL_PROPERTY": {
"value": 1,
"previous": 1
}
}
}
],
"totals": {
"ANY_ADDITIONAL_PROPERTY": {
"value": 1,
"previous": 1
}
}
}Returns the analytics catalog as data: every metric with its family, kind (flow/stock/derived), date anchor, and compatible groupBy values, plus dimensions, intervals, and comparison modes. Call this before query_analytics to construct valid queries.
Account API key authentication. Pass an API key as a Bearer token in the Authorization header. An account may have multiple named keys; any of them grants full access to all endpoints — equivalent to all OAuth scopes.
Successful response
Unauthorized - Authentication is required or has failed
Forbidden - You do not have permission to access this resource
Internal Server Error - An unexpected error occurred
GET /v2/analytics/capabilities HTTP/1.1
Host: api.spiffy.co
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"objects": [
"text"
],
"metrics": [
{
"key": "text",
"label": "text",
"format": "text",
"family": "text",
"kind": "text",
"description": "text",
"group_by": [
"text"
],
"anchor": "text"
}
],
"dimensions": [
{
"key": "text",
"label": "text"
}
],
"intervals": [
"text"
],
"compare": [
"text"
]
}Last updated