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

Projects

Create blackbox and greybox projects, select testing configuration, and read projects through the SDK.

A project holds targets, scope, account configuration, tasks, and the current findings store. A scan is one execution of that project. Creating a project does not start a scan.

Project creation requires organization ownership and available plan capacity. Reading and controlling an existing project use the key owner's resource permissions. Free organizations cannot create projects; capacity and target-domain policy depend on the organization's plan and provisioning.

Blackbox preset

const project = await client.projects.createBlackbox(organization.id, {
  project_name: "public-surface-assessment",
  targets: ["https://app.customer.example", "https://api.customer.example"],
  scope: "Public application and public API at the listed targets.",
  exclusions: "Load testing and payment processing.",
  certification_requirements: "iso27001",
  environment: "staging",
});
InputRequirement or default
project_nameRequired, non-blank; unique within the organization
targetsRequired, nonempty array of absolute HTTPS URLs
scopeRequired, non-blank in this helper
exclusionsDefaults to ""
certification_requirements"iso27001" by default, or "SOC2"
environment"dev", "pre", "staging", "prod", or null; omitted when unspecified

The helper preserves target order, paths, and query strings. The first target remains primary. It rejects URL credentials, localhost names, non-public literal IPs, and ambiguous target syntax. DNS checks, public-destination enforcement, and authorization belong to the application.

The preset forces type: "black-box", empty architectural resources and accounts, and allow_account_creation: false with max_accounts: 0. It rejects extra credential, account, architecture, or type overrides. Use projects.create when supplying those settings.

Full blackbox or greybox configuration

const project = await client.projects.create(organization.id, {
  project_name: "authenticated-application-assessment",
  targets: ["https://app.customer.example"],
  scope: "Public and authenticated application flows.",
  exclusions: "Payment processing.",
  type: "grey-box",
  environment: "staging",
  certification_requirements: "SOC2",
  testing_accounts: {
    accounts: [{
      profile_name: "standard-user",
      username: "tester@customer.example",
      password: testAccountPassword,
      role: "user",
      origin: "user",
    }],
    login_page: "https://app.customer.example/login",
    refresh_page: null,
    auth_policy: { allow_account_creation: false },
  },
  architectural_resources: {},
});

Load testAccountPassword from your server's secret store. The testing accounts guide covers profiles and authentication policy.

projects.create requires project_name and targets. It supports "black-box" and "grey-box" only, defaulting to "black-box" when type is omitted. White-box, null, and unknown creation types are rejected locally with StraylabsInputError.

Other fields retain the API's snake_case wire contract. Omitted scope and certification settings use server defaults; the strict helper above applies its own documented defaults. architectural_resources is an API-defined JSON object; the SDK has no upload method or separate documentation-resource API.

List and read projects

const projects = await client.projects.list(organization.id);

const projectRef = {
  organizationId: organization.id,
  projectId: selectedProjectId,
};
const project = await client.projects.get(projectRef);

selectedProjectId comes from the API project list or a persisted project reference. Lists contain complete arrays, newest first, without pagination options. Use IDs for identity; names and list positions are not durable keys. Read results preserve the API's fields, nulls, timestamps and additional properties, including existing projects with older wire types.

Project responses can contain target credentials. Return an application-owned status view to browser clients instead of exposing raw project data.

Existing-project configuration

The current API-key SDK provides create, list, and get. It does not expose project editing, deletion, or adding account profiles to an existing project. Those Platform operations use session-authenticated routes in the supplied contract. Reuse an existing project when its configuration fits the assessment; creating a replacement changes project and finding identities.

Launch the project explicitly with scans.start.

Last updated

On this page