API
Belay’s API lets a pipeline start batches and runs, read their results, and run your workflows’ files, with an organization’s API key. A key made to update workflows also saves them from their files. No key changes a setting. This page is the API’s contract. To do all of this from a pipeline without writing requests, use the belay command or the GitHub Action: see Run from CI.
The base address is https://app.belayqa.com/api/v1. Every path below is under it.
Send the key in the Authorization header of every request:
GET /api/v1/projects HTTP/1.1Host: app.belayqa.comAuthorization: Bearer belay_…A key is its organization’s. It reads only that organization’s projects, workflows, batches, and runs, and anything else is answered as not found. A request with no key, or with a key that is unknown or revoked, is answered 401. A key that is revoked stops working at once.
Conventions
Section titled “Conventions”- JSON in and out, in UTF-8, with member names in camelCase. A member with no value is left out rather than sent as
null, except inside a step’s evidence, which sendsnullfor a part the step has no value for. - Times are ISO 8601 in UTC, such as
2026-11-14T09:30:00Z, and can carry fractions of a second. Durations are in milliseconds (durationMs). - The contract only gains members: within
v1nothing is renamed, removed, or changed in meaning. Ignore members you don’t know. - A list is an object that holds an array, such as
{ "projects": [ … ] }. projectis a project’s id or its name, ignoring case. A name two projects share is refused, and the message gives their ids.environmentis an environment’s id or its name within the project. A workflow, a batch, and a run are named by their ids.- A project, workflow, batch, and run in an answer has its
urlin Belay, to open it in the app. - An outcome has its name and a
label, the words Belay shows for it. The names are on Outcomes, in the column “In MCP and the API”.
Starting once
Section titled “Starting once”POST /batches and POST /runs take an Idempotency-Key header of up to 200 characters. A second start with the same key in the same organization starts nothing and answers 200 with the batch or run the first one started, even when the two arrive at once. Use one key per pipeline attempt, such as the run’s id and attempt number, so a retried request never starts twice.
Errors
Section titled “Errors”An error is answered as application/problem+json:
{ "status": 429, "code": "limit_reached", "title": "A run limit was reached", "detail": "This batch needs 14 runs; 9 are left of the limit of 60 runs per hour. It fits at 14:32 (2026-11-14T14:32:05Z). Nothing was started.", "retryAt": "2026-11-14T14:32:05Z"}code |
Status | When |
|---|---|---|
unauthorized |
401 | No key, or one that is unknown or revoked. |
forbidden |
403 | The key may not do this. |
not_found |
404 | No such project, environment, tag, folder, workflow, batch, run, or screenshot in the organization. |
invalid |
400 | The request needs a change. detail says what to change. |
limit_reached |
429 | A limit of your plan refused the start, and nothing started, or refused a save of files that adds more workflows than the plan allows, and nothing was saved. detail says which limit; retryAt and the Retry-After header say when runs can start again, when that is known. |
too_many_requests |
429 | The key made more than 300 requests in a minute. Retry-After says how many seconds to wait. |
error |
500 | A problem on Belay’s side. There is no detail; try again. |
detail is the message Belay gives, in the words the app and an agent read.
Endpoints
Section titled “Endpoints”| Method and path | What it does |
|---|---|
GET /projects |
The organization’s projects. |
GET /environments |
A project’s environments. |
GET /workflows |
A project’s workflows. |
GET /workflows/{workflowId} |
One workflow, with its steps and how Belay read them. |
GET /tags |
A project’s folders and tags. |
GET /workflow-files |
A project’s workflows as files. |
POST /workflow-files/check |
What a save of files would do, and which steps need a change, saving nothing. |
POST /workflow-files |
Save workflows from their files. Needs a key that can update workflows. |
POST /batches |
Start a batch. |
GET /batches |
A project’s recent batches. |
GET /batches/{batchId} |
One batch, with every workflow in it. |
POST /batches/{batchId}/cancel |
Cancel a batch. |
POST /batches/{batchId}/rerun-interrupted |
Run a batch’s interrupted runs again. |
POST /runs |
Start a run of one workflow. |
GET /runs |
Recent runs. |
GET /runs/{runId} |
One run, with every step. |
POST /runs/{runId}/cancel |
Cancel a run. |
GET /runs/{runId}/steps/{stepId} |
One step’s evidence. |
GET /runs/{runId}/steps/{stepId}/image |
One of a step’s screenshots. |
Projects, environments, workflows, and tags
Section titled “Projects, environments, workflows, and tags”GET /projects answers { "projects": [ { "projectId", "name", "url" } ] }.
GET /environments?project=Switchback answers { "environments": [ { "environmentId", "name", "baseUrl" } ] }.
GET /workflows?project=Switchback answers { "workflows": [ … ] }. Add tag= or folder= to keep the workflows with that tag or in that folder; folder= with no name keeps those in no folder. Each workflow has:
| Member | |
|---|---|
workflowId, name, url |
The workflow. |
fileId |
The id its file carries, unique in the project. |
inRepository |
true when a pipeline has saved the workflow from its file; left out otherwise. |
folder, tags |
Its folder and tags, when it has them. |
steps |
How many steps it has. |
stepsNeedingChange, canRun |
How many of its steps need a change, and whether it can run. |
lastRun |
Its last run: runId, status, outcome and label once it finished, and at. |
updatedAt, updatedBy |
When it was last saved, and by whom. |
GET /workflows/{workflowId} answers the workflow with its fileId and inRepository, as in the list, its definition (its steps and their ids), the project’s routes, the project’s and the workflow’s own variables (a secret’s value is never shown), the values its steps remember (captured), and readings, once its steps have been read: for each step, its status, how Belay read it (reading), and, when it needs a change, the kind of change (needs) and a suggestion. A step that runs a routine has routine: its routineId, name, and steps, each of the routine’s steps with its stepId, status, and reading or what it needs. A step that might mean a routine has question, which asks which one. The workflow list and this read hold workflows only; a routine is neither.
GET /tags?project=Switchback answers { "folders": [ { "name", "workflows" } ], "tags": [ { "name", "workflows" } ] }, with how many workflows each holds.
Workflow files
Section titled “Workflow files”GET /workflow-files?project=Switchback answers { "files": [ … ] }: each workflow of the project as a file, ordered by its file id. Add tag= or folder= to keep the workflows with that tag or in that folder (folder= with no name keeps those in no folder), or workflow= with a workflow’s id for that one. A deleted workflow has no file. Each file has:
| Member | |
|---|---|
path |
Where to put it: <folder>/<fileId>.yaml, the folder’s name in lowercase with one - for each run of spaces and other marks (“Gift Cards” is gift-cards), or <fileId>.yaml for a workflow in no folder. It is only a suggestion: the id inside the file is what finds its workflow. |
fileId, workflowId, workflow |
The file’s id, and the workflow’s id and name. |
inRepository |
true when a pipeline has saved the workflow from its file; left out otherwise. |
kind |
routine for a routine’s file; left out for a workflow’s. |
content |
The file’s text, in UTF-8. Write it as it is. |
With no tag=, folder=, or workflow=, the project’s routines are files too, each at routines/<fileId>.yaml, with the routine’s id as workflowId and its name as workflow. A workflow= naming a workflow the project does not have, or one that is deleted, is answered not_found.
Files in a request
Section titled “Files in a request”A save, a check, and a start of a batch of files each send the files the same way, in files:
{ "path": "belay/checkout/guest-checkout.yaml", "content": "id: guest-checkout\nname: Guest checkout\nsteps:\n - …" }Each file is its path, which Belay uses only in what it says about the file, and its content, the file’s text. A file finds its workflow by the id inside it, never by its path. A routine’s file, with kind: routine, is sent the same way, among the workflows’ files. A request takes up to 500 files, 4 MB of them, a file up to 64 KB, and no two files with one id. A body larger than 8 MB is answered invalid.
Belay reads every file before anything else. When a file cannot be read, as when a step needs quotes, nothing is saved or started, and the answer is 400 with invalid, the title “A file could not be read”, and every problem in files, each with its path, its line when it has one, and what to change (problem):
{ "status": 400, "code": "invalid", "title": "A file could not be read", "detail": "belay/checkout/guest-checkout.yaml, line 14: put this step in single quotes. …", "files": [ { "path": "belay/checkout/guest-checkout.yaml", "line": 14, "problem": "Put this step in single quotes. …" } ]}A file with more steps than your plan allows one workflow is answered the same way, before any step is read, with every such file in files and no line.
Save workflows from their files
Section titled “Save workflows from their files”POST /workflow-files saves the files to the project’s workflows, so the saved workflows, and the schedules that run them, follow what you release. It needs a key made to Run workflows and update them from files (see API keys); any other key is answered forbidden, before anything is read:
This key can’t update workflows. Make one that can on Organization, API keys.
POST /workflow-files/check takes the same request and answers the same way, saving nothing and starting nothing. Any key can check.
{ "project": "Switchback", "files": [ { "path": "belay/checkout/guest-checkout.yaml", "content": "id: guest-checkout\nname: Guest checkout\n…" } ]}project is the project’s id or name, and files the files. Each file’s workflow is:
| The file | Its workflow |
|---|---|
| Has no workflow in the project | Made, in the project. |
| Differs from its workflow | Saved over. |
| Belongs to a workflow that was deleted, or that is only in files from a batch of files | Brought into the project, with its runs and under the same workflowId, and saved. |
| Is the same as its workflow | Left as it is, apart from its name, folder, and tags. |
Each workflow takes its name, folder, and tags from its file: a folder or tag the project lacks is made, a file with no folder puts it in no folder, and a file with no tags takes its tags away. Belay reads the steps of every file that differs, as a save in the app reads them. A step that needs a change is saved, and the workflow can’t run until it is changed. Nothing is saved when a file cannot be read, a step can’t be read at all, or the files add more workflows than your plan allows (limit_reached; a workflow brought into the project counts as one more). A workflow whose file you leave out is not changed or deleted.
A routine’s file is saved in the same write, as its routine is: made, saved over, or left as it is when its name, description, and steps are the same. A workflow’s file may run a routine that the same request makes. Saving a routine reads again every workflow that runs it, whether or not its file was sent. Nothing is saved, and the answer is invalid with each file in files, when a workflow’s file has a routine’s file id or a routine’s file a workflow’s, a routine’s step says another routine’s name, or two routines would have one name. Routines take no place among your plan’s workflows.
Sending the same files again changes nothing. A workflow a key saved shows the key’s name with “(API)” as who saved it, here, in the app, and to an agent.
It answers:
{ "created": 1, "updated": 1, "restored": 0, "unchanged": 14, "files": [ { "path": "belay/checkout/guest-checkout.yaml", "fileId": "guest-checkout", "workflowId": "wf-…", "workflow": "Guest checkout", "change": "updated", "canRun": true, "replacedEdit": { "by": "Robin Lee", "at": "2026-11-12T16:02:11Z" }, "url": "https://app.belayqa.com/projects/…/workflows/wf-…" }, { "path": "belay/account/sign-up.yaml", "fileId": "sign-up", "workflowId": "wf-…", "workflow": "Sign up", "change": "created", "canRun": false, "steps": [ { "stepId": "s4f09a1", "line": 9, "step": "Fill in the form.", "status": "needs a change", "needs": "Needs more detail", "reason": "…" } ], "url": "https://app.belayqa.com/projects/…/workflows/wf-…" } ]}| Member | |
|---|---|
created, updated, restored, unchanged |
How many files made a workflow, saved over one, brought one back, or left one as it was. |
path, fileId |
The file, as you sent it. |
workflowId, workflow, url |
The workflow’s id, its name, and where it is in Belay. A check leaves out workflowId and url for a file that has no workflow yet. |
change |
created, updated, restored, or unchanged. |
canRun |
Whether the workflow can run as saved: false while a step needs a change. For a routine’s file, whether every step of the routine is understood. |
kind |
routine for a routine’s file; left out for a workflow’s. |
usedBy, noLongerRun |
For a routine’s file that made or changed its routine: how many workflows run it, and how many of them could run before and can’t now. A check says what a save would do. Left out otherwise. |
replacedEdit |
When the save replaces steps someone saved in the app since a pipeline last sent this file, or ever, when none has: who (by) and when (at). A check says the same of what a save would replace. Belay keeps no copy of the replaced steps. Left out otherwise. |
steps |
Only the steps that need a change, each with its stepId, its line in the file, the sentence (step), and what GET /workflows/{workflowId}’s readings give for it: status, needs, reason, a suggestion or a replacement when there is one, question when it might mean a routine, and routine when it runs one whose step needs a change. Left out when no step needs a change. |
Start a batch
Section titled “Start a batch”POST /batches:
{ "project": "Switchback", "environment": "staging", "tag": "smoke", "commit": "1a2b3c4d5e6f", "branch": "main", "link": "https://github.com/acme/shop/actions/runs/123"}| Member | |
|---|---|
project, environment |
Required. |
tag, folder, "all": true, or files |
Exactly one: what to run. A tag or folder is named ignoring case. files runs the workflows’ files you send (below). |
commit, branch, link |
Optional: what the pipeline is building, up to 64, 200, and 500 characters. link is an http or https address. They are shown on the batch’s page and in its read, and change nothing about the batch. |
It answers 201:
{ "batchId": "batch-0b6e2c1a-…", "started": 39, "notStarted": [ { "workflowId": "wf-…", "workflow": "Gift card balance", "reason": "…" } ], "url": "https://app.belayqa.com/projects/…/batches/batch-0b6e2c1a-…"}A batch follows every rule of Batches: the workflows are the ones selected at that moment, a workflow that can’t run is listed in notStarted with why, and a batch starts whole or not at all. If the plan’s run limit has no room for every run, nothing starts and the answer is 429 with limit_reached.
Start a batch of files
Section titled “Start a batch of files”POST /batches with files in place of tag, folder, or all runs the workflows’ files you send, and saves nothing. A pull request that changes your application and its tests is tested with its own tests.
{ "project": "Switchback", "environment": "staging", "files": [ { "path": "belay/checkout/guest-checkout.yaml", "content": "id: guest-checkout\nname: Guest checkout\nsteps:\n - …" } ], "branch": "coupon-field"}files are the files; a file that cannot be read, or has more steps than your plan allows, starts nothing. Each file is one workflow of the batch:
| The file | Its run |
|---|---|
| Is the same as its saved workflow | A run of the saved workflow, as any batch runs it. |
| Differs from its saved workflow | A run of the file’s steps. The saved workflow does not change. |
| Has an id no workflow of the project has | A run of the file’s steps, under a workflow that is only in files: it is in no list, count, or batch of the project, and its runs say so. |
| Belongs to a workflow that was deleted | A run of the file’s steps, under that workflow, which stays deleted. |
| Has a step that needs a change, a variable with no value on the environment, or another reason it can’t run | Listed in notStarted with why. |
The same means the same description, the same variables with the same values in the same order, and the same steps in the same order; the name, folder, and tags change no run.
A routine’s file is never a workflow of the batch: it is read with the workflows’ files, in place of the saved routine. A workflow whose file is the same as its saved workflow runs as saved only when no routine it runs was sent with a difference; otherwise its file’s steps run, with the routines as sent. A routine that was not sent is used as saved, and a step that says the name of a routine neither sent nor saved is read as an ordinary step. A request whose files are all routines’ is answered invalid.
A workflow only in files has the file’s name and steps, and is in no list, count, batch, or schedule of the project until a save brings it in. In a batch’s read, one that did not start has no url. A file with a step that needs a change is listed by the step’s place and its line in the file, not its sentence: POST /workflow-files/check says what the step needs.
Only the API runs files: the app, an agent, and a schedule run what is saved.
A batch of files is compared (“since the last batch”) with the last batch of files on the same project, environment, and branch; one with no branch is compared with those with none. Its interrupted runs run again from the same steps.
Read a batch
Section titled “Read a batch”GET /batches/{batchId}:
{ "batchId": "batch-0b6e2c1a-…", "result": "failed", "label": "Failed", "ran": "Tag smoke", "project": "Switchback", "projectId": "…", "environment": "staging", "environmentId": "…", "source": "api", "startedBy": "GitHub Actions", "commit": "1a2b3c4d5e6f", "branch": "main", "link": "https://github.com/acme/shop/actions/runs/123", "createdAt": "2026-11-14T09:30:00Z", "finishedAt": "2026-11-14T09:33:04Z", "durationMs": 184000, "passRate": 0.9487, "counts": { "workflows": 40, "passed": 37, "notPassed": 2, "notStarted": 1, "cancelled": 0, "interrupted": 0, "unfinished": 0 }, "sinceLastBatch": { "stoppedPassing": 2, "stillNotPassing": 0, "passingAgain": 0, "stillPassing": 37, "newNotPassing": 0, "newPassing": 0 }, "workflows": [ { "workflowId": "wf-…", "workflow": "Checkout with a saved card", "runId": "run-…", "status": "finished", "outcome": "failed", "label": "Failed", "stepId": "s4", "step": "Check that the Cart panel shows \"Order placed\".", "why": "Not in the Cart panel. It appears once elsewhere, in the header.", "change": "stopped_passing", "durationMs": 21000, "url": "https://app.belayqa.com/projects/…/runs/run-…" }, { "workflowId": "wf-…", "workflow": "Gift card balance", "label": "Can't run", "notStarted": "…", "url": "https://app.belayqa.com/projects/…/workflows/wf-…" } ], "url": "https://app.belayqa.com/projects/…/batches/batch-0b6e2c1a-…"}resultisrunninguntil every run has finished, thenpassed,failed, orincomplete, as Batches says.labelis the same in the words the batch’s page shows: Running, Passed, Failed, or Incomplete.countsalways has all seven numbers, andunfinishedis how many runs have not finished yet.countsandsinceLastBatchare the same as in a webhook’sbatch.passRateis the share of finished runs that passed, left out while none has a result. Interrupted and cancelled runs are in no pass rate.sourceis who started it:ui,mcp,schedule, orapi.startedByis the person’s name, the schedule’s name, or the key’s name.sinceLastBatchis left out on the first batch of its selection on its environment (for a batch of files, from its branch).ransays what the batch ran:Tag smoke,Folder Checkout,All workflows, or, for a batch of files,Files from coupon-field(itsbranch), orFileswith no branch. A workflow whose run ran a file’s own steps hasdraft: true, as its run does, and one that is only in files has nourlwhen it did not start.- A workflow has
status(queued,running, orfinished) once it has a run,outcomeandlabelonce the run finished, andstepId,step, andwhywhen a step did not pass. When that step was one of a routine’s, it also has itsplace(2.3, the third step of the routine step 2 runs), theroutine’s name, andstepWords, the words the app uses for it: “step 2.3, in Log in as admin”.changeisstopped_passing,still_not_passing,passing_again, ornew, and is left out when nothing changed or there is nothing to compare. A workflow that did not start hasnotStarted, which says why, and no run.
Read the batch every few seconds until result is no longer running. Each read is cheap, and no request stays open while the batch runs.
GET /batches?project=Switchback answers { "batches": [ … ] }, newest first, each as above without workflows. Add environment=, tag=, folder=, or result= (running, passed, failed, incomplete) to narrow it, and limit= (1 to 100, 20 when left out).
Cancel a batch, and rerun its interrupted runs
Section titled “Cancel a batch, and rerun its interrupted runs”POST /batches/{batchId}/cancel takes no body and answers { "batchId", "cancelledQueued", "cancelRequested" }: how many runs were cancelled before they started, and how many running runs were asked to stop.
POST /batches/{batchId}/rerun-interrupted takes no body and starts each interrupted run of the batch again, in the batch. It answers 200 with { "batchId", "started", "runs": [ { "workflowId", "runId" } ] }. An interrupted run says nothing about your application, so running it again is right. It is refused with invalid when no run of the batch was interrupted or a newer batch of the same selection has run on the environment, and with limit_reached when the new runs don’t fit your plan’s run limit.
Start a run
Section titled “Start a run”POST /runs:
{ "workflow": "wf-…", "environment": "staging", "stopAfterStep": "s3" }workflow is the workflow’s id, and environment an environment’s id or its name in the workflow’s project. stopAfterStep is optional: the run stops after that step, and the steps after it are Not run. It answers 201 with { "runId", "status": "queued", "url" }. A repeat with the same Idempotency-Key answers 200 with the same run, still saying queued; read the run for where it is.
Read a run
Section titled “Read a run”GET /runs/{runId}:
{ "runId": "run-…", "workflowId": "wf-…", "workflow": "Checkout with a saved card", "projectId": "…", "environment": "staging", "environmentId": "…", "status": "finished", "outcome": "failed", "label": "Failed", "batchId": "batch-…", "source": "api", "startedBy": "GitHub Actions", "createdAt": "2026-11-14T09:30:00Z", "startedAt": "2026-11-14T09:30:02Z", "finishedAt": "2026-11-14T09:30:23Z", "durationMs": 21000, "firstNonPassingStep": { "stepId": "s4", "step": "Check that the Cart panel shows \"Order placed\".", "outcome": "failed", "label": "Failed", "why": "…" }, "steps": [ { "stepId": "s1", "step": "Go to the shop page.", "outcome": "passed", "label": "Passed", "durationMs": 900 } ], "url": "https://app.belayqa.com/projects/…/runs/run-…"}statusisqueued,running, orfinished;outcomeandlabelcome once it finished.- An interrupted run’s
outcomeisinterrupted, and itswhysays Belay could not finish it. - A step that was Not found may have
suggestionsunderfirstNonPassingStep: each awordingthat found one element on the same page, and the step rewritten with it (instruction). - A step has
warningwhen it passed with something worth a look, andcaptured(variable,value) when it remembered a value. stopAfterStep,draft, andcancelRequestedappear when they apply.draft: truemeans the run ran steps that are not the saved workflow’s: the editor’s unsaved steps, which the app calls Unsaved steps, or a file’s own steps. It is not a draft workflow, which never runs.- A run that ran a routine lists the routine’s steps after the step that runs it, as its page does, and every step has its
place:2for the workflow’s own second step,2.3for the third step of the routine it runs. The step that runs it hascall: theroutineId, theroutine’s name, and how manystepsit ran. Each of the routine’s steps hasroutine, its name, and astepIdof its own. When the step that did not pass was a routine’s,firstNonPassingStephas itsplace,routine, andstepWords(“step 2.3, in Log in as admin”). A run with no routine has none of these.
GET /runs answers { "runs": [ … ] }, newest first: the organization’s runs, or narrowed with project=, workflow=, or batch=, and limit= (1 to 100, 20 when left out). Each has runId, workflowId, workflow, environment, status, outcome and label once finished, stepId and why for the step that did not pass (with place, routine, and stepWords when it was a routine’s), durationMs, source, startedBy, batchId, createdAt, and url.
POST /runs/{runId}/cancel takes no body and answers { "runId", "status" }, with cancelled: true when the run had not started and is now cancelled, and cancelRequested: true when the run was running and has been asked to stop. With neither, the run had already finished and nothing changed.
A step’s evidence
Section titled “A step’s evidence”GET /runs/{runId}/steps/{stepId} answers what the step’s evidence shows on the run’s page: how Belay read the step, what it chose and how sure it was, why it ended as it did, how long it took (durationMs), and the names of its screenshots. See Reading a run. In a run that ran a routine, {stepId} may also be a step’s place, such as 2.3, and the evidence has the step’s place and, for a routine’s step or the step that runs it, the routine’s name.
GET /runs/{runId}/steps/{stepId}/image?which=explains answers one of the step’s screenshots as an image. which is explains (the one that best explains the step, and the default), focus (what the step acted on or checked), or after (the page after the step). A step with no such screenshot answers 404.
Both answer invalid for a step the run doesn’t have, a run that has not started, and a run whose evidence is no longer kept; the run’s outcome and steps are kept.
Limits
Section titled “Limits”- A key may make up to 300 requests a minute.
- Every run the API starts counts against your plan as any run does, a run of a file’s own steps included, and a limit refuses a start as it would in the app. See Plan and usage.
- The API saves workflows only from their files, with a key made to update them. It does not delete workflows, does not save routes, variables, environments, or projects, and does not open a live page.