Start API test runs from your own code with the Run API

The CLI is the usual way to run API tests in CI. But sometimes the thing that should start a run is your own code: a release orchestrator, an internal developer portal, a Slack bot, a script in a language that isn't Node.js. The Run API is one REST call for that.

Authenticate

Send an API token as a bearer token:

  • an organization API token (trs_…) with the write scope can start runs, and one with read can list targets and read runs;
  • a personal API token (trt_…) works with your own permissions.

For automation, prefer an organization token: it doesn't stop working when the person who made it leaves. See Organization API tokens for CI.

Start a run

Terminal
curl -sS https://api.requestarium.com/api/v1/runs \
  -H "Authorization: Bearer $REQUESTARIUM_TOKEN" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: deploy-$GITHUB_RUN_ID" \
  -d '{
    "workspace_id": "<workspace id>",
    "target": { "kind": "suite", "id": "<suite id>" },
    "environment_id": "<environment id>",
    "variables": { "baseUrl": "https://preview-42.example.com" },
    "wait": 60
  }'
FieldMeaning
workspace_idRequired
target.kind, target.idcollection, folder or suite, and its id. GET /api/v1/targets?workspace_id=… lists what you can run
environment_idOptional. A suite uses its own environment unless you give one
variablesValues that override the environment for this run, such as a preview deployment's URL
iterations, stop_on_failureFor collections and folders, up to 20 iterations
waitSeconds to wait for the result, 0 to 60. Without it, the answer is 202 Accepted with a Location to poll
callback_url, callback_secretAn https URL that gets the finished run, signed with the secret

The same Idempotency-Key within 24 hours returns the first run instead of starting another, so a retried deploy step doesn't run the suite twice. (If you're testing your own idempotency keys, here's how.)

Read the result

GET /api/v1/runs/{id} returns the status (queued, running, passed, failed, error or cancelled), a summary and per-request results:

JSON
{
  "id": "6474…",
  "status": "failed",
  "target": { "kind": "collection", "id": "7f9e…", "name": "Smoke" },
  "summary": { "total": 2, "passed": 1, "failed": 1, "errors": 0, "duration_ms": 7 },
  "results": [ { "path": "Smoke/missing", "status": "failed", "statusCode": 404, "tests": [] } ],
  "links": { "self": "/api/v1/runs/6474…", "junit": "/api/v1/runs/6474…/junit" }
}

Add ?results=false for just the summary. POST /api/v1/runs/{id}/cancel stops a queued or running run.

The run shows in the app under Runs with the source api, so it's in the same history as runs from the app and the CLI.

Callbacks instead of polling

With callback_url, Requestarium POSTs once when the run finishes:

JSON
{ "event": "run.finished", "run": { "id": "…", "status": "passed", "summary": { "…": "…" } } }

With callback_secret, the call carries X-Requestarium-Signature-256: sha256=<hex HMAC-SHA256 of the body>. Check it before trusting the call.

Run API or CLI?

Run APICLI
Who sends the requeststhe Requestarium serverthe machine running the CLI
Reaches localhost, VPN, private networksno (unless you self-host inside that network)yes
Needs Node.jsnoyes
ProtocolsHTTP and GraphQLHTTP and GraphQL

Limits: 60 runs started per minute per token, 2 runs at a time per organization (more wait in a queue), 10 minutes per run.