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

API reference

Supported TypeScript SDK methods, overloads, result types, and HTTP operations.

Client and references

import {
  DEFAULT_BASE_URL,
  StraylabsClient,
  type ProjectRef,
  type ScanRef,
} from "@straylabs/sdk";

const client = new StraylabsClient({ apiKey });
const projectRef: ProjectRef = { organizationId, projectId };
const scanRef: ScanRef = { ...projectRef, scanId };

DEFAULT_BASE_URL is https://platform.straylabs.ai/api. IDs come from API results; there is no required organization-ID environment variable or global current-organization setting.

Every method accepts an optional RequestOptions object:

type RequestOptions = {
  signal?: AbortSignal;
  timeoutMs?: number;
};

The default timeout is 30 seconds for the whole operation. Default read retries allow two extra GET attempts. See configuration and errors.

Methods

In the table, P is /organizations/{organizationId}/projects and R is P/{projectId}. Each path segment is encoded independently. All listed methods use x-api-key authentication.

MethodHTTP operationReturn type
organizations.list(options?)GET /me/organizationsMyOrganizationOut[]
organizations.getByName(name, options?)Same GET, exact name selection locallyMyOrganizationOut
projects.list(organizationId, options?)GET PProjectOut[]
projects.create(organizationId, body, options?)POST P, JSON bodyProjectOut (201)
projects.createBlackbox(organizationId, input, options?)POST P, strict blackbox JSONProjectOut (201)
projects.get(projectRef, options?)GET RProjectOut
scans.start(projectRef, options?)POST R/start-scan, no bodyProjectOut
scans.stop(projectRef, options?)POST R/stop-scan, no bodyProjectOut
scans.list(projectRef, options?)GET R/scansScanListItemOut[]
scans.get(projectRef, options?)History GET, then latest detail GETScanDetailOut or null
scans.get(scanRef, options?)GET R/scans/{scanId}ScanDetailOut
findings.list(projectRef, options?)GET R/findingsFindingOut[]
reports.generate(projectRef, options?)POST R/reports/generate, no bodyReportGeneration (202)
reports.list(projectRef, options?)GET R/reportsReportList
reports.download(projectRef, options?)Report-list GET, then latest PDF GETReportDownload or null
reports.download(projectRef, filename, options?)GET R/reports/{filename}ReportDownload

Other successes use HTTP 200. List methods return full arrays, except reports use a { reports: [...] } envelope. There are no pagination, incremental-sync, name-query, report-job or scan-selection query parameters added by the SDK.

Project creation types

import type { ProjectCreate, ProjectType, BlackboxProjectInput } from "@straylabs/sdk";

const type: ProjectType = "grey-box";
const body: ProjectCreate = {
  project_name: "Application assessment",
  targets: ["https://app.customer.example"],
  type,
};

Creation supports black-box and grey-box, with black-box as the default. ProjectCreate preserves the wire configuration fields while narrowing its type. BlackboxProjectInput requires explicit scope and applies the stricter preset described in Projects.

Response and account types

The package exports relevant generated wire types, including MyOrganizationOut, ProjectOut, ScanListItemOut, ScanDetailOut, ScanTaskRunOut, ScanFindingOut, FindingOut, TestingAccount, TestingAccountOut, TestingAccountsConfig, TestingAccountsConfigOut, and AuthPolicy.

UUIDs and date-time values remain strings; nulls and optional fields are preserved. Status/severity fields declared as strings accept future strings. Additional response properties are retained at runtime. Report/error handling has explicit overrides for the export's generic report JSON, binary downloads and actual error envelopes.

Current API-key boundaries

CapabilitySDK behavior
Organization provisioning and key managementUse session-authenticated Platform workflows
Project update/delete or adding profiles after creationOutside the current API-key SDK
Managed testing-account generationSeparate route declares session/JWT authentication; policy settings do not invoke it
Scan statusExplicit request; no polling helper or background scheduling
Stop/resumeStop abandons the current scan; no normal resume abstraction
Individual finding update or dedicated retestOutside the current surface
Report job status or guaranteed scan attributionNot supplied by the API contract
Completion webhooks and evidence uploadsApplication integration responsibilities; SDK does not implement them

Check the testing accounts, reports, and error recovery guides before relying on a Platform workflow from an API-key integration.

Last updated

On this page