Archive
Read raw log events directly out of R2 cold storage for a given day/hour.
Reads events straight from the gzip-compressed R2 archive files (bypassing the D1 hot tier and the archive_chunks manifest used by /api/logs). This endpoint has no org/project-scoped mount — it only exists at the plain path below.
Auth: session cookie or API key (requireSession) — see Authentication
Project scoping depends on how you authenticate: an API key resolves the project automatically. A session cookie alone does not resolve a project on this route (there’s no org/project URL segment to derive it from), so the request falls back to the legacy, non-project-scoped archive path rather than being scoped to one of your projects — in a modern multi-tenant deployment this typically returns no data. In practice, call this endpoint with an API key.
GET /api/archive
Query params
| param | type | description |
|---|---|---|
| date | string | Required. YYYY-MM-DD |
| hour | string | Optional hour, 0–23 (zero-padded internally). If omitted, all hours for date are read and merged |
| level | string | Filter by level. Comma-separated for multiple, e.g. error,warn |
| type | string | Filter by type. Comma-separated for multiple |
| service | string | Exact match on service |
| environment | string | Exact match on environment |
| device_type | string | Exact match on device_type |
| q | string | Substring match against message (case-insensitive) |
Response 200
{
"events": [
{
"id": "evt_01hxyz",
"project_id": "proj_01abc",
"timestamp": 1720392000000,
"level": "error",
"type": "crash",
"message": "Unhandled exception in checkout flow",
"user_id": "user_42",
"session_id": "sess_abc123",
"environment": "production",
"service": "checkout-api",
"device_type": "ios",
"metadata": {},
"trace_id": "trace_01",
"span_id": "span_01"
}
],
"count": 128
}
count is events.length — there’s no separate total or pagination; all matching events for the requested date/hour are returned in one response. When hour is omitted, events from all of that day’s hour-files are merged and sorted by timestamp ascending; when hour is specified, events come back in the order stored in that single hour’s file (not explicitly sorted).
Errors: 400 — { "error": "date parameter required (YYYY-MM-DD)" } if date is missing or doesn’t match the expected format
Common responses (401; 402 and 429 don’t apply to this endpoint) — see Authentication.