Skip to main content

Audit client

Audit logging requires a write-scoped or read-scoped f0_live_* API key.

Constructor options

The Fact0Client accepts the following options: You can also pass these values via the environment variable FACT0_API_KEY.

Write methods

log(event: AuditEventInput): Promise<void>

Validates and writes a single audit event immediately.

logBatch(events: AuditEventInput[]): Promise<Record<string, unknown>>

Sends up to 1000 events in a single batch request.

Read methods

getEvent(id: string): Promise<Record<string, unknown>>

GET /v1/events/{id} Retrieves a single audit event by its ID.

listEvents(params?: ListEventsParams): Promise<Record<string, unknown>>

GET /v1/events Filters and lists events. Parameters include: actor_id, actor_type, action, resource_id, outcome, from, to, page, and page_size.

getReceipt(id: string): Promise<Record<string, unknown>>

GET /v1/receipts/{id} Retrieves an asynchronous ingestion receipt status.

Verify methods

verify(params?: { from?: string; to?: string; scan_all?: boolean }): Promise<Record<string, unknown>>

GET /v1/verify Walks the hash chain and verifies integrity.

verifyEvent(id: string): Promise<Record<string, unknown>>

GET /v1/events/{id}/verify Recomputes the hash of a single event and checks for tampering.

Export methods

exportPdf(params?: { from?: string; to?: string }): Promise<ArrayBuffer>

GET /v1/export/pdf Returns an ArrayBuffer representing the PDF audit report.

exportEvidencePack(params?: { from?: string; to?: string }): Promise<ArrayBuffer>

GET /v1/export/evidence-pack Returns an ArrayBuffer containing the ZIP evidence pack.