ZeroLeaks
API Reference

Types and Errors

Polling options, shared unions, and typed SDK errors.

Types and Errors

All public SDK types are exported from @zeroleaks/sdk.

Polling

interface WaitOptions<T> {
  pollIntervalMs?: number;
  timeoutMs?: number;
  signal?: AbortSignal;
  onPoll?: (value: T) => void | Promise<void>;
}

Attack surfaces

type AttackSurface =
  | "direct_chat"
  | "indirect_content"
  | "tool_calling"
  | "mcp"
  | "repo_ci"
  | "rag_vector"
  | "multi_turn";

Errors

ErrorMeaning
ZeroLeaksErrorBase API, validation, authentication, or network error
ZeroLeaksTimeoutErrorRequest, polling, or runtime relay timed out
ZeroLeaksAbortErrorThe supplied abort signal was triggered
ZeroLeaksScanErrorA scan reached a non-success terminal state or the runtime target failed
import { ZeroLeaksScanError } from "@zeroleaks/sdk";

try {
  await zeroleaks.runtimeScans.run(target);
} catch (error) {
  if (error instanceof ZeroLeaksScanError) {
    console.error(error.scanId, error.details);
  }
}

On this page