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
doneTo 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.listScope: tests:read
Returns leaf tests and directories in a project branch, with pagination.
Query Parameters
| Parameter | Type | Default | Notes |
|---|---|---|---|
limit | integer | 50 | Results per page. 1 to 1000. |
page | integer | 0 | Zero-based page index. Maximum 10000. |
name | string | - | Case-insensitive substring filter on test name. |
status | string or string[] | - | Filter by status: draft, active, archived, or quarantined. Repeat the parameter to match multiple values. |
tagIds | UUID or UUID[] | - | Filter to tests carrying any of these tag IDs. Repeat to pass multiple. |
type | string | all | all, visual, or script. |
testId | UUID | - | Return only direct children of this directory test. |
branch | UUID | - | Override the x-branch-id header for this request. |
sortBy | string | - | name, status, or updatedAt. |
sortOrder | string | - | asc or desc. |
exportAll | boolean | false | Return 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.getScope: 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
| Parameter | Type | Required | Notes |
|---|---|---|---|
testId | UUID | yes | The test or directory to read. |
branch | UUID | no | Overrides 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
| Status | Meaning |
|---|---|
200 | Test found |
404 | Test, working revision, or branch not found |
Get Generated Code
GET /v1/actions/tests.get-codeScope: tests:read
Returns the generated Playwright code for the test's current working revision on the active branch.
Query Parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
testId | UUID | yes | The 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-filesScope: 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
| Parameter | Type | Required | Notes |
|---|---|---|---|
testId | UUID | yes | The 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.listScope: tests:read
Returns the saved revisions for the test on the active branch.
Query Parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
testId | UUID | yes | The test whose revisions to list. |
page, limit | integer | no | See 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.getScope: tests:read
Returns a specific revision with its full step tree.
Query Parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
testId | UUID | yes | The test the revision belongs to. |
revisionId | UUID | yes | The 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
| Status | Meaning |
|---|---|
200 | Revision found |
404 | Test or revision not found |
Create a Test
POST /v1/actions/tests.createScope: tests:create
Body
| Field | Required | Notes |
|---|---|---|
testData | yes | Object. Fields described below. |
uploads | no | Up to 10,000 uploadToken values from step-files.upload-urls. |
testData Fields
| Field | Type | Default | Notes |
|---|---|---|---|
name | string | - | Required. Max 64 characters, trimmed, must not be blank. |
metadata | object | - | Required. Includes type (visual or script). |
config | object | - | Run configuration. Shape described under Run configuration. |
status | string | draft | draft, 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. |
directory | boolean | false | Create a directory rather than a leaf test. |
parentTestId | UUID | - | Place the new test inside this directory. |
steps | array | - | Initial steps. Shape is complex and primarily produced by the test editor. See note below. |
tags | UUID[] | - | Tag IDs to attach. |
vars, parameters | JSON | - | 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.jsonValidation 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.duplicateScope: tests:create
Creates a copy of the test (or directory and all its children) on the active branch, preserving steps, tags, and secrets.
Body
| Field | Required | Notes |
|---|---|---|
testId | yes | UUID of the test or directory to copy. |
name | no | Name 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. |
status | no | Status for the copy: draft, active, archived, or quarantined. Defaults to the original's status. |
reason | conditional | Required (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.updateScope: tests:update
All testData fields are optional. Only fields present are updated.
Body
| Field | Required | Notes |
|---|---|---|
testId | yes | UUID of the test to update. |
testData | yes | Object. Accepts the same fields as create plus editVersion, all optional: name, status, metadata, config, steps, tags, directory, parentTestId, parameters, vars. |
uploads | no | Up to 10,000 uploadToken values from step-files.upload-urls. |
reason | conditional | Top-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
| Status | Meaning |
|---|---|
200 | Updated |
404 | Test or working revision not found |
400 | reason_required: quarantine requested without a reason; reason_too_long: reason over 500 characters |
409 | Edit conflict: another save happened since you last fetched the test |
Create a Revision (Snapshot)
POST /v1/actions/test-revisions.createScope: tests:update
Saves the current working state as a named snapshot.
Returns 400 if there are no unsaved changes.
Body
| Field | Required | Notes |
|---|---|---|
testId | yes | UUID of the test. |
message | yes | Snapshot 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-statusScope: tests:update
Sets the status of multiple tests at once.
Body
| Field | Required | Notes |
|---|---|---|
testIds | yes | Array of test IDs. 1 to 5000. Duplicates are ignored. |
status | yes | draft, active, archived, or quarantined. |
branchScope | no | current (default) updates the active branch only. all updates the test on every branch of the project. |
from | no | quarantined 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. |
branch | no | Branch UUID that branchScope: current acts on. Defaults to the active branch. |
reason | conditional | Required (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-tagsScope: tests:update
Replaces the tag set for multiple tests at once.
Body
| Field | Required | Notes |
|---|---|---|
testIds | yes | Array of test IDs. 1 to 5000. Duplicates are ignored. |
tagIds | yes | New 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.moveScope: tests:update
Moves tests and directories into a directory, or to the root of the project
when parentTestId is null.
Body
| Field | Required | Notes |
|---|---|---|
testIds | yes | Array of test or directory IDs to move. 1 to 5000. Duplicates are ignored. |
parentTestId | yes | UUID of the target directory, or null to move to the root. |
Response
200 { "data": null }Status Codes
| Status | Meaning |
|---|---|
200 | Moved |
400 | The target is one of the moved directories or lies inside one ("Cannot move a folder into itself or its own subfolder") |
404 | One or more tests not found, or the target directory not found on the active branch |
Delete a Test
DELETE /v1/actions/tests.deleteScope: tests:delete
Body
| Field | Required | Notes |
|---|---|---|
testId | yes | UUID of the test or directory. |
recursive | no | true 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-deleteScope: tests:delete
Body
| Field | Required | Notes |
|---|---|---|
testIds | yes | Array of test IDs. 1 to 5000. Duplicates are ignored. |
recursive | no | true 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.runScope: 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
| Field | Required | Notes |
|---|---|---|
testId | yes | UUID of the test or directory. |
config | no | Run configuration overrides. use.headless is always forced to true regardless of what you send. Shape: Run configuration. |
enqueue | no | true to queue the run when the parallel limit is full rather than returning 429. Default false. |
devices | no | Array 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
| Status | Meaning |
|---|---|
200 | Run started or queued |
400 | No active branch, or directory contains no executable tests |
404 | Test not found, or no working revision on the active branch |
409 | Test already has an active run (pending, queued, or running) |
429 | Cooldown period active (10 s), parallel limit exceeded (with enqueue: false), or queue is full (100 runs) |
Run Many Tests
POST /v1/actions/tests.run-manyScope: 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
| Field | Required | Notes |
|---|---|---|
testIds | one of | 1 to 5000 test or directory IDs. A directory runs every active test inside it. All must belong to the same project. |
tagId | one of | Runs every active leaf test carrying this tag on the active branch. Exactly one of testIds or tagId is required. |
config | no | Run configuration overrides. use.headless is always forced to true. |
enqueue | no | true to queue the run when the parallel limit is full rather than returning 429. Default false. The queue holds at most 100 pending runs. |
devices | no | Array 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
| Status | Meaning |
|---|---|
200 | Run started or queued |
400 | No 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 |
404 | tagId does not exist |
429 | Cooldown period active (10 s), parallel limit exceeded (with enqueue: false), or queue is full (100 runs) |
Export Tests
POST /v1/actions/tests.exportScope: tests:read
Exports the selected tests as a ZIP archive, returned base64-encoded.
Body
| Field | Type | Notes |
|---|---|---|
testIds | UUID[] | Specific tests to include. |
tagIds | UUID[] | Include all tests carrying any of these tags. |
directoryId | UUID | Include a directory and all its descendants. |
format | string | json (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:
| Path | What |
|---|---|
tests/<slug>.spec.ts | Generated Playwright spec for each leaf test |
tests/fixtures.ts | Shared fixtures used by all specs |
playwright.config.ts | Config 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.json | Package 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.zipImport Tests
POST /v1/actions/tests.importScope: tests:create
Archives that contain shared steps also need tests:update.
Body
| Field | Required | Notes |
|---|---|---|
contentBase64 | yes | The 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:
| Field | Type | Default | Notes |
|---|---|---|---|
use.browserName | string | chromium | chromium, webkit, or firefox. |
use.baseURL | string | — | Base URL prepended to relative navigation targets. |
use.trace | string | retain-on-failure | off, on, retain-on-failure, or on-first-retry. |
use.video | string | off | off, on, retain-on-failure, or on-first-retry. |
use.screenshot | string | only-on-failure | off, on, or only-on-failure. |
use.actionTimeout | integer (ms) | 0 | Per-action timeout. 0 = default of 60 000. Max 3 600 000. |
use.navigationTimeout | integer (ms) | 0 | Navigation timeout. 0 = no limit. Max 3 600 000. |
retries | integer | 0 | Times to retry a failing test. |
timeout | integer (ms) | 30000 | Per-test timeout. Max 3 600 000 (1 h). |
workers | integer | 1 | Parallel workers per machine, 1 to 8. Limited by the number of parallels in your plan. |
shards | integer | 1 | Number 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. |
repeatEach | integer | 1 | How many times to run each test. |
use.viewport.width | integer | 1920 | Viewport width in pixels. |
use.viewport.height | integer | 1080 | Viewport height in pixels. |
use.screen.width / use.screen.height | integer | — | Screen size in pixels (window.screen). Set both or neither. |
use.headless is accepted but ignored for remote runs — the runner always
runs headless.
Projects and Branches
List projects and branches available to an API key using projects.list and branches.list. Both are GET actions; project actions do not need x-project-id.
Steps
Read, edit, and reorder the steps in a test's working revision using the SmoothDeploy API. Step actions use the tests scope; editing requires tests:update.