Skip to main content

Account

Start or stop collection

Whether a site records new events — and what stopping actually does.

PATCH/sites/{siteId}/collection
Start or stop collection
curl --request PATCH \
  --url 'https://truestat.io/api/v1/sites/{siteId}/collection' \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "active": false
}'
{
  "data": {
    "active": false,
    "first_event_at": "2026-09-03T18:40:02.000Z"
  },
  "meta": {
    "site_id": "6fed8980-a119-4a9c-a4d4-53e448ef9f9e"
  }
}

The switch that decides whether new events are recorded.

Stopping deletes nothing

Everything already recorded stays. Every report over a past window goes on answering, exactly as before.

What stops is new events arriving. Turn it back on and collection resumes, losing nothing — except the traffic that happened while it was off, which is gone for good because it was never written.

A reversible switch with an irreversible gap behind it. The switch can be flipped as often as you like; the missing hours cannot be recovered.

The collector takes up to a minute

It caches each site's configuration, so events can keep landing for about a minute after this call returns.

That is deliberate — the alternative is a database read on the hottest path in the product — and it is the same delay that applies to excluded paths and addresses.

A script that stops collection and immediately asserts "no more events" will see that assertion fail. Wait, or assert on a window that starts a minute later.

What closes while it is off

The data endpoints answer 403 site_collection_stopped: overview, breakdowns, AI, live, search. That mirrors the dashboard, which hides those screens for a stopped site.

This endpoint and settings keep answering. They have to — a site stopped through the API could otherwise never be started again, because the route that would start it would refuse along with everything else.

Telling "stopped" from "never installed"

first_event_at is null when nothing has ever arrived.

Two sites reporting zero traffic can be in completely different situations: one was switched off on purpose, the other was created and never wired up. The first needs a decision, the second needs the script installing.

Authorizations

Authorizationstringheaderrequired

An API key from Settings → API keys. Scopes available: analytics:read, sites:read, sites:write, settings:read, settings:write, goals:read, goals:write, funnels:read, funnels:write, notes:read, notes:write, alerts:read, alerts:write, team:read, team:write, revenue:read, revenue:write.

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Path parameters

siteIdstring (uuid)pathrequired
The site's id, from `GET /sites`. A site that is not yours and a site that does not exist both answer 403, so this cannot be used to discover other people's ids.

Request bodyapplication/json

activebooleanbodyrequired
True to record new events, false to stop.

Response

application/json

The answer.

dataobject
metaobject