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.
| Method | HTTP operation | Return type |
|---|---|---|
organizations.list(options?) | GET /me/organizations | MyOrganizationOut[] |
organizations.getByName(name, options?) | Same GET, exact name selection locally | MyOrganizationOut |
projects.list(organizationId, options?) | GET P | ProjectOut[] |
projects.create(organizationId, body, options?) | POST P, JSON body | ProjectOut (201) |
projects.createBlackbox(organizationId, input, options?) | POST P, strict blackbox JSON | ProjectOut (201) |
projects.get(projectRef, options?) | GET R | ProjectOut |
scans.start(projectRef, options?) | POST R/start-scan, no body | ProjectOut |
scans.stop(projectRef, options?) | POST R/stop-scan, no body | ProjectOut |
scans.list(projectRef, options?) | GET R/scans | ScanListItemOut[] |
scans.get(projectRef, options?) | History GET, then latest detail GET | ScanDetailOut or null |
scans.get(scanRef, options?) | GET R/scans/{scanId} | ScanDetailOut |
findings.list(projectRef, options?) | GET R/findings | FindingOut[] |
reports.generate(projectRef, options?) | POST R/reports/generate, no body | ReportGeneration (202) |
reports.list(projectRef, options?) | GET R/reports | ReportList |
reports.download(projectRef, options?) | Report-list GET, then latest PDF GET | ReportDownload 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
| Capability | SDK behavior |
|---|---|
| Organization provisioning and key management | Use session-authenticated Platform workflows |
| Project update/delete or adding profiles after creation | Outside the current API-key SDK |
| Managed testing-account generation | Separate route declares session/JWT authentication; policy settings do not invoke it |
| Scan status | Explicit request; no polling helper or background scheduling |
| Stop/resume | Stop abandons the current scan; no normal resume abstraction |
| Individual finding update or dedicated retest | Outside the current surface |
| Report job status or guaranteed scan attribution | Not supplied by the API contract |
| Completion webhooks and evidence uploads | Application 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