Node SDK · Event shape

The TypeScript interface:

interface Event {
    id: string;                          // uuid v4; auto-generated
    tenantId?: string;                   // optional; set when partitioning by your end-customer
    occurredAt: Date;                    // auto-populated
    actor: Actor;                        // who caused the event
    action: string;                      // dotted verb, e.g. "user.lock"
    target?: Target;                     // what was acted on
    metadata?: Record<string, unknown>;  // freeform context
    origin?: Origin;                     // IP, user-agent, request ID
    result?: Result;                     // outcome
    change?: Change;                     // before/after for mutations
    idempotencyKey?: string;             // optional dedup key
}

interface Actor  { type: string; id?: string; displayName?: string; email?: string }
interface Target { type: string; id: string }
interface Result { status: "ok" | "error" | "denied"; code?: number; message?: unknown }
interface Origin { ip?: string; userAgent?: string; requestId?: string }

The TypeScript API uses camelCase (tenantId, occurredAt); the JSON wire format uses snake_case (tenant_id, occurred_at). The SDK handles the translation for you.