Skip to content

API reference

Analytics

Read revenue, traffic, the conversion funnel, and session sources over a window of days.

Get an analytics summary

GET/api/v1/analytics/summary

Revenue, orders, product views, conversion (orders per view), and new customers over the last `days`, each with the window before it and the relative change (0.12 is +12%). Revenue leaves out refunded orders.

Scope
analytics:read
MCP tool
analytics_summary
Changes data
No

Parameters

NameTypeDescription
daysquery · optionalintegerWindow in days, 1-3651-365default 30

Request

curl "https://3commerce.com/api/v1/analytics/summary" \
  -H "Authorization: Bearer 3c_live_…"

Response

200 OK
{
  "days": 30,
  "revenue": {
    "value": 4630,
    "previous": 3985,
    "change": 0.1619
  },
  "orders": {
    "value": 41,
    "previous": 36,
    "change": 0.1389
  },
  "views": {
    "value": 2860,
    "previous": 2410,
    "change": 0.1867
  },
  "conversion": {
    "value": 0.0143,
    "previous": 0.0149,
    "change": -0.0403
  },
  "new_customers": {
    "value": 18,
    "previous": 0,
    "change": null
  }
}

Get revenue over time

GET/api/v1/analytics/revenue

Revenue and order count per day or per week over the last `days`, oldest first, with every bucket present even when empty. Revenue leaves out refunded orders. Times are UTC.

Scope
analytics:read
MCP tool
analytics_revenue
Changes data
No

Parameters

NameTypeDescription
daysquery · optionalintegerWindow in days, 1-3651-365default 30
intervalquery · optionalenumBucket size. Defaults to `day` up to 30 days and `week` beyondone of day, week

Request

curl "https://3commerce.com/api/v1/analytics/revenue" \
  -H "Authorization: Bearer 3c_live_…"

Response

200 OK
{
  "days": 7,
  "interval": "day",
  "data": [
    {
      "date": "2026-11-19",
      "revenue": 212,
      "orders": 2
    },
    {
      "date": "2026-11-20",
      "revenue": 0,
      "orders": 0
    }
  ]
}

Get traffic by source and device

GET/api/v1/analytics/traffic

Product page views over the last `days`, broken down by source (such as `direct`, `instagram`, `search`) and by device, each with its share of the total from 0 to 1.

Scope
analytics:read
MCP tool
analytics_traffic
Changes data
No

Parameters

NameTypeDescription
daysquery · optionalintegerWindow in days, 1-3651-365default 30

Request

curl "https://3commerce.com/api/v1/analytics/traffic" \
  -H "Authorization: Bearer 3c_live_…"

Response

200 OK
{
  "days": 30,
  "total_views": 2860,
  "by_source": [
    {
      "source": "instagram",
      "views": 1210,
      "share": 0.4231
    },
    {
      "source": "direct",
      "views": 860,
      "share": 0.3007
    }
  ],
  "by_device": [
    {
      "device": "mobile",
      "views": 1990,
      "share": 0.6958
    },
    {
      "device": "desktop",
      "views": 870,
      "share": 0.3042
    }
  ]
}

Get top products

GET/api/v1/analytics/top-products

The products that earned the most over the last `days`, with units sold and revenue, highest revenue first. Refunded orders do not count.

Scope
analytics:read
MCP tool
analytics_top_products
Changes data
No

Parameters

NameTypeDescription
daysquery · optionalintegerWindow in days, 1-3651-365default 30
limitquery · optionalintegerHow many products, 1-501-50default 5

Request

curl "https://3commerce.com/api/v1/analytics/top-products" \
  -H "Authorization: Bearer 3c_live_…"

Response

200 OK
{
  "days": 30,
  "data": [
    {
      "id": "5a3b9c1d-6e2f-4a8b-b0c4-2d7e9f1a3b65",
      "slug": "merino-crew-sweater",
      "title": "Merino crew sweater",
      "image": "https://images.example.com/merino-crew.jpg",
      "units": 14,
      "revenue": 1372
    }
  ]
}

Get the conversion funnel

GET/api/v1/analytics/funnel

How many sessions reached each step over the last `days`: viewed a product, added to the cart, started checkout, purchased. The same figures as the dashboard’s Analytics page.

Scope
analytics:read
MCP tool
analytics_funnel
Changes data
No

Parameters

NameTypeDescription
daysquery · optionalintegerWindow in days, 1-3651-365default 30

Request

curl "https://3commerce.com/api/v1/analytics/funnel" \
  -H "Authorization: Bearer 3c_live_…"

Response

200 OK
{
  "days": 30,
  "from": "2026-10-29",
  "to": "2026-11-27",
  "steps": [
    {
      "event": "view_item",
      "label": "Viewed a product",
      "sessions": 1840
    },
    {
      "event": "add_to_cart",
      "label": "Added to cart",
      "sessions": 212
    },
    {
      "event": "begin_checkout",
      "label": "Started checkout",
      "sessions": 88
    },
    {
      "event": "purchase",
      "label": "Purchased",
      "sessions": 41
    }
  ]
}

Get session sources

GET/api/v1/analytics/sources

Sessions over the last `days` by where they came from, such as `instagram` or `google`, most first. A session with no attributed source is `direct`.

Scope
analytics:read
MCP tool
analytics_sources
Changes data
No

Parameters

NameTypeDescription
daysquery · optionalintegerWindow in days, 1-3651-365default 30

Request

curl "https://3commerce.com/api/v1/analytics/sources" \
  -H "Authorization: Bearer 3c_live_…"

Response

200 OK
{
  "days": 30,
  "from": "2026-10-29",
  "to": "2026-11-27",
  "sources": [
    {
      "label": "instagram",
      "value": 920
    },
    {
      "label": "direct",
      "value": 610
    }
  ]
}