Documentation menu

Snapshot

Real-time rollup of recent activity for a project: event counts, top services, top and new patterns, and an optional AI summary.

GET /api/orgs/:orgSlug/projects/:projectSlug/snapshot

A point-in-time summary of the last N minutes of activity, used to power the dashboard overview and AI digests. This endpoint has no plain /api/snapshot path — it’s only mounted org/project-scoped.

Auth: session cookie (or API key, resolved to your account’s org/project membership) — see Authentication

Query params

paramtypedescription
window_minutesnumberLookback window in minutes. Clamped to 1–60. Default 10
include_aistringPass true to also generate an AI summary via Workers AI (summary_text). Adds latency; a failure here is non-fatal and leaves summary_text: null

Response 200

{
  "window_minutes": 10,
  "total_events": 482,
  "error_count": 6,
  "warn_count": 14,
  "top_services": [
    { "service": "checkout-api", "count": 210 }
  ],
  "top_patterns": [
    { "fingerprint": "fp_01hxyz", "message_template": "Timeout calling {service}", "level": "error", "count": 9 }
  ],
  "new_patterns": [
    { "fingerprint": "fp_02habc", "message_template": "New retry path hit", "level": "warn", "first_seen_at": 1720478000000 }
  ],
  "sample_events": [
    { "message": "Unhandled exception in checkout flow", "level": "error", "service": "checkout-api", "timestamp": 1720478390000 }
  ],
  "summary_text": null
}

Field notes:

  • total_events / error_count / warn_count are counted over hot_events within the window.
  • top_services — up to 5 services by event count, service IS NOT NULL AND service != ''.
  • top_patterns — up to 5 patterns from pattern_aggregates by summed event_count within the window.
  • new_patterns — up to 10 patterns from pattern_registry whose first_seen_at falls within the window, most recent first.
  • sample_events — up to 3 of the most recent level = "error" events in the window.
  • summary_text stays null unless include_ai=true and the Workers AI binding is configured and succeeds; any AI error is swallowed and the rest of the response is unaffected.

Errors: 500{ "error": "internal_error" } on a database failure.

Common responses (401; 402 and 429 don’t apply to this query endpoint) — see Authentication.