Skip to content
trawler
Use Trawler

The Run API

The Run API is how a program starts a run and reads what it found. It has three calls, all authenticated with an API token: one starts a run of a project’s plan, one returns the run’s state and, once it has ended, its result, and one stops a run. trawler-ci is built on it; call it directly to run Trawler from a CI system or a script of your own.

A run started this way is an ordinary run: the same plan, people, cap, report and run page as one started with Start run, and it shows in the project’s Runs. The address of the API is the address of the app.

Send the token in the Authorization header: Authorization: Bearer trw_…, with one space. Every response, a refusal included, is JSON and carries Cache-Control: no-store; a refusal’s body is {"error": "…"}, with "code": "model_key" added when the workspace’s model key is the reason, see What starting a run checks.

Status Message Why
401 Send the API token as ‘Authorization: Bearer ’. The header is missing or not in that form. The response carries WWW-Authenticate: Bearer.
401 That API token is not valid or was revoked. The token is not one Trawler knows, or it was revoked.
429 Too many calls with this token. Slow down. The token made 120 calls in the current clock minute. Trawler counts them in its database, so the limit holds however many servers answer. Retry-After says how many seconds are left in the minute.

POST /api/v1/runs with a JSON body. Only project is required.

Terminal window
curl -sS https://app.usetrawler.com/api/v1/runs \
-H "Authorization: Bearer $TRAWLER_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"project": "0b9c3f0e-5d0e-4c53-9d3b-7a1f5c1f2a11", "cap": 3}'
Field Type
project UUID, required The project to test. It is the UUID in the project’s address in the app, app.usetrawler.com/projects/<project>.
plan UUID The plan to run, the UUID after plan= in the address when a plan is open. Without it, the project’s first plan.
execution "hosted" or "own" Where the run is carried out. "hosted" by default. See Hosted and own.
url address, up to 2,048 characters Test this address instead of the project’s own. Only with "own". Its origin is allowed to the people, as the project’s own is.
cap number, 0.1 to 50 The hard cap in dollars, as in the Start panel. $2 by default.
model text, up to 200 characters of letters, digits and . _ : / @ - The model for every person, replay and judge call. By default the first model Trawler suggests for the provider of the workspace’s key: deepseek/deepseek-v4.1-flash for OpenRouter, gpt-5-mini for OpenAI, claude-haiku-4-5 for Anthropic and gemini-3.5-flash for Google. An OpenAI-compatible service has no default, and the request is refused unless it names a model.
conversation true Let the people work at the same time and talk. See People who talk during a run. Ignored when the plan has one person.
allowedOrigins up to 5 addresses Origins the people may open besides the one of url, for services in the job such as a mail inbox. Only with "own" and url; each must be an http or https address, and only its origin is used.
accounts up to 20 names The names of people whose accounts the runner reads from a file. Only with "own". See Accounts from the CI job.
pullRequest object The pull request the run is for. See below.
planMode "regression", "change" or "both" How the run uses the pull request. "change" by default: the run plays only the plan Trawler makes for the pull request. See Plans for pull requests.
replan true Plan the pull request again even if it has not changed since its plan was made.

The pullRequest object has these fields, all optional:

Field
number The pull request’s number, a positive integer. Without it, no plan is kept for the pull request.
title Up to 300 characters.
description Up to 4,000 characters.
changedFiles Up to 200 paths, each up to 300 characters.
environment A description of how the app runs in the CI job and what it does not have, up to 4,000 characters. See Describing the CI setup.
baseRef, headRef The branch names, up to 200 characters each.
commit The commit, up to 64 characters.
repository Such as acme/shop, up to 200 characters.
url The pull request’s address, up to 2,048 characters.

Trawler keeps the object with the run. Only title, description, changedFiles and environment are read to plan; number and repository name the pull request the plan belongs to. The run page shows title as a line under its heading, and number, title, url, repository, headRef and commit on its Details tab.

Starting a run with a number stops the earlier run of the same project, repository and number that is still going, whatever its execution: see Newer pushes and other pull requests.

A request that breaks these rules is refused with 400 and Invalid request: followed by the field and what is wrong with it. A body that is not JSON is refused the same way.

201 Created:

{
"id": "5f1d5f54-3a0c-4a3a-8c58-0f4d9e6b2c10",
"number": 17,
"reportUrl": "https://app.usetrawler.com/runs/0017",
"people": 3
}

id is what GET takes, number the run’s number in the workspace, reportUrl the run page, which opens for people in the workspace, and people the number of people the run starts with.

In this order, the call is refused if:

Status Message Why
403 This API token is limited to another project. The token is for one project, and it is not project.
400 Invalid request: model is not a valid model name. model has characters other than those listed.
422 A different target URL can only be tested by a runner in your own network. Use execution “own”, or leave the URL out to test the project’s target. url with "hosted".
400 Invalid request: other addresses can only be allowed with execution “own” and a target URL, because they are next to an app in your own network. allowedOrigins with "hosted", or without url.
400 Invalid request: accounts can only be given with execution “own”, because a hosted runner cannot read the CI job’s accounts. accounts with "hosted".
404 That project is not in this workspace. project is not a project of the token’s workspace.
412 Start the first run of this project from the app, where you confirm you are authorised to test it. Runs started with an API token are available after that. The project has no run yet, of any kind. Start run on the app’s start page asks you to confirm that you may test the product; a token cannot give that confirmation. A product on a private network has no Start panel: its start page, headed Run from CI, has a box to confirm it may be tested and Allow runs from CI, and once that is chosen the call accepts the project’s first run.
404 That plan is not on this project. plan is not one of the project’s plans.
422 Maya needs a test account to sign in. A person who has to sign in has no test account on the plan, and accounts does not name them.
422 This workspace uses its own endpoint, so say which model to use. The workspace’s key is for an OpenAI-compatible service, and model is missing.
422 Add a model key in Settings to start runs. The workspace has no key, and its first run on Trawler is already used. The body has "code": "model_key".
409 Run 0007 is still going on this project. Wait for it to finish or stop it, then start again. The project has a run that is Queued or Live and takes the project’s place: a hosted run, or a run for "own" without url. A run for "own" with url does not. A project runs one such run at a time, a run of the same pull request apart, which the new one replaces.
429 This workspace already has 5 runs going in CI jobs, the most it may have at once. Wait for one to finish or stop one, then start again. A newer push to a pull request replaces its earlier run, so that does not add to the count. The workspace has 5 runs for "own" that are Queued or Live.
422 Trawler has paused hosted runs for now. Try again later, or run it on your own machine with the local runner. Trawler paused runs. It applies to runs for your own runners too.
422 Runs on this project are paused. Resume them on the project’s page, then start again. The project is paused.
422 The Free plan includes 3 hosted runs a day, and this workspace has started them all today. … The workspace has no runs left today on its workspace plan. Every run counts, whoever carries it out and however it was started.
422 This workspace has spent its $50.00 monthly budget: $51.20 since September 1 (UTC). An owner or admin can raise it in Settings. The workspace reached its monthly budget.
422 The Free plan takes up to 4 people in a run, and the plan on this project has 5. … The plan has more people than the workspace plan allows in a run.
422 OpenAI did not accept this key (…). The workspace’s key is refused by its provider; the provider is named, and the provider’s own explanation follows in the brackets. No run started. The body has "code": "model_key".
422 This key cannot use gpt-5-mini (…). Pick another model. The key is accepted, but not for the model of the request or the default one. The body has "code": "model_key".
503 OpenAI could not be reached to check the key. Try again in a moment. The provider did not answer the test call, or answered with something else. Try again. The body has "code": "model_key".
422 The first run on Trawler takes up to 4 people, and this plan has 5. Remove people from the plan, or pay with your own model key. The workspace has no key and its first run on Trawler is still unused, but the plan has more than 4 people.
409 The workspace’s model key was removed or changed while the run was starting. Try again. The key changed under the call, after the test. No run started.
422 This workspace has used its first run on Trawler. Add a model key to start more runs. Two calls raced for the first run on Trawler. The body has "code": "model_key".

A client that wants to treat the workspace’s key as not the pull request’s fault can look for "code": "model_key" with 422 or 503: trawler-ci does, and passes the job. It also waits and tries again on 409 and 429, see When a run cannot start yet.

Which model pays follows the workspace: its key pays when it has one, at the model and cap in the request. A workspace with no key and an unused first run on Trawler starts that run: the model is DeepSeek V4.1 Flash, the cap is $1, or the lower cap the request gives, and model is ignored.

When the workspace’s key pays, the call makes the same test call to the model as Start run, with the request’s model, before the run is queued: see What Start checks. Nothing is queued when it fails. A run that Trawler pays for makes no test call, and the call never asks for the confirmation that you may test the product: that is what the first run from the app is for.

Send an Idempotency-Key header, 1 to 255 letters, digits and ., _, : or -, to make a retry safe. For 24 hours, the same key with the same body on the same project returns the first answer, the 201 with the run, and the header Idempotent-Replayed: true, instead of starting another run. The same key with another body is refused with 409 and This Idempotency-Key was already used for a different request. Use a new key for a new run. A key in another form is refused with 400. trawler-ci does not send one.

GET /api/v1/runs/<id> returns the state of a run of the token’s workspace — for a token limited to a project, of that project — however it was started. A run that is not found, or belongs to another project, answers 404 with Run not found.

{
"id": "5f1d5f54-3a0c-4a3a-8c58-0f4d9e6b2c10",
"number": 17,
"status": "succeeded",
"finished": true,
"reportUrl": "https://app.usetrawler.com/runs/0017",
"people": 3,
"goalsReached": 7,
"goalsTotal": 9,
"unreachedGoals": ["Ana sends a reminder for an unpaid invoice", "Tom sees the reminder on the invoice"],
"defects": { "confirmed": 1, "refuted": 0, "inconclusive": 1 },
"confirmed": [
{
"title": "Invoice total ignores the discount",
"page": "https://shop.example.com/invoices/42",
"severity": "high",
"person": "Ana",
"observed": "The total still shows the full price.",
"steps": ["Open https://shop.example.com/invoices/42", "Apply the code SPRING"]
}
],
"costUsd": 0.41,
"commentMarkdown": "<!-- trawler-ci -->\n\n### Trawler: 1 defect confirmed by replay\n…"
}
Field
status queued, running, succeeded, failed, cancelled or stopped_budget: the run page’s Queued, Live, Complete, Failed, Stopped and Stopped at cap. A run that is stopped_budget ran out of its cap before it finished: it is not a clean result, whatever defects says.
cancelReason Present on a run that ended cancelled: why it was stopped, as a word such as stopped, stopped_from_ci, superseded (a newer push replaced it), ci_gone (nobody asked about it for 3 minutes), unclaimed or nothing_to_test.
skipped true for a run that did not start because nothing in the change can be tested, or can be seen in the app as CI runs it. Its status is cancelled, it has no people and no goals, and skipNote holds the plan’s note on why, when there is one.
leadFallback Present when Trawler could not plan for the pull request and the run played the project’s plan instead: why. Such a run is not a clean result for the change: trawler-ci prints it as a warning and, when no defect is confirmed, exits with 0 saying so.
finished false while the run is queued or running.
people, goalsReached, goalsTotal The people in the run, and the goals they reached out of all.
unreachedGoals The goals that were not reached, as the people were given them. A run with goalsReached under half of goalsTotal is not a clean result: commentMarkdown says so.
defects How many defects the replays confirmed, refuted and left inconclusive, counting each defect once however many people reported it and leaving out those marked not a bug. Defects that were never judged are in none of them.
unverified How many reported defects have no verdict: the judge gave none, or the defect never reached the judge. The app always sends it; a client may treat it as optional. A run with unverified above 0 has reported defects that may still be real.
confirmed The confirmed defects, each with its title, the page it was on or null, its severity (low, medium or high), person — the name of the person who reported it, or the names of all who did, separated by commas — what they observed, and the steps to reproduce it.
costUsd What the run has spent on model calls so far.
commentMarkdown The Markdown of the pull request comment for the run as it is now.

Poll with a pause between calls: a token may make 120 calls a minute. trawler-ci asks every 5 seconds.

A run started with a token is stopped when nobody asks about it: if 3 minutes pass without a GET for it, Trawler stops it, with The CI job that started this run stopped asking about it, so the run was stopped. A client that starts a run and leaves, instead of polling, loses it. Trawler checks once a minute.

POST /api/v1/runs/<id>/stop, with no body, stops a run of the token’s workspace — for a token limited to a project, of that project — as Stop run does on the run page: what is still waiting is cancelled, what the run found so far stays, and the page says Stopped from CI: the job timed out, was cancelled or was interrupted before the run finished. A run that is not found, or belongs to another project, answers 404 with Run not found.

{ "id": "5f1d5f54-3a0c-4a3a-8c58-0f4d9e6b2c10", "status": "cancelled", "stopped": true }

The call is safe to repeat. stopped is true when this call ended the run, and false when the run had already ended, in which case status is the status it ended with and nothing changes. It works for a hosted run and an own-runner run alike. trawler-ci calls it when it stops waiting; see Stopping the run.

Trawler also stops an own-runner run that is still Queued 20 minutes after it was started, because no runner took it: No runner picked this run up within 20 minutes, so it was stopped.

execution says who carries the run out.

"hosted" "own"
Carried out by Trawler’s runners A runner you start, with an API token, in a network that can reach the product
The address tested The project’s own, which Trawler’s runners must be able to reach: a public address The project’s, or url, which can be http://localhost:3000
url Refused Allowed
accounts Refused Allowed
Network The runner’s browser reaches only the product’s origins through Trawler’s proxy, which refuses private addresses The browser reaches whatever the runner’s network reaches, but opens only the allowed origins
Model calls Through Trawler, with the workspace’s key The same
Cap, plan limits, monthly budget The same The same
One run at a time on a project Yes Not with url: such runs go side by side, up to 5 in a workspace. Without url, yes

Trawler’s runners never take a run for "own", and an own runner takes only own runs of the workspace of its token, or of its project when the token is limited to one. A run for "own" stays Queued, with Waiting for a runner. on its page, until a runner you start takes it; if none does within 20 minutes, Trawler stops it. A runner takes the jobs of any such run without url within its token’s scope, or of one run only when it is started with that run’s id in TRAWLER_RUN_ID, as trawler-ci does. A run with url is taken only by a runner started with its id. The runner is trawler-runner work --control-plane <the app's address> from a checkout of the public repository, with the API token in TRAWLER_RUNNER_TOKEN; trawler-ci starts it for you. See An app started in the job.