Skip to Content
Timberlogs is in beta. Sign up at app.timberlogs.dev
API ReferenceQuery Logs

Query Logs

Retrieve logs from Timberlogs with filtering and pagination.

List Logs

GET /v1/logs

Query Parameters

ParameterTypeDefaultDescription
limitnumber100Number of logs to return (max 1000)
offsetnumber0Number of logs to skip
levelstring-Filter by log level
sourcestring-Filter by source
environmentstring-Filter by environment
datasetstring-Filter by dataset
userIdstring-Filter by user ID
sessionIdstring-Filter by session ID
flowIdstring-Filter by flow ID
fromnumber-Start timestamp (Unix ms)
tonumber-End timestamp (Unix ms)

Response

{ "logs": [ { "id": "log_abc123", "timestamp": 1704067200000, "level": "info", "message": "User signed in", "source": "api-server", "environment": "production", "userId": "user_123", "sessionId": "sess_abc", "data": {"method": "oauth"}, "tags": ["auth"] } ], "pagination": { "limit": 100, "offset": 0, "count": 50, "hasMore": false } }

Examples

Basic query:

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs" \ -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Filter by level:

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs?level=error" \ -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Filter by source and environment:

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs?source=api-server&environment=production" \ -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Filter by time range:

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs?from=1704067200000&to=1704153600000" \ -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Filter by user:

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs?userId=user_123" \ -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Filter by flow:

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs?flowId=checkout-a1b2c3d4" \ -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Pagination:

# First page curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs?limit=50" \ -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx" # Second page curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs?limit=50&offset=50" \ -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Get Single Log

GET /v1/logs/:id

Retrieve a single log by its ID.

Response

{ "log": { "id": "log_abc123", "timestamp": 1704067200000, "level": "info", "message": "User signed in", "source": "api-server", "environment": "production", "userId": "user_123", "sessionId": "sess_abc", "requestId": "req_xyz", "data": {"method": "oauth"}, "tags": ["auth"], "flowId": "login-x1y2z3", "stepIndex": 0 } }

Error Response

404 Not Found:

{ "error": "Log not found" }

Example

curl -X GET "https://timberlogs-ingest.enaboapps.workers.dev/v1/logs/log_abc123" \ -H "Authorization: Bearer tb_live_xxxxxxxxxxxxx"

Log Object

FieldTypeDescription
idstringUnique log identifier
timestampnumberUnix timestamp in milliseconds
levelstringLog level: debug, info, warn, error
messagestringLog message
sourcestringApplication/service name
environmentstringEnvironment name
datasetstringDataset name
versionstringApplication version
userIdstringUser identifier
sessionIdstringSession identifier
requestIdstringRequest identifier
dataobjectAdditional structured data
errorNamestringError class/name
errorStackstringError stack trace
tagsstring[]Array of tags
countrystringCountry code (auto-detected)
ipAddressstringClient IP address
flowIdstringFlow identifier
stepIndexnumberStep index within flow

Pagination

The API uses offset-based pagination:

  • limit - Number of items per page (default: 100, max: 1000)
  • offset - Number of items to skip
  • hasMore - Boolean indicating if more results exist

To iterate through all logs:

let offset = 0 const limit = 100 let hasMore = true while (hasMore) { const response = await fetch( `https://timberlogs-ingest.enaboapps.workers.dev/v1/logs?limit=${limit}&offset=${offset}`, { headers: { Authorization: `Bearer ${apiKey}` } } ) const data = await response.json() // Process data.logs console.log(`Fetched ${data.logs.length} logs`) hasMore = data.pagination.hasMore offset += limit }
Last updated on