SDK

TypeScript SDK

A typed client for every Tracee endpoint, for Node.js, Deno, Bun, browsers and extensions.

@tracee/sdk has a typed method for every endpoint, grouped like the CLI's commands, and no runtime dependencies: it uses the global fetch.

The SDK isn't on the npm registry yet. Build it from packages/sdk in the Tracee repository, or use the CLI, which bundles it.

Create a client

import { Tracee } from "@tracee/sdk";

const tracee = new Tracee({ apiKey: process.env.TRACEE_API_KEY });
OptionDefaultEffect
apiKeyTRACEE_API_KEYA personal or workspace key.
baseUrlTRACEE_BASE_URL, then https://traceeai.comYour Tracee address.
workspaceIdnoneSends Tracee-Workspace on every request (personal keys).
maxRetries2Retries after a rate limit, and after server errors on reads.
timeoutMs60000Per request; uploads and waits get longer.
fetchglobal fetchYour own, for tests or proxies.

Call it

Path parameters come first, then the input, then options. Input fields use the API's names.

await tracee.brand.learn({ url: "https://acme.com" }, { wait: 120 });
await tracee.inbox.reply(threadId, { text: "Thanks!", close: true });
const signals = await tracee.radar.signals({ min_strength: 3, days: 7 });
const image = await tracee.media.generateImage({ prompt: "…", platform: "linkedin", logo: true });
await tracee.posts.duplicate(postId);
for await (const post of tracee.posts.listAll({ status: "scheduled" })) console.log(post.title);

Groups: workspaces, connections, channels, brand, memory, web, media, clips, posts, approvals, inbox, analytics, radar, crm, apps, workflows.

Any operation also runs by its id from the API reference, with path, query and body fields in one object:

await tracee.call("updateRadarTracker", { tracker_id: id, enabled: false });
Tracee.operations; // every operation, as the server describes it

Errors and retries

Failures throw a TraceeError subclass with status, code, message and details; see Errors. Rate limits and server errors on reads are retried for you. tracee.rateLimit holds the last X-RateLimit-* values.