Skip to main content

TypeScript SDK

npm@fact0/sdk v1.0.2
APIhttps://api.fact0.io
RequiresNode.js 18+
npm install @fact0/sdk
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

VariablePurpose
FACT0_API_KEYBearer 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).