Skip to content

Latest commit

 

History

History
218 lines (190 loc) · 34.3 KB

api.md

File metadata and controls

218 lines (190 loc) · 34.3 KB
title API reference
nav_order 5
parent Server

API reference

Everything the dashboard, the sessionly binary and the GitHub Action do goes through these endpoints, under /api/v1. They take and answer JSON.

Calling it

curl -H "Authorization: Bearer $SESSIONLY_TOKEN" https://sessionly.example.com/api/v1/ping
  • A request without a token the server knows is answered 401.
  • What a token may call depends on its role (see People, tokens and sign-in): below, person means an admin or member token. A member's answers hold their own sessions only; an admin's, everyone's in the organisation.
  • An error is {"error": "…"}, some with a code to tell them apart.
  • A request body can be 32 MB at most (413 past that).
  • Where SESSIONLY_RATE_PER_MINUTE is set, a token that passes it gets 429 with the code rate_limited.

Sessions

Who
GET /ping any token Whether the token is accepted, with its organisation, address, name and role.
PUT /sessions/{machine_id}/{source}/{session_id} person, env Stores or replaces one session. The body is the payload described under What an upload contains. Answers {"stored": true}; {"stored": false, "excluded": true} for a repository its person stopped. 403 with code person_removed when the address it is filed under belongs to someone who was removed: that session is refused, and a shared token goes on to the next. 422 for a body that does not fit the schema (with the first five things wrong with it) or whose address is not the session's, 409 for a session that is someone else's.
DELETE /sessions/{machine_id}/{source}/{session_id} person, env Takes one back. Only the person a session is filed under can; the answer is {"removed": true}, or false if there was none of theirs.
GET /sessions/{machine_id}/{source}/{session_id} person One session: owner_email, updated_at and the upload as it was stored. 404 if it is not there or not theirs to see.
GET /sessions person A page of sessions, newest first: {"sessions": […], "total": n}. Takes the filters below and limit (50, at most 500) and offset. Each has review_runs, null where they are not known: a session from a collector that did not count them, or a Codex session whose rollout was not read.
GET /sessions/held?machine={machine_id} person The sessions of theirs the server has from one machine.
GET /summary?by=… person Totals, grouped by user (the default), repo, model, tool, day, runtime or agent_version: {"groups": […], "total": {…}}. By agent_version a group is an agent and a version of it, its key the two with a blank between (claude-code 2.1.302), and grok (unknown) for an agent's sessions that name no version. Takes the filters below. Each has cost_usd and where it went: in_pr_usd (charged to pull requests that are merged or open), closed_unmerged_usd (to ones closed without merging) and not_in_pr_usd (to none). The three add up to cost_usd. review_runs sums the sessions' review runs, and sessions_reviews_unknown counts those whose review runs are not known: from a collector that did not count them, or a Codex session whose rollout was not read. kept_1d, kept_7d, kept_30d are the rewrite checkpoints summed; outcomes_1d, outcomes_7d, outcomes_30d what later commits did by those ages (sessions_reached of sessions_total, which counts sessions with outcomes and no rewrite measurement too, lines_tracked, sessions_with_fix, fix_commits, likely_fix_commits, lines_fixed, sessions_reverted (not relanded), revert_commits, lines_reverted, rework_commits, lines_reworked, and by_agent: of those, the ones another agent's session made, per source, with fix_commits, likely_fix_commits, lines_fixed, revert_commits, lines_reverted, rework_commits and lines_reworked), see Later commits.
GET /files person The files agents changed, with the filters below and limit (200, at most 2000).
GET /inventory person Which agents and which versions of them people and machines run, by the version each session started on: {"generated_at", "grace_days", "inactive_days", "pending_sessions", "agents": […], "machines": […], "events": […]}. An admin and a viewer get the organisation's, a member their own machines, measured against their own sessions alone. Each of agents has agent, newest (the newest version seen on a person's machine: of releases, or of versions from before a release where there is no other; null where none can be put in order), newest_first_seen, newest_seen_by (people), versions ({version, sessions, people, machines, first_seen, last_seen}, newest first) and unversioned_sessions. Each of machines is a person's machine, or all of a person's cloud sessions (runtime cloud), with owner_email, machine_id, last_active and agents: for each agent there its version as of its last session that names one (null where none does), status, behind_by (newer versions seen), first_seen, last_seen and sessions on that version however it is written, and previous_version with upgraded_at. status is current; behind (a newer version has been seen for grace_days or more); inactive (no session going for inactive_days, whatever it is on); unknown_order (a version that cannot be put in order, like latest); unrecorded (no session there names a version); or cloud (a platform chooses the version: never behind, and no measure for the rest). events are an agent on a machine going from one version to another, newest first: {at, owner_email, machine_id, agent, from, to, direction}, direction being upgrade, downgrade or changed. pending_sessions counts sessions the server has not read the version of yet, just after an upgrade: they are in none of the rest. Newest means of the versions these sessions ran on, not of every version there is. A release is measured against the releases after it; a version from before a release against every version after it, its own release among them. Times are of when a session is seen, as since and until have it below; a clock that is behind by less than that rule catches is taken at its word. A session that says no end was last going as it started. A machine is behind once any version newer than its own has been seen for grace_days, and in use while a session of the agent there has gone on within inactive_days. All of it is of the sessions the filters leave, so a filter changes what is newest and who is behind, not only what is listed: since leaves nothing older to have been seen, so within a few days of it nobody is behind yet; and standings are as of now, so with until in the past everything is inactive. Takes the filters below, and grace_days (7), inactive_days (30) and events_limit (50, at most 500). Nothing of a session but its agent, version, person, machine and times is in it.
GET /inventory/timeline?bucket=… person Sessions and people on each agent's versions over time, by week (the default, from Monday) or day, in UTC: {"bucket", "buckets": [{"start": "2026-11-09", "versions": [{agent, version, sessions, people}]}]}, oldest first, version null for sessions that name none. A week or day with no session is left out. Takes the filters below.
GET /filters person What there is to choose from: users, repositories, models, tools, and where sessions ran.

Filters, for /sessions, /summary, /files, /inventory and /inventory/timeline:

Filter Keeps sessions
user, repo, model whose person, repository or models contain the text, in any case
user_is filed under exactly that address
repo_is, model_is of exactly that repository, or with exactly that main model; (unknown) for those with none
tool from one agent: claude-code, cursor, grok, codex or opencode
agent_version_is that ran on exactly that version of their agent, as a summary by agent_version names it after the agent; (unknown) for those that name none. Of every agent with that version: add tool for one agent's. Blanks around it are left out, and what is past 64 characters, as of the version that is kept; nothing but blanks is no filter, as nothing is. A + in a version is written %2B, as in any address: left as it is, it is read as a blank
runtime cloud, or local for those on people's machines
q with the text in the title, repository, branch, session id, a prompt or a file's path
since, until seen at or after since, and before until: a date or a time. A session is seen as it started, or as it came to the server where it says no start, or says one before 2020 or after it came (a clock that lost its time, or is ahead). A summary by day goes by the same time

Repositories a person stopped

Who
GET /repos/excluded person The repositories the token's person stopped.
PUT /repos/excluded person Stops one: the body is {"repo": "…"}. Deletes the sessions that person already submitted from it, and says how many. A person who was removed is 403 (person_removed).
DELETE /repos/excluded?repo=… person Allows one again. A person who was removed is 403 (person_removed).

How a repository is named, and what a path covers, is under Uploading.

Pull requests

Who
PUT /prs ci, admin The Action's report of one pull request. May carry ci, what CI said of up to 20 of its commits: [{sha, state, failed, total, cancelled, failed_checks?}], kept for a head of it or the commit it was merged as. A head named for the first time is kept with the lines new at it. Answers {"stored": true, "attribution": {…}, "ci_pending": [{number, sha}]}: the figures the Action then shows, and the heads of it (at most 20) whose CI is still pending.
GET /prs admin, viewer A page of pull requests. Filters repo (part of its name), repo_is (exactly a repository: its own name, the one its branch is in, or another it goes by), state (open, merged or closed) and since; limit (50, at most 500) and offset. Each has cost: usd, everything spent on it by the sessions that gave it lines, review rounds included, and opened_usd, what its first version cost (see how to read it). Neither shrinks when review removes lines. Each has local_reviews too (see Review runs). A merged one has later: {age, reverted, fix_commits, likely_fix_commits} of its later commits by 30 days, or 7 if 30 are not read yet (null before 7 are, or with no time of merging), and merge_ci_state, what CI said of the commit it was merged as (null while not known).
GET /prs/summary admin, viewer The same pull requests summed by model, with local_reviews over local_reviews_pulls, the pull requests whose sessions all counted them. Same filters. Its total has what was spent on them (cost_usd, null when none has a cost figure; those closed without merging are left out unless only they are asked for), and per_surviving_line_usd: the sum of their opened_usd over the lines of their first versions that survived, each counted once.
GET /prs/detail?repo=…&number=… admin, viewer One pull request, with its files, the sessions that wrote its lines (each with red_on_arrival: whether CI was red at the first head that had one of its lines; null while not known), its reviews and comments, history, after_merge: its agent lines as counted on its branch 7 and 30 days after merging, apart from the history of its reports, outcomes once merged: {scanned_until, windows: {1d, 7d, 30d}, commits}, the later commits that changed its lines, heads: each head it was reported at, oldest first, as {sha, first_reported_at, ci: {state, failed, total, cancelled, checked_at, failed_checks?}} (a state unknown for one no run has read, apart from pending), merge_ci, the same of the commit it was merged as (null while not known; one read as pending 7 days after merging has none), merge_commit_sha, that commit (null when reported merged by an Action from before 0.5.0), and merge_known_at, when it was first reported: its CI is asked for in the 7 days from then. repo is its whole name.
GET /prs/due?repo=… ci, admin The merged pull requests of a repository whose agent lines are to be counted again on the branch they were merged into, 50 at most, as {"due": [{number, base_ref, checkpoints, paths}]}: the ages reached and not yet counted (7d, 30d), and the files to read. See After merge.
PUT /prs/after-merge ci, admin {repo, number, checkpoints, files}: the ages the files were read for, as GET /prs/due named them (only those are kept), and each of those files as it is on the branch now, as a path and the hashes of its lines (none for a file that is gone). Answers {"stored": […]} with the counts kept, which is none when no age was due. 422 when a file asked for is left out, or the pull request is not merged.
GET /prs/outcomes/due?repo=… ci, admin The merged pull requests of a repository whose later commits are to be read, 50 at most, by the branch they were merged into: {"branches": [{base_ref, since, until, pulls: [{number, merged_at, merge_commit_sha, since, tips, paths}]}]}. Each pull request's since is how far it was read, and tips the commits it was read up to (null while none are known); paths are the files its agent lines are in and where later commits moved them. since= (a date) also names those merged from then on, earlier than the server reads by itself (from 30 days before it began). Not one whose branch is gone. Those read longest ago come first; one a run said it could not read counts as read then. Asking changes nothing. No hashes.
PUT /prs/outcomes ci, admin One branch's later commits as the Action read them: {repo, base_ref, tip, scanned_until, pulls: [{number, merge_commit_sha, found, from, tips, paths}], commits: [{sha, landed_at, pulls, after, signals, reverts: {shas, pulls}, reapply, removed_total, files: [{path, removed, added}], moves: [{from, to, hashes}]}], gone, unread}, oldest landed first: landed_at is when the branch's own (first-parent) commit that brought the commit in was made, and for a pull request read from its tips later than its since; read by date, the commit's own committer date; either way no later than 5 minutes before the run, so one made since, or by a clock ahead, lands then. Commits that landed by scanned_until (no later than now) are all in it, or in an earlier one. A pull request's from is the tips it was named with: when it has others now, another run moved it, and this one leaves it as it is; tips are those it was read up to now. Its paths are the files it was read in, as the due answer named them: when its sessions have lines in another now (matched meanwhile), this one leaves it as it is too. gone names pull requests merged into base_ref whose branch is gone: they are not named again. unread names those this run could not read (the branch is not in the checkout, or its reading failed): they are named after the others from then on. At most 500 commits, 100 pull requests, 200,000 line hashes in a commit and 500,000 in all, 100,000 files and moves; names of at most 1,024 bytes, paths of 4,096 characters; 422 past any of them. A commit's link is made from repo and its SHA; the Action sends none. Answers {"stored": [{number, sha, kind}], scanned_until} with the commits kept, once each.
GET /prs/policy ci, admin What the organisation sets for every repository's Action, which it asks for once a run when it reads later commits or CI: {"policy": {fix_words, bug_labels, ci_ignore, ci_only, updated_at}} (the four fields each a list, or null for the repository's own input; updated_at the time it was set), or {"policy": null} without one (a core server, or no license with outcome_policy). See the organisation's policy.
GET /prs/ci/due?repo=… ci, admin The commits of a repository whose CI the Action is to read: {"heads": [{number, sha}], "merges": [{number, sha, base_ref}]}, heads still pending (reported in the last 7 days; one read as pending longer ago is set to none first, one never read is left as it is and no longer asked for) and the commits merged pull requests with agent lines were merged as, of which nothing is known yet or only that CI was pending, whose merge commit was first reported in the last 7 days (one read as pending longer ago is set to none first). Oldest first, 50 of each. No hashes.
PUT /prs/ci ci, admin What CI said of commits: {repo, heads: [{number, sha, state, failed, total, cancelled, failed_checks?}], merges: […]}, at most 100 of each, a state among success, failure, pending and none, counts whole numbers, and at most 20 names of 100 characters. Kept where the commit is a head of that pull request or the one it was merged as, and passed over otherwise; a state that came out one way or the other is not put back to pending or none, but is replaced by one that came out the other way; names only with a failure. Answers {"heads": n, "merges": n}, how many were changed. 422 past any limit.
GET /prs/outcomes/summary?by=… admin, viewer Merged pull requests' later commits summed by tool, model, user, repo or day (merged). Filters repo, repo_is and since, as GET /prs has them (not state: these are all merged), until (merged before), and tool, model and user, the sessions whose lines count. cohort=true makes each age of its own pull requests: those merged that long before the period (since to until or now), named in cohorts as {1d, 7d, 30d: {from, to}}; CI stays of the period, and a pull request of no age nor of the period is in no group. single=true leaves out pull requests with lines of more than one group, told by every session that had lines in them (one deleted since too) whatever the filters, and counts them in the total's pulls_mixed, at each age it is in and in its ci when of the period (grouped by repo or day none is). Answers {groups: [{key, outcomes_1d, outcomes_7d, outcomes_30d}], total, cohorts, generated_at, server_version} (server_version the release the server was built from, or unreleased), each age {pulls_reached, pulls_total, agent_lines, pulls_reverted, revert_commits, agent_lines_reverted, fix_commits, likely_fix_commits, agent_lines_fixed, sessions_fixed, pulls_fixed, pulls_likely_fixed, rework_commits, agent_lines_reworked, fix_commits_split, rework_commits_split}: pulls_fixed and pulls_likely_fixed are the pull requests a fix (a likely one) changed the group's lines of, and the two _split counts are commits counted by the group's share of the lines each changed, so they add up across groups to the total. pulls_total is every pull request whose later commits can be read, whether it has reached the age or not (not one merged more than 30 days before the server began reading them and never read, one with no base branch, or one whose branch is gone); pulls_reached those of them that reached it and were read up to it, and the rest is of those only. A commit (by repository and SHA) or a session counts once in a group and once in the total, however many pull requests it changed. Each group and the total also have ci, with no age: {heads_with_ci, heads_failed, sessions_with_ci, red_on_arrival_sessions, pulls_arrival_known, pulls_red_on_arrival, pulls_merge_known, pulls_merge_failed, pulls_ci_unknown}, of every merged pull request with agent lines in the group, read or not: heads whose CI came out either way and the red ones, sessions whose lines arrived at a head with CI known and those where it was red (once each), the same of pull requests (one with any such session red), pull requests whose merge commit's CI is known and those where it failed, and those where it is not known.
POST /prs/match admin Match lines again against the sessions held now, without a report. With repo (its whole name) and number: one pull request, answered with its figures, or 409 with the code needs_report when it was last reported before that could be done. Otherwise the filters of GET /prs (repo, repo_is, state, since), for up to 100 at a time: send the answer's started back, with the same filters, until remaining is 0. Each pull request is matched and stored on its own; failed counts those of a request that could not be, which stay among the remaining.

A report may name who sent it: reporter, { "name": "sessionly-action", "version": "0.2.0" }. The name is 1 to 50 characters. The version is three numbers of at most 9 digits each, or those with a pre-release suffix such as 0.3.0-rc.1 (0.10.0 counts; v0.2.0, 2024.11 and 1.2.1000000000 do not). A version that does not fit is left out and the name is still kept. A reporter that is present but does not fit is stored as unknown, which is not the Action and is not treated as an older one. Only a report that leaves reporter out, or sends null, is stored with no name. The report is stored either way. The version is kept only when the name is sessionly-action. The three numbers are compared, and when they are equal a pre-release is older than the release. A pre-release of a higher version is not an older Action. A sessionly-action version the server cannot read is not one either. Another client's report is stored under its own name, and is not treated as an older Action. A report that names no reporter still is: an Action from before this was sent. A row stored before a report said who sent it is marked with an empty name, which a client cannot send, and is not judged. GET /prs/detail gives local_reviews.each too: each review run of the pull request's sessions, oldest first, with its time, command, effort, where it ran, how it went, cost, findings and the session it ran in.

GET /prs and GET /prs/detail give review_split: whose feedback the pull request's rounds followed (see Rounds by who asked). The list has its rounds and unknown; the detail has reviewers, author and round_authors too. reviewers has one entry for everyone in its reviews and comments but its author, bots first: author, bot, reviews, changes_requested, inline (comments on the diff that start a thread), replies, conversation, first_at and last_at. author is the same entry for the author's own comments and replies, which are answers and not review, or null with none. rounds is { bots, people, both }, which add up to review_rounds, and round_authors lists for each round who it followed, as { author, bot }. When that is not known, both are null and unknown says why: action_did_not_say (last reported by an Action before 0.4.0, which counted some rounds) or not_kept (by one that says, with nothing of it kept: its next report brings it, unless the pull request has more rounds or logins than a report may name, below). In the list, review_split is null while none is stored of the pull request's last report: on one from before the upgrade, or whose last report a server of another version stored, until the server has gone through it, when it starts and every hour. The detail always has one: it is worked out as it is read where none is stored. GET /prs/summary gives by_reviewer: one row for each bot that reviewed (author its login) and one for all people (author null), with pulls, the sums of those counts, rounds_alone, rounds_shared and pulls_with_rounds_known, the pull requests the two round figures are over; and reviewers_pending, the pull requests in the filter that by_reviewer leaves out because their review_split is null.

A report (PUT /prs) may carry review_round_authors: for each of its review_rounds, oldest first, a list of { author, bot } (bot true or false), at most 300 rounds of 1 to 50 logins, and 2,000 logins in all. One that does not fit, or is not as many rounds as review_rounds, is refused with the report (422).

GET /prs and GET /prs/detail give reporter_version (null when none was kept) and reporter_older. GET /prs/detail also gives reporter_current, the version of the Action this server knows, and repo_reporter_older: the repository's most recent report from the Action, or that named no reporter, is from an older Action, and none from the last 30 days came from the current Action or a newer one. A pull request another client reported is skipped, including one whose reporter did not fit, and a repository with no such report is not old. repo_reporter_version is the version that most recent report named, which is what the repository notice quotes. A current report keeps the notice off for 30 days, whichever pull request it was, and a re-run of an older one in that time does not bring it back. GET /prs/summary gives older_actions, the repositories in the filter that report with an older Action by that rule.

history on GET /prs/detail is the figures each time they moved, newest first, 50 at most. A row is kept when the lines, the agent lines, the commits, or the set of sessions and their line counts differ from the latest one, and when a newer Action reports the same figures. Each row has at, event (opened, synchronize, review, closed, manual, or match when the lines were matched again on the server), commits, lines, agent_lines, sessions (each session's key and its lines, no hashes), reporter_version (the version that produced that row), and change against the row before it: the lines, agent lines and commits before and after, sessions_added, sessions_gone, sessions_changed, and reason. The reason is, in this order: new commits (2 new commits); fewer commits (2 commits removed); sessions uploaded since (1 session uploaded since: +17 agent lines); sessions no longer matched; a newer Action (Action 0.2.0, was 0.1.0, or Action 0.2.0 when the one before named no version); a session whose line count changed (1 session's lines changed: +1 agent lines); otherwise matched again, nothing new. The first row's reason is null. A pull request stored before this was kept has one row, from the figures it had then. A report that only brings a newer Action is a row of its own, and the row before it keeps the version that produced those figures.

Tokens and people

Who
GET /me person Who the token is, and in which organisation. owner is true when they signed in as the organisation's owner. A token for a machine is not an owner, even the owner's own. On a server that is not hosted, the admin token from the environment and the dashboard (POST /auth/open) are the owner and nobody else is; opened is true for the dashboard's.
GET /me/tokens person Their own tokens.
POST /me/tokens person A new member token for a machine of theirs: {"name": "…"}, optional. The token is in the answer, once.
DELETE /me/tokens/{id} person Revokes one of them.
DELETE /auth/session person Signs out: ends a sign-in made with Google or GitHub, or the session the dashboard of a server of your own opened with.
GET /tokens admin Every token of the organisation (never the tokens themselves).
POST /tokens admin A new token: {"email": "…", "role": "member", "name": "…"}. The role is admin, member (the default), ci or env.
DELETE /tokens/{id} admin Revokes one.
GET /users admin The people who may sign in.
POST /users admin Adds one: {"email": "…", "role": "member"}, the role admin or member. 409 where neither Google nor GitHub is set up (always, on a server that is not hosted), or for someone already there; 30 an hour at most.
DELETE /users/{id} admin Removes one. Their sessions stay. With ?data=true, their sessions are deleted too, and so are the repositories they stopped; pull requests stay. A session filed under their address is not stored while they stay removed.
DELETE /org owner, hosted Deletes the organisation. The body is {"name": "<the organisation's name>"}. The wrong name is 400. The right name is 204: every token of the organisation is then 401, and it is no longer offered at sign-in. The rows are removed after 7 days. Not offered on a server that is not hosted (403).
POST /users/{id}/forget-account admin Lets a person in with another Google or GitHub account than the one they have used.
GET /export owner The organisation as JSON lines (application/x-ndjson), a download named sessionly-<org>-<date>.jsonl. One line each for the organisation (with the time and the server's version: the release it was built from, or unreleased), each person (no sign-in account ids), each session (its columns and the payload as uploaded), each pull request (every column), the lines each session has in a pull request, each earlier set of figures for a pull request, what was counted after merge, each later commit kept, each head with what CI said of it, each branch's reading of later commits, each stopped repository, and each token (never the hash). Once every ten minutes per organisation (429, code rate_limited). An admin or a member is 403. A token for a machine is not an owner, even the owner's. On a server that is not hosted, the admin token from the environment is.

Without a token

GET /healthz {"ok": true} while the server runs. (Not under /api/v1.)
GET /readyz The same once the database has answered; 503 if it does not. (Not under /api/v1.)
GET /api/v1/auth/options How people can sign in here: the providers set up (on a hosted service only), whether this is a hosted service, and noSignIn, true where the dashboard opens without signing in.
POST /api/v1/auth/open On a server that is not hosted, a session for the dashboard as its admin (SESSIONLY_ADMIN_EMAIL), which lasts a week: what the dashboard opens with, as nobody signs in there. Asked by the dashboard only, as JSON. 404 on a hosted service.
GET /api/v1/telemetry What the dashboard needs to count its pages, or null where that is off.
/api/v1/auth/… The round trip of signing in with Google or GitHub, which the dashboard makes. Not for other callers.

The ee server

Who
GET /license person The license's state.
POST /license admin Installs one: {"license": "<the file's text>"}.
GET /policy person The organisation's content policy. Needs a license with that feature.
PUT /policy admin Sets it: {"content": "metadata"} or "previews".
GET /outcomes/policy person What the organisation sets for every repository's Action: {fix_words, bug_labels, ci_ignore, ci_only, updated_by, updated_at}, the four fields each a list or null, updated_by (the admin's email) and updated_at a string or null, all null when none is set. Needs a license with outcome_policy (an expired one too) while none is set; one that is set is shown whatever the license.
PUT /outcomes/policy admin Sets it, whole: each field a list or null (left to each repository's inputs); none empty; updated_by and updated_at, as GET answers them, are passed over. Words and labels at most 64, each one word of letters and digits of at most 32, kept lowercased (as written where its lowercase is not one word, as İptal); check names at most 50 of at most 200 characters, * for any text (at most 4, and not * alone); at most 256 KB. Needs the license active or in its grace.
DELETE /outcomes/policy admin Clears it: every field each repository's again. Whatever the license, as the Action goes by the policy while one with the feature is installed, an expired one too.
GET /outcomes/alerts/hooks admin The organisation's alert hooks: {hooks: [{id, url, events, events_since, fix_count, likely_only, disabled_at, failing_since, created_by, created_at, updated_by, updated_at}]}, the URL shown only as far as its host, the secret never. Needs a license with outcome_alerts (an expired one too).
POST /outcomes/alerts/hooks admin Adds one: {url, events, fix_count?, likely_only?}, url an https:// address on the internet (no user, password or fragment; not a name only a network of its own has) of at most 2,048 characters, events of revert, base_red, fixes, fix_count 1 to 100. Answers it with secret, which is never answered again. At most 10 (409 too_many_hooks). Changes like this one need the license active or in its grace.
PATCH /outcomes/alerts/hooks/<id> admin Changes url, events, fix_count, likely_only, or enabled (false turns it off and fails what waits; true turns it on, told of events from then on). An event turned on is told of from then on.
DELETE /outcomes/alerts/hooks/<id> admin Removes it, with its deliveries: waiting, sent and failed.
POST /outcomes/alerts/hooks/<id>/secret admin A new secret, answered once.
POST /outcomes/alerts/hooks/<id>/test admin Queues a test event for the job, which looks every minute: 202 {delivery, queued: true}. At most 3 waiting (409 tests_pending); none to a hook turned off (409 hook_disabled).
GET /outcomes/alerts/deliveries?hook= admin The last 50 deliveries: {deliveries: [{delivery, hook, event, repo, number, sha, status, attempts, next_at, last_status, last_error, created_at, finished_at}]}, status one of pending, sent, failed, dropped.

See Editions and license.

The types

The payload types in packages/schema are generated from schema/upload.schema.json, which is generated from the Rust types. pnpm gen regenerates them and a test fails if they are stale. A value of a field the schema gives a fixed set for (status, outcome and so on) that the server does not know is accepted as it is.