Skip to content
All articles

API reference

Every route of the Stats API: what it takes, what it answers, and the errors it can give.

View as Markdown

Every route is a GET under https://api.crustat.com/v1/ and answers JSON. Start with The Stats API for API keys, errors and limits.

Your sites

GET /v1/sites

The sites you can read, oldest first. A site’s id is the one in its tracking code: pass it as site to every stats route. timezone is the zone its days and hours are in.

Example request

curl -H "Authorization: Bearer $CRUSTAT_API_KEY" \
  "https://api.crustat.com/v1/sites"

Example answer

{
  "sites": [
    {
      "id": "AbC123_-xyzXYZ01",
      "name": "Example",
      "domain": "example.com",
      "timezone": "Europe/Chisinau"
    }
  ]
}

Errors

  • 401 No valid API key or token (or, at app.crustat.com/api/v1, not signed in), the key or token was revoked or expired, or the person it belongs to is no longer in the workspace.
  • 429 More than 120 requests in a minute. Wait the seconds in Retry-After.
  • 5XX Something went wrong on our side (500), or the stats couldn’t be loaded (502). Try again in a moment.

Overview

GET /v1/stats/overview

The headline numbers for the range and for the period before it, visitors right now, the visitors chart, the first rows of the four lists (sources, countries, pages, browsers), and the visits left out of every number: bots, and copies of the site on other hostnames.

Parameters

  • site (required) — text. The site’s ID, from its tracking code or from /sites.
  • range (optional) — today, yesterday, 7d, 30d, 90d, month, lastmonth, or YYYY-MM-DD..YYYY-MM-DD (default 7d). Days in the site’s time zone. 7d, 30d and 90d end today; month is this month so far, lastmonth the whole month before. Or any span of up to 90 days, both days included, none in the future and none older than 89 days ago.
  • host (optional) — text. One of the site’s hostnames, to see its visits only. A host that isn’t the site’s is ignored: the answer covers every host.

Example request

curl -H "Authorization: Bearer $CRUSTAT_API_KEY" \
  "https://api.crustat.com/v1/stats/overview?site=AbC123_-xyzXYZ01&range=7d"

Example answer

{
  "site": "AbC123_-xyzXYZ01",
  "range": "7d",
  "current": {
    "visitors": 1240,
    "pageviews": 3100,
    "bounce": 42,
    "time": 114
  },
  "previous": {
    "visitors": 1051,
    "pageviews": 2800,
    "bounce": 45,
    "time": 98
  },
  "online": 3,
  "series": {
    "metric": "visitors",
    "points": [
      {
        "t": "2026-09-21T00:00:00.000Z",
        "value": 170
      }
    ]
  },
  "tops": {
    "channel": [
      {
        "name": "Search",
        "visitors": 508,
        "pageviews": 700
      }
    ],
    "country": [
      {
        "name": "RO",
        "visitors": 300,
        "pageviews": 500
      }
    ],
    "page": [
      {
        "name": "/pricing",
        "visitors": 600,
        "pageviews": 900
      }
    ],
    "browser": [
      {
        "name": "Chrome",
        "visitors": 700,
        "pageviews": 1800
      }
    ]
  },
  "filtered": {
    "total": 62,
    "reasons": {
      "dc": 48,
      "auto": 9,
      "host": 5
    }
  }
}

Errors

  • 400 A parameter is missing or isn’t one of its values.
  • 401 No valid API key or token (or, at app.crustat.com/api/v1, not signed in), the key or token was revoked or expired, or the person it belongs to is no longer in the workspace.
  • 402 The workspace has no plan: its trial ended or it was deactivated. Choosing a plan opens the stats again.
  • 404 No such route (or not a GET), or no such site among the ones you can read.
  • 429 More than 120 requests in a minute. Wait the seconds in Retry-After.
  • 5XX Something went wrong on our side (500), or the stats couldn’t be loaded (502). Try again in a moment.

One list

GET /v1/stats/breakdown

Any list of the dashboard, by dim: up to limit rows, biggest first. Pages, entry pages, exit links and events are sorted by their own count (pageviews), every other list by visitors. pageviews is the row’s own count: page views for pages, entries for entry pages, clicks for exit links, times sent for events. page and entry rows carry the host they’re on unless you pass host. Campaign rows carry their source and medium in sub.

Parameters

  • site (required) — text. The site’s ID, from its tracking code or from /sites.
  • range (optional) — today, yesterday, 7d, 30d, 90d, month, lastmonth, or YYYY-MM-DD..YYYY-MM-DD (default 7d). Days in the site’s time zone. 7d, 30d and 90d end today; month is this month so far, lastmonth the whole month before. Or any span of up to 90 days, both days included, none in the future and none older than 89 days ago.
  • dim (required) — channel, referrer, campaign, country, region, city, page, entry, exit, browser, os, device, event, host. Which list.
  • limit (optional) — 1 to 100 (default 10). How many rows at most.
  • q (optional) — up to 100 characters. Only rows whose name matches this search.
  • host (optional) — text. One of the site’s hostnames, to see its visits only. A host that isn’t the site’s is ignored: the answer covers every host.

Example request

curl -H "Authorization: Bearer $CRUSTAT_API_KEY" \
  "https://api.crustat.com/v1/stats/breakdown?site=AbC123_-xyzXYZ01&range=7d&dim=page"

Example answer

{
  "dim": "page",
  "rows": [
    {
      "name": "/pricing",
      "visitors": 600,
      "pageviews": 900,
      "host": "example.com"
    }
  ]
}

Errors

  • 400 A parameter is missing or isn’t one of its values.
  • 401 No valid API key or token (or, at app.crustat.com/api/v1, not signed in), the key or token was revoked or expired, or the person it belongs to is no longer in the workspace.
  • 402 The workspace has no plan: its trial ended or it was deactivated. Choosing a plan opens the stats again.
  • 404 No such route (or not a GET), or no such site among the ones you can read.
  • 429 More than 120 requests in a minute. Wait the seconds in Retry-After.
  • 5XX Something went wrong on our side (500), or the stats couldn’t be loaded (502). Try again in a moment.

One number over time

GET /v1/stats/series

The chart of one headline number: one point an hour for a one-day range (today, yesterday, or a custom range of a single day), one a day for anything longer. t is the start of the hour or day in the site’s time zone, written as a UTC time.

Parameters

  • site (required) — text. The site’s ID, from its tracking code or from /sites.
  • range (optional) — today, yesterday, 7d, 30d, 90d, month, lastmonth, or YYYY-MM-DD..YYYY-MM-DD (default 7d). Days in the site’s time zone. 7d, 30d and 90d end today; month is this month so far, lastmonth the whole month before. Or any span of up to 90 days, both days included, none in the future and none older than 89 days ago.
  • metric (required) — visitors, pageviews, bounce, time. Which number: visitors, page views, bounce rate (whole %) or average time on site (seconds).
  • host (optional) — text. One of the site’s hostnames, to see its visits only. A host that isn’t the site’s is ignored: the answer covers every host.

Example request

curl -H "Authorization: Bearer $CRUSTAT_API_KEY" \
  "https://api.crustat.com/v1/stats/series?site=AbC123_-xyzXYZ01&range=7d&metric=visitors"

Example answer

{
  "metric": "visitors",
  "points": [
    {
      "t": "2026-09-21T00:00:00.000Z",
      "value": 42
    }
  ]
}

Errors

  • 400 A parameter is missing or isn’t one of its values.
  • 401 No valid API key or token (or, at app.crustat.com/api/v1, not signed in), the key or token was revoked or expired, or the person it belongs to is no longer in the workspace.
  • 402 The workspace has no plan: its trial ended or it was deactivated. Choosing a plan opens the stats again.
  • 404 No such route (or not a GET), or no such site among the ones you can read.
  • 429 More than 120 requests in a minute. Wait the seconds in Retry-After.
  • 5XX Something went wrong on our side (500), or the stats couldn’t be loaded (502). Try again in a moment.

When people came

GET /v1/stats/hours

Visitors in each local hour of each day of the range, in the site’s time zone: 24 numbers a day, midnight first. weekday is 0 (Sunday) to 6 (Saturday).

Parameters

  • site (required) — text. The site’s ID, from its tracking code or from /sites.
  • range (optional) — today, yesterday, 7d, 30d, 90d, month, lastmonth, or YYYY-MM-DD..YYYY-MM-DD (default 7d). Days in the site’s time zone. 7d, 30d and 90d end today; month is this month so far, lastmonth the whole month before. Or any span of up to 90 days, both days included, none in the future and none older than 89 days ago.
  • host (optional) — text. One of the site’s hostnames, to see its visits only. A host that isn’t the site’s is ignored: the answer covers every host.

Example request

curl -H "Authorization: Bearer $CRUSTAT_API_KEY" \
  "https://api.crustat.com/v1/stats/hours?site=AbC123_-xyzXYZ01&range=7d"

Example answer

{
  "days": [
    {
      "day": "2026-09-27",
      "weekday": 0,
      "hours": [
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        3,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0,
        0
      ]
    }
  ]
}

Errors

  • 400 A parameter is missing or isn’t one of its values.
  • 401 No valid API key or token (or, at app.crustat.com/api/v1, not signed in), the key or token was revoked or expired, or the person it belongs to is no longer in the workspace.
  • 402 The workspace has no plan: its trial ended or it was deactivated. Choosing a plan opens the stats again.
  • 404 No such route (or not a GET), or no such site among the ones you can read.
  • 429 More than 120 requests in a minute. Wait the seconds in Retry-After.
  • 5XX Something went wrong on our side (500), or the stats couldn’t be loaded (502). Try again in a moment.

Right now

GET /v1/stats/live

People with a page view in the last 5 minutes, with the pages they’re on, where they came from and their countries: the top 5 of each. A source of "" is Direct.

Parameters

  • site (required) — text. The site’s ID, from its tracking code or from /sites.
  • host (optional) — text. One of the site’s hostnames, to see its visits only. A host that isn’t the site’s is ignored: the answer covers every host.

Example request

curl -H "Authorization: Bearer $CRUSTAT_API_KEY" \
  "https://api.crustat.com/v1/stats/live?site=AbC123_-xyzXYZ01"

Example answer

{
  "visitors": 3,
  "pages": [
    {
      "name": "/pricing",
      "visitors": 2,
      "pageviews": 2
    }
  ],
  "sources": [
    {
      "name": "",
      "visitors": 2,
      "pageviews": 2
    }
  ],
  "countries": [
    {
      "name": "DE",
      "visitors": 3,
      "pageviews": 3
    }
  ]
}

Errors

  • 400 A parameter is missing or isn’t one of its values.
  • 401 No valid API key or token (or, at app.crustat.com/api/v1, not signed in), the key or token was revoked or expired, or the person it belongs to is no longer in the workspace.
  • 402 The workspace has no plan: its trial ended or it was deactivated. Choosing a plan opens the stats again.
  • 404 No such route (or not a GET), or no such site among the ones you can read.
  • 429 More than 120 requests in a minute. Wait the seconds in Retry-After.
  • 5XX Something went wrong on our side (500), or the stats couldn’t be loaded (502). Try again in a moment.

The last 30 minutes

GET /v1/stats/live/minutes

People on the site in each of the last 30 minutes, oldest first; the last point is this minute.

Parameters

  • site (required) — text. The site’s ID, from its tracking code or from /sites.
  • host (optional) — text. One of the site’s hostnames, to see its visits only. A host that isn’t the site’s is ignored: the answer covers every host.

Example request

curl -H "Authorization: Bearer $CRUSTAT_API_KEY" \
  "https://api.crustat.com/v1/stats/live/minutes?site=AbC123_-xyzXYZ01"

Example answer

{
  "points": [
    {
      "t": "2026-09-27T14:29:00.000Z",
      "value": 0
    },
    {
      "t": "2026-09-27T14:30:00.000Z",
      "value": 2
    }
  ]
}

Errors

  • 400 A parameter is missing or isn’t one of its values.
  • 401 No valid API key or token (or, at app.crustat.com/api/v1, not signed in), the key or token was revoked or expired, or the person it belongs to is no longer in the workspace.
  • 402 The workspace has no plan: its trial ended or it was deactivated. Choosing a plan opens the stats again.
  • 404 No such route (or not a GET), or no such site among the ones you can read.
  • 429 More than 120 requests in a minute. Wait the seconds in Retry-After.
  • 5XX Something went wrong on our side (500), or the stats couldn’t be loaded (502). Try again in a moment.

Still stuck? Write to hello@crustat.com.