For the complete documentation index, see llms.txt. This page is also available as Markdown.

Analytics

Query analytics: revenue, orders, AOV, LTV, conversion rate, MRR, subscriptions, refunds — as totals, time series, or attribution breakdowns

post

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" }

Authorizations
AuthorizationstringRequired

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.

Body
objectstring · enumRequired

Query scope: 'account' for account-wide analytics, or 'checkout' to scope to a single checkout (requires objId). 'product' is not yet supported.

Possible values:
objIdstringOptional

Id of the scoped object. Required when object is 'checkout'; omit for 'account'.

metricsstring[]Optional

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.

groupBystringRequired

'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.

compareany ofOptional

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.

string · enumOptionalPossible values:
or
or
any · nullableOptional
groupingstring · enumOptional

Bucket size when groupBy is 'interval'. Defaults to 'day'.

Possible values:
touchstring · enumOptional

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.

Possible values:
Responses
200

Successful response

application/json
groupBystringRequired
post/v2/analytics/query
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
    }
  }
}

List available analytics metrics, dimensions, and groupings

get

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.

Authorizations
AuthorizationstringRequired

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.

Responses
200

Successful response

application/json
objectsstring[]Required
intervalsstring[]Required
comparestring[]Required
get/v2/analytics/capabilities
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