Docs / Connect your data
Bring in past data
Send past counts so alerts start today, and see which alerts the past would have raised.
In short: send your past counts once and alerts start the same day; the result shows what the past would have raised. Your agent can do it. No code: Import past counts (Senders (Connect) → Imports) takes a CSV file with two columns, each row's start time and its count; a longer file is fine, its last 90 days are added.
POST /v1/import takes arrays of counts per watch: {metric, tags, start, resolution: 5m | 1h | 1d, counts[]} (start falls on a step of the resolution, in UTC), up to 90 days each and 1,000 watch-days per request (and a body under 2 MB, refused at once with 413 before anything is stored). Have only the times of single events (sign-ups, orders)? Send {metric, events: ["2026-08-01T19:04:44Z", …]} instead of counts (up to 10,000): each adds 1 to its 5-minute window, and every 5-minute window from the first event (or start) up to now is imported, zeros included; leave out events in the current 5 minutes. Add past_events for spans you know about (kind: real | expected_change, direction: spike | drop | no_data), and tz for the watch's timezone. The answer is 202 with an import_id; poll GET /v1/imports/{import_id} until status: done. Each watch then shows the rules chosen for it and the alerts they would have raised in the replayed days: what this service would have told you.
curl -X POST https://countwatch.com/v1/import \
-H "Authorization: Bearer $COUNTWATCH_API_KEY" -H "Content-Type: application/json" \
-H "Idempotency-Key: orders-history-1" \
-d '{"watches":[{"metric":"orders","tags":{"shop":"EU"},"start":"<bucket start>","resolution":"5m","counts":[3,5]}]}'
- Live counts are safe. An import never overwrites or adds to counts a watch already received live: it stops at the watch's first live 5-minute window. So you can start sending live counts first and import the past afterwards; history and live data join at that window.
- Running it again is safe. The same
Idempotency-Keywithin 24 hours gets the first answer and stores nothing new. Without a key, an import into a watch that only an import wrote to replaces that watch's history in full; it never doubles counts. - Learning ends. A new watch needs about three weeks of counts before its own rules run (starter rules alert meanwhile). Import that much and the replay chooses its rules at once.
- Big imports: one request carries up to 1,000 watch-days (for example 20 watches × 30 days = 600). Split larger histories by watch, one request each, each with its own
Idempotency-Key.
For agents: this page as Markdown.