API Reference

Trigger a run

Kick off scenarios from any environment with a single authenticated POST. Returns a batch_id you can poll for status and reports.

POST/api/v1/runs/trigger

Authenticate with an API key from Settings → API Tokens. Send it as Authorization: Bearer ….

cURL
curl -X POST https://assertive.tech/api/v1/runs/trigger \
  -H "Authorization: Bearer $ASSERTIVE_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "project_id": "proj_XXXX",
    "scenario_ids": ["scn_login", "scn_checkout"],
    "environment": "staging"
  }'
JavaScript (Node 18+)
const res = await fetch("https://assertive.tech/api/v1/runs/trigger", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.ASSERTIVE_API_TOKEN}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    project_id: "proj_XXXX",
    scenario_ids: ["scn_login", "scn_checkout"],
    environment: "staging",
  }),
});
const { batch_id } = await res.json();
Python
import os, requests

res = requests.post(
    "https://assertive.tech/api/v1/runs/trigger",
    headers={
        "Authorization": f"Bearer {os.environ['ASSERTIVE_API_TOKEN']}",
        "Content-Type": "application/json",
    },
    json={
        "project_id": "proj_XXXX",
        "scenario_ids": ["scn_login", "scn_checkout"],
        "environment": "staging",
    },
    timeout=30,
)
batch_id = res.json()["batch_id"]
Assertive CLI (@assertive/cli)
# Install once (or run ad-hoc with npx)
npm i -g @assertive/cli

# Authenticate — reads $ASSERTIVE_API_TOKEN from your env
export ASSERTIVE_API_TOKEN="sk_live_..."

# Trigger a run
assertive runs trigger \
  --project proj_XXXX \
  --scenario scn_login \
  --scenario scn_checkout \
  --env staging

# Or one-off, no install:
npx @assertive/cli runs trigger \
  --project proj_XXXX --scenario scn_login --env staging

Response

{
  "batch_id": "batch_01HXYZ...",
  "queued": 2,
  "status_url": "https://assertive.tech/api/v1/runs/batch_01HXYZ..."
}