TypeScript SDK
| |
|---|
| npm | @fact0/sdk v1.0.2 |
| API | https://api.fact0.io |
| Requires | Node.js 18+ |
import { Fact0Client } from "@fact0/sdk";
const client = new Fact0Client({
apiKey: process.env.FACT0_API_KEY!,
});
await client.audit.log({
actor: { id: "agent-1", type: "agent" },
action: "document.delete",
resource: { id: "doc_1", type: "document" },
outcome: "success",
});
const events = await client.audit.listEvents({ pageSize: 20 });
Never expose API keys in browser code. Use @fact0/sdk only in server-side contexts (Next.js route handlers, Node agents, workers).
Modules
client.audit - audit log read/write/verify/export
client.telemetry - execution tracing
Types are generated from OpenAPI specs in openapi/.
Environment variables
| Variable | Purpose |
|---|
FACT0_API_KEY | Bearer API key (optional if apiKey is set in code) |
API origin defaults to https://api.fact0.io. Override with baseUrl in the constructor for local dev (e.g. http://localhost:8000).