TypeScript SDK
Integrate Straylabs project creation, scans, findings, and reports into your server application.
@straylabs/sdk is the server-side TypeScript client for Straylabs. Create blackbox and greybox projects, configure testing accounts, start scans, read their progress and full details, retrieve findings, and download reports.
Use Node.js 22 or later, or Bun 1.3 or later. The package exports ESM JavaScript and TypeScript declarations and uses native fetch. API keys and target credentials belong in your server's secret store.
Start with an API key
import { StraylabsClient } from "@straylabs/sdk";
const apiKey = process.env.STRAYLABS_API_KEY;
if (!apiKey) throw new Error("STRAYLABS_API_KEY is required");
const client = new StraylabsClient({ apiKey });
const organization = await client.organizations.getByName("Acme Corp");
const projects = await client.projects.list(organization.id);The default API root is https://platform.straylabs.ai/api. Organization IDs come from the API: resolve an exact name or list the organizations accessible to your key.
Choose a guide
Installation and first scan
Configure the client, discover an organization, create a project, and save the scan ID.
Projects
Create blackbox or greybox projects, use the strict blackbox preset, and read existing projects.
Testing accounts
Supply named profiles, configure authentication, and understand account-generation limitations.
Scans and progress
List history, retrieve the latest or a specific scan with full details, and stop a scan explicitly.
Findings
Read provider findings and correlate them with a scan while preserving local review decisions.
Reports
Enqueue generation after completion, then download the latest available PDF or a named file.
Errors and recovery
Handle HTTP errors, cancellation, deadlines, and uncertain mutation outcomes.
API reference
Find every supported method, input type, result shape, and HTTP operation.
Request-driven integration
The SDK makes requests when your application calls a method. It does not start background polling, launch a scan when creating a project, or generate a report when downloading one.
const history = await client.scans.list(projectRef);
const latest = await client.scans.get(projectRef); // Full details, or null
const report = await client.reports.download(projectRef); // Latest available PDF, or nullFor a new assessment, create the project, start a scan, and persist the organization, project, and scan IDs. A later refresh reads status; after completion, enqueue report generation once. A subsequent download returns the latest available PDF or null while none is ready.
The Platform documentation covers dashboard actions. These SDK guides cover the API-key client; session-only Platform features are not automatically available through the SDK.
Last updated