Skip to main content

Reference

Examples

Worked requests in curl, JavaScript and Python.

Not available yet. The routes are not built. These examples show the planned request and response shapes. The responses use realistic figures for a small documentation site.

Set your key once:

export TRUESTAT_API_KEY="ts_live_a1b2c3d4e5f6..."

Find your site ids

curl "https://truestat.io/api/v1/sites" \
  -H "Authorization: Bearer $TRUESTAT_API_KEY"
{
  "data": [
    {
      "id": "9c2f4e81-6d3a-4b17-9f52-8a1e0c7d3b46",
      "name": "Docs",
      "domain": "example.com",
      "timezone": "Europe/Berlin"
    }
  ],
  "meta": {}
}

One number for a status page

curl "https://truestat.io/api/v1/sites/9c2f4e81-6d3a-4b17-9f52-8a1e0c7d3b46/overview?period=last30d" \
  -H "Authorization: Bearer $TRUESTAT_API_KEY"
{
  "data": {
    "views": 12483,
    "unique_visitors": 3912,
    "ai_crawler_views": 1247,
    "verified_crawler_share": null
  },
  "meta": {
    "site_id": "9c2f4e81-6d3a-4b17-9f52-8a1e0c7d3b46",
    "range": {
      "from": "2026-07-25T00:00:00+02:00",
      "to": "2026-08-24T00:00:00+02:00",
      "tz": "Europe/Berlin",
      "clamped": false
    },
    "bots": "excluded"
  }
}

verified_crawler_share is null, not 0 — "no crawler visited" and "crawlers visited and none could be verified" are opposite findings. See How reliable is it.

Cache this. A status page does not need to ask on every page load.

Chart the last 7 days

curl "https://truestat.io/api/v1/sites/$SITE/timeseries?period=last7d&unit=day" \
  -H "Authorization: Bearer $TRUESTAT_API_KEY"
{
  "data": [
    { "bucket": "2026-08-18T00:00:00+02:00", "views": 1642, "unique_visitors": 511 },
    { "bucket": "2026-08-19T00:00:00+02:00", "views": 1893, "unique_visitors": 604 },
    { "bucket": "2026-08-20T00:00:00+02:00", "views": 2114, "unique_visitors": 672 },
    { "bucket": "2026-08-21T00:00:00+02:00", "views": 1776, "unique_visitors": 559 },
    { "bucket": "2026-08-22T00:00:00+02:00", "views": 1408, "unique_visitors": 447 },
    { "bucket": "2026-08-23T00:00:00+02:00", "views": 617, "unique_visitors": 208 },
    { "bucket": "2026-08-24T00:00:00+02:00", "views": 502, "unique_visitors": 173 }
  ],
  "meta": {
    "site_id": "9c2f4e81-…",
    "range": { "from": "…", "to": "…", "tz": "Europe/Berlin", "clamped": false },
    "unit": "day",
    "bots": "excluded"
  }
}

Empty buckets come back as zeros, not missing. A quiet day is a 0 row, so your chart's time axis stays honest without you filling gaps.

Note that unique visitors do not sum to the 30-day figure above — someone visiting on three days is one visitor in the month and three in the daily sum.

Top pages, filtered to one section

curl "https://truestat.io/api/v1/sites/$SITE/breakdowns/pages?period=last30d&filter_path_pattern=/docs/*&limit=5" \
  -H "Authorization: Bearer $TRUESTAT_API_KEY"
{
  "data": [
    { "path": "/docs/getting-started", "views": 2914, "unique_visitors": 1180 },
    { "path": "/docs/install/nextjs",  "views": 1287, "unique_visitors": 703 },
    { "path": "/docs/api",             "views": 897,  "unique_visitors": 512 },
    { "path": "/docs/script/options",  "views": 664,  "unique_visitors": 389 },
    { "path": "/docs/privacy",         "views": 421,  "unique_visitors": 244 }
  ],
  "meta": {
    "site_id": "9c2f4e81-…",
    "range": { "…": "…" },
    "pagination": { "limit": 5, "offset": 0 }
  }
}

No total in pagination — it is not computed rather than being guessed. Ask for limit=6 if you need to know whether a sixth row exists.

Which AI crawlers read your site

curl "https://truestat.io/api/v1/sites/$SITE/ai/crawlers?period=last30d" \
  -H "Authorization: Bearer $TRUESTAT_API_KEY"
{
  "data": [
    { "family": "gpt",         "label": "OpenAI",         "views": 612, "verified_views": 0 },
    { "family": "claude",      "label": "Anthropic",      "views": 341, "verified_views": 0 },
    { "family": "google",      "label": "Google",         "views": 188, "verified_views": 0 },
    { "family": "perplexity",  "label": "Perplexity",     "views": 74,  "verified_views": 0 },
    { "family": "commoncrawl", "label": "Common Crawl",   "views": 32,  "verified_views": 0 }
  ],
  "meta": { "site_id": "9c2f4e81-…", "range": { "…": "…" } }
}

verified_views is 0 everywhere today because IP verification is not yet running. That is the honest state rather than a claimed confidence tier. See How reliable is it, which also explains why these counts are a floor rather than a total.

Only the crawlers answering live questions

curl "https://truestat.io/api/v1/sites/$SITE/ai/pages?period=last30d&filter_bot_kind=ai_assistant" \
  -H "Authorization: Bearer $TRUESTAT_API_KEY"
{
  "data": [
    { "path": "/docs/api",             "views": 284 },
    { "path": "/docs/getting-started", "views": 197 },
    { "path": "/llms.txt",             "views": 91 }
  ],
  "meta": { "…": "…" }
}

ai_assistant means someone asked a question and your page was fetched to answer it. ai_training means corpus collection with no reader at the other end. Two different findings — see What this panel shows.

Your usage this period

curl "https://truestat.io/api/v1/usage" \
  -H "Authorization: Bearer $TRUESTAT_API_KEY"
{
  "data": {
    "events_limit": 200000,
    "events_used": 147382,
    "period_start": "2026-08-04T00:00:00Z",
    "period_end": "2026-09-04T00:00:00Z",
    "is_over": false,
    "max_sites": 25,
    "max_team_seats": 10,
    "retention_days": 1095
  },
  "meta": {}
}

Being over the limit does not stop collection. See When you reach your event limit.

A small Node client

const BASE = "https://truestat.io/api/v1";

async function truestat(path, params = {}) {
  const url = new URL(BASE + path);
  for (const [k, v] of Object.entries(params)) url.searchParams.set(k, v);

  const res = await fetch(url, {
    headers: { Authorization: `Bearer ${process.env.TRUESTAT_API_KEY}` },
  });

  const body = await res.json();
  if (!res.ok) {
    throw new Error(`${body.error.code}: ${body.error.message}`);
  }
  return body;
}

const { data } = await truestat(
  `/sites/${process.env.SITE_ID}/overview`,
  { period: "last30d" }
);

console.log(`${data.unique_visitors} visitors, ${data.views} views`);

The key lives in an environment variable and the call is server-side. A key in browser JavaScript is public — see Authentication.

Was this page helpful?

Last updated August 28, 2026