ZeroLeaksDocs
API Reference

Types and Errors

Polling options, shared unions, and typed SDK 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";

Report unions

Exported by @zeroleaks/sdk 0.3.0 or later.

type SecretLeakClass =
  | "credential"
  | "planted_canary"
  | "authorization_rule"
  | "internal_endpoint"
  | "tool_schema"
  | "instruction_text";

type EvidenceStrength =
  | "semantic"
  | "indicator"
  | "observed_tool_call"
  | "deterministic_effect";

type FindingSeverity = "critical" | "high" | "medium" | "low" | "informational";

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

Every error extends ZeroLeaksError, which includes status, code, details (the response body or scan result), and requestId. It also includes retryAfterMs when the response provides a Retry-After header. ZeroLeaksScanError adds scanId.

codeSource
MISSING_API_KEY, INVALID_API_KEYClient constructor
MISSING_FETCHNo fetch implementation available
NETWORK_ERRORThe API could not be reached
TIMEOUT, ABORTEDZeroLeaksTimeoutError, ZeroLeaksAbortError
SCAN_FAILEDZeroLeaksScanError
INVALID_TARGET_RESPONSEA runtime target returned something without text; arrives as the details of a ZeroLeaksScanError
SUBSCRIPTION_LIMITAPI 403: no scan access on the current plan or workspace
SCAN_CONCURRENCY_LIMIT, SCAN_HOURLY_LIMITAPI 429: plan throughput cap
PROMPT_SCANS_RETIREDAPI 410 from scans.create and scans.run: hosted prompt scans are retired. Do not retry.
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