Agent API
Three operations, nothing else
The agent API is next-story's whole tool surface: three read-only HTTP endpoints, each behind its own scope and bound to the sites a token may read. There is no MCP server and no CLI; an agent calls these with a bearer token.
| Operation | Endpoint | Scope |
|---|---|---|
| List sessions Closed sessions for one site, one row each, with what visitors raged and dead-clicked at. | GET /sites/:site_id/sessions | journey:read:sessions |
| Daily rollup Per-day, per-route counts and rates, each with its prior-period baseline. | GET /sites/:site_id/rollup | journey:read:rollup |
| Compare periods Route-by-route deltas between a window and a baseline window. | GET /sites/:site_id/compare | journey:read:compare |
Every response has the same envelope
So an agent can always tell what window it got, which rules produced it, and whether the site was silent.
- site_id
- The site that was read
- time_window
- Absolute bounds, even when asked with since
- rule_version, rule_versions
- null plus the full list when rows disagree
- status
- ok, no_data or quota_exceeded
- data
- The rows