SmoothDeploy Docs
API Reference

Tests

Use the SmoothDeploy API to list, create, update, delete, and run tests. Each action lists its required scopes; bulk and import actions are also covered.

Tests are the primary resource in SmoothDeploy. Each test holds a name, a run configuration, and a set of steps. Tests live inside a project and a branch. Each action lists the scopes it needs. Actions that change data or start a run require an active subscription and otherwise return 403 { "error": "LICENSE_REQUIRED" }; read actions do not. See Authentication for headers and Scopes for the full scope reference.

Every action is called at /v1/actions/<name>. GET actions take their inputs as query parameters. All other actions, including DELETE, take a JSON body with Content-Type: application/json. All actions on this page require x-project-id; the branch comes from x-branch-id or the project default branch.

CI Quick-Start

The most common API use case: trigger a remote run and gate your pipeline on the result. The API key needs tests:run to trigger runs, and testRuns:read to poll status and download artifacts.

# 1 - start a bulk run
RUN=$(curl -s -X POST https://api.smoothdeploy.com/v1/actions/tests.run-many \
  -H "x-api-key: sd_your_api_key" \
  -H "x-project-id: 3f8a1b2c-1111-2222-3333-444455556666" \
  -H "x-branch-id: 7a9d3e4f-aaaa-bbbb-cccc-888899990000" \
  -H "Content-Type: application/json" \
  -d '{"testIds":["aabbccdd-1234-5678-abcd-ef0123456789"]}')

RUN_ID=$(echo "$RUN" | jq -r .data.runId)
echo "Run started: $RUN_ID"

# 2 - poll until the run reaches a terminal status
while :; do
  STATUS=$(curl -s "https://api.smoothdeploy.com/v1/actions/test-runs.get?runId=$RUN_ID" \
    -H "x-api-key: sd_your_api_key" \
    -H "x-project-id: 3f8a1b2c-1111-2222-3333-444455556666" \
    | jq -r .data.status)
  case "$STATUS" in
    completed) echo "All tests passed"; exit 0 ;;
    failed)    echo "Tests failed";     exit 1 ;;
    cancelled) echo "Run cancelled";    exit 1 ;;
    *)         echo "Status: $STATUS - waiting..."; sleep 10 ;;
  esac
done

To download artifacts afterwards, call test-runs.get-artifacts (see Test Runs). x-branch-id is optional. When omitted the project's default branch is used.


List Tests

GET /v1/actions/tests.list

Scope: tests:read

Returns leaf tests and directories in a project branch, with pagination.

Query Parameters

ParameterTypeDefaultNotes
limitinteger50Results per page. 1 to 1000.
pageinteger0Zero-based page index. Maximum 10000.
namestring-Case-insensitive substring filter on test name.
statusstring or string[]-Filter by status: draft, active, archived, or quarantined. Repeat the parameter to match multiple values.
tagIdsUUID or UUID[]-Filter to tests carrying any of these tag IDs. Repeat to pass multiple.
typestringallall, visual, or script.
testIdUUID-Return only direct children of this directory test.
branchUUID-Override the x-branch-id header for this request.
sortBystring-name, status, or updatedAt.
sortOrderstring-asc or desc.
exportAllbooleanfalseReturn up to 10 000 rows in one response, without pagination.

When testId is set, limit is ignored and all direct children are returned.

Response

{
  "data": [
    {
      "id": "aabbccdd-1234-5678-abcd-ef0123456789",
      "parentTestId": null,
      "projectId": "proj-uuid",
      "organizationId": "org-uuid",
      "name": "Login flow",
      "status": "active",
      "directory": false,
      "config": { "use": { "browserName": "chromium" }, "workers": 1 },
      "vars": null,
      "parameters": null,
      "metadata": { "type": "visual", "description": "Login flow", "tags": [] },
      "tags": [],
      "childrenCount": 0,
      "stepsCount": 3,
      "createdAt": "2026-09-01T00:00:00.000Z",
      "updatedAt": "2026-09-15T08:30:00.000Z"
    }
  ],
  "pagination": {
    "page": 0,
    "limit": 50,
    "total": 3,
    "totalPages": 1,
    "hasMore": false
  }
}

With exportAll=true the response is { data, truncated } with no pagination.


Get a Test

GET /v1/actions/tests.get

Scope: tests:read

Returns the test record merged with its working revision, plus its direct children (if it is a directory), its top-level steps, and its parent directory.

Query Parameters

ParameterTypeRequiredNotes
testIdUUIDyesThe test or directory to read.
branchUUIDnoOverrides the x-branch-id header for this request.

Response

{
  "data": {
    "test": {
      "id": "aabbccdd-1234-5678-abcd-ef0123456789",
      "name": "Login flow",
      "status": "active",
      "directory": false,
      "parentTestId": null,
      "config": {
        "use": { "browserName": "chromium", "baseURL": "https://app.example.com" },
        "timeout": 30000,
        "workers": 1
      },
      "updatedAt": "2026-09-15T08:30:00.000Z"
    },
    "children": [],
    "steps": [],
    "parentDirectory": null,
    "editVersion": 4
  }
}

editVersion is the value to pass back to tests.update for optimistic locking.

Status Codes

StatusMeaning
200Test found
404Test, working revision, or branch not found

Get Generated Code

GET /v1/actions/tests.get-code

Scope: tests:read

Returns the generated Playwright code for the test's current working revision on the active branch.

Query Parameters

ParameterTypeRequiredNotes
testIdUUIDyesThe test to generate code for.

Response

{
  "data": {
    "filename": "login-flow.spec.js",
    "scriptText": "import { test, expect } from ...",
    "configText": "import { defineConfig } from ...",
    "fixturesText": "..."
  }
}

Get Test File Attachments

GET /v1/actions/tests.get-files

Scope: tests:read

Returns a short-lived (5 minute) signed download URL for each file of any setInputFiles step in the test. Download the file with a plain GET on url; the URL expires, so call this action again for a fresh one. To attach a file again, upload it through step-files.upload-urls.

Query Parameters

ParameterTypeRequiredNotes
testIdUUIDyesThe test whose files to read.

Response

{
  "data": [
    {
      "name": "upload.pdf",
      "stepId": "step-uuid",
      "url": "https://assets.example.com/…?Expires=…&Signature=…&Key-Pair-Id=…"
    }
  ]
}

List Revisions

GET /v1/actions/test-revisions.list

Scope: tests:read

Returns the saved revisions for the test on the active branch.

Query Parameters

ParameterTypeRequiredNotes
testIdUUIDyesThe test whose revisions to list.
page, limitintegernoSee Pagination.

Response

{
  "data": [
    {
      "id": "rev-uuid",
      "message": "Added error state assertions",
      "revisionType": "manual",
      "createdAt": "2026-09-14T12:00:00.000Z"
    }
  ]
}

Each revision also carries the name of its creator.


Get a Revision

GET /v1/actions/test-revisions.get

Scope: tests:read

Returns a specific revision with its full step tree.

Query Parameters

ParameterTypeRequiredNotes
testIdUUIDyesThe test the revision belongs to.
revisionIdUUIDyesThe revision to read.

Response

{
  "data": {
    "revision": {
      "id": "rev-uuid",
      "message": "Added error state assertions",
      "createdAt": "2026-09-14T12:00:00.000Z"
    },
    "test": { "id": "test-uuid", "name": "Login flow" },
    "steps": []
  }
}

Status Codes

StatusMeaning
200Revision found
404Test or revision not found

Create a Test

POST /v1/actions/tests.create

Scope: tests:create

Body

FieldRequiredNotes
testDatayesObject. Fields described below.
uploadsnoUp to 10,000 uploadToken values from step-files.upload-urls.

testData Fields

FieldTypeDefaultNotes
namestring-Required. Max 64 characters, trimmed, must not be blank.
metadataobject-Required. Includes type (visual or script).
configobject-Run configuration. Shape described under Run configuration.
statusstringdraftdraft, active, archived, or quarantined.
reason (top-level, outside testData)string-Required when status is quarantined (max 500 characters, not blank; longer returns 400 reason_too_long), else 400 reason_required.
directorybooleanfalseCreate a directory rather than a leaf test.
parentTestIdUUID-Place the new test inside this directory.
stepsarray-Initial steps. Shape is complex and primarily produced by the test editor. See note below.
tagsUUID[]-Tag IDs to attach.
vars, parametersJSON-Static JSON values. See Variables and parameters.

Variables and Parameters

vars is a JSON object of starting values for a visual test. Steps can overwrite them while the test runs. parameters is a JSON array of objects; the test runs once per object. Values can be any JSON, nested values included.

{
  "vars": { "DEFAULT_USER": "jane" },
  "parameters": [{ "EMAIL": "row1@example.com" }, { "EMAIL": "row2@example.com" }]
}

A vars value that is not an object, or a parameters value that is not an array of objects, is rejected with 400. Each field is limited to 64 KB of JSON. Send null to clear a field.

The steps array structure is deeply nested and generated by the console editor. Constructing it by hand is possible but non-trivial. The JSON Schema at /v1/schemas/test.json describes the step objects.

Create a Script Test from a Spec File

A script test stores a Playwright spec file as one script step. Set metadata.type to "script", metadata.lang to "ts" or "js", and pass the file contents as action.code. action.packages is optional and lists extra npm packages the spec imports; packages are also detected from the import statements.

jq -n --rawfile code login.spec.ts '{
  testData: {
    name: "Login spec",
    status: "active",
    metadata: { type: "script", lang: "ts" },
    config: {},
    steps: [{ id: "6f1c2d3e-0000-4000-8000-000000000001", name: "Script", order: 0,
              action: { name: "script", code: $code } }]
  }
}' > body.json

curl -s -X POST https://api.smoothdeploy.com/v1/actions/tests.create \
  -H "x-api-key: sd_your_api_key" \
  -H "x-project-id: 3f8a1b2c-1111-2222-3333-444455556666" \
  -H "Content-Type: application/json" \
  --data @body.json

Validation returns 400 when the spec does not contain exactly one top-level test() ("File must contain a single top-level test()") or imports a package outside the organization allowlist ("Packages not in allowlist: left-pad").

Response

The response is the bare test row. Name, status, and config are stored on the revision, not the test record, so they are not present here.

{
  "data": {
    "id": "aabbccdd-1234-5678-abcd-ef0123456789",
    "parentTestId": null,
    "projectId": "proj-uuid",
    "organizationId": "org-uuid",
    "createdAt": "2026-10-01T09:00:00.000Z",
    "updatedAt": "2026-10-01T09:00:00.000Z"
  }
}

Duplicate a Test

POST /v1/actions/tests.duplicate

Scope: tests:create

Creates a copy of the test (or directory and all its children) on the active branch, preserving steps, tags, and secrets.

Body

FieldRequiredNotes
testIdyesUUID of the test or directory to copy.
namenoName for the copy. Defaults to "<original name> (Copy)"; the (Copy) suffix is always kept, and the original name is kept whole when it fits (57 characters or fewer), otherwise only its end is cut so the copy is exactly 64. Max 64 characters, trimmed, must not be blank.
statusnoStatus for the copy: draft, active, archived, or quarantined. Defaults to the original's status.
reasonconditionalRequired (max 500 characters, not blank; longer returns 400 reason_too_long) when the copy ends up quarantined and the original has no recorded reason, else 400 reason_required. When given, it replaces the original's reason on the copy. For a directory, quarantined children without their own reason take this one; if any still has none, the call returns 400 reason_required naming them and copies nothing.

Response

{
  "data": {
    "id": "new-test-uuid",
    "name": "Login flow (Copy)"
  }
}

Update a Test

PUT /v1/actions/tests.update

Scope: tests:update

All testData fields are optional. Only fields present are updated.

Body

FieldRequiredNotes
testIdyesUUID of the test to update.
testDatayesObject. Accepts the same fields as create plus editVersion, all optional: name, status, metadata, config, steps, tags, directory, parentTestId, parameters, vars.
uploadsnoUp to 10,000 uploadToken values from step-files.upload-urls.
reasonconditionalTop-level, outside testData. Required (max 500 characters, not blank; longer returns 400 reason_too_long) when testData.status changes to quarantined, else 400 reason_required. Optional when unquarantining.

Supplying testData.editVersion enables optimistic locking: if the value you send does not match the server's current version, the request returns 409. Omit editVersion to skip this check.

Response

{
  "data": { "editVersion": 5 }
}

editVersion is incremented on every save. Pass it back in a subsequent tests.update call as testData.editVersion to detect concurrent edits.

Status Codes

StatusMeaning
200Updated
404Test or working revision not found
400reason_required: quarantine requested without a reason; reason_too_long: reason over 500 characters
409Edit conflict: another save happened since you last fetched the test

Create a Revision (Snapshot)

POST /v1/actions/test-revisions.create

Scope: tests:update

Saves the current working state as a named snapshot. Returns 400 if there are no unsaved changes.

Body

FieldRequiredNotes
testIdyesUUID of the test.
messageyesSnapshot label.

Response

{
  "data": {
    "id": "rev-uuid",
    "message": "Locked for release",
    "revisionType": "manual",
    "createdAt": "2026-10-01T09:15:00.000Z"
  }
}

Bulk Update Status

POST /v1/actions/tests.bulk-update-status

Scope: tests:update

Sets the status of multiple tests at once.

Body

FieldRequiredNotes
testIdsyesArray of test IDs. 1 to 5000. Duplicates are ignored.
statusyesdraft, active, archived, or quarantined.
branchScopenocurrent (default) updates the active branch only. all updates the test on every branch of the project.
fromnoquarantined limits the change to revisions that are currently quarantined, so archived or draft revisions on other branches are left alone. Omit it to change every revision whose status differs.
branchnoBranch UUID that branchScope: current acts on. Defaults to the active branch.
reasonconditionalRequired (max 500 characters, not blank; longer returns 400 reason_too_long) when status is quarantined, optional otherwise. Missing or blank returns 400 reason_required.

Response

200 { "data": null }

Returns 404 if any ID is not a test in the project.


Bulk Update Tags

POST /v1/actions/tests.bulk-update-tags

Scope: tests:update

Replaces the tag set for multiple tests at once.

Body

FieldRequiredNotes
testIdsyesArray of test IDs. 1 to 5000. Duplicates are ignored.
tagIdsyesNew complete tag set. At most 100. Pass an empty array to clear all tags.

Response

200 { "data": null }

Returns 404 if any test or tag is not found.


Move Tests

POST /v1/actions/tests.move

Scope: tests:update

Moves tests and directories into a directory, or to the root of the project when parentTestId is null.

Body

FieldRequiredNotes
testIdsyesArray of test or directory IDs to move. 1 to 5000. Duplicates are ignored.
parentTestIdyesUUID of the target directory, or null to move to the root.

Response

200 { "data": null }

Status Codes

StatusMeaning
200Moved
400The target is one of the moved directories or lies inside one ("Cannot move a folder into itself or its own subfolder")
404One or more tests not found, or the target directory not found on the active branch

Delete a Test

DELETE /v1/actions/tests.delete

Scope: tests:delete

Body

FieldRequiredNotes
testIdyesUUID of the test or directory.
recursivenotrue deletes a directory together with everything inside it. Default false.

Returns 400 if the test, or any test deleted recursively, is referenced by one or more active schedules. Returns 409 when the test is a non-empty directory and recursive is not true.

Response

200 { "data": null }

Bulk Delete Tests

POST /v1/actions/tests.bulk-delete

Scope: tests:delete

Body

FieldRequiredNotes
testIdsyesArray of test IDs. 1 to 5000. Duplicates are ignored.
recursivenotrue deletes directories together with their contents. Default false.

Returns 409 when a directory in testIds is not empty and recursive is not true.

Response

200 { "data": null }

Run a Test or Directory

POST /v1/actions/tests.run

Scope: tests:run

Starts a remote run for the test. If the test is a directory, all active descendant leaf tests execute as a single run.

There is a 10-second cooldown per test between triggers. Attempting to trigger while a run is already pending, queued, or running returns 409.

Body

FieldRequiredNotes
testIdyesUUID of the test or directory.
confignoRun configuration overrides. use.headless is always forced to true regardless of what you send. Shape: Run configuration.
enqueuenotrue to queue the run when the parallel limit is full rather than returning 429. Default false.
devicesnoArray of Playwright device names, up to 10. Each device runs as its own Playwright project. Omit to use the devices saved on the test; send [] for no devices.

When enqueue: true and capacity is available the run starts immediately (queued: false). When capacity is full the run waits in a queue (queued: true) and starts once a worker is free. The queue holds at most 100 pending runs; a full queue returns 429 even with enqueue: true.

Response

{
  "data": {
    "runId": "run-uuid",
    "status": "pending",
    "queued": false
  }
}

For a single leaf test the totalTests field is omitted from the response; directory and bulk runs always include it. queued: true means the run was accepted but is waiting for a free parallel.

Status Codes

StatusMeaning
200Run started or queued
400No active branch, or directory contains no executable tests
404Test not found, or no working revision on the active branch
409Test already has an active run (pending, queued, or running)
429Cooldown period active (10 s), parallel limit exceeded (with enqueue: false), or queue is full (100 runs)

Run Many Tests

POST /v1/actions/tests.run-many

Scope: tests:run

Runs an explicit list of test IDs, or every test carrying a tag, as a single run. Directory IDs are expanded to their descendant leaf tests. Draft and archived tests are excluded automatically.

There is a 10-second cooldown per organization between bulk triggers.

Body

FieldRequiredNotes
testIdsone of1 to 5000 test or directory IDs. A directory runs every active test inside it. All must belong to the same project.
tagIdone ofRuns every active leaf test carrying this tag on the active branch. Exactly one of testIds or tagId is required.
confignoRun configuration overrides. use.headless is always forced to true.
enqueuenotrue to queue the run when the parallel limit is full rather than returning 429. Default false. The queue holds at most 100 pending runs.
devicesnoArray of Playwright device names, up to 10. Each device runs as its own Playwright project. Omit to use the devices saved on the test; send [] for no devices.

Response

{
  "data": {
    "runId": "run-uuid",
    "status": "pending",
    "queued": false,
    "totalTests": 3,
    "message": "Started bulk run with 3 tests"
  }
}

queued: true means the run was accepted but is waiting for a free parallel.

Status Codes

StatusMeaning
200Run started or queued
400No active branch, both or neither of testIds/tagId, no executable tests in the selection, or more than 100 active tests after directories and tags are expanded
404tagId does not exist
429Cooldown period active (10 s), parallel limit exceeded (with enqueue: false), or queue is full (100 runs)

Export Tests

POST /v1/actions/tests.export

Scope: tests:read

Exports the selected tests as a ZIP archive, returned base64-encoded.

Body

FieldTypeNotes
testIdsUUID[]Specific tests to include.
tagIdsUUID[]Include all tests carrying any of these tags.
directoryIdUUIDInclude a directory and all its descendants.
formatstringjson (default) or pw (Playwright script).

At most 10,000 tests can be exported in one call. Selecting more returns 400. All fields are optional in the schema; a request that selects no tests does not return a usable archive. Requires an active subscription.

pw Format Zip Contents

The pw zip is a self-contained Playwright project:

PathWhat
tests/<slug>.spec.tsGenerated Playwright spec for each leaf test
tests/fixtures.tsShared fixtures used by all specs
playwright.config.tsConfig generated from the run configuration of the first exported test. Tests with a different stored config run under this one. Each parameter row becomes a Playwright project.
package.jsonPackage manifest with @playwright/test pinned to the version SmoothDeploy uses
<step-key>/<filename>Any setInputFiles attachments, at the root

Run it with npm install && npx playwright test from the unzipped directory.

Response

{
  "data": {
    "filename": "smoothdeploy-tests.zip",
    "contentBase64": "UEsDBBQ..."
  }
}

Decode contentBase64 to get the ZIP bytes:

curl -s -X POST https://api.smoothdeploy.com/v1/actions/tests.export \
  -H "x-api-key: sd_your_api_key" \
  -H "x-project-id: 3f8a1b2c-1111-2222-3333-444455556666" \
  -H "Content-Type: application/json" \
  -d '{"testIds":["aabbccdd-1234-5678-abcd-ef0123456789"]}' \
  | jq -r .data.contentBase64 | base64 --decode > my-test.zip

Import Tests

POST /v1/actions/tests.import

Scope: tests:create

Archives that contain shared steps also need tests:update.

Body

FieldRequiredNotes
contentBase64yesThe base64-encoded .zip archive, in the format produced by tests.export. The ZIP must be at most 50 MB uncompressed (base64 input max ~66.7 MB).
base64 < smoothdeploy-tests.zip | tr -d '\n' > archive.b64
jq -n --rawfile b archive.b64 '{contentBase64: $b}' \
  | curl -s -X POST https://api.smoothdeploy.com/v1/actions/tests.import \
      -H "x-api-key: sd_your_api_key" \
      -H "x-project-id: 3f8a1b2c-1111-2222-3333-444455556666" \
      -H "Content-Type: application/json" \
      --data @-

Response

{
  "data": {
    "imported": {
      "tests": 5,
      "sharedSteps": 2,
      "tags": 1,
      "steps": 18
    },
    "errors": []
  }
}

errors is an array of objects with file and error fields describing any entries in the archive that could not be imported, for example a test whose name is blank or longer than 64 characters. Directory names are trimmed and shortened to 64 characters; a blank directory name is reported as an error.

Returns 400 for an invalid ZIP or an archive with no tests.

A quarantined test in the archive (status: quarantined) must carry a non-blank statusReason (max 500 characters; tests.export writes it, using "No reason recorded" for older tests without one). If any quarantined test lacks one, the whole import is rejected with 400 reason_required, and with 400 reason_too_long if one exceeds the limit, naming those tests, and nothing is imported.


Run Configuration

The config object accepted by create, update, and remote-run endpoints:

FieldTypeDefaultNotes
use.browserNamestringchromiumchromium, webkit, or firefox.
use.baseURLstring—Base URL prepended to relative navigation targets.
use.tracestringretain-on-failureoff, on, retain-on-failure, or on-first-retry.
use.videostringoffoff, on, retain-on-failure, or on-first-retry.
use.screenshotstringonly-on-failureoff, on, or only-on-failure.
use.actionTimeoutinteger (ms)0Per-action timeout. 0 = default of 60 000. Max 3 600 000.
use.navigationTimeoutinteger (ms)0Navigation timeout. 0 = no limit. Max 3 600 000.
retriesinteger0Times to retry a failing test.
timeoutinteger (ms)30000Per-test timeout. Max 3 600 000 (1 h).
workersinteger1Parallel workers per machine, 1 to 8. Limited by the number of parallels in your plan.
shardsinteger1Number of machines the run is split across, 1 to 5. Each machine uses workers. Parallels used: shards × workers. Tests inside one file are split across machines only when fullyParallel is on.
repeatEachinteger1How many times to run each test.
use.viewport.widthinteger1920Viewport width in pixels.
use.viewport.heightinteger1080Viewport height in pixels.
use.screen.width / use.screen.heightinteger—Screen size in pixels (window.screen). Set both or neither.

use.headless is accepted but ignored for remote runs — the runner always runs headless.