MainworthyDocs Open Mainworthy

API and agent tools

This reference lists each Mainworthy operation, its address, the permission you need, and the input it accepts. The web UI, command line, and agent tools call the same operations. The HTTP API and command line list every operation. Mainworthy exposes ten of them through the Model Context Protocol (MCP) for agents.

A capability is a permission to use a group of operations. A grant lists the capabilities an actor holds on one project or across all projects. An actor can be a person, an agent, a pipeline, or the policy when it answers automatically. The policy sets who answers each kind of question and which answers count.

CapabilityWhat it lets you do
readSee cases, results, questions, and the gate.
recordReport results and attachments, and mark changes as ended. These are the writes a pipeline makes. A pipeline with record can also announce deployments.
produceWrite and edit cases, report results, review, and send answers. This includes record.
answerGive an answer that counts when the policy asks a project member.
planStart planned runs.
adminOn a project, accept its policy changes. A person who holds it on every project can also invite people, issue tokens, and change grants.

A project admin holds admin on one project. An instance admin holds it across all projects. If you hold admin across one organisation's projects, you are an admin for that organisation. See people, agents and pipelines for how permissions work.

Call an operation #

Each operation takes one POST with a JSON body. Project operations use /api/p/<project>/<operation>. Operations that name no project use /api/<operation>. These are admin, org, session, credential, invitation, account, billing, and subscribe. If you call one at a project's address, the server returns not_found with the correct address.

Paddle sends signed notifications to /api/billing-event. Only the internal job service can call job.

$ curl -s -X POST http://127.0.0.1:7357/api/p/scratch/find \
    -H 'content-type: application/json' \
    -d '{"in":"cases","limit":2}'
{"ok":true,"result":{"count":0,"items":[],"cursor":null},"seq":1}

Text inputs cannot contain NUL (U+0000), including in nested text and object keys. If the server finds a NUL, it returns invalid and names the field. If the test runner writes a NUL, the report shows it as ␀ (U+2400). See Report results.

The OpenAPI document at /api/openapi.json describes each operation's input and successful reply, including the fields inside result. The registry supplies both schemas. seq is required and is null for an operation that names no project. A field declared nullable may hold null. An optional field may be absent. The schema lists alternative replies for operations whose reply shape depends on the action or ref.

A matching API version preserves existing operation contracts. An older compatible build may lack an operation in a newer build. If the server lacks an operation, it returns an error. To use that operation, upgrade the server.

The current API version is 4. The CLI checks /health before sending an operation and sends x-mainworthy-api-version: 4. If the server advertises a different version, the CLI stops before sending the operation. Clients pinned to API 1, 2 or 3 must upgrade with the server. API 4 changed one reply value: a report receipt says "how": "decided automatically" where API 3 said "decided by rule".

The web client sends the same header on its API fetch requests. If a request specifies the wrong version, the server returns 409 conflict before the operation runs. The server identifies browser requests by the Origin or Sec-Fetch-Site header, even in local mode. Browser requests other than GET, HEAD, and /api/logout must send the version. If an old page omits the header, the server refuses the operation without writing anything. The error asks you to reload before trying again.

The server accepts unversioned requests without those browser headers. This includes bearer scripts and MCP clients. A cookie alone does not identify a browser. Read-only browser streams use GET and need no header.

Signing out at /api/logout works even when the API version is missing or mismatched. The server still checks that the request comes from the same origin. It ends the session named in the cookie and expires the cookie.

A successful operation returns ok: true, result, and seq, the project's sequence number at that point. The since operation with {"cursor":"s:12"} returns changes after sequence 12. A reply with more: true has more changes available through another call with the returned cursor.

When an operation does not run, its reply has ok: false and an error with a code and a message:

{"ok":false,"error":{"code":"not_found","message":"no operation named nope"}}
CodeHTTP statusMeaning
invalid400The input is wrong. details says which field.
unauthenticated401The caller supplied no working credentials. Refused tokens, provider answers, and invitation codes get the same reply, regardless of the reason.
forbidden403The caller lacks the required capability, or the operation or policy refuses the action.
not_found404No such operation, project, or ref. The server returns the same code for a project the caller has no grant on.
conflict409The edit uses an older version, the command id belongs to another request, or the client's API version differs from the server's.
limited429The request reached a limit on authentication attempts or anonymous sign-in starts. Failed attempts include wrong tokens from this address, wrong tokens with the same prefix, and refused provider answers or invitation codes from this address. Anonymous starts have separate, non-escalating limits of 300 successful starts per public IPv4 address or IPv6 /56 per minute. The Retry-After header says how many seconds to wait.
busy503A writer could not acquire a lock or connection within its bound, a sign-in resolved to another actor while waiting, or PostgreSQL detected a deadlock or serialization conflict. Retry unchanged content with the same command id. A report that committed acceptance returns success with a pending receipt if application hits one of these failures.
internal500The server failed. The message is internal error, and the detail is in the server's log. A report can commit in stages, so a failure does not prove that nothing was written.

Sign-in locks its existing actor and does not queue behind identity changes for unrelated actors. Ending a session whose id was absent when the request discovered its owner returns not_found, even if a sign-in creates that id during the request.

A busy reply rolls back the transaction and its unaccepted command id. A same-id retry starts the request again. Once a report commits acceptance, a lock timeout, deadlock, or other busy during application returns HTTP 200 with ok: true. The receipt names its durable batch, has empty results, zero applied counts, zero counts for basis (which case version a result applies to), and says pending: report accepted; waiting for application in gate.reason. Its seq is the acceptance sequence. The batch and any command remain pending until startup recovery or a retry with the same id applies the batch. After application, the server completes the command and saves the applied receipt as the final reply. Read gate for the current verdict. If a report succeeds without a command id, do not resubmit it. Mainworthy treats another manual or case report as a new result.

If the client loses a reply, it can query command or retry with the same id to learn whether the operation committed. Changing the content requires a new id. The CLI and MCP generate a command id for each report that lacks one, before forwarding it. Their transport retries keep that id. A new CLI invocation or MCP tool call generates a new id. Use an explicit cmd when a retry must span invocations.

The CLI reports busy and exits with code 4. It does not retry the write automatically. The web client keeps the request and its command id so a retry checks or resends that same request. Before it applies an accepted report, the server checks the original token or browser session and the caller's current permissions. If the token or session ended or the caller lost permission, the server cancels application, clears pending marks, and records the refusal on the command. The server also cancels accepted reports from an archive because archives hold neither proof of admission nor credential hashes.

Authenticate #

Token authentication uses Authorization: Bearer <token>. A server in local mode trusts requests from the same machine and needs no token. People, agents and pipelines explains how to make a token and what the token may do.

Sign in as a person #

These routes handle sign-in outside the operation registry. A person signs in through the instance's identity provider, or with a token. A successful sign-in sets a session cookie. Each POST refuses requests from another site's page and allows scripts such as curl that send no site headers. GET /api/login/methods answers anybody. The POST requests take JSON, except that logout needs no body. Replies use the operation envelope without seq. People, agents and pipelines describes the sign-in steps.

RequestBodyWhat it does
GET /api/login/methodsnoneReturns {"token": true, "oidc": {"name"} or null}. oidc names the identity provider, or is null when the instance has none.
POST /api/login{"token"}Signs in with a token. The session has recent proof for ten minutes.
POST /api/login/invitation{"invitation"}Returns {"invitation": {"name", "purpose", "expiresAt"}}: the invitation's recipient, purpose (join or recover), and expiry. Looking up the invitation leaves it usable. If the code cannot accept an invitation, the server returns not_found.
POST /api/login/oidc{}, {"invitation", "replace"?}, {"link": true} or {"proof": true}Begins signing in through the identity provider, accepting an invitation that way, linking the provider to the person whose browser session sends it, or proving it is that person. Returns {"url"}, the provider's address to send the browser to, and sets an HttpOnly ceremony cookie, mainworthy_ceremony over HTTP or __Host-mainworthy_ceremony over HTTPS. A script must keep that cookie. The provider sends the browser back to /signin/oidc with a code and a state. {"proof": true} asks the provider to sign the person in again (max_age=0). A refused invitation is not_found. If the browser is signed in as another person, accepting an invitation is conflict with their name in details.signedInAs. If you send that name as replace, the server signs them out of this browser when it accepts the invitation. {"link": true} and {"proof": true} with a token are forbidden. On an instance with no provider, every body is invalid.
POST /api/login{"oidc": "<query>"}Finishes what /api/login/oidc began, with the query the provider sent the browser back with, and the ceremony cookie. The ceremony works once, in the browser that began it, for five minutes. A sign-in or an accepted invitation returns {"signedIn": true} and sets the session cookie. A link returns {"linked": true}, and a proof {"proven": true}. If anyone has already linked the identity, linking it returns conflict. The server returns forbidden if proof comes from a different identity or lacks a valid auth_time at or after the ceremony began. Proof lasts ten minutes from its auth_time. Sign-in with an unlinked identity returns unauthenticated.
POST /api/logoutnoneEnds the browser's session and clears its cookie.

If an OIDC callback state contains NUL after URL decoding, or an identity subject contains NUL, the server treats it as a failed sign-in and counts it toward the address limit. The server ignores malformed optional display claims from the provider, including claims with NUL or malformed Unicode. Required identity text must contain whole Unicode characters. An identity subject can have at most 255 characters. The combined identity must fit the database key. The server gives the same generic refusal for oversized or malformed identities.

Recent proof #

Recent proof confirms the identity of the person who is signed in to the current browser session. If the caller's session has no proof from the last ten minutes, linking or removing an identity returns HTTP 403 with recent_proof_required. The session stays signed in, and the server writes no command. After confirming your identity, retry the action.

Signing in with a token gives that session proof for ten minutes. If you signed in through the provider, you can get proof with POST /api/login/oidc and {"proof": true}. A bearer token carries no session proof. Linking even your first identity requires proof. Accepting an invitation or recovery link requires none.

If you change another person's details as an organisation admin, you prove your own identity. The browser also requires recent proof to issue a token through credential or admin, issue an invitation, set a direct or team grant that includes admin, or add a member to a team that holds admin. Recent proof applies to browser sessions. Authorized bearer-token and local callers can use the operations their credentials allow.

Browser uploads to POST /api/import also require recent proof. The server checks proof before reading the upload and again under the write gate before import. Authorized bearer-token and local imports remain available without proof.

Each sign-in request body must match one of the shapes above and contain only the fields in that shape.

GET /api/session returns who is signed in, their numeric actor id (actorId), the current session id (session), and whether they own their organisation (owner). For a person, credentials gives the number of identities the account has linked (identities). The account field says whether the session started through the identity provider and can list and switch organisations. If you sign in through the provider and belong to several organisations, choose one with POST /api/login/switch and { "org": <id> }. Until you choose, actor, actorId, and kind are null, and projects is empty. The server returns forbidden for every operation except account. An archive import can replace actor ids.

Only the organisation's owner can create a recovery invitation. Whoever accepts it takes over the named person's identity in that organisation. Mainworthy revokes the named person's tokens and ends their sessions there. Their original account keeps its identities and other organisations. If you are a person who holds admin across the organisation's projects, you can list recoveries with invitation and { "do": "recoveries" }. Recovery does not change other actors' tokens. See a lost identity and accept an invitation for the limit when concurrent responses replace the browser's cookie.

The account operation lists and removes the identities of the caller's account, lists its organisations, and lists and ends its sessions in every organisation. Only a browser session started through the identity provider can call it. The server refuses bearer tokens and token-backed browser sessions. To link an identity, use /api/login/oidc. The credential operation manages personal CLI tokens with token.create, token.list, and token.revoke. Token creation requires a session opened through the identity provider, with recent proof, or local-owner access. The new token belongs to the caller, and the reply returns the secret once. The default expiry is 30 days, with a 365-day maximum. A bearer token or a token-backed browser session cannot create a personal CLI token. Make your own command-line token gives the inputs, replies, and CLI setup.

Send a write twice safely #

For a write whose input accepts cmd, that field identifies the request. Repeating the same completed request with the same id returns its saved reply and writes nothing. Reusing the id with different content returns conflict. The command operation returns the request's status if the reply was lost. If a report began but did not finish, a retry with the same id and input resumes it.

Secret replies are an exception. Token and invitation creation keep the command's record but do not save its secret reply. Retrying the same id returns conflict without repeating the write.

Say when a write happened #

The server records every write with its own clock, except in a demo project. mainworthy seed uses demo projects to write records dated before today.

admin with {"do": "project.demo", "key": "<project>"} makes a project a demo. The operation works only on a project with no writes since its creation. The demo status cannot be undone. The reply holds key and since, the moment the project became a demo. Both fields are required by the API reply schema. Repeating the call returns the same moment. Both project.list and the session reply mark each project with demo: true or false. A client can use that flag to identify projects whose writes accept caller-supplied times.

A write to a demo project may carry X-Mainworthy-At with a time in milliseconds since 1970. The server records the write at that time. The server refuses a future time or a value that is not a whole number. The header is invalid on reads, operations that name no project, or projects that are not demos. The time is part of the request identified by cmd. The same request at another time is a different request.

The server does not check the order of a demo's write times. To preserve that order, send the oldest writes first. A flaky answer holds for a number of days from the time the answer was given. An answer dated in the past may already have expired, causing its question to reopen within a minute.

An archive does not say which project is a demo. After an import, the server timestamps every project's writes with its own clock.

The machine-readable description #

GET /api/openapi.json returns an OpenAPI 3.1 document of every operation. The server builds it from the same list as this page on each call. It needs no token.

Follow changes #

GET /api/p/<project>/events is a stream of server-sent events about committed writes to the project. The stream requires read. If delivery to one subscriber fails, the write still succeeds and other subscribers still receive the event. The server logs the failure without the subscriber's error text. The server stores committed events in PostgreSQL. A write on any instance wakes streams on the others. Each stream reads the event history. If a stream misses a wakeup, it catches up on its next heartbeat. A gap in retained history or an archive import asks the client for a full refresh.

If the server cannot check an open stream's read permission, it closes that stream so the client can reconnect and read again. Other streams keep receiving changes. The web app reconnects and reloads its project reads.

The stream's first event is opened. It carries the project's identity and the stream's starting seq. The imported field says whether the project's last change was an archive import. Every write after seq comes as an event. Project operation replies include the seq at which the server read the data. If all the client's data for that identity is at or after the stream's starting seq, it has missed no event unless imported is true. Because an import can lower the sequence or leave it unchanged, the client reads its data again after an import.

The stream does not replay missed events on reconnect. A client that misses an event can read the data again or request changes through since with its last cursor. When its first stream opens, the web app reads again only if something it read is older than the stream's start, names no seq, or was read more than an hour ago, or if imported is true. It reads again each time a later stream opens, when a stream does not send opened within ten seconds, and it refreshes stale reads when the window regains focus.

Placement results #

For callers with read, the propose reply includes placements, an array of place and state edits that undo the changes the server made to case placement. Without read, this array is empty. Immediate decide replies apply the same rule to effects.placements, including command replay. The edits are already in undo order. To undo those placements, submit {"edits": reply.placements} to propose. If the server made no placement changes, it returns placements: []. Do not submit that empty array. Cases that were already in the requested state or already had the requested tags do not appear in these edits. The cases field records the versions of the case bodies, regardless of placement changes. An edit that undoes a move includes the previous folder id and rank, the key that orders the case. To undo the move, send that same key for the single case. Use either rank or after. If another case has occupied that key, the returned case follows it with a unique key. An open or rejected proposal returns no edits to undo placements. The server retains full effects internally. Clients treat placements missing from a recorded pre-upgrade proposal reply as an empty array.

Operations #

Ordinary JSON case reads include custom field values in fields. Explicit get field selections such as fields: ["title", "fields"] select those values without the remaining case content. To see which cases use a fragment and which versions they pin, select fields: ["users"]. A find --in cases reply includes the project's fieldDefinitions, even when its list is empty. With rows: ["C-1", "C-2"], find reads at most 200 requested case refs from the current project, including archived cases and fragments. It returns each found row once in request order, names absent refs in missing, and returns a null cursor. Its count is the number of found rows. This mode accepts no listing filters, pagination options, or run selection. Ordinary case listing and run selection keep their paging behavior. Suite window reads use window: {kind: "open"}, {kind: "after", cursor}, {kind: "before", cursor}, or {kind: "anchor", ref}. They return at most 200 cases with a forward cursor and a backward before cursor. Listing filters still apply. Ordinary non-search case cursors include folder, rank and case id, so equal ranks do not skip cases. If you have a non-search cursor from an older build, start again from a fresh page. find --outline returns the complete case listing as outline.numbers in folder, rank and stable id order. Each [folderId, count] pair in outline.folders identifies the folder for the next group of cases in that array. The outline includes fragments. It uses the same folder, deep, tag, and state filters as ordinary case pages. By default the outline lists active cases. To list archived cases, use state: "archived". The outline omits row bodies. The items array is empty, cursor is null, and count is exact. limit does not truncate the outline. If the list has more than 250,000 cases, the server returns invalid with details.reason: "outline-too-large". For a list of that size, read it in pages. A ranked text search has no complete outline. If you request one, the server returns invalid with details.reason: "outline-text-search". The server also refuses an outline with another in value, a run select, or a cursor. Case pages and outlines carry identity, sequence and revision from their read snapshot. Compare all three before combining them. sequence advances for any project write, so it may invalidate an outline even when order stays unchanged. revision identifies the event at that sequence and can be null when no event remains. Each read uses one snapshot. A later page can use a different snapshot. For callers with read, session project summaries also include fieldDefinitions. The default selection includes tests as well as the fields named below. If you select steps, hasFragments says whether the case version pins any fragments. If it does, sourceSteps contains the editable references behind the expanded steps.

job #

Run the server's queued background work. Only the server itself may call it.

HTTPPOST /api/job
Commandmainworthy job
NeedsInternal in-process runner only; HTTP and command callers are refused
Effectruns jobs in the server process
Agent toolno
Input of job
PropertyTypeRequiredDescription
[1].do"run"yes
[1].idstringyes
[2].do"tick"yes
[3].do"drain"yes

attach #

Append a screenshot or small file to a result you recorded. Supply the file as base64.

HTTPPOST /api/p/<project>/attach
Commandmainworthy attach
Needsrecord
Effectwrites
Agent toolno
Input of attach
PropertyTypeRequiredDescription
resultintegeryes
attachmentobjectyes
attachment.namestringyes
attachment.datastringyes
attachment.atstringno
projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.

attachment #

List a result's attachments, or read one: its file name, its content type and its bytes as base64.

HTTPPOST /api/p/<project>/attachment
Commandmainworthy attachment
Needsread
Effectreads
Agent toolno
Input of attachment
PropertyTypeRequiredDescription
resultintegeryes
idintegerno

propose #

Save edits: create or change cases and folders, set which requirements a case covers, pin a fragment's version, quarantine a test, or change the policy. Every save is a proposal; the policy decides whether it takes effect at once or waits for someone to accept it. Linking a test to a case is not an edit: answer its question with decide.

HTTPPOST /api/p/<project>/propose
Commandmainworthy propose
Needsproduce
Effectwrites
Agent toolyes
Input of propose
PropertyTypeRequiredDescription
editsarray<object>yes
edits[][quarantine].op"quarantine"yes
edits[][quarantine].teststringyes
edits[][quarantine].baseinteger | nullyes
edits[][quarantine].exitobject | nullyes
edits[][quarantine].exit[1][1].kind"person"yes
edits[][quarantine].exit[1][2].kind"expiry"yes
edits[][quarantine].exit[1][2].atintegeryes
edits[][quarantine].exit[1][3].kind"passes"yes
edits[][quarantine].exit[1][3].countintegeryes
edits[][fragment].op"fragment"yes
edits[][fragment].fragmentstringyes
edits[][fragment].fromintegeryes
edits[][fragment].tointegeryes
edits[][fragment].casesarray<object>yes
edits[][fragment].cases[].casestringyes
edits[][fragment].cases[].baseintegeryes
edits[][create].op"create"yes
edits[][create].kind"case" | "fragment"no
edits[][create].bodyobjectno
edits[][create].body.titlestringno
edits[][create].body.prestringno
edits[][create].body.stepsarray<object>no
edits[][create].body.steps[][inline].idstringyes
edits[][create].body.steps[][inline].actionstringyes
edits[][create].body.steps[][inline].expectedstring | nullyes
edits[][create].body.steps[][inline].useneverno
edits[][create].body.steps[][fragment].idstringyes
edits[][create].body.steps[][fragment].useobjectyes
edits[][create].body.steps[][fragment].use.fragmentstringyes
edits[][create].body.steps[][fragment].use.versionintegeryes
edits[][create].body.steps[][fragment].actionstringnoDefault: "".
edits[][create].body.steps[][fragment].expectedstring | nullnoDefault: null.
edits[][create].body.methodsarray<"human" | "auto" | "agent">no
edits[][create].body.automate"none" | "wanted" | "not-applicable"no
edits[][create].body.fieldsrecord<string>no
edits[][create].mdstringno
edits[][create].outlinestringno
edits[][create].folderinteger | stringno
edits[][create].tagsarray<string>no
edits[][create].coversarray<string>no
edits[][create].aliasesarray<string>no
edits[][create].afterstringno
edits[][edit].op"edit"yes
edits[][edit].casestringyesThe case, for example C-311.
edits[][edit].baseintegeryesThe version this edit was made on. If the case has a newer version, nothing is saved: the edit is refused, naming both versions.
edits[][edit].bodyobjectno
edits[][edit].body.titlestringno
edits[][edit].body.prestringno
edits[][edit].body.stepsarray<object>no
edits[][edit].body.steps[][inline].idstringyes
edits[][edit].body.steps[][inline].actionstringyes
edits[][edit].body.steps[][inline].expectedstring | nullyes
edits[][edit].body.steps[][inline].useneverno
edits[][edit].body.steps[][fragment].idstringyes
edits[][edit].body.steps[][fragment].useobjectyes
edits[][edit].body.steps[][fragment].use.fragmentstringyes
edits[][edit].body.steps[][fragment].use.versionintegeryes
edits[][edit].body.steps[][fragment].actionstringnoDefault: "".
edits[][edit].body.steps[][fragment].expectedstring | nullnoDefault: null.
edits[][edit].body.methodsarray<"human" | "auto" | "agent">no
edits[][edit].body.automate"none" | "wanted" | "not-applicable"no
edits[][edit].body.fieldsrecord<string>no
edits[][edit].mdstringno
edits[][place].op"place"yes
edits[][place].casesarray<string>yes
edits[][place].folderinteger | stringno
edits[][place].afterstring | nullno
edits[][place].rankstringno
edits[][place].tagsobjectno
edits[][place].tags.setarray<string>no
edits[][place].tags.addarray<string>no
edits[][place].tags.removearray<string>no
edits[][state].op"state"yes
edits[][state].casesarray<string>yes
edits[][state].to"active" | "archived"yes
edits[][restore].op"restore"yes
edits[][restore].casestringyesThe case.
edits[][restore].tointegeryesThe version to restore.
edits[][folder].op"folder"yes
edits[][folder].folderinteger | stringnoThe folder to rename, move or archive, by id or path. Leave it out to create a folder, which then needs a name.
edits[][folder].namestringno
edits[][folder].parentinteger | string | nullno
edits[][folder].archivebooleanno
edits[][cover].op"cover"yes
edits[][cover].casestringyesThe case.
edits[][cover].requirementstringyes
edits[][cover].onbooleanyes
edits[][cover].titlestringno
edits[][policy].op"policy"yes
edits[][policy].baseintegernoThe policy version this edit was made on: version in policy show --json. Required with settings. If the policy has a newer version, the edit is refused.
edits[][policy].presetstringno
edits[][policy].settingsobjectno
edits[][policy].settings.fieldsrecord<object>no
edits[][policy].settings.flakyDetectionobjectnoDefault: {"enabled":true,"windowDays":14,"minFlips":2}.
edits[][policy].settings.flakyDetection.enabledbooleanyes
edits[][policy].settings.flakyDetection.windowDaysintegeryes
edits[][policy].settings.flakyDetection.minFlipsintegeryes
edits[][policy].settings.unlinked"ask" | "track" | "create"yes
edits[][policy].settings.emptyReports"pending" | "nothing-required"noDefault: "pending".
edits[][policy].settings.basis"exact" | "exact-or-assumed"yesWhich results fill a planned run's slot by default: exact takes only a result known to be for the slot's case version, because it was reported into that slot or names that version; exact-or-assumed also takes one assumed to be for it because it was the current version of the case the result names or is linked to.
edits[][policy].settings.holdsobjectyes
edits[][policy].settings.holds.flakyDaysintegeryes
edits[][policy].settings.holds.infraThisTargetOnlybooleanyes
edits[][policy].unlinked"ask" | "track" | "create"no
edits[][policy].emptyReports"pending" | "nothing-required"no
reasonstringnoWhy. Shown in the case history.
projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.

import-csv #

Preview the cases a CSV file makes once its columns are mapped to case fields, then confirm to propose them, at most 200 cases to a proposal. A row whose ID in the other tool was imported before is refused.

HTTPPOST /api/p/<project>/import-csv
Commandmainworthy import-csv
Needsproduce
Effectwrites
Agent toolno
Input of import-csv
PropertyTypeRequiredDescription
csvstringyesUTF-8 CSV file content, with headers.
mappingobjectno
mapping.idstringyes
mapping.titlestringyes
mapping.stepsstringno
mapping.expectedstringno
mapping.folderstringno
mapping.prestringno
mapping.executionstringno
mapping.fieldsrecord<string>no
preset"testrail"no
confirmstringnoThe confirmation the preview returned. Omit it to preview.
projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.

report #

Record test results: those parsed from a CI report, one result a person tested by hand, or an agent's batch. Each result is recorded as reported by the caller: a person, agent or pipeline.

HTTPPOST /api/p/<project>/report
Commandmainworthy report
Needsrecord
Effectwrites
Agent toolyes
Input of report
PropertyTypeRequiredDescription
targetobjectnoWhat was tested. Required unless run is given.
target[1].buildstringyesThe build's label, such as a version number. Agent tools do not offer it, so an agent reports into a planned run instead.
target[1].envstringno
target[2].commitstringyes
target[2].headstringnoThe change's head commit as the code host shows it now. Without it, a report can move the head to its commit only if that commit is new, or was first reported after both the current head's first report and the last time head was named. Needs pr or a branch other than trunk.
target[2].repostringno
target[2].branchstringno
target[2].envstringno
target[2].printegerno
target[2].basestringnoThe commit this change is based on.
target[2].titlestringno
target[2].urlstringno
target[2].filesarray<string>noThe files the change touches, which impact reads to find the cases it affects.
target[3].sessionstringyes
runstringnoA planned run these results are for, for example R-4.
modelstringnoThe model that produced this report's results. Agent tokens only; 1 to 120 characters after trimming.
jobstringno
attemptintegerno
shardobjectnoWhen a job runs its tests in shards, which shard this report is: for shard 2 of 4, index 2 and of 4. A commit's gate can fail or block early, but passes only once every shard of the job has reported.
shard.indexintegeryes
shard.ofintegeryes
buildUrlstringno
spanobjectnoWhen the runner started and ended these tests, as the report says. A change run shows its reported test span only when every report it counts names one.
span.startedAtintegeryesMilliseconds since 1970 when the runner started these tests, by its clock.
span.endedAtintegeryesMilliseconds since 1970 when it ended them; not before startedAt.
resultsarray<object>yes
results[].testobjectyes
results[].test[1].keystringyes
results[].test[1].namestringno
results[].test[1].filestringno
results[].test[2].casestringyesThe case this manual or agent result is for.
results[].outcome"pass" | "fail" | "skip" | "blocked" | "error"yes
results[].attachmentsarray<object>no
results[].attachments[].namestringyes
results[].attachments[].datastringyes
results[].attachments[].atstringno
results[].durationMsintegernoHow long it took, in milliseconds. At most 30 days.
results[].failureobjectno
results[].failure.messagestringyes
results[].failure.detailstringno
results[].failure.atstringno
results[].stepsarray<object>no
results[].steps[].stepstringyesThe case step's ID, or the label the test runner gave the step.
results[].steps[].outcome"pass" | "fail" | "skip" | "blocked" | "error"yes
results[].steps[].durationMsintegerno
results[].steps[].actionsarray<object>no
results[].steps[].actions[].textstringyes
results[].steps[].actions[].outcome"pass" | "fail" | "skip" | "blocked" | "error"no
results[].steps[].actions[].durationMsintegerno
results[].steps[].attachmentintegernoThe step's screenshot: its position in the result's attachments, counting from 0.
results[].notestringno
results[].annotationobjectno
results[].annotation.casestringyes
results[].annotation.versionintegerno
results[].correctsintegernoThe id of an earlier result of yours that this one replaces.
results[].triesarray<object>no
results[].tries[].outcome"pass" | "fail" | "skip" | "blocked" | "error"yes
results[].tries[].durationMsintegernoHow long it took, in milliseconds. At most 30 days.
results[].tries[].failureobjectno
results[].tries[].failure.messagestringyes
results[].tries[].failure.detailstringno
nothingRequiredtruenoSend it with an empty results list to declare that the commit needed no tests. Only a pipeline may send it, for a commit. The gate counts it only when the policy's emptyReports is nothing-required.
projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.

claim #

Record a review and what it found, or why failed results failed. A review with no findings is still recorded.

HTTPPOST /api/p/<project>/claim
Commandmainworthy claim
Needsproduce
Effectwrites
Agent toolyes
Input of claim
PropertyTypeRequiredDescription
[1].lensstringyesThe kind of review, for example adversarial-review.
[1].aboutstringnoThe change reviewed, for example pr:482.
[1].patchstringnoThe commit you reviewed: impact's change.head. impact marks the cases you read as reviewed only while this is the change's current head.
[1].reviewedarray<string>noThe cases you read, each as C-311@<hash> with the hash get returned. Only a case still at that version is recorded, even when you found nothing.
[1].findingsarray<object>noDefault: [].
[1].findings[].onstringyesWhere: a case (C-311), a step (C-311#b7), a requirement (req:WEB-290) or a change (pr:482).
[1].findings[].category"cannot-fail" | "ambiguous" | "missing-expected" | "uncovered-path" | "duplicate" | "outdated" | "defect" | "other"yes
[1].findings[].notestringyes
[1].findings[].reprostringno
[1].findings[].suggestobjectno
[1].findings[].suggest[1].caseobjectyes
[1].findings[].suggest[1].case.titlestringyes
[1].findings[].suggest[1].case.folderstringno
[1].findings[].suggest[1].case.stepsarray<string>yes
[1].findings[].suggest[2].stepstringno
[1].findings[].suggest[2].actionstringno
[1].findings[].suggest[2].expectedstringno
[1].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.
[2].failuresarray<object>yesFailed results and why each failed. Recorded beside the failure's answer; it decides nothing.
[2].failures[].resultstringyesA failed result as result:<id>, for example result:812: find --in results gives the id as result.
[2].failures[].cause"defect" | "test" | "flaky" | "infra"yesdefect: the product was wrong. test: the test was wrong. flaky: it fails by chance. infra: the runner or a service failed.
[2].failures[].notestringyesWhat failed and what fixed it.
[2].failures[].fixstringnoThe commit that made the test pass, if one did.
[2].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.

change #

Mark a change, such as a pull request, as merged, closed or open again. Reporting a merge saves its head commit's gate as it stands then. Ending a change closes the questions about its failures, except those an open planned run still waits on.

HTTPPOST /api/p/<project>/change
Commandmainworthy change
Needsrecord
Effectwrites
Agent toolno
Input of change
PropertyTypeRequiredDescription
changestringyesThe change, for example pr:482.
state"merged" | "closed" | "open"yesmerged: it merged, and its head commit's gate is saved as it stands now. closed: it ended without merging. open: it is open again.
headstringnoThe change's head commit as the code host shows it now. For merged, the commit that merged. The change's gate is this commit's gate.
landingobjectnoFor merged: the commit that landed on trunk, and the trunk branch. Its failures are judged as trunk's. After a squash or rebase merge it is not the head, and it has a gate of its own.
landing.commitstringyes
landing.branch"main" | "master" | "trunk"yes
projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.

announce #

Record a deployment: which build went to which environment, tied for good to the built artifact's digest and source commits. The caller needs the record capability and must be a pipeline or a person with admin on the project.

HTTPPOST /api/p/<project>/announce
Commandmainworthy announce
Needsrecord
Effectwrites
Agent toolno
Input of announce
PropertyTypeRequiredDescription
deploystringyesThe build's label, such as a version number. Its first announcement ties it to one artifact for good.
envstringyesThe environment it was deployed to, such as production.
digeststringnoThe artifact's digest, sha256: followed by 64 hex digits. Required the first time a build label is announced, and it must match after that.
codearray<object>noThe source repositories and full commit hashes the artifact was built from. Required the first time its digest is announced, and they must match after that.
code[].repostringyes
code[].commitstringyes
projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.

tracker #

Preview a defect for a failed result, ask your issue tracker to create it, or check that an existing tracker issue can be linked to it. Needs both the read and the produce capability.

HTTPPOST /api/p/<project>/tracker
Commandmainworthy tracker
Needsread and produce
Effectwrites
Agent toolno
Input of tracker
PropertyTypeRequiredDescription
[1].do"preview"yes
[1].resultintegeryes
[1].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.
[2].do"create"yes
[2].resultintegeryes
[2].confirmstringno
[2].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.
[3].do"link"yes
[3].resultintegeryes
[3].keystringyes
[3].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.

plan #

Start a planned run: choose its cases, which results count, and what finishes it. Results already recorded that count fill their slots at once.

HTTPPOST /api/p/<project>/plan
Commandmainworthy plan
Needsplan
Effectwrites
Agent toolno
Input of plan
PropertyTypeRequiredDescription
namestringyes
selectobjectyes
select.casesarray<string>no
select.foldersarray<integer | string>no
select.tagsarray<string>no
select.textstringno
acceptsobjectnoWhich results count: those for a build, those for a commit, or only those recorded in this run. Default: only those recorded in this run.
accepts[1].buildstringyes
accepts[1].envstringno
accepts[2].commitstringyes
accepts[2].repostringno
accepts[2].envstringno
accepts[3].selftrueyes
requirearray<object>no
require[][1].idstringyes
require[][1].kind"exercise"yes
require[][1].methodsarray<"human" | "auto" | "agent">yes
require[][1].minActors1 | 2yes
require[][1].basis"exact" | "exact-or-assumed" | "same-claim"yesWhich results fill a slot: exact takes only a result known to be for the slot's case version, because it was reported into that slot or names that version; exact-or-assumed also takes one assumed to be for it because it was the current version of the case the result names or is linked to; same-claim also takes one for another version with the same preconditions and steps.
require[][2].idstringyes
require[][2].kind"jobs"yes
require[][2].jobsarray<string>yes
assignarray<string>noThe people or agents, by name, to share the slots between in turn.
projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.

work #

Take a case's slot in a planned run for a limited time (a lease), either a named slot or the next free one; renew the lease, or give the slot back.

HTTPPOST /api/p/<project>/work
Commandmainworthy work
Needsrecord
Effectwrites
Agent toolyes
Input of work
PropertyTypeRequiredDescription
do"take" | "give-back"yes
runstringyes
slotintegernoThe slot's id, which find --in slots --run lists. Leave it out to take the next free slot that is not finished. Required to give a slot back.
secondsintegernoHow long you hold the slot, in seconds: 30 to 86400. Default: 900.
projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.

decide #

Answer a question, or withdraw a decision. Policy says whether your answer settles it, is advice, or is refused.

HTTPPOST /api/p/<project>/decide
Commandmainworthy decide
Needsproduce
Effectwrites
Agent toolyes
Input of decide
PropertyTypeRequiredDescription
[1].qstringyesThe question, for example Q-12.
[1].ifOpenbooleannoRefuse if the question is no longer open.
[1].onEvidencestringyesThe evidence hash you saw. If the evidence changed since, the reply is a conflict with the new evidence.
[1].answerrecord<unknown>yesThe answer, for example {"is":"defect"}. The allowed answers depend on the question kind.
[1].reasonstringno
[1].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.
[2].allarray<object>yes
[2].all[].qstringyesThe question, for example Q-12.
[2].all[].ifOpenbooleannoRefuse if the question is no longer open.
[2].all[].onEvidencestringyesThe evidence hash you saw. If the evidence changed since, the reply is a conflict with the new evidence.
[2].all[].answerrecord<unknown>yesThe answer, for example {"is":"defect"}. The allowed answers depend on the question kind.
[2].all[].reasonstringno
[2].reasonstringno
[2].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.
[3].undostringyesThe question whose decision to withdraw.
[3].ifDecisionintegerno
[3].reasonstringno
[3].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.
[4].undoarray<object>yes
[4].undo[].qstringyesThe question whose decision to withdraw.
[4].undo[].ifDecisionintegeryes
[4].reasonstringno
[4].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.

handoff #

Hand a failure question to the coding agent this instance is configured to start, with its evidence.

HTTPPOST /api/p/<project>/handoff
Commandmainworthy handoff
Needsanswer
Effectwrites
Agent toolno
Input of handoff
PropertyTypeRequiredDescription
questionstringyesThe failure question, Q-70 or 70.
projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.

inbox #

List the questions waiting for an answer; with no filter, the ones that block most come first. With state=decided, list past decisions instead.

HTTPPOST /api/p/<project>/inbox
Commandmainworthy inbox
Needsread
Effectreads
Agent toolyes
Input of inbox
PropertyTypeRequiredDescription
state"open" | "decided"noDefault: "open".
kind"adopt" | "map" | "failure" | "finding" | "signoff"no
onstringnoOnly questions about this case, run, test or change.
limitintegerno
cursorstringnoThe cursor from the previous page.

get #

Read cases, questions, runs, tests, results or proposals by their refs, such as C-12 or Q-7.

HTTPPOST /api/p/<project>/get
Commandmainworthy get
Needsread
Effectreads
Agent toolyes
Input of get
PropertyTypeRequiredDescription
projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.
repostringnoFor commit refs: the repository, when more than one could have that commit.
cursorstringnoFor one proposal: the cursor from its previous page of edits. Restart without it after a project change.
refsarray<string>yesThe refs to read: cases (C-), questions (Q-), runs (R-), tests (T-), proposals (P-), result:<id>, commit:<hash> or change:<key>.
fieldsarray<string>noFor cases: which fields to return, any of title, pre, steps, methods, fields, tags, covers, place, proof, tests, and users for a fragment. Default: all but users.
as"data" | "md"nodata returns JSON. md returns each case as Markdown, the form an edit's md takes, in fewer tokens. Other refs return JSON either way. Default: "data".
unlessrecord<string>noFor cases: each case's ref mapped to the etag an earlier get returned for it, read with the same as and fields. Without version, an unchanged case comes back as {ref, unchanged: true, hash, etag} instead of in full.
versionintegernoFor one case: this version instead of the current one.

find #

Search and list: cases (by text, folder, tag, or compact outline), tests, runs, slots, folders, requirements, changes.

HTTPPOST /api/p/<project>/find
Commandmainworthy find
Needsread
Effectreads
Agent toolyes
Input of find
PropertyTypeRequiredDescription
outlinebooleannoFor cases: every matching case's number, in order, and how many cases each folder holds, instead of the rows. Not with text, select, cursor or window.
receiptintegernoFor receipt-results: the merge receipt's id, from impact's change.mergeReceipt.
in"cases" | "tests" | "runs" | "folders" | "tags" | "requirements" | "slots" | "changes" | "receipt-results" | "deployments" | "results"noDefault: "cases".
selectobjectnoFor cases: list the cases a run with this selection would get, instead of using the listing filters. Fragments are left out, and naming one is refused.
select.casesarray<string>no
select.foldersarray<integer | string>no
select.tagsarray<string>no
select.textstringno
rowsarray<string>noFor cases: read only these cases, archived ones and fragments included, with no other listing options. Refs not found are listed under missing.
windowobjectnoFor cases: 200 rows as the Suite screen reads them. open starts at the top, after and before page from a cursor, and anchor reads the page that holds one case.
window[1].kind"open"yes
window[2].kind"after"yes
window[2].cursorstringyes
window[3].kind"before"yes
window[3].cursorstringyes
window[4].kind"anchor"yes
window[4].refstringyes
textstringno
folderinteger | stringno
deepbooleannoWith folder: include its subfolders.
tagsarray<string>no
statestringno
origin"planned" | "change"noFor runs: planned for runs started with plan, or change for the run Mainworthy makes for each reported commit.
runstringnoFor slots: the run.
commitstringnoFor results: the commit.
changestringnoFor results and runs: a change key (pr:482).
repostringno
unlinkedbooleannoFor tests: only those with no case.
limitintegernoRows in a page: at most 500, or 2000 for cases.
cursorstringnoThe cursor from the previous page.

impact #

List the cases a change affects and why, with what was already reviewed or decided, so you check those instead of the whole suite.

HTTPPOST /api/p/<project>/impact
Commandmainworthy impact
Needsread
Effectreads
Agent toolyes
Input of impact
PropertyTypeRequiredDescription
changestringnoA change key, for example pr:482.
filesarray<string>noThe paths the change touches. They replace the paths Mainworthy saved for the change, or stand in when it does not know the change.
sincestringnoA cursor from an earlier call: only what moved since.
cursorstringnoThe next value from the previous impact page. Send the same other inputs. After a project change, start again without it.
ledgerbooleannoWhether to mark the cases you already reviewed, at their current version and the change's head, and list them last. False treats every case as unreviewed. Default: true.

since #

List what changed since a cursor from an earlier read: each case that changed and how, and the questions that were settled.

HTTPPOST /api/p/<project>/since
Commandmainworthy since
Needsread
Effectreads
Agent toolyes
Input of since
PropertyTypeRequiredDescription
cursorstringyesA cursor from any earlier read.
limitintegerno

gate #

Say whether a commit, change or run is tested: passed, failed (needs a fix), blocked (a question needs an answer) or pending (still waiting for evidence).

HTTPPOST /api/p/<project>/gate
Commandmainworthy gate
Needsread or record
Effectreads
Agent toolno
Input of gate
PropertyTypeRequiredDescription
commitstringno
runstringno
changestringnoA change key, for example pr:482: the gate of its latest commit.
repostringno

history #

List a case's versions, or compare two of them step by step.

HTTPPOST /api/p/<project>/history
Commandmainworthy history
Needsread
Effectreads
Agent toolno
Input of history
PropertyTypeRequiredDescription
refstringyesThe case.
fromintegerno
tointegernoCompare up to this version, step by step, from from or the version before it.

timeline #

Show what happened to a case, newest first: versions, moves, results from everyone who reported, findings, reviews and questions.

HTTPPOST /api/p/<project>/timeline
Commandmainworthy timeline
Needsread
Effectreads
Agent toolno
Input of timeline
PropertyTypeRequiredDescription
refstringyesThe case.
limitintegerno

check #

Check the suite for structural problems: cases with no steps or no expected result, duplicate titles, dangling links.

HTTPPOST /api/p/<project>/check
Commandmainworthy check
Needsread
Effectreads
Agent toolno
Input of check
PropertyTypeRequiredDescription
limitintegerno

stats #

Reports over the last days: pass rate per day, flaky tests, time lost to reruns, automation and its backlog, manual effort, coverage by requirement.

HTTPPOST /api/p/<project>/stats
Commandmainworthy stats
Needsread
Effectreads
Agent toolno
Input of stats
PropertyTypeRequiredDescription
[1].of"manual-effort"yesThe cases people spent the most time testing by hand, by the time they reported. Cases that also have automated tests are included.
[1].daysintegernoHow many days to read, today included: 1 to 90. Default: 30.
[1].limitintegernoHow many rows to list. Default: 20.
[1].cursorintegernoThe cursor from the previous page, or 0 for the first page. Default: 0.
[2].of"pass-rate"yesPer day: the results that passed, failed, were skipped or blocked.
[2].daysintegernoHow many days to read, today included: 1 to 90. Default: 30.
[2].zonestringnoThe time zone that decides when each day starts, such as Europe/Berlin. Default: "UTC".
[2].method"human" | "auto" | "agent"noOnly results produced one way: human for cases tested by hand, auto for automated tests, agent for agents' results.
[3].of"flaky"yesThe tests that passed and failed on the same code, most often first.
[3].daysintegernoHow many days to read, today included: 1 to 90. Default: 30.
[3].limitintegernoHow many rows to list. Default: 20.
[3].cursorintegernoThe cursor from the previous page, or 0 for the first page. Default: 0.
[4].of"reruns"yesTime lost when tests ran again: repeated pipeline attempts and a runner's earlier tries, each counted once.
[4].daysintegernoHow many days to read, today included: 1 to 90. Default: 30.
[4].limitintegernoHow many rows to list. Default: 20.
[4].cursorintegernoThe cursor from the previous page, or 0 for the first page. Default: 0.
[5].of"automation"yesHow many cases have an automated test, and which to automate next.
[5].daysintegernoHow many days to read, today included: 1 to 90. Default: 30.
[5].limitintegernoHow many rows to list. Default: 20.
[5].cursorintegernoThe cursor from the previous page, or 0 for the first page. Default: 0.
[6].of"coverage"yesEach requirement's cases, by the latest result of their tests.
[6].daysintegernoHow many days to read, today included: 1 to 90. Default: 30.
[6].limitintegernoHow many requirements to list. Default: 100.
[6].cursorintegernoThe cursor from the previous page, or 0 for the first page. Default: 0.
[6].requirementstringnoOne requirement's key: the reply holds that requirement alone, with the list of its cases.

command #

Look up a write you sent with a cmd key, a retry key you choose: not recorded, begun, or done with its reply.

HTTPPOST /api/p/<project>/command
Commandmainworthy command
Needsread
Effectreads
Agent toolno

tracker-status #

Read whether a request to your issue tracker, a new defect or a check of an existing issue, went through, and the issue it names.

HTTPPOST /api/p/<project>/tracker-status
Commandmainworthy tracker-status
Needsread
Effectreads
Agent toolno
Input of tracker-status
PropertyTypeRequiredDescription
idstringyes

handoff-status #

Read whether a failure question's latest hand-off to an agent was sent, or why it failed.

HTTPPOST /api/p/<project>/handoff-status
Commandmainworthy handoff-status
Needsread
Effectreads
Agent toolno
Input of handoff-status
PropertyTypeRequiredDescription
questionstringyesThe failure question, Q-70 or 70.

audit #

Export a project's retained decisions, answers, policy changes and case versions as a verifiable audit file.

HTTPPOST /api/p/<project>/audit
Commandmainworthy audit
Needsadmin
Effectreads
Agent toolno
Input of audit
PropertyTypeRequiredDescription
fromintegernoDefault: 0.
tointegerno
receiptintegerno
cursorstringno
limitintegerno

admin #

Manage your organisation: its projects, its actors (people, agents and pipelines), teams, grants (what each actor may do) and tokens, and hand it to another owner. There are no seats: an actor costs nothing, and a token may do what its actor's grants allow. From a browser, making a token or granting admin needs a recent sign-in.

HTTPPOST /api/admin
Commandmainworthy admin
Needsadmin
Effectwrites
Agent toolno
Input of admin
PropertyTypeRequiredDescription
[1].do"team.create"yes
[1].namestringyes
[2].do"team.list"yes
[3].do"team.member.add"yes
[3].teamstringyes
[3].personstringyes
[4].do"team.member.remove"yes
[4].teamstringyes
[4].personstringyes
[5].do"team.grant.set"yes
[5].teamstringyes
[5].projectstringnoThe project key. Absent: every project.
[5].canarray<"read" | "record" | "produce" | "answer" | "plan" | "admin">yes
[6].do"team.grant.remove"yes
[6].teamstringyes
[6].projectstringnoThe project key. Absent: every project.
[7].do"team.history"yes
[7].teamstringyes
[8].do"project.create"yes
[8].keystringyes
[8].namestringno
[8].presetstringno
[8].unlinked"ask" | "track" | "create"noWhat happens to a test with no case: ask, track or create. Absent: what the preset starts with.
[9].do"project.list"yes
[10].do"project.demo"yes
[10].keystringyesMakes the project a demo: a write to it may say when it happened. Only a project nothing was written to, and it is not undone.
[10].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.
[11].do"token.create"yes
[11].actorstringyes
[11].kind"human" | "agent" | "ci"yes
[11].canarray<"read" | "record" | "produce" | "answer" | "plan" | "admin">noWhat a new actor may do. Absent: a person everything, an agent read and produce, a pipeline record. Not for an actor that exists: use grant.set. Default: [].
[11].projectstringnoLimit the grant to one project. Absent: every project.
[11].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.
[11].labelstringno
[11].expiresstringnoHow long the token works from now: 90d, 12h, 2w. After that it is refused as a revoked one is. Absent: it has no end.
[12].do"token.list"yes
[13].do"token.revoke"yes
[13].idintegeryes
[14].do"actor.list"yes
[15].do"grant.set"yes
[15].actorstringyes
[15].projectstringnoThe project the grant is for. Absent: every project.
[15].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.
[15].canarray<"read" | "record" | "produce" | "answer" | "plan" | "admin">yesWhat the actor may do there from now on, in place of what it could.
[15].rolesarray<string>noNamed roles on this grant. Absent: keep its roles; []: clear them.
[16].do"grant.remove"yes
[16].actorstringyes
[16].projectstringnoThe project the grant is for. Absent: the grant on every project.
[16].projectIdentitystringnoThe project's identity from an earlier read. If the key now names another project, such as one deleted and made again, the call is refused.
[17].do"actor.forget"yes
[17].namestringyesRemoves who this actor was in this organisation: a pseudonym replaces the name and its tokens and sessions stop working. History keeps what was done. An admin may forget themselves, unless they own the organisation. A person's account and their other organisations stay.
[18].do"policy.show"yes
[18].projectstringyes
[19].do"org.transfer"yes
[19].tostringyesHands this organisation to the person of this name in it. Only its owner does; the new owner may do everything here, and you keep your grants.

org #

For the operator who runs this instance: list its organisations, approve one made by signup, suspend one or let it in again, read and raise one's limits, and delete an account on the operator's own decision, never on a request by email. An organisation made by signup only reads until it is approved. A suspended organisation's tokens and sessions are refused and its data is kept.

HTTPPOST /api/org
Commandmainworthy org
Needsadmin
Effectwrites
Agent toolno
Input of org
PropertyTypeRequiredDescription
[1].do"list"yes
[2].do"suspend"yes
[2].orgintegeryesRefuses every token and session of this organisation, and keeps its data.
[3].do"resume"yes
[3].orgintegeryesLets a suspended organisation in again.
[4].do"approve"yes
[4].orgintegeryesLets an organisation made by signup write: until then it reads and exports only. Approving one that is approved changes nothing.
[5].do"account.delete"yes
[5].orgintegernoAn organisation the person is in, with actor.
[5].actorstringnoThe person's name in org.
[5].subjectstringnoInstead of org and actor: the person's subject at the identity provider, which names the account when no organisation has them any more.
[6].do"limits"yes
[6].orgintegeryes
[7].do"limits.set"yes
[7].orgintegeryes
[7].projectsinteger | nullnoThe most projects it holds; null for the default.
[7].membersinteger | nullnoThe most people, agents and pipelines it holds; null for the default.
[7].attachmentBytesinteger | nullnoThe most bytes of attachments its results carry; null for the default.
[7].resultsinteger | nullnoThe most results its projects hold; null for the default.
[7].requestsPerMinuteinteger | nullnoThe most requests its tokens and sessions send in a minute; null for the default.

session #

List your browser sign-ins, or end one. A person with admin on every project of the organisation can do the same for anyone in the organisation except the instance's operator.

HTTPPOST /api/session
Commandmainworthy session
Needsno capability: any person or agent that is signed in, for what is their own
Effectwrites
Agent toolno
Input of session
PropertyTypeRequiredDescription
[1].do"list"yes
[1].actorstringnoWhose sessions. Absent: your own. Somebody else's is for an admin who is a person.
[2].do"end"yes
[2].idintegeryesThe session, from the list. Your own, or anyone's for an admin who is a person.

credential #

List, make or revoke your own command-line tokens in this organisation. Only a person may call it. From a browser, making one needs a recent sign-in through the identity provider in that session. A personal token is shown once and expires after 30 days by default. The identities you sign in with belong to your account: see account.

HTTPPOST /api/credential
Commandmainworthy credential
Needsno capability: any person or agent that is signed in, for what is their own
Effectwrites
Agent toolno
Input of credential
PropertyTypeRequiredDescription
[1].do"token.create"yes
[1].labelstringyesWhat you use this token for.
[1].expiresstringnoDefault: 30d. At most 365d. A session opened through the identity provider creates your own token, shown once. Default: "30d".
[2].do"token.list"yes
[3].do"token.revoke"yes
[3].idintegeryes

invitation #

Invite a person with a link: make one, list them, revoke one. The person accepts by signing in at the identity provider, so an instance without one makes no invitations. The link is shown once. From a browser, making one needs a recent sign-in; a token or the instance's own command line needs none.

HTTPPOST /api/invitation
Commandmainworthy invitation
Needsadmin
Effectwrites
Agent toolno
Input of invitation
PropertyTypeRequiredDescription
[1].do"create"yes
[1].namestringyesThe person. A new name: an invitation to join. A person who exists: a recovery, which only the owner of the organisation makes; once accepted, whoever accepts it is that person here, and their tokens and sessions here end.
[1].canarray<"read" | "record" | "produce" | "answer" | "plan" | "admin">noWhat a new person may do. Absent: everything. Not for a person who exists: use grant.set. Default: [].
[1].projectstringnoLimit the grant to one project. Absent: every project.
[1].expiresstringnoHow long the link works: 12h, 3d, 2w. At most 30d. Default: "3d".
[2].do"list"yes
[3].do"revoke"yes
[3].idintegeryes
[4].do"recoveries"yes

account #

What you do as your account, from a browser signed in through the identity provider: the organisations you are in, making one with its first project where this instance takes new ones, the identities you sign in with (removing one needs a recent sign-in), your sessions in every organisation, and deleting the account once no organisation has you (also after a recent sign-in). A token, or a browser signed in with one, is refused: it speaks for one organisation. Switching organisation is POST /api/login/switch.

HTTPPOST /api/account
Commandmainworthy account
Needsno capability: any person or agent that is signed in, for what is their own
Effectwrites
Agent toolno
Input of account
PropertyTypeRequiredDescription
[1].do"orgs"yes
[2].do"identity.list"yes
[3].do"identity.remove"yes
[3].idintegeryesThe identity, from the list. The last one is not removed.
[4].do"session.list"yes
[5].do"session.end"yes
[5].idintegeryesThe session, from the list.
[6].do"delete"yes
[7].do"signup"yes
[8].do"org.create"yes
[8].namestringyesThe organisation's name, as its people read it.
[8].projectstringyesThe key of its first project, such as web.
[8].requeststringyesAn id the client makes once for this organisation, 8 to 64 letters, digits, - and _: a repeat with the same id returns the organisation it made.
[8].personstringnoYour name in it. Absent: the name signup suggests. Made unique in the organisation.

billing #

What this organisation pays for: its subscription and that subscription's status, or the offer when there is none.

HTTPPOST /api/billing
Commandmainworthy billing
Needsadmin
Effectreads
Agent toolno

subscribe #

Start a checkout for this organisation, at the instance's configured price, and get the checkout's address. An organisation that already has a subscription is refused; an open checkout is offered again.

HTTPPOST /api/subscribe
Commandmainworthy subscribe
Needsadmin
Effectwrites
Agent toolno

billing-event #

Where Paddle sends its notifications. Only a body signed with the destination's secret in Paddle-Signature is taken; each event is applied once.

HTTPPOST /api/billing-event
Commandmainworthy billing-event
Needsno token or session: a body its provider signed, in the paddle-signature header
Effectwrites
Agent toolno
Input of billing-event
PropertyTypeRequiredDescription
event_idstringyes
event_typestringyes
occurred_atstringyes
datarecord<unknown>yes

Agent tools #

MCP lists the tools below for connected agents. Tool discovery omits some API inputs, including attachments, quarantine edits, direct build targets, and the CI declaration that no tests are required. Each tool has a compact output schema for { result, seq }, the result's top-level type, and its required fields. The OpenAPI document describes nested fields and alternative replies in full. The skill reference that ships with Mainworthy describes most input fields. Tool schemas retain guidance for commit reuse, question answers, and review filtering. Let an agent in explains how to connect one.

ToolWhat the agent is told it is for
proposeSave case edits; an edit of a case's content (op edit) names the version you read (base). A proposal comes back adopted (now current), open (waits for a person to accept it) or rejected. An edit on an older version is refused: read the case again and redo it. Over 200 edits are sent as several proposals, each in result.proposals with its error if any; one refused or waiting does not stop the rest.
reportRecord test results for a commit or a named session (target), or for a planned run (run). Name each test by its key, or by the case it checks.
claimRecord a review of a change (about) at a commit (patch): the cases you read, as C-311@hash, and what you found; the reply's known lists earlier findings. Or record why each failed result:<id> failed; that answers no question.
workPass run to take its next free slot, or run with slot to take or renew that slot. Reporting its result or giving it back frees the slot.
decidePass the question's evidenceHash as onEvidence. Reply status: decided; pending (more approvals needed); advised (your answer is advice, a person decides); forbidden; invalid; already (decided before); reopened; conflict (the evidence changed: read it again). To withdraw a decision, pass undo; ifDecision makes sure it is the decision you mean.
inboxOpen questions (with no filter, most blocking first), each with the evidenceHash decide needs. Pass on to see only one case, run, test or change.
getRead by ref: C-, Q-, R-, T-, P- or result:id. commit:hash, change:key and R-n give the gate's verdict. To skip an unchanged case, pass its earlier etag under its ref in unless. cursor pages a proposal's edits.
findSearch cases, tests, runs and slots. Pass the reply's cursor back for the next page.
impactCases a change, or a list of changed files, affects. For the next page pass the reply's next as cursor with the same inputs; keep the last page's cursor for since. Start over when the project changes.
sinceCases changed and questions settled since cursor. Call again with the new cursor while more is true.
Mainworthy 0.1.0 · Licence · this page is docs/guide/api.md in the repository