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.
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 });| Option | Default | Effect |
|---|---|---|
apiKey | TRACEE_API_KEY | A personal or workspace key. |
baseUrl | TRACEE_BASE_URL, then https://traceeai.com | Your Tracee address. |
workspaceId | none | Sends Tracee-Workspace on every request (personal keys). |
maxRetries | 2 | Retries after a rate limit, and after server errors on reads. |
timeoutMs | 60000 | Per request; uploads and waits get longer. |
fetch | global fetch | Your 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 itErrors 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.