There is no npm package to install: the client is one function around fetch. Copy it into your project and call it wherever your agent acts.
Prerequisites
- Node.js 22.6 or later (it runs
.tsfiles directly; with older Node, compile withtscor run withtsx).
1. Get an API key
- In Ovelin, open Settings → API keys.
- Under Ingest key, create a key and copy it. It is shown once; Ovelin keeps only a hash.
- Copy the Organization ID from the same page.
Put all three values in your environment, not in code:
export OVELIN_URL="https://your-ovelin-host" # http://localhost:3000 for a local instance
export OVELIN_ORG_ID="your-organization-id"
export OVELIN_API_KEY="agl_live_…"An organization key can report for any agent. For production, give each agent its own key under Settings → API keys → Agent keys: a leaked agent key can then only write as that one agent, and you can revoke it alone.
2. Install
Copy examples/node/ovelin.ts into your project. It has no dependencies.
/**
* Minimal Ovelin client: one function, plain fetch, no SDK.
*
* Reads OVELIN_URL, OVELIN_ORG_ID and OVELIN_API_KEY from the environment.
* Every Node guide in docs/integrations imports this file.
*/
import { randomUUID } from "node:crypto";
const OVELIN_URL = (process.env.OVELIN_URL ?? "http://localhost:3000").replace(/\/$/, "");
const OVELIN_ORG_ID = required("OVELIN_ORG_ID");
const OVELIN_API_KEY = required("OVELIN_API_KEY");
/** One id per agent run. Ovelin groups events with the same metadata.run_id under Sessions. */
export const RUN_ID = process.env.OVELIN_RUN_ID || `run-${randomUUID()}`;
export type Outcome = "success" | "failure" | "unknown";
export interface LoggedEvent {
ok: true;
id: string;
seq: number;
hash: string;
duplicate: boolean;
}
export async function logEvent(
agent: string,
action: string,
opts: {
outcome?: Outcome;
actor?: string;
dataAccessed?: string[];
metadata?: Record<string, unknown>;
source?: string;
} = {},
): Promise<LoggedEvent> {
const res = await fetch(`${OVELIN_URL}/api/ingest/${OVELIN_ORG_ID}`, {
method: "POST",
headers: { Authorization: `Bearer ${OVELIN_API_KEY}`, "Content-Type": "application/json" },
body: JSON.stringify({
source: opts.source ?? "custom",
agent_name: agent,
action,
outcome: opts.outcome ?? "success",
...(opts.actor ? { actor: opts.actor } : {}),
...(opts.dataAccessed ? { data_accessed: opts.dataAccessed } : {}),
metadata: { run_id: RUN_ID, ...opts.metadata },
}),
});
const body = await res.json().catch(() => ({}));
if (!res.ok) throw new Error(`Ovelin refused the event: ${res.status} ${JSON.stringify(body)}`);
return body as LoggedEvent;
}
function required(name: string): string {
const v = process.env[name];
if (!v) throw new Error(`${name} is not set. See examples/.env.example.`);
return v;
}3. Minimal working example
// Send one event to Ovelin from Node/TypeScript and print the seal.
import { logEvent } from "./ovelin.ts";
const record = await logEvent("invoice-agent", "sent_invoice_reminder", {
actor: "ops@example.com",
dataAccessed: ["customer_pii", "financial_data"],
metadata: { invoice: "INV-1042" },
});
console.log(`sealed as seq ${record.seq}: ${record.hash.slice(0, 16)}…`);Call logEvent after each action your agent takes, with outcome: "failure" when it failed. A failed attempt is exactly what an auditor will ask about.
4. Run it
cd examples/node
node send-event.ts
# sealed as seq 2: 609d3e4bb8ff5a9b…5. Check it in Ovelin
- Open Activity. The newest rows are the events you just sent, each with a sequence number and a seal.
- Click one. The detail panel shows the payload as received; Recompute seal checks its seal again.
- Events from one process share
RUN_ID, so Sessions shows them as one execution. Open Agents: an agent name Ovelin had not seen before is registered automatically, without an owner. Give it one so someone is accountable for it.
To confirm nothing was altered later, open Integrity. It recomputes every seal and every link between records, and reports Trail intact.
Common errors
| Response | Cause | Fix |
|---|---|---|
401 Invalid API key | The key is wrong, revoked, or belongs to another organization. | Create a key in Settings → API keys and check OVELIN_ORG_ID is the same organization's. |
401 Missing API key (use Authorization: Bearer <key>) | The Authorization header was not sent. | Send Authorization: Bearer $OVELIN_API_KEY. The key never goes in the body. |
422 Payload must include a 'source' field | The JSON has no source. | Add "source": "custom" (or n8n, make_com, openai_api, zapier). |
422 Invalid option: expected one of "success"|"failure"|"unknown" | outcome has another value, such as warning. | Use success, failure or unknown. |
400 Invalid organization id | OVELIN_ORG_ID is not the organization's UUID. | Copy the Organization ID from Settings → API keys. |
429 Rate limit exceeded | More than 600 events a minute for one organization. | Retry after the Retry-After header. To send many events, use the batch endpoint (up to 100 per request). |
OVELIN_ORG_ID is not set | The environment was not exported in this shell. | export the three variables, or load them with node --env-file=.env. |
ERR_UNKNOWN_FILE_EXTENSION ".ts" | Node older than 22.6. | Upgrade Node, or run the file with npx tsx. |
How this guide is tested
Every code block above is copied from examples/node/ by node scripts/sync-guide-snippets.mjs, and pnpm examples:test runs send-event.ts against a local Ovelin and checks the events were sealed.

