Docs

Events API

Ingest and query structured audit log events. Events are immutable records that cannot be modified or deleted after ingestion.

Ingest Events#

POST/api/v1/events

Send a single event or a batch of up to 100 events in a single request.

Auth: Project key or Master key

Request body

NameTypeRequiredDescription
actionstringRequiredDot-namespaced action name (e.g. user.created). Must match ^[a-z][a-z0-9_]*(\.[a-z][a-z0-9_]*)+$
categorystringRequiredOne of: auth, access, mutation, admin, security, system
actorobjectRequired{ id (required), type (required: user | api_key | service | system), name (optional), email (optional) }
tenant_idstringRequiredYour customer's unique identifier
targetobjectOptionalThe resource acted upon. { id (required), type (required), name (optional) }
contextobjectOptionalRequest context. { ip_address, user_agent, location, session_id } (all optional)
metadataobjectOptionalArbitrary key-value pairs attached to the event
changesarrayOptionalArray of field changes. Each item: { field, before, after }
idempotency_keystringOptionalUnique key for deduplication. Auto-generated by the SDK.
occurred_atstringOptionalISO 8601 timestamp. Defaults to server receive time if omitted.
Single event
curl -X POST https://logstitch.io/api/v1/events \
  -H "Authorization: Bearer pk_..." \
  -H "Content-Type: application/json" \
  -d '{
    "action": "user.invited",
    "category": "mutation",
    "actor": { "id": "user_123", "type": "user", "name": "Alice" },
    "tenant_id": "acme_corp",
    "target": { "id": "user_456", "type": "user", "name": "Bob" },
    "metadata": { "role": "editor" }
  }'
Batch request (array)
curl -X POST https://logstitch.io/api/v1/events \
  -H "Authorization: Bearer pk_..." \
  -H "Content-Type: application/json" \
  -d '[
    {
      "action": "user.invited",
      "category": "mutation",
      "actor": { "id": "user_123", "type": "user", "name": "Alice" },
      "tenant_id": "acme_corp",
      "target": { "id": "user_456", "type": "user", "name": "Bob" }
    },
    {
      "action": "document.created",
      "category": "mutation",
      "actor": { "id": "user_123", "type": "user", "name": "Alice" },
      "tenant_id": "acme_corp",
      "target": { "id": "doc_789", "type": "document", "name": "Q1 Report" }
    }
  ]'
201Success
Response
{
  "ids": ["evt_01HX..."],
  "redacted_count": 0,
  "request_id": "req_abc123"
}

Batch ingestion

Send up to 100 events in a single request by passing an array instead of an object. Each event in the batch is validated independently.

Query Events#

GET/api/v1/events

Retrieve events with filtering and cursor-based pagination. Results are returned in reverse chronological order.

Auth: Project key, Master key, or Viewer token

Query parameters

NameTypeRequiredDescription
tenant_idstringOptionalFilter by tenant. Required for viewer tokens (auto-applied).
actor_idstringOptionalFilter by actor ID
actor_typestringOptionalFilter by actor type (user, api_key, service, system)
actionstringOptionalFilter by action. Supports wildcard suffix: user.* matches user.created, user.deleted, etc.
categorystringOptionalFilter by category (auth, access, mutation, admin, security, system)
target_idstringOptionalFilter by target ID
target_typestringOptionalFilter by target type
start_datestringOptionalISO 8601 datetime -- only events on or after this time
end_datestringOptionalISO 8601 datetime -- only events on or before this time
searchstringOptionalFull-text search across action, actor name, and target name
cursorstringOptionalPagination cursor from a previous response
limitnumberOptionalNumber of events per page (1-200, default 50)
Query with filters
curl "https://logstitch.io/api/v1/events?tenant_id=acme_corp&category=mutation&limit=25" \
  -H "Authorization: Bearer pk_..."
200Success
Response
{
  "events": [
    {
      "id": "evt_01HX...",
      "action": "user.created",
      "category": "mutation",
      "actor": { "id": "user_123", "type": "user", "name": "Alice" },
      "tenant_id": "acme_corp",
      "target": { "id": "user_456", "type": "user", "name": "Bob" },
      "content_hash": "sha256:abc...",
      "redacted": false,
      "occurred_at": "2026-01-15T09:30:00.000Z",
      "received_at": "2026-01-15T09:30:01.234Z"
    }
  ],
  "cursor": "eyJv...",
  "has_more": true,
  "request_id": "req_abc123"
}

Viewer token behavior

Viewer tokens automatically filter by their embedded tenant_id. They can only be used to read events and cannot ingest events or perform administrative operations.