Admin API

Event Logs

HappyView logs system events — lexicon changes, record operations, script errors, user actions, and more. See the Event Logs guide for details on event types and retention.

const TOKEN = "hv_..."; // your API key
const headers = { Authorization: `Bearer ${TOKEN}` };

List event logs

GET /admin/events
interface EventLog {
  id: string;
  event_type: string;
  severity: string;
  actor_did: string;
  subject: string;
  detail: Record<string, unknown>;
  created_at: string;
}

interface EventLogResponse {
  events: EventLog[];
  cursor: string | null;
}

const response = await fetch(
  "http://127.0.0.1:3000/admin/events?severity=error&limit=10",
  { headers },
);
const data: EventLogResponse = await response.json();
ParamTypeRequiredDescription
event_typestringnoFilter by exact event type (e.g. script.error)
categorystringnoFilter by category prefix (e.g. lexicon matches all lexicon events)
severitystringnoFilter by severity: info, warn, or error
subjectstringnoFilter by subject (lexicon ID, record URI, admin DID, etc.)
cursorstringnoPagination cursor (ISO 8601 timestamp from previous response)
limitnumbernoResults per page (default 50, max 100)

Response: 200 OK

{
  "events": [
    {
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "event_type": "script.error",
      "severity": "error",
      "actor_did": "did:plc:abc123",
      "subject": "com.example.feed.like",
      "detail": {
        "error": "attempt to index nil value",
        "script_source": "function handle() ... end",
        "input": { "status": "hello" },
        "caller_did": "did:plc:abc123",
        "method": "com.example.feed.like"
      },
      "created_at": "2026-03-01T12:00:00Z"
    }
  ],
  "cursor": "2026-03-01T11:59:00Z"
}

Events are returned in reverse chronological order (newest first). Pass the cursor value from the response to fetch the next page.

On this page