Documentation Index
Fetch the complete documentation index at: https://docs.fact0.io/llms.txt
Use this file to discover all available pages before exploring further.
Audit client
Constructor options
| Parameter | Default | Description |
|---|---|---|
api_key | required | Write or read-scoped alk_live_* key |
base_url | https://api.ledgerflow.io | API origin |
batch_max_size | 100 | Max events per flush |
batch_max_wait_ms | 500 | Max wait before flush |
raise_on_error | False | Raise on transport failure |
dead_letter_path | None | JSONL path for failed batches |
sync | False | Synchronous ingest (X-LedgerFlow-Sync: true) |
poll_receipts | True | Poll async receipts after ingest |
LEDGERFLOW_API_KEY, LEDGERFLOW_BASE_URL.
Write methods
log(**fields) -> None
Validate and enqueue one event. Returns immediately.
log_batch(events: list[dict]) -> BatchResult | AsyncReceipt
Send up to 1000 events. Uses batch endpoint.
flush() -> None
Block until the in-memory buffer is drained.
close() -> None
Stop background flusher and drain. Registered with atexit.
Read methods
get_event(event_id: str) -> dict
GET /v1/events/{id}
list_events(**filters) -> dict
GET /v1/events — filters: actor_id, actor_type, action, resource_id, outcome, from, to, page, page_size.
get_receipt(receipt_id: str) -> dict
GET /v1/receipts/{id}
wait_for_receipt(receipt_id: str, timeout_s=30) -> dict
Poll until status is committed or failed.
Verify methods
verify(from_=None, to=None, scan_all=False) -> dict
GET /v1/verify
verify_event(event_id: str) -> dict
GET /v1/events/{id}/verify
Export methods
export_pdf(from_=None, to=None) -> bytes
GET /v1/export/pdf
export_evidence_pack(from_=None, to=None) -> bytes
GET /v1/export/evidence-pack
Stream
stream_events() -> Iterator[dict]
SSE iterator over GET /v1/events/stream.
Error handling
| Exception | When |
|---|---|
ledgerflow.ValidationError | Invalid event fields at log() |
ledgerflow.TransportError | HTTP failure (only if raise_on_error=True) |
ledgerflow.AuditLogError | Base class |