Need help with the Platform? Join us on Discord or email us at contact@straylabs.ai.
Stray Platform
SDK

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

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 null

For 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

On this page