{
  "openapi": "3.1.0",
  "info": {
    "title": "Hod API",
    "description": "The public API of a Hod server: trigger, read, list, cancel and rerun runs, read jobs and their logs, and receive forge webhooks. Until Hod 0.1, v1 may change in ways that break clients.",
    "version": "v1"
  },
  "paths": {
    "/api/v1/invites/accept": {
      "post": {
        "tags": [
          "members"
        ],
        "summary": "Join an org through an invite link.",
        "description": "Only from a signed-in browser session: a personal token or the admin\ntoken can't. A member keeps any higher role they had. An invite that\ndoesn't exist, is used up, has expired or was revoked gets one answer,\n404 with the code `invite_invalid`.",
        "operationId": "accept_invite",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AcceptInvite"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AcceptedInvite"
                }
              }
            }
          },
          "403": {
            "description": "Not a user's browser session",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No live invite with that secret (`invite_invalid`)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}": {
      "get": {
        "tags": [
          "members"
        ],
        "summary": "Get an org's settings.",
        "operationId": "get_org",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Org"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "members"
        ],
        "summary": "Change an org's settings.",
        "operationId": "update_org",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateOrg"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Org"
                }
              }
            }
          },
          "400": {
            "description": "A role rule that doesn't check",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Not an owner of the org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/audit": {
      "get": {
        "tags": [
          "members"
        ],
        "summary": "Read an org's audit log, newest first.",
        "operationId": "list_audit",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Most events to return: 50 by default, at most 500.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` from the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "actor",
            "in": "query",
            "description": "Only events done by this user (an ID), or by the admin token\n(`admin`).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "action",
            "in": "query",
            "description": "Only these actions, comma-separated, such as `OrgMembers,Runners`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "target",
            "in": "query",
            "description": "Only events whose target starts with this, such as `app/`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "Only events at or after this time (RFC 3339).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "before",
            "in": "query",
            "description": "Only events before this time (RFC 3339).",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditPage"
                }
              }
            }
          },
          "400": {
            "description": "Bad limit or cursor",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Not an owner of the org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/components/resolve": {
      "post": {
        "tags": [
          "components"
        ],
        "summary": "Resolve published components under the org's policy: the version each\nreference takes, or why it can't be locked.",
        "operationId": "resolve_components",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ResolveComponents"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResolvedComponents"
                }
              }
            }
          },
          "400": {
            "description": "Too many references",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/components/{digest}/files": {
      "get": {
        "tags": [
          "components"
        ],
        "summary": "A component's files, a gzipped tar, from the server's cache: for\n`hod local run` on a machine that can't reach the registry.",
        "operationId": "get_component_files",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "digest",
            "in": "path",
            "description": "The manifest digest, sha256:<hex>",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The files layer",
            "content": {
              "application/gzip": {}
            }
          },
          "404": {
            "description": "Not in the org's cache: lock it with hod component update",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/events": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Follow changes to runs and jobs as Server-Sent Events. Experimental.",
        "description": "Events hint at changes rather than carry them: `run` (`RunHint`) and\n`job` (`JobHint`) events give a row's new `version` and the fields a\nlist shows, and anything else is fetched. Hints may come more than\nonce and out of order; drop any older than the version held. The\nstream starts with `hello` (`Hello`, with the server's time); fetch\nwhat is shown after it. `resync` means changes may have been missed:\nfetch again. Nothing is replayed, so after a reconnect, fetch again\ntoo. A comment every 15 s keeps idle streams open through proxies. The\nstream ends when access in the org changes or the session ends:\nreconnect, and be checked again.",
        "operationId": "stream_events",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "query",
            "description": "Only this project's runs and jobs.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "run",
            "in": "query",
            "description": "Only this run of `project` and its jobs.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`hello`, then `run` (`RunHint`), `job` (`JobHint`) and `resync` events",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "`run` without `project`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or run",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/orgs/{org}/invites": {
      "get": {
        "tags": [
          "members"
        ],
        "summary": "List an org's invite links, newest first, used and revoked ones\nincluded. Never their secrets.",
        "operationId": "list_invites",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InviteList"
                }
              }
            }
          },
          "403": {
            "description": "Not an owner of the org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "members"
        ],
        "summary": "Make an invite link.",
        "description": "The answer holds the link, with its secret after `#`, this once. Send\nit to the people to invite: whoever opens it and signs in joins the org\nwith its role, as many times as it allows, until it expires.",
        "operationId": "create_invite",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateInvite"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedInvite"
                }
              }
            }
          },
          "400": {
            "description": "Uses or days out of range",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Not an owner of the org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/invites/{id}": {
      "delete": {
        "tags": [
          "members"
        ],
        "summary": "Revoke an invite link: nobody else joins with it. Those who joined stay.",
        "operationId": "revoke_invite",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Invite ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked"
          },
          "403": {
            "description": "Not an owner of the org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, or no live invite with that ID",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/members": {
      "get": {
        "tags": [
          "members"
        ],
        "summary": "List an org's members.",
        "operationId": "list_org_members",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OrgMemberList"
                }
              }
            }
          },
          "403": {
            "description": "Not an owner of the org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/members/{user}": {
      "put": {
        "tags": [
          "members"
        ],
        "summary": "Give a user a role in an org, or change it.",
        "operationId": "set_org_member",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "user",
            "in": "path",
            "description": "User ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetOrgMember"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "The user has the role"
          },
          "403": {
            "description": "Not an owner of the org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org or user",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "It would leave the org without an owner",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "members"
        ],
        "summary": "Remove a user from an org, with their roles on its projects.",
        "operationId": "remove_org_member",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "user",
            "in": "path",
            "description": "User ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removed"
          },
          "403": {
            "description": "Not an owner of the org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, user or membership",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The org's last owner",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/projects": {
      "get": {
        "tags": [
          "projects"
        ],
        "summary": "List an org's projects, sorted by name.",
        "operationId": "list_projects",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "repo",
            "in": "query",
            "description": "Only the project for this repository, whatever URL names it:\n`git@github.com:acme/app.git` finds the project for\n`https://github.com/acme/app`. Host and path are compared without\ncase, scheme, user, port or `.git`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "history",
            "in": "query",
            "description": "Add each project's last N runs on its default branch (at most 50),\nand the job slowest on average over them.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectList"
                }
              }
            }
          },
          "400": {
            "description": "`repo` is not a repository URL",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ]
      }
    },
    "/api/v1/orgs/{org}/projects/{project}": {
      "patch": {
        "tags": [
          "projects"
        ],
        "summary": "Change a project's settings, such as whether it is public.",
        "operationId": "update_project",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateProject"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Project"
                }
              }
            }
          },
          "403": {
            "description": "No manage role on the project",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org or project",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/members": {
      "get": {
        "tags": [
          "members"
        ],
        "summary": "List the roles granted on a project.",
        "operationId": "list_project_members",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProjectMemberList"
                }
              }
            }
          },
          "403": {
            "description": "No manage role on the project",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org or project",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/members/{user}": {
      "put": {
        "tags": [
          "members"
        ],
        "summary": "Give an org member a role on a project, or change it.",
        "operationId": "set_project_member",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "user",
            "in": "path",
            "description": "User ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetProjectMember"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "The user has the role"
          },
          "403": {
            "description": "No manage role on the project",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or user",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The user isn't a member of the org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "members"
        ],
        "summary": "Take a member's own role on a project away. The org's default project\nrole still applies.",
        "operationId": "remove_project_member",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "user",
            "in": "path",
            "description": "User ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Removed"
          },
          "403": {
            "description": "No manage role on the project",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, user or role",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "List a project's runs, newest first, with their jobs' summaries.",
        "operationId": "list_project_runs",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ref",
            "in": "query",
            "description": "Only runs for this branch (`main`) or full ref (`refs/tags/v1.0`).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sha",
            "in": "query",
            "description": "Only runs of this commit (the full SHA).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only runs in one of these states, comma-separated: `waiting`,\n`running`, `passed`, `failed`, `cancelled`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "trigger",
            "in": "query",
            "description": "Only runs this event type started: `push`, `pull_request`, `tag`,\n`schedule` or `manual`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mine",
            "in": "query",
            "description": "Only runs the caller started (`true`).",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Text to match: `#12` or `12` the run number, 4 or more hex digits a\ncommit SHA prefix, and otherwise a substring of the branch or title,\nignoring case.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branch_not",
            "in": "query",
            "description": "Leave out runs on branches this glob matches, such as `renovate/*`\n(`*` is any run of characters).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Most runs to return: 50 by default, at most 500.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` from the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunPage"
                }
              }
            }
          },
          "400": {
            "description": "Bad limit or cursor",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org or project",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ]
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Get a run and its jobs.",
        "operationId": "get_run",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or run",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ]
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/cancel": {
      "post": {
        "tags": [
          "runs"
        ],
        "summary": "Cancel a run.",
        "description": "Jobs that haven't started never will, and running jobs are stopped.\nCancelling a finished run changes nothing.",
        "operationId": "cancel_run",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The run after cancelling",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or run",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Get a job of a run, with its attempts.",
        "operationId": "get_job",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Job"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run or job",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ]
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/groups": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Read a job's log's groups. Experimental.",
        "description": "The setup and each step are top-level groups; groups the program made\n(`::group::`) are inside its step. Each has its row range; a group that\nis still open has no `last`. Steps' groups are titled with their names.",
        "operationId": "get_groups",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The group tree",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogGroups"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/log": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Read a job's log from a byte offset.",
        "description": "Poll with the offset from the `hod-log-next-offset` header to follow a\nrunning job, until `hod-log-complete` is `true`. Each attempt has its\nown log; `attempt` picks an earlier one.",
        "operationId": "get_log",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Byte offset to read from; 0 by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Log bytes from the offset, ANSI codes kept; may be empty",
            "headers": {
              "hod-log-complete": {
                "schema": {
                  "type": "boolean"
                },
                "description": "True when the attempt has ended and this response reaches the end of its log"
              },
              "hod-log-next-offset": {
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "description": "Offset to read from next"
              }
            },
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ]
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/log/stream": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Follow a job's log as Server-Sent Events.",
        "description": "Sends the attempt's log from the offset, then live, as `log` events\n(`LogText`) whose `id` is the byte offset after them; reconnecting with\n`Last-Event-ID` resumes exactly there. Once the attempt has ended and\nits whole log was sent, an `end` event (`LogEnd`) closes the stream. A\ncomment every 15 s keeps idle streams open through proxies.\nThe stream also ends when access in the org changes or the session\nends: reconnect from the last event, and be checked again.",
        "operationId": "stream_log",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Last-Event-ID",
            "in": "header",
            "description": "Offset to resume from; wins over `offset`",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Byte offset to read from; 0 by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`log` events with `LogText` data, then one `end` event with `LogEnd` data",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ]
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/rows": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Read a job's log as rows. Experimental.",
        "description": "The log as the server's terminal model left it: one row per line, with\na line number that never changes, its text as styled spans and as\n`plain` text, its step and group, and the program's marks\n(`::error::`, `::warning::`, `::notice::`). A progress bar redrawn many\ntimes is one row in its last state. Rows reaching the end of a running\nlog come with its `live` area, the last lines, which may still change.\n`tail` opens a log at its end.",
        "operationId": "get_rows",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "The first row, from 1; 1 by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "The last row; at most 5,000 rows after `from` by default and at most.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "tail",
            "in": "query",
            "description": "The last `tail` final rows instead (at most 5,000), and the live\narea: for opening a log at its end.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "fields",
            "in": "query",
            "description": "`plain` leaves out spans and styles: rows' text only.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The rows, the styles they use, and the live area",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogRows"
                }
              }
            }
          },
          "400": {
            "description": "`tail` with `from` or `to`, or an unknown `fields`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/rows/overview": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Summarise a job's log for a minimap. Experimental.",
        "description": "The rows in `buckets` runs of about the same size, each with its time\nrange, its rows marked as errors and warnings, and its step; and the\nfirst row marked as an error.",
        "operationId": "get_overview",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buckets",
            "in": "query",
            "description": "How many buckets: 200 by default, at most 2,000.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The log in buckets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogOverview"
                }
              }
            }
          },
          "400": {
            "description": "`buckets` out of range",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/rows/search": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Search a job's log. Experimental.",
        "description": "Finds rows whose `plain` text matches `q`, across the whole log,\nfolded groups included; the live area isn't searched. Plain text by\ndefault, ignoring case; `regex` and `case` change that. Hits come in\norder with where they match; `next` says where to go on from.",
        "operationId": "search_rows",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "The text to find.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "regex",
            "in": "query",
            "description": "`q` is a regular expression (Rust's `regex` syntax); false by\ndefault.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "case",
            "in": "query",
            "description": "Upper and lower case differ; false by default.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "The first row to search, from 1; 1 by default. Go on from a\nresponse's `next`.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "The most hits to return: 100 by default, at most 1,000.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching rows",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogSearch"
                }
              }
            }
          },
          "400": {
            "description": "An empty `q`, or a regular expression that isn't one",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/rows/stream": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Follow a job's log rows as Server-Sent Events. Experimental.",
        "description": "`rows` events (`LogRowsEvent`) carry rows that became final, in order,\nwith the styles they use that the stream hasn't sent; their `id` is the\nlast row's number, so reconnecting with `Last-Event-ID` resumes exactly\nthere. `live` events (`LogLive`) carry the live area whenever it\nchanges, replacing the one before. Once the attempt has ended and every\nrow was sent, an `end` event (`LogEnd`) closes the stream.\nThe stream also ends when access in the org changes or the session\nends: reconnect from the last event, and be checked again.",
        "operationId": "stream_rows",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Last-Event-ID",
            "in": "header",
            "description": "The last row held; wins over `after`",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "The last row already held: the stream starts after it; 0 by\ndefault. `Last-Event-ID` wins over it.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "fields",
            "in": "query",
            "description": "`plain` leaves out spans and styles.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`rows` (`LogRowsEvent`) and `live` (`LogLive`) events, then one `end` event (`LogEnd`)",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "An unknown `fields`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/services/{service}/groups": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Read a job's service's log's groups. Experimental.",
        "description": "The groups the service's program made (`::group::`).",
        "operationId": "get_service_groups",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "service",
            "in": "path",
            "description": "Service name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The group tree",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogGroups"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job, service or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/services/{service}/log": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Read a job's service's log from a byte offset.",
        "description": "Like the job's log (`…/jobs/{job}/log`): poll with the offset from the\n`hod-log-next-offset` header until `hod-log-complete` is `true`. A\nservice's log is what it wrote while its job ran.",
        "operationId": "get_service_log",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "service",
            "in": "path",
            "description": "Service name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Byte offset to read from; 0 by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Log bytes from the offset, ANSI codes kept; may be empty",
            "headers": {
              "hod-log-complete": {
                "schema": {
                  "type": "boolean"
                },
                "description": "True when the attempt has ended and this response reaches the end of the log"
              },
              "hod-log-next-offset": {
                "schema": {
                  "type": "integer",
                  "format": "int64",
                  "minimum": 0
                },
                "description": "Offset to read from next"
              }
            },
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job, service or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ]
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/services/{service}/log/stream": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Follow a job's service's log as Server-Sent Events.",
        "description": "The same events as the job's log stream (`…/jobs/{job}/log/stream`).",
        "operationId": "stream_service_log",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "service",
            "in": "path",
            "description": "Service name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Last-Event-ID",
            "in": "header",
            "description": "Offset to resume from; wins over `offset`",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "offset",
            "in": "query",
            "description": "Byte offset to read from; 0 by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`log` events with `LogText` data, then one `end` event with `LogEnd` data",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job, service or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ]
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/services/{service}/rows": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Read a job's service's log as rows. Experimental.",
        "description": "Like the job's (`…/jobs/{job}/rows`); a service's log has no steps.",
        "operationId": "get_service_rows",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "service",
            "in": "path",
            "description": "Service name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "The first row, from 1; 1 by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "to",
            "in": "query",
            "description": "The last row; at most 5,000 rows after `from` by default and at most.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "tail",
            "in": "query",
            "description": "The last `tail` final rows instead (at most 5,000), and the live\narea: for opening a log at its end.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "fields",
            "in": "query",
            "description": "`plain` leaves out spans and styles: rows' text only.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The rows, the styles they use, and the live area",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogRows"
                }
              }
            }
          },
          "400": {
            "description": "`tail` with `from` or `to`, or an unknown `fields`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job, service or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/services/{service}/rows/overview": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Summarise a job's service's log for a minimap. Experimental.",
        "description": "Like the job's (`…/jobs/{job}/rows/overview`).",
        "operationId": "get_service_overview",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "service",
            "in": "path",
            "description": "Service name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "buckets",
            "in": "query",
            "description": "How many buckets: 200 by default, at most 2,000.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The log in buckets",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogOverview"
                }
              }
            }
          },
          "400": {
            "description": "`buckets` out of range",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job, service or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/services/{service}/rows/search": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Search a job's service's log. Experimental.",
        "description": "Like the job's (`…/jobs/{job}/rows/search`).",
        "operationId": "search_service_rows",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "service",
            "in": "path",
            "description": "Service name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "The text to find.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "regex",
            "in": "query",
            "description": "`q` is a regular expression (Rust's `regex` syntax); false by\ndefault.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "case",
            "in": "query",
            "description": "Upper and lower case differ; false by default.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "from",
            "in": "query",
            "description": "The first row to search, from 1; 1 by default. Go on from a\nresponse's `next`.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "The most hits to return: 100 by default, at most 1,000.",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Matching rows",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LogSearch"
                }
              }
            }
          },
          "400": {
            "description": "An empty `q`, or a regular expression that isn't one",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job, service or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/jobs/{job}/services/{service}/rows/stream": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Follow a job's service's log rows as Server-Sent Events. Experimental.",
        "description": "The same events as the job's (`…/jobs/{job}/rows/stream`).",
        "operationId": "stream_service_rows",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          },
          {
            "name": "job",
            "in": "path",
            "description": "Job name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "service",
            "in": "path",
            "description": "Service name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "Last-Event-ID",
            "in": "header",
            "description": "The last row held; wins over `after`",
            "required": false,
            "schema": {
              "type": [
                "integer",
                "null"
              ],
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "after",
            "in": "query",
            "description": "The last row already held: the stream starts after it; 0 by\ndefault. `Last-Event-ID` wins over it.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int64",
              "minimum": 0
            }
          },
          {
            "name": "fields",
            "in": "query",
            "description": "`plain` leaves out spans and styles.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "attempt",
            "in": "query",
            "description": "Which attempt's log: the latest by default.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "`rows` (`LogRowsEvent`) and `live` (`LogLive`) events, then one `end` event (`LogEnd`)",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "An unknown `fields`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project, run, job, service or attempt",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/runs/{number}/rerun": {
      "post": {
        "tags": [
          "runs"
        ],
        "summary": "Rerun an ended run's failed jobs, or all of its jobs.",
        "description": "Starts the run's next attempt (`attempt` goes up by one). With\n`{\"jobs\": \"failed\"}`, the default (an empty body works too), the jobs\nthat ended with `failure`, `error`, `cancelled` or `timed_out` run again,\nwith every job that needs them; jobs that succeeded keep their results\nand outputs. With `{\"jobs\": \"all\"}`, every job runs again.",
        "operationId": "rerun_run",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "number",
            "in": "path",
            "description": "Run number within the project",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int64"
            }
          }
        ],
        "requestBody": {
          "description": "Which jobs; `failed` when absent",
          "content": {
            "application/json": {
              "schema": {
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/RerunRequest"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The run, in its new attempt",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "400": {
            "description": "Malformed body",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or run",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The run hasn't ended",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "No job failed: nothing to rerun",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/schedules": {
      "post": {
        "tags": [
          "schedules"
        ],
        "summary": "Create a schedule. The cron, time zone and branch are checked, and the\npipeline at the branch's head is compiled: if it doesn't compile, or the\nrepository can't be read now, the schedule is still created, with\n`warnings`.",
        "operationId": "create_schedule",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateSchedule"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Schedule"
                }
              }
            }
          },
          "400": {
            "description": "Bad name, cron, time zone, catch-up or branch",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org or project",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "The project has a schedule with that name",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/schedules/{name}": {
      "get": {
        "tags": [
          "schedules"
        ],
        "summary": "A schedule, with its next fire times and latest fire.",
        "operationId": "get_schedule",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Schedule name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Schedule"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or schedule",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ]
      },
      "delete": {
        "tags": [
          "schedules"
        ],
        "summary": "Delete a schedule and its fires. Its runs stay.",
        "operationId": "delete_schedule",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Schedule name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "description": "No such org, project or schedule",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "schedules"
        ],
        "summary": "Change a schedule. Absent fields stay as they are. A new cron or time\nzone moves the next fire time; checks and warnings are as on create.",
        "operationId": "update_schedule",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Schedule name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSchedule"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Schedule"
                }
              }
            }
          },
          "400": {
            "description": "Bad cron, time zone, catch-up or branch",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or schedule",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/schedules/{name}/fires": {
      "get": {
        "tags": [
          "schedules"
        ],
        "summary": "A schedule's fires, newest first: when each slot fired and what came of\nit, skipped slots included.",
        "operationId": "list_fires",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Schedule name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Most fires to return: 50 by default, at most 500.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/FireList"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or schedule",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ]
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/schedules/{name}/pause": {
      "post": {
        "tags": [
          "schedules"
        ],
        "summary": "Pause a schedule: no slot fires until it resumes. Idempotent.",
        "operationId": "pause_schedule",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Schedule name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Schedule"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or schedule",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/schedules/{name}/resume": {
      "post": {
        "tags": [
          "schedules"
        ],
        "summary": "Resume a paused schedule from its next slot after now: slots while it\nwas paused don't catch up. Idempotent.",
        "operationId": "resume_schedule",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Schedule name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Schedule"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or schedule",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/schedules/{name}/run": {
      "post": {
        "tags": [
          "schedules"
        ],
        "summary": "Run a schedule now, paused or not, whatever `only_if_changed` says. The\nrun starts in the background; its fire says which run it is.",
        "operationId": "run_schedule",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Schedule name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "202": {
            "description": "The fire, pending",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Fire"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or schedule",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/projects/{project}/secrets/{name}": {
      "get": {
        "tags": [
          "secrets"
        ],
        "summary": "A project's secret, without its value.",
        "operationId": "get_project_secret",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Secret name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Secret"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or secret",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "secrets"
        ],
        "summary": "Create a project's secret or replace its value. It wins over an\norg-wide secret of the same name. 201 when created, 200 when replaced.",
        "operationId": "set_project_secret",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Secret name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetSecret"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Replaced",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Secret"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Secret"
                }
              }
            }
          },
          "400": {
            "description": "Bad name, value or rule",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org or project",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "It kept changing while it was set; try again",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The server has no key to store secrets with",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "secrets"
        ],
        "summary": "Delete a project's secret. Its releases stay in the audit trail.",
        "operationId": "delete_project_secret",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Secret name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "description": "No such org, project or secret",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "secrets"
        ],
        "summary": "Change a project's secret's rule, keeping its value.",
        "operationId": "update_project_secret",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "path",
            "description": "Project name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Secret name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSecret"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Secret"
                }
              }
            }
          },
          "400": {
            "description": "Bad rule",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, project or secret",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/role-rule/try": {
      "post": {
        "tags": [
          "members"
        ],
        "summary": "Try a role rule on the claims of your own sign-in, without saving it.",
        "description": "The claims are those the provider gave at the sign-in that made the\ncaller's browser session; sessions from sign-in codes or the admin\ntoken have none. GitHub teams are only fetched at sign-in once a saved\nrule names `teams`.",
        "operationId": "try_role_rule",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TryRoleRule"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RoleRuleTrial"
                }
              }
            }
          },
          "400": {
            "description": "A rule that doesn't check, or a session without sign-in claims (`no_claims`)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Not an owner of the org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/runner-tokens": {
      "get": {
        "tags": [
          "runners"
        ],
        "summary": "List an org's registration tokens, newest first, without their secrets.",
        "operationId": "list_runner_tokens",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunnerTokenList"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "runners"
        ],
        "summary": "Create a registration token for a runner pool.",
        "description": "`trust` says which runs its runners take: `protected` runners take only\nthe jobs of default-branch and tag runs, `unprotected` ones only the\nothers, such as pull requests'. Keep the two kinds on separate machines.\n\nThe response is the only place the secret (`token`, starting with\n`hod_reg_`) appears; the server keeps only its hash. Runners register with\nit (`HOD_RUNNER_TOKEN=<token> hod runner start`).",
        "operationId": "create_runner_token",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateRunnerToken"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The new token, with its secret",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunnerToken"
                }
              }
            }
          },
          "400": {
            "description": "Invalid pool name or expiry",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/runner-tokens/{id}": {
      "delete": {
        "tags": [
          "runners"
        ],
        "summary": "Delete a registration token. Runners that registered with it keep\nrunning; no new runner can register with it.",
        "operationId": "delete_runner_token",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Token ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "description": "No such org or token, or it is the server's configured token",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/runners": {
      "get": {
        "tags": [
          "runners"
        ],
        "summary": "List the org's runners: those not gone, then those gone in the last day.",
        "operationId": "list_runners",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunnerList"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/runners/{id}": {
      "delete": {
        "tags": [
          "runners"
        ],
        "summary": "Deregister a runner.",
        "description": "Its access tokens stop working at once and its key is refused, so it\ncan't get new ones; it has to register again with a registration token.\nJobs it was running are requeued when their leases expire.",
        "operationId": "delete_runner",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Runner ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deregistered"
          },
          "404": {
            "description": "No such org, or no registered runner with that ID",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/runs": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "List an org's runs, newest first, with their jobs' summaries.",
        "operationId": "list_runs",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "query",
            "description": "Only this project's runs.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "ref",
            "in": "query",
            "description": "Only runs for this branch (`main`) or full ref (`refs/tags/v1.0`).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "sha",
            "in": "query",
            "description": "Only runs of this commit (the full SHA).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "status",
            "in": "query",
            "description": "Only runs in one of these states, comma-separated: `waiting`,\n`running`, `passed`, `failed`, `cancelled`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "trigger",
            "in": "query",
            "description": "Only runs this event type started: `push`, `pull_request`, `tag`,\n`schedule` or `manual`.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "mine",
            "in": "query",
            "description": "Only runs the caller started (`true`).",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "Text to match: `#12` or `12` the run number, 4 or more hex digits a\ncommit SHA prefix, and otherwise a substring of the branch or title,\nignoring case.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "branch_not",
            "in": "query",
            "description": "Leave out runs on branches this glob matches, such as `renovate/*`\n(`*` is any run of characters).",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Most runs to return: 50 by default, at most 500.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "description": "`next_cursor` from the previous page.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunPage"
                }
              }
            }
          },
          "400": {
            "description": "Bad limit or cursor",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ]
      },
      "post": {
        "tags": [
          "runs"
        ],
        "summary": "Start a manual run of a repository's branch or tag.",
        "description": "The run is of the ref's current commit; a `sha` that isn't it is\nrefused, so a commit can't run with a ref's secrets, OIDC claims and\ncache. The server fetches `.hod/pipeline.yaml` at that commit, compiles it, and\nstores the run with its jobs; jobs with nothing to wait for are queued at\nonce. The project is created on the first trigger for a repository URL,\nwhich needs the org's `member` role; an existing project's runs need its\n`run` role, also when another trigger created the project meanwhile.",
        "operationId": "trigger_run",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TriggerRun"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The new run, with its jobs",
            "headers": {
              "location": {
                "schema": {
                  "type": "string"
                },
                "description": "The run's URL path"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Run"
                }
              }
            }
          },
          "400": {
            "description": "Bad repository URL, SHA or ref, a SHA that isn't the ref's tip, or a pipeline that doesn't compile",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "422": {
            "description": "The repository, commit or pipeline file couldn't be fetched",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/schedules": {
      "get": {
        "tags": [
          "schedules"
        ],
        "summary": "List the org's schedules, or one project's, by project and name, with\ntheir next fire times and latest fire.",
        "operationId": "list_schedules",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "query",
            "description": "Only this project's schedules.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduleList"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ]
      }
    },
    "/api/v1/orgs/{org}/search": {
      "get": {
        "tags": [
          "runs"
        ],
        "summary": "Search projects, runs and failed jobs.",
        "description": "Projects match by name or repository URL; runs as the run lists' `q`\nfilter matches them; jobs are the failed jobs of the runs that matched.\nOnly what the caller may read is returned.",
        "operationId": "search",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "q",
            "in": "query",
            "description": "The text: a project's name or repository; a run's number (`#12`),\ncommit SHA prefix, branch or title.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "query",
            "description": "Only this project's runs and jobs.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Most results of each kind: 10 by default, at most 50.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SearchResults"
                }
              }
            }
          },
          "400": {
            "description": "Bad limit",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {},
          {
            "bearer_token": []
          },
          {
            "session_cookie": []
          }
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/orgs/{org}/secrets": {
      "get": {
        "tags": [
          "secrets"
        ],
        "summary": "List secrets, without values: the whole org's, or what one project's\nruns see.",
        "operationId": "list_secrets",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "project",
            "in": "query",
            "description": "Only what this project's runs see: its own secrets and the org's.",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SecretList"
                }
              }
            }
          },
          "404": {
            "description": "No such org or project",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/secrets/{name}": {
      "get": {
        "tags": [
          "secrets"
        ],
        "summary": "An org-wide secret, without its value.",
        "operationId": "get_org_secret",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Secret name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Secret"
                }
              }
            }
          },
          "404": {
            "description": "No such org or secret",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "put": {
        "tags": [
          "secrets"
        ],
        "summary": "Create an org-wide secret or replace its value. 201 when created, 200\nwhen replaced.",
        "operationId": "set_org_secret",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Secret name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SetSecret"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Replaced",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Secret"
                }
              }
            }
          },
          "201": {
            "description": "Created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Secret"
                }
              }
            }
          },
          "400": {
            "description": "Bad name, value or rule",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "It kept changing while it was set; try again",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "503": {
            "description": "The server has no key to store secrets with",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "delete": {
        "tags": [
          "secrets"
        ],
        "summary": "Delete an org-wide secret. Its releases stay in the audit trail.",
        "operationId": "delete_org_secret",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Secret name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Deleted"
          },
          "404": {
            "description": "No such org or secret",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "patch": {
        "tags": [
          "secrets"
        ],
        "summary": "Change an org-wide secret's rule, keeping its value.",
        "operationId": "update_org_secret",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "name",
            "in": "path",
            "description": "Secret name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateSecret"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Secret"
                }
              }
            }
          },
          "400": {
            "description": "Bad rule",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org or secret",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/tokens": {
      "get": {
        "tags": [
          "tokens"
        ],
        "summary": "List personal tokens in an org, newest first: yours, or with\n`all=true` everyone's (owners only). Never their secrets.",
        "operationId": "list_tokens",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "all",
            "in": "query",
            "description": "Everyone's tokens in the org (owners only), not just yours.",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PersonalTokenList"
                }
              }
            }
          },
          "403": {
            "description": "`all` without the owner role",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "tokens"
        ],
        "summary": "Mint a personal token for yourself.",
        "description": "Needs a browser session signed in under 10 minutes ago: a token can't\nmint another. The response is the only place the token appears.",
        "operationId": "create_token",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateToken"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The new token, shown this once",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedToken"
                }
              }
            }
          },
          "400": {
            "description": "A role above your own, or more days than the org allows",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not signed in, or signed in too long ago (code `reauth`)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "A token, or the admin token",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/tokens/cli-codes": {
      "post": {
        "tags": [
          "tokens"
        ],
        "summary": "Approve a token `hod login` asked for.",
        "description": "Needs a browser session signed in under 10 minutes ago. Answers where\nto send the browser: `hod login`'s address on 127.0.0.1, with a code\nthe CLI trades for the token within a minute.",
        "operationId": "create_cli_code",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateCliCode"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CliCodeRedirect"
                }
              }
            }
          },
          "400": {
            "description": "A bad port, state or challenge; a role above your own, or more days than the org allows",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Not signed in, or signed in too long ago (code `reauth`)",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "A token, or the admin token",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/tokens/{id}": {
      "delete": {
        "tags": [
          "tokens"
        ],
        "summary": "Revoke a personal token: your own, or as an owner anyone's in the org.\nIt stops working at once, and the streams it opened end.",
        "operationId": "revoke_token",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "id",
            "in": "path",
            "description": "Token ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "Revoked"
          },
          "404": {
            "description": "No such org, or no such token of yours",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/webhooks/deliveries": {
      "get": {
        "tags": [
          "webhooks"
        ],
        "summary": "List webhook deliveries, newest first: what each forge event did, and\nwhy an event started no run.",
        "operationId": "list_deliveries",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "description": "Most deliveries to return: 50 by default, at most 500.",
            "required": false,
            "schema": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          }
        ],
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeliveryList"
                }
              }
            }
          },
          "404": {
            "description": "No such org",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/orgs/{org}/webhooks/forgejo": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "summary": "Receive a Forgejo (or Gitea) webhook.",
        "description": "Configure it on the repository (or org) in Forgejo: this URL, content type\n`application/json`, the server's `HOD_FORGEJO_WEBHOOK_SECRET` as the\nsecret, and the push and pull request events. The body is signed with\nHMAC-SHA256 (`X-Forgejo-Signature`) instead of an admin token. Hod\nstores the delivery and answers at once; pushes and pull requests are\nprocessed in the background (`GET …/webhooks/deliveries` shows what\nhappened). A delivery ID already stored returns that delivery and starts\nnothing. Forgejo's \"Redeliver\" sends a new ID, so it starts a new run.",
        "operationId": "forgejo_webhook",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Forgejo-Signature",
            "in": "header",
            "description": "Hex HMAC-SHA256 of the body, keyed by the webhook secret",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Forgejo-Event",
            "in": "header",
            "description": "The event: push, pull_request, …",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Forgejo-Delivery",
            "in": "header",
            "description": "The delivery's ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "The forge's JSON payload",
          "content": {
            "application/json": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "A delivery already received",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Delivery"
                }
              }
            }
          },
          "202": {
            "description": "Stored: pending, or ignored with the reason",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Delivery"
                }
              }
            }
          },
          "400": {
            "description": "Not a webhook Forgejo sends, or a repository on another forge",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong signature",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, or no Forgejo configured",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {}
        ]
      }
    },
    "/api/v1/orgs/{org}/webhooks/github": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "summary": "Receive a GitHub App's webhook (design/forges.md, section 8).",
        "description": "Signed with the App's webhook secret. Answered at once: pushes and pull\nrequests are stored and become runs in the background; \"Re-run\" on a\ncheck run or suite reruns jobs. A repeat of a delivery that failed (GitHub's\n\"Redeliver\" keeps the ID) is processed again. The check run and suite\nevents that Hod's own check runs cause are answered without being\nstored.",
        "operationId": "github_webhook",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-Hub-Signature-256",
            "in": "header",
            "description": "`sha256=` and the hex HMAC-SHA256 of the body, keyed by the App's webhook secret",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-GitHub-Event",
            "in": "header",
            "description": "The event: push, pull_request, check_run, check_suite, …",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "X-GitHub-Delivery",
            "in": "header",
            "description": "The delivery's ID; a redelivery repeats it",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "GitHub's JSON payload",
          "content": {
            "application/json": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "A delivery already received",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Delivery"
                }
              }
            }
          },
          "202": {
            "description": "Stored: pending, or ignored with the reason; or a failed delivery, to process again",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Delivery"
                }
              }
            }
          },
          "204": {
            "description": "Nothing to do, and not stored: a check run or suite event that Hod's own check runs caused"
          },
          "400": {
            "description": "Not a webhook GitHub sends, or a repository elsewhere",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong signature",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, or no GitHub App configured",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {}
        ]
      }
    },
    "/api/v1/orgs/{org}/webhooks/gitlab": {
      "post": {
        "tags": [
          "webhooks"
        ],
        "summary": "Receive a GitLab webhook (design/forges.md, section 9).",
        "description": "Configure it on the project (or group) in GitLab: this URL, the push,\ntag push and merge request events, and the server's\n`HOD_GITLAB_SIGNING_TOKEN` as its signing token (GitLab 19.0 and\nlater: `webhook-signature`, checked with `webhook-id` and a\n`webhook-timestamp` at most 5 minutes off) or `HOD_GITLAB_WEBHOOK_SECRET`\nas its secret token (`X-Gitlab-Token`), or both. Answered at once; pushes\nand merge requests are processed in the background. GitLab's \"Resend\nRequest\" keeps the delivery's ID (`webhook-id`), so it starts nothing\nnew.",
        "operationId": "gitlab_webhook",
        "parameters": [
          {
            "name": "org",
            "in": "path",
            "description": "Org name",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-signature",
            "in": "header",
            "description": "Standard Webhooks signature: `v1,` and the base64 HMAC-SHA256 of `{webhook-id}.{webhook-timestamp}.{body}`",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "webhook-id",
            "in": "header",
            "description": "The delivery's ID; a retry or resend repeats it (or `Idempotency-Key`)",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "webhook-timestamp",
            "in": "header",
            "description": "When GitLab sent it, in Unix seconds",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "X-Gitlab-Token",
            "in": "header",
            "description": "The webhook's secret token",
            "required": false,
            "schema": {
              "type": [
                "string",
                "null"
              ]
            }
          },
          {
            "name": "X-Gitlab-Event",
            "in": "header",
            "description": "The event: Push Hook, Tag Push Hook, Merge Request Hook, …",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "GitLab's JSON payload",
          "content": {
            "application/json": {
              "schema": {
                "type": "string"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "A delivery already received",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Delivery"
                }
              }
            }
          },
          "202": {
            "description": "Stored: pending, or ignored with the reason",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Delivery"
                }
              }
            }
          },
          "400": {
            "description": "Not a webhook GitLab sends, or a project on another forge",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "401": {
            "description": "Missing or wrong signature or secret token, or a stale timestamp",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such org, or no GitLab configured",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {}
        ]
      }
    },
    "/api/v1/runner-downloads": {
      "get": {
        "tags": [
          "runners"
        ],
        "summary": "The hod-runner builds this server hands out: its version, and each\nbuild's target, SHA-256 and size. Needs no token.",
        "operationId": "list_runner_downloads",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunnerDownloads"
                }
              }
            }
          }
        },
        "security": [
          {}
        ]
      }
    },
    "/api/v1/runner-downloads/{target}": {
      "get": {
        "tags": [
          "runners"
        ],
        "summary": "One hod-runner build, for a target from the list. Needs no token.",
        "operationId": "get_runner_download",
        "parameters": [
          {
            "name": "target",
            "in": "path",
            "description": "Rust target triple, such as `x86_64-unknown-linux-musl`",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The hod-runner binary",
            "content": {
              "application/octet-stream": {}
            }
          },
          "404": {
            "description": "No build for this target",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {}
        ]
      }
    },
    "/api/v1/server": {
      "get": {
        "tags": [
          "server"
        ],
        "summary": "The server's version, where its source is, and its default org.",
        "description": "Anyone may read it, signed in or not: the web UI's footer links to the\nsource for everyone who uses the server (AGPL-3.0, section 13).",
        "operationId": "server_info",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ServerInfo"
                }
              }
            }
          },
          "403": {
            "description": "Wrong token",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {}
        ]
      }
    },
    "/api/v1/sessions": {
      "post": {
        "tags": [
          "sessions"
        ],
        "summary": "Sign a browser in with a login code or the admin token: sets the\nsession cookie. Needs no token, but must come from Hod's own pages.\nExperimental.",
        "operationId": "sign_in",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SignIn"
              }
            }
          },
          "required": true
        },
        "responses": {
          "204": {
            "description": "Signed in: `Set-Cookie` holds the session"
          },
          "400": {
            "description": "Not exactly one of `code` and `token`",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "A code or token that isn't valid, or a request from another site",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {}
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/sessions/codes": {
      "post": {
        "tags": [
          "sessions"
        ],
        "summary": "A one-time code that signs a browser in: `hod ui` opens\n`/login?code=…` with it. It works once, for a minute. Experimental.",
        "operationId": "create_login_code",
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LoginCode"
                }
              }
            }
          }
        },
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/sessions/current": {
      "get": {
        "tags": [
          "sessions"
        ],
        "summary": "Who the caller is, and their orgs. Experimental.",
        "operationId": "current",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CurrentSession"
                }
              }
            }
          },
          "401": {
            "description": "Not signed in",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-hod-stability": "experimental"
      },
      "delete": {
        "tags": [
          "sessions"
        ],
        "summary": "Sign out: ends the session and clears its cookie. Must come from Hod's\nown pages. Experimental.",
        "operationId": "sign_out",
        "responses": {
          "204": {
            "description": "Signed out; the cookie is cleared"
          },
          "403": {
            "description": "A request from another site",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {}
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/sessions/providers": {
      "get": {
        "tags": [
          "sessions"
        ],
        "summary": "The providers people sign in with: the login page lists them, and\n`/login/<name>` starts a sign-in. Needs no token. Experimental.",
        "operationId": "providers",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SignInProviders"
                }
              }
            }
          }
        },
        "security": [
          {}
        ],
        "x-hod-stability": "experimental"
      }
    },
    "/api/v1/tokens": {
      "get": {
        "tags": [
          "tokens"
        ],
        "summary": "List your personal tokens in every org you belong to, newest first.\nNever their secrets. Only from a browser session: a token works in one\norg and doesn't see the others.",
        "operationId": "list_my_tokens",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PersonalTokenList"
                }
              }
            }
          },
          "403": {
            "description": "A personal token or the admin token: sign in with a browser",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tokens/current": {
      "get": {
        "tags": [
          "tokens"
        ],
        "summary": "The personal token this request was sent with: its org, cap and expiry.",
        "operationId": "current_token",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PersonalToken"
                }
              }
            }
          },
          "404": {
            "description": "The request wasn't sent with a personal token",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/tokens/exchange": {
      "post": {
        "tags": [
          "tokens"
        ],
        "summary": "Trade a `hod login` code and its PKCE verifier for the token.",
        "description": "Needs no credentials: the code works once, within a minute, and only\nwith the verifier whose SHA-256 the CLI sent when it asked.",
        "operationId": "exchange_cli_code",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExchangeCliCode"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "description": "The new token, shown this once",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatedToken"
                }
              }
            }
          },
          "400": {
            "description": "A code that is used, expired or unknown, or the wrong verifier",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "security": [
          {}
        ]
      }
    },
    "/api/v1/users": {
      "get": {
        "tags": [
          "users"
        ],
        "summary": "List users.",
        "operationId": "list_users",
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserList"
                }
              }
            }
          },
          "403": {
            "description": "Not a server admin",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      },
      "post": {
        "tags": [
          "users"
        ],
        "summary": "Create a user.",
        "description": "Until people sign in through an identity provider (design/auth.md,\nphase A2), a server admin creates users and gives them roles.",
        "operationId": "create_user",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreateUser"
              }
            }
          },
          "required": true
        },
        "responses": {
          "201": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "400": {
            "description": "An empty name",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "403": {
            "description": "Not a server admin",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/users/{user}": {
      "patch": {
        "tags": [
          "users"
        ],
        "summary": "Disable or enable a user, or make them a server admin.",
        "description": "A disabled user is treated as signed out everywhere: their sessions and\npersonal tokens stop working and their open streams end. Nobody may\ndisable themselves, and a server admin named in config is changed in\nconfig.",
        "operationId": "update_user",
        "parameters": [
          {
            "name": "user",
            "in": "path",
            "description": "User ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateUser"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/User"
                }
              }
            }
          },
          "403": {
            "description": "Not a server admin",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "404": {
            "description": "No such user",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "409": {
            "description": "Yourself, or a server admin from config",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AcceptInvite": {
        "type": "object",
        "description": "`POST /api/v1/invites/accept`: join an org through an invite link.",
        "required": [
          "token"
        ],
        "properties": {
          "token": {
            "type": "string",
            "description": "The secret after `/invite#`, starting with `hod_inv_`."
          }
        },
        "additionalProperties": false
      },
      "AcceptedInvite": {
        "type": "object",
        "description": "Where joining through an invite link left the caller.",
        "required": [
          "org",
          "role"
        ],
        "properties": {
          "org": {
            "type": "string",
            "description": "The org joined."
          },
          "role": {
            "$ref": "#/components/schemas/OrgRole",
            "description": "The caller's role there now: the invite's, or a higher one they had."
          }
        }
      },
      "AuditEvent": {
        "type": "object",
        "description": "An entry in an org's audit log: who changed what.",
        "required": [
          "id",
          "at",
          "actor",
          "action",
          "target",
          "details"
        ],
        "properties": {
          "action": {
            "type": "string",
            "description": "What they did, such as `RunTrigger` or `OrgMembers`."
          },
          "actor": {
            "type": "string",
            "description": "Who did it: a user's ID, or `admin` for the admin token."
          },
          "actor_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "The user's name, if a user did it and still exists."
          },
          "at": {
            "type": "string",
            "format": "date-time",
            "description": "When it happened."
          },
          "details": {
            "type": "object",
            "description": "More about it."
          },
          "id": {
            "type": "string",
            "description": "Event ID (a UUID); later events have greater IDs."
          },
          "ip": {
            "type": [
              "string",
              "null"
            ],
            "description": "The client's IP address: the peer's, or the one a trusted proxy\nreported. Absent when unknown, as on events from before it was\nrecorded.",
            "example": "198.51.100.7"
          },
          "target": {
            "type": "string",
            "description": "What they did it to, such as `app/runs/12`."
          }
        }
      },
      "AuditPage": {
        "type": "object",
        "description": "`GET /api/v1/orgs/{org}/audit`: audit events, newest first.",
        "required": [
          "events"
        ],
        "properties": {
          "events": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuditEvent"
            },
            "description": "The events."
          },
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` for the next page; absent on the last."
          }
        }
      },
      "CliCodeRedirect": {
        "type": "object",
        "description": "Where the browser goes next: `hod login`'s loopback address, with a\none-time code.",
        "required": [
          "redirect"
        ],
        "properties": {
          "redirect": {
            "type": "string",
            "description": "`http://127.0.0.1:<port>/callback?code=…&state=…`."
          }
        }
      },
      "CreateCliCode": {
        "type": "object",
        "description": "`POST /api/v1/orgs/{org}/tokens/cli-codes`: approve a token `hod login`\nasked for. Needs a browser session signed in under 10 minutes ago.",
        "required": [
          "port",
          "state",
          "code_challenge",
          "name"
        ],
        "properties": {
          "code_challenge": {
            "type": "string",
            "description": "The CLI's PKCE challenge: base64url SHA-256 of its verifier (S256)."
          },
          "days": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "How many days it lasts [default: 30].",
            "minimum": 0
          },
          "name": {
            "type": "string",
            "description": "What the token is for, such as `hod on laptop`."
          },
          "port": {
            "type": "integer",
            "format": "int32",
            "description": "The port `hod login` listens on, on 127.0.0.1 (1024 to 65535).",
            "minimum": 0
          },
          "role": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TokenRole",
                "description": "The most it may do [default: the most your org role allows]."
              },
              {
                "type": "null"
              }
            ]
          },
          "state": {
            "type": "string",
            "description": "The CLI's state, handed back to it unchanged."
          }
        },
        "additionalProperties": false
      },
      "CreateInvite": {
        "type": "object",
        "description": "`POST /api/v1/orgs/{org}/invites`: make an invite link.",
        "required": [
          "role"
        ],
        "properties": {
          "days": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "How many days it works [default: 7, at most 30].",
            "minimum": 0
          },
          "max_uses": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "How many people may join with it [default: 1, at most 1000].",
            "minimum": 0
          },
          "role": {
            "$ref": "#/components/schemas/OrgRole",
            "description": "The role it gives."
          }
        },
        "additionalProperties": false
      },
      "CreateRunnerToken": {
        "type": "object",
        "description": "Create a registration token, which runners register with\n(runner-protocol.md, section 2).",
        "required": [
          "trust"
        ],
        "properties": {
          "expires_in": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Seconds until it stops working. Absent means it never expires.",
            "minimum": 0
          },
          "one_time": {
            "type": "boolean",
            "description": "It registers one runner only, for example one an autoscaler starts."
          },
          "pool": {
            "type": "string",
            "description": "The pool runners join with it. `default` if absent."
          },
          "trust": {
            "$ref": "#/components/schemas/RunnerTrust",
            "description": "Which runs its runners take: `protected` (the default branch and\ntags) or `unprotected` (everything else). Required."
          }
        },
        "additionalProperties": false
      },
      "CreateSchedule": {
        "type": "object",
        "description": "`POST /api/v1/orgs/{org}/projects/{project}/schedules`: create a\nschedule.",
        "required": [
          "name",
          "cron"
        ],
        "properties": {
          "branch": {
            "type": "string",
            "description": "The branch. The repository's default branch if absent."
          },
          "catch_up": {
            "type": "integer",
            "format": "int64",
            "description": "Seconds a slot may fire late: at least 60, at most a week. An hour\nif absent.",
            "minimum": 0
          },
          "cron": {
            "type": "string",
            "description": "When it fires, as in [`Schedule::cron`]."
          },
          "name": {
            "type": "string",
            "description": "Its name: letters, digits, `.`, `_` and `-`."
          },
          "only_if_changed": {
            "type": "boolean",
            "description": "Skip a slot when the branch hasn't moved."
          },
          "overlap": {
            "$ref": "#/components/schemas/Overlap",
            "description": "`skip` if absent."
          },
          "timezone": {
            "type": "string",
            "description": "An IANA time zone. `UTC` if absent."
          }
        },
        "additionalProperties": false
      },
      "CreateToken": {
        "type": "object",
        "description": "`POST /api/v1/orgs/{org}/tokens`: mint a personal token for yourself.\nNeeds a browser session signed in under 10 minutes ago.",
        "required": [
          "name"
        ],
        "properties": {
          "days": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "How many days it lasts [default: 30, at most the org's\n`token_max_days`].",
            "minimum": 0
          },
          "name": {
            "type": "string",
            "description": "What it is for."
          },
          "role": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/TokenRole",
                "description": "The most it may do [default: the most your org role allows]."
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "CreateUser": {
        "type": "object",
        "description": "`POST /api/v1/users`: create a user. People who sign in through a\nprovider get one at their first sign-in (auth.md, section 5); a server\nadmin can also create them this way.",
        "required": [
          "name"
        ],
        "properties": {
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "Email, for display only."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "server_admin": {
            "type": "boolean",
            "description": "Make the user a server admin."
          }
        },
        "additionalProperties": false
      },
      "CreatedInvite": {
        "type": "object",
        "description": "A new invite link, with its secret: shown this once.",
        "required": [
          "info",
          "url"
        ],
        "properties": {
          "info": {
            "$ref": "#/components/schemas/Invite",
            "description": "What it is."
          },
          "url": {
            "type": "string",
            "description": "The link to send: the server's `/invite#` and the secret."
          }
        }
      },
      "CreatedToken": {
        "type": "object",
        "description": "A new personal token, shown this once.",
        "required": [
          "token",
          "info"
        ],
        "properties": {
          "info": {
            "$ref": "#/components/schemas/PersonalToken",
            "description": "What it is."
          },
          "token": {
            "type": "string",
            "description": "The token, starting with `hod_pat_`. Send it as `Authorization: Bearer`."
          }
        }
      },
      "CurrentSession": {
        "type": "object",
        "description": "`GET /api/v1/sessions/current`: who the caller is. Experimental.",
        "required": [
          "server_admin",
          "orgs"
        ],
        "properties": {
          "orgs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Membership"
            },
            "description": "The orgs the user has a role in, by name. Empty for a user nobody\nhas given a role yet."
          },
          "provider": {
            "type": [
              "string",
              "null"
            ],
            "description": "The provider the session signed in through, which step-up sends the\nuser back to. Absent for sessions from login codes or the admin\ntoken."
          },
          "server_admin": {
            "type": "boolean",
            "description": "May do anything in every org."
          },
          "user": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/User",
                "description": "The signed-in user; absent for the admin token."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Delivery": {
        "type": "object",
        "description": "A webhook delivery: what a forge sent, and what Hod did with it.",
        "required": [
          "id",
          "forge",
          "delivery_id",
          "event",
          "ref",
          "sha",
          "status",
          "reason",
          "attempts",
          "received_at"
        ],
        "properties": {
          "attempts": {
            "type": "integer",
            "format": "int32",
            "description": "Processing attempts so far."
          },
          "delivery_id": {
            "type": "string",
            "description": "The forge's ID for the delivery."
          },
          "event": {
            "type": "string",
            "description": "The forge's event name, such as `push` or `pull_request`."
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it ended: done, ignored or failed. `null` while pending."
          },
          "forge": {
            "type": "string",
            "description": "The forge kind: `forgejo`."
          },
          "id": {
            "type": "string",
            "description": "Hod's ID for it (a UUID)."
          },
          "reason": {
            "type": "string",
            "description": "Why it was ignored or failed, or why its last attempt failed."
          },
          "received_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it arrived."
          },
          "ref": {
            "type": "string",
            "description": "The ref it is about; empty if it wasn't a run candidate."
          },
          "run": {
            "type": [
              "string",
              "null"
            ],
            "description": "The run it started, as `project#number`; `null` if none."
          },
          "sha": {
            "type": "string",
            "description": "The commit it is about; empty if it wasn't a run candidate."
          },
          "status": {
            "$ref": "#/components/schemas/DeliveryStatus",
            "description": "Where it is."
          }
        }
      },
      "DeliveryList": {
        "type": "object",
        "description": "Webhook deliveries, newest first.",
        "required": [
          "deliveries"
        ],
        "properties": {
          "deliveries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Delivery"
            },
            "description": "The deliveries."
          }
        }
      },
      "DeliveryStatus": {
        "type": "string",
        "description": "Where a webhook delivery is (design/forges.md).",
        "enum": [
          "pending",
          "done",
          "ignored",
          "failed"
        ]
      },
      "ExchangeCliCode": {
        "type": "object",
        "description": "`POST /api/v1/tokens/exchange`: trade a `hod login` code and its PKCE\nverifier for the token.",
        "required": [
          "code",
          "code_verifier"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "The code from the loopback redirect."
          },
          "code_verifier": {
            "type": "string",
            "description": "The verifier whose SHA-256 was the challenge."
          }
        },
        "additionalProperties": false
      },
      "Fire": {
        "type": "object",
        "description": "One slot of a schedule, and what became of it.",
        "required": [
          "id",
          "scheduled_for",
          "manual",
          "status",
          "reason",
          "attempts"
        ],
        "properties": {
          "attempts": {
            "type": "integer",
            "format": "int32",
            "description": "Attempts to start its run."
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it ended; `null` while pending."
          },
          "id": {
            "type": "string",
            "description": "Its ID (a UUID)."
          },
          "manual": {
            "type": "boolean",
            "description": "Started by hand (`run`), not by the clock."
          },
          "reason": {
            "type": "string",
            "description": "Why it was skipped or failed, or why its last attempt failed."
          },
          "run": {
            "type": [
              "string",
              "null"
            ],
            "description": "The run it started, as `project#number`; `null` if none."
          },
          "scheduled_for": {
            "type": "string",
            "format": "date-time",
            "description": "The slot; for a run-now fire, when it was asked for."
          },
          "status": {
            "$ref": "#/components/schemas/FireStatus",
            "description": "Where it is."
          }
        }
      },
      "FireList": {
        "type": "object",
        "description": "`GET …/schedules/{name}/fires`: a schedule's fires, newest first.",
        "required": [
          "fires"
        ],
        "properties": {
          "fires": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Fire"
            },
            "description": "The fires."
          }
        }
      },
      "FireStatus": {
        "type": "string",
        "description": "Where one slot of a schedule is (design/scheduling.md).",
        "enum": [
          "pending",
          "done",
          "skipped",
          "failed"
        ]
      },
      "GroupKind": {
        "type": "string",
        "description": "What made a group.",
        "enum": [
          "setup",
          "step",
          "group"
        ]
      },
      "Guard": {
        "type": "object",
        "description": "What a job attempt's gateway guard saw (design/components.md,\nsection 10).",
        "required": [
          "origin",
          "mode",
          "hosts"
        ],
        "properties": {
          "hosts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GuardHost"
            },
            "description": "Each host it saw, by step."
          },
          "mode": {
            "type": "string",
            "description": "`audit` (everything allowed and recorded) or `block`."
          },
          "origin": {
            "type": "string",
            "description": "The guard's component (`hod/egress-guard@v1`)."
          }
        }
      },
      "GuardHost": {
        "type": "object",
        "description": "One host a guard saw, during one step.",
        "required": [
          "step",
          "name",
          "address",
          "port",
          "protocol",
          "verdict",
          "count"
        ],
        "properties": {
          "address": {
            "type": "string",
            "description": "The address connected to; empty for a lookup alone."
          },
          "count": {
            "type": "integer",
            "format": "int32",
            "description": "How many times."
          },
          "name": {
            "type": "string",
            "description": "The name looked up, or sent as the TLS SNI or HTTP Host; empty for\nan address used without one."
          },
          "port": {
            "type": "integer",
            "format": "int32",
            "description": "The port; 0 for a lookup."
          },
          "protocol": {
            "type": "string",
            "description": "`tcp`, `udp` or `dns`."
          },
          "step": {
            "type": "integer",
            "format": "int32",
            "description": "The step it happened during, from 1; 0 outside every step (while\nservices start, say)."
          },
          "verdict": {
            "type": "string",
            "description": "`allowed` or `blocked`."
          }
        }
      },
      "Hello": {
        "type": "object",
        "description": "The data of a [`HELLO_EVENT`].",
        "required": [
          "server_time"
        ],
        "properties": {
          "server_time": {
            "type": "string",
            "format": "date-time",
            "description": "The server's time, so a client can count a running job's time\nwithout trusting its own clock."
          }
        }
      },
      "HistoryRun": {
        "type": "object",
        "description": "One run of a project's history: enough for a bar in the UI's history\nstrip.",
        "required": [
          "number",
          "status",
          "attempt"
        ],
        "properties": {
          "attempt": {
            "type": "integer",
            "format": "int32",
            "description": "Its attempt: above 1, it was rerun."
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When its last job ended."
          },
          "number": {
            "type": "integer",
            "format": "int64",
            "description": "Run number."
          },
          "result": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RunResult",
                "description": "How it ended; `null` until it has."
              },
              {
                "type": "null"
              }
            ]
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When its first job was assigned."
          },
          "status": {
            "$ref": "#/components/schemas/RunStatus",
            "description": "Where it is."
          }
        }
      },
      "Identity": {
        "type": "object",
        "description": "One of a user's identities at a sign-in provider.",
        "required": [
          "provider",
          "login"
        ],
        "properties": {
          "login": {
            "type": "string",
            "description": "The user's login there; empty if the provider gives none."
          },
          "provider": {
            "type": "string",
            "description": "The provider's name in the server's config (`github` for GitHub),\nor its issuer URL when no configured provider has it."
          }
        }
      },
      "Invite": {
        "type": "object",
        "description": "An invite link, without its secret (design/auth.md, phase A4).",
        "required": [
          "id",
          "role",
          "max_uses",
          "uses",
          "state",
          "expires_at",
          "created_by",
          "created_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was made."
          },
          "created_by": {
            "type": "string",
            "description": "Who made it: a user's ID, or `admin` for the admin token."
          },
          "created_by_name": {
            "type": [
              "string",
              "null"
            ],
            "description": "Their name, if a user made it and still exists."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it stops working."
          },
          "id": {
            "type": "string",
            "description": "Invite ID (a UUID)."
          },
          "max_uses": {
            "type": "integer",
            "format": "int32",
            "description": "How many people may join with it.",
            "minimum": 0
          },
          "role": {
            "$ref": "#/components/schemas/OrgRole",
            "description": "The role it gives."
          },
          "state": {
            "$ref": "#/components/schemas/InviteState",
            "description": "Where it stands."
          },
          "uses": {
            "type": "integer",
            "format": "int32",
            "description": "How many have.",
            "minimum": 0
          }
        }
      },
      "InviteList": {
        "type": "object",
        "description": "`GET /api/v1/orgs/{org}/invites`: an org's invite links, newest first.",
        "required": [
          "invites"
        ],
        "properties": {
          "invites": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Invite"
            },
            "description": "The invites."
          }
        }
      },
      "InviteState": {
        "type": "string",
        "description": "Where an invite link stands.",
        "enum": [
          "live",
          "used_up",
          "expired",
          "revoked"
        ]
      },
      "Job": {
        "type": "object",
        "description": "A job of a run.",
        "required": [
          "id",
          "name",
          "needs",
          "status",
          "reason",
          "attempt",
          "run_attempt"
        ],
        "properties": {
          "allowed": {
            "type": "boolean",
            "description": "It failed, and its `allow_failure:` allows that: it counts as a\nsuccess for the jobs that need it and for the run."
          },
          "attempt": {
            "type": "integer",
            "format": "int32",
            "description": "Assignments so far, over all of the run's attempts: 0 before the\nfirst. Logs are kept per attempt."
          },
          "attempts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/JobAttempt"
            },
            "description": "Its attempts, oldest first. Only in the job endpoint."
          },
          "concurrency_group": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its own concurrency group, if it has one; absent otherwise."
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it ended."
          },
          "id": {
            "type": "string",
            "description": "Job ID (a UUID)."
          },
          "matrix_of": {
            "type": [
              "string",
              "null"
            ],
            "description": "For a matrix instance, its job key (`test`); absent otherwise."
          },
          "name": {
            "type": "string",
            "description": "Job name, unique within the run. A matrix instance's adds its\nvalues to the job key: `test (linux, 1.22)`. In URL paths, job names\nare percent-encoded."
          },
          "needs": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Jobs it needs, each matrix as its instances."
          },
          "outputs": {
            "type": "object",
            "description": "The values its steps wrote to their `outputs:`, by name, as JSON\n(`\"1.2.0\"`, `true`, `42`, `[\"a\"]`): only once it has succeeded, and\nonly in the run and job endpoints, not in lists of runs.",
            "additionalProperties": {},
            "propertyNames": {
              "type": "string"
            }
          },
          "queued_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was queued."
          },
          "reason": {
            "type": "string",
            "description": "Why it didn't succeed, for people; for a queued or waiting job, why\nit may be waiting (no online runner can take it, its concurrency\ngroup is held); empty otherwise."
          },
          "reason_code": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ReasonCode",
                "description": "Why it didn't succeed, for programs; `null` on success and until it\nhas ended."
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobResult",
                "description": "How it ended; `null` until it has."
              },
              {
                "type": "null"
              }
            ]
          },
          "run_attempt": {
            "type": "integer",
            "format": "int32",
            "description": "The run attempt its state belongs to."
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it started running."
          },
          "status": {
            "$ref": "#/components/schemas/JobStatus",
            "description": "Where it is in its life (design/server-state.md, section 3)."
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "description": "Change counter: every change to the job, its steps or its services\nadds one. Live updates ([`JobHint`]) older than the version held can\nbe dropped."
          }
        }
      },
      "JobAttempt": {
        "type": "object",
        "description": "One assignment of a job to a runner. Never changes once ended.",
        "required": [
          "attempt",
          "run_attempt",
          "assigned_at",
          "reason",
          "steps"
        ],
        "properties": {
          "assigned_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was assigned."
          },
          "attempt": {
            "type": "integer",
            "format": "int32",
            "description": "Attempt number, from 1."
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it ended."
          },
          "guard": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Guard",
                "description": "What its gateway guard (`guards:`) saw, if it had one."
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "type": "string",
            "description": "Why, for people."
          },
          "reason_code": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ReasonCode",
                "description": "Why, for programs."
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobResult",
                "description": "How it ended; `null` while it is going."
              },
              {
                "type": "null"
              }
            ]
          },
          "run_attempt": {
            "type": "integer",
            "format": "int32",
            "description": "The run attempt it belongs to."
          },
          "runner_id": {
            "type": [
              "string",
              "null"
            ],
            "description": "The runner it was assigned to (a UUID)."
          },
          "services": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Service"
            },
            "description": "Its services (`services:`), in the order they started, as far as\nthey got. Each has a log: `…/jobs/{job}/services/{service}/log`."
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the runner confirmed it had the job; `null` if it never did.\nAttempts that never started don't count against the retry limit."
          },
          "steps": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Step"
            },
            "description": "Its steps, in order, as far as they got."
          }
        }
      },
      "JobHint": {
        "type": "object",
        "description": "The data of a [`JOB_EVENT`]: a job's new version and the fields a run's\njob list shows. Steps, attempts and outputs are fetched from\n`GET …/jobs/{job}`.",
        "required": [
          "id",
          "run",
          "name",
          "version",
          "status",
          "attempt"
        ],
        "properties": {
          "attempt": {
            "type": "integer",
            "format": "int32",
            "description": "Assignments so far."
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it ended."
          },
          "id": {
            "type": "string",
            "description": "Job ID (a UUID)."
          },
          "name": {
            "type": "string",
            "description": "Job name."
          },
          "result": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobResult",
                "description": "How it ended; `null` until it has."
              },
              {
                "type": "null"
              }
            ]
          },
          "run": {
            "type": "string",
            "description": "Its run's ID."
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it started."
          },
          "status": {
            "$ref": "#/components/schemas/JobStatus",
            "description": "Status."
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "description": "Its version now ([`Job::version`])."
          }
        }
      },
      "JobResult": {
        "type": "string",
        "description": "How a job ended (design/server-state.md, section 3).",
        "enum": [
          "success",
          "failure",
          "error",
          "cancelled",
          "skipped",
          "timed_out"
        ]
      },
      "JobStatus": {
        "type": "string",
        "description": "Where a job is in its life (design/server-state.md, section 3).",
        "enum": [
          "pending",
          "waiting",
          "queued",
          "assigned",
          "running",
          "canceling",
          "ended"
        ]
      },
      "LockedComponent": {
        "type": "object",
        "description": "A locked component, as `hod.lock` holds it (design/components.md,\nsection 8).",
        "required": [
          "version",
          "repository",
          "digest",
          "signer"
        ],
        "properties": {
          "digest": {
            "type": "string",
            "description": "The manifest digest."
          },
          "reason": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why the cooldown was skipped."
          },
          "repository": {
            "type": "string",
            "description": "Registry host and path."
          },
          "signed_at": {
            "type": [
              "string",
              "null"
            ],
            "description": "When it was signed (RFC 3339), if the signature proved a time."
          },
          "signer": {
            "type": "string",
            "description": "Who signed it: `key:<name>`, `keyless:<issuer>:<identity>` or\n`unsigned`."
          },
          "version": {
            "type": "string",
            "description": "The exact version."
          }
        }
      },
      "LogBucket": {
        "type": "object",
        "description": "A run of rows in a [`LogOverview`].",
        "required": [
          "first",
          "last",
          "first_ts",
          "last_ts",
          "errors",
          "warnings"
        ],
        "properties": {
          "errors": {
            "type": "integer",
            "format": "int32",
            "description": "Rows marked as errors.",
            "minimum": 0
          },
          "first": {
            "type": "integer",
            "format": "int64",
            "description": "Its first row.",
            "minimum": 0
          },
          "first_ts": {
            "type": "integer",
            "format": "int64",
            "description": "When its rows' first bytes arrived, in Unix milliseconds: about\nthe earliest and the latest."
          },
          "last": {
            "type": "integer",
            "format": "int64",
            "description": "Its last row.",
            "minimum": 0
          },
          "last_ts": {
            "type": "integer",
            "format": "int64",
            "description": "See `first_ts`."
          },
          "step": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The step its first row belongs to; absent for the setup and for\nservices' logs.",
            "minimum": 0
          },
          "warnings": {
            "type": "integer",
            "format": "int32",
            "description": "Rows marked as warnings.",
            "minimum": 0
          }
        }
      },
      "LogColor": {
        "oneOf": [
          {
            "type": "integer",
            "format": "int32",
            "description": "A palette index.",
            "minimum": 0
          },
          {
            "type": "string",
            "description": "A 24-bit colour, `#rrggbb`."
          }
        ],
        "description": "A terminal colour: an index into the 256-colour palette (the viewer maps\n0–15 to its theme), or `#rrggbb`."
      },
      "LogEnd": {
        "type": "object",
        "description": "The data of a [`LOG_END_EVENT`]: the attempt has ended and its whole\nlog has been sent.",
        "required": [
          "attempt"
        ],
        "properties": {
          "attempt": {
            "type": "integer",
            "format": "int32",
            "description": "The attempt."
          },
          "result": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobResult",
                "description": "How it ended; `null` if it never ran."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "LogGroup": {
        "type": "object",
        "description": "A foldable range of rows.",
        "required": [
          "id",
          "kind",
          "first"
        ],
        "properties": {
          "collapsed": {
            "type": "boolean",
            "description": "The program asked for it to start folded (GitLab's\n`[collapsed=true]`, Buildkite's `---`)."
          },
          "first": {
            "type": "integer",
            "format": "int64",
            "description": "Its first row. A marker's group starts with its header row.",
            "minimum": 0
          },
          "id": {
            "type": "integer",
            "format": "int32",
            "description": "Its ID within the log, from 1.",
            "minimum": 0
          },
          "kind": {
            "$ref": "#/components/schemas/GroupKind",
            "description": "What made it."
          },
          "last": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Its last row; absent while it is open. Below `first` if it has no\nrows.",
            "minimum": 0
          },
          "parent": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The group it is in.",
            "minimum": 0
          },
          "step": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The step, for a step's group and groups inside it.",
            "minimum": 0
          },
          "title": {
            "type": "string",
            "description": "Its title: the marker's; a step's name; empty for the setup."
          }
        }
      },
      "LogGroups": {
        "type": "object",
        "description": "`GET …/groups`: a log's group tree.",
        "required": [
          "groups",
          "complete"
        ],
        "properties": {
          "complete": {
            "type": "boolean",
            "description": "The attempt has ended and every group is closed."
          },
          "groups": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LogGroup"
            },
            "description": "Its groups, by ID; a group's parent comes before it."
          }
        }
      },
      "LogHit": {
        "type": "object",
        "description": "A row that matches a search.",
        "required": [
          "n",
          "ranges"
        ],
        "properties": {
          "n": {
            "type": "integer",
            "format": "int64",
            "description": "The row.",
            "minimum": 0
          },
          "ranges": {
            "type": "array",
            "items": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "int32",
                "minimum": 0
              }
            },
            "description": "Where it matches in its `plain` text: start and end, in characters\n(Unicode scalar values), end excluded."
          }
        }
      },
      "LogMark": {
        "type": "object",
        "description": "What a program said about a row with a workflow command\n(`::error file=src/a.rs,line=3::message`). The row's text is the message.",
        "required": [
          "level"
        ],
        "properties": {
          "col": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Its column.",
            "minimum": 0
          },
          "end_col": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The last column, for a range.",
            "minimum": 0
          },
          "end_line": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The last line, for a range.",
            "minimum": 0
          },
          "file": {
            "type": [
              "string",
              "null"
            ],
            "description": "The file it is about."
          },
          "level": {
            "$ref": "#/components/schemas/MarkLevel",
            "description": "Error, warning or notice."
          },
          "line": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Its line in the file.",
            "minimum": 0
          },
          "title": {
            "type": [
              "string",
              "null"
            ],
            "description": "A title."
          }
        }
      },
      "LogOverview": {
        "type": "object",
        "description": "`GET …/rows/overview`: a log summarised in buckets of rows, for a\nminimap.",
        "required": [
          "total",
          "buckets"
        ],
        "properties": {
          "buckets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LogBucket"
            },
            "description": "The rows in order, in at most the buckets asked for, of about the\nsame number of rows each."
          },
          "first_error": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "The first row marked as an error, if any.",
            "minimum": 0
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "Final rows so far.",
            "minimum": 0
          }
        }
      },
      "LogRow": {
        "type": "object",
        "description": "One line of a log.",
        "required": [
          "n",
          "ts"
        ],
        "properties": {
          "cols": {
            "type": "integer",
            "format": "int32",
            "description": "Its width in terminal columns.",
            "minimum": 0
          },
          "cut": {
            "type": "boolean",
            "description": "The line was longer than a row holds; the raw log has the rest."
          },
          "group": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The innermost group it belongs to (`groups`), if any.",
            "minimum": 0
          },
          "hod": {
            "type": "boolean",
            "description": "A message from Hod itself, not from the job's programs."
          },
          "mark": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LogMark",
                "description": "The program tagged it as an error, a warning or a notice."
              },
              {
                "type": "null"
              }
            ]
          },
          "n": {
            "type": "integer",
            "format": "int64",
            "description": "Its line number in the log, from 1; never changes. 0 for a row of the\nlive area, which may still change.",
            "minimum": 0
          },
          "plain": {
            "type": "string",
            "description": "Its text with no styles."
          },
          "rewritten": {
            "type": "integer",
            "format": "int32",
            "description": "How many times the program redrew it (a progress bar); the raw log\nkeeps every version.",
            "minimum": 0
          },
          "spans": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LogSpan"
            },
            "description": "Its text as runs of one style each; left out with `fields=plain`."
          },
          "step": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The step whose output it is, by index in the job; absent for the\nsetup and for services' logs.",
            "minimum": 0
          },
          "ts": {
            "type": "integer",
            "format": "int64",
            "description": "When its first byte arrived, in Unix milliseconds."
          }
        }
      },
      "LogRows": {
        "type": "object",
        "description": "`GET …/rows`: final rows, and the styles they use.",
        "required": [
          "rows",
          "total",
          "complete"
        ],
        "properties": {
          "complete": {
            "type": "boolean",
            "description": "The attempt has ended and every row is final: `total` won't grow."
          },
          "live": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LogRow"
            },
            "description": "The live area, numbered 0, when the rows asked for reach the end of\na running log: the last lines, which may still change."
          },
          "rows": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LogRow"
            },
            "description": "The rows asked for, in order."
          },
          "styles": {
            "type": "object",
            "description": "The styles those rows use, by index; absent with `fields=plain`.",
            "additionalProperties": {
              "$ref": "#/components/schemas/LogStyle"
            },
            "propertyNames": {
              "type": "integer",
              "format": "int32",
              "minimum": 0
            }
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "Final rows in the log so far.",
            "minimum": 0
          }
        }
      },
      "LogSearch": {
        "type": "object",
        "description": "`GET …/rows/search`: rows whose text matches, in order.",
        "required": [
          "hits",
          "total"
        ],
        "properties": {
          "hits": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LogHit"
            },
            "description": "Matching rows."
          },
          "next": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Where to go on from (`from`), if the search stopped before the last\nfinal row: at `limit` hits, or after scanning its share of rows.",
            "minimum": 0
          },
          "total": {
            "type": "integer",
            "format": "int64",
            "description": "Final rows in the log when it searched; the live area isn't\nsearched.",
            "minimum": 0
          }
        }
      },
      "LogSpan": {
        "type": "object",
        "description": "Text in one style.",
        "required": [
          "text"
        ],
        "properties": {
          "style": {
            "type": "integer",
            "format": "int32",
            "description": "Its style, an index into the log's style table; 0, the default, is\nleft out.",
            "minimum": 0
          },
          "text": {
            "type": "string",
            "description": "The text."
          }
        }
      },
      "LogStyle": {
        "type": "object",
        "description": "A style of a log's style table. Absent fields are the default.",
        "properties": {
          "bg": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LogColor",
                "description": "Background colour."
              },
              {
                "type": "null"
              }
            ]
          },
          "bold": {
            "type": "boolean",
            "description": "Bold."
          },
          "dim": {
            "type": "boolean",
            "description": "Dim."
          },
          "fg": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LogColor",
                "description": "Foreground colour."
              },
              {
                "type": "null"
              }
            ]
          },
          "inverse": {
            "type": "boolean",
            "description": "Foreground and background swapped."
          },
          "italic": {
            "type": "boolean",
            "description": "Italic."
          },
          "link": {
            "type": [
              "string",
              "null"
            ],
            "description": "A link (OSC 8), `http` or `https` only."
          },
          "strike": {
            "type": "boolean",
            "description": "Struck through."
          },
          "underline": {
            "type": "boolean",
            "description": "Underlined."
          }
        }
      },
      "LogText": {
        "type": "object",
        "description": "The data of a [`LOG_EVENT`]: log text, which starts at `offset` in the\nattempt's log.",
        "required": [
          "offset",
          "text"
        ],
        "properties": {
          "offset": {
            "type": "integer",
            "format": "int64",
            "description": "Where the text starts in the log, in bytes.",
            "minimum": 0
          },
          "text": {
            "type": "string",
            "description": "The text, ANSI codes kept. Invalid UTF-8 becomes U+FFFD; offsets\nstill count the log's bytes."
          }
        }
      },
      "LoginCode": {
        "type": "object",
        "description": "`POST /api/v1/sessions/codes`: a one-time code that signs a browser in\n(`hod ui`). Experimental.",
        "required": [
          "code",
          "expires_at"
        ],
        "properties": {
          "code": {
            "type": "string",
            "description": "The code, starting with `hod_login_`. Works once."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it stops working: a minute after it was made."
          }
        }
      },
      "MarkLevel": {
        "type": "string",
        "description": "How serious a mark is.",
        "enum": [
          "error",
          "warning",
          "notice"
        ]
      },
      "Membership": {
        "type": "object",
        "description": "A signed-in user's role in an org.",
        "required": [
          "org",
          "role"
        ],
        "properties": {
          "org": {
            "type": "string",
            "description": "Org name."
          },
          "role": {
            "$ref": "#/components/schemas/OrgRole",
            "description": "The user's role there."
          }
        }
      },
      "Org": {
        "type": "object",
        "description": "An org's settings.",
        "required": [
          "name",
          "default_project_role",
          "token_max_days"
        ],
        "properties": {
          "default_project_role": {
            "$ref": "#/components/schemas/ProjectRole",
            "description": "The project role every member gets."
          },
          "my_role": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OrgRole",
                "description": "The caller's role in the org: `owner` for server admins, absent for\nsomeone who isn't a member (reading its public projects)."
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string",
            "description": "Org name."
          },
          "role_rule": {
            "type": [
              "string",
              "null"
            ],
            "description": "The role rule: CEL over a sign-in's `claims`, giving `\"owner\"`,\n`\"member\"`, `\"viewer\"` or `\"\"` (design/auth.md, section 5)."
          },
          "token_max_days": {
            "type": "integer",
            "format": "int32",
            "description": "The longest a personal token may last, in days.",
            "minimum": 0
          }
        }
      },
      "OrgMember": {
        "type": "object",
        "description": "A user's membership of an org.",
        "required": [
          "user",
          "name",
          "role",
          "source",
          "created_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the membership was created."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "The user's email, for display."
          },
          "identities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Identity"
            },
            "description": "The user's identities at the server's providers."
          },
          "last_sign_in_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the user last signed in through a provider."
          },
          "name": {
            "type": "string",
            "description": "The user's name."
          },
          "role": {
            "$ref": "#/components/schemas/OrgRole",
            "description": "The user's role in the org."
          },
          "rule_role": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OrgRole",
                "description": "The role the rule gives a member who also has a manual grant; they\nget the higher of the two."
              },
              {
                "type": "null"
              }
            ]
          },
          "source": {
            "type": "string",
            "description": "`manual`, granted by a person, or `rule`, by the org's role rule."
          },
          "user": {
            "type": "string",
            "description": "The user's ID."
          }
        }
      },
      "OrgMemberList": {
        "type": "object",
        "description": "`GET /api/v1/orgs/{org}/members`: an org's members, by name.",
        "required": [
          "members"
        ],
        "properties": {
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/OrgMember"
            },
            "description": "The members."
          }
        }
      },
      "OrgRole": {
        "type": "string",
        "description": "A role in an org, lowest first: `viewer` reads every project, `member`\ngets the org's default project role, `owner` manages the org.",
        "enum": [
          "viewer",
          "member",
          "owner"
        ]
      },
      "Overlap": {
        "type": "string",
        "description": "What a schedule's run does while the schedule's previous run is still\ngoing: the concurrency policies (pipeline-format.md, section 12),\nplus `allow`.",
        "enum": [
          "skip",
          "buffer_one",
          "buffer_all",
          "cancel_other",
          "allow"
        ]
      },
      "PersonalToken": {
        "type": "object",
        "description": "A personal token, without its secret.",
        "required": [
          "id",
          "org",
          "name",
          "role",
          "user",
          "user_name",
          "created_at",
          "expires_at"
        ],
        "properties": {
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was made."
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it stops working."
          },
          "id": {
            "type": "string",
            "description": "Token ID (a UUID)."
          },
          "last_used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was last used, to the minute."
          },
          "name": {
            "type": "string",
            "description": "What it is for."
          },
          "org": {
            "type": "string",
            "description": "The org it works in."
          },
          "role": {
            "$ref": "#/components/schemas/TokenRole",
            "description": "The most it may do."
          },
          "user": {
            "type": "string",
            "description": "Whose it is: the user's ID."
          },
          "user_name": {
            "type": "string",
            "description": "The user's name."
          }
        }
      },
      "PersonalTokenList": {
        "type": "object",
        "description": "`GET /api/v1/orgs/{org}/tokens`: personal tokens, newest first.",
        "required": [
          "tokens"
        ],
        "properties": {
          "tokens": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PersonalToken"
            },
            "description": "The tokens."
          }
        }
      },
      "Problem": {
        "type": "object",
        "description": "An error response (RFC 9457 problem details), served as\n`application/problem+json`.",
        "required": [
          "type",
          "title",
          "status",
          "detail"
        ],
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "What went wrong, for programs, when they can do something about it.\n`reauth`: a 401 for a session whose sign-in is too old for this\nchange (step-up, design/auth.md section 6); sign in again through\nthe session's provider and retry."
          },
          "detail": {
            "type": "string",
            "description": "What went wrong, for people."
          },
          "status": {
            "type": "integer",
            "format": "int32",
            "description": "HTTP status code.",
            "minimum": 0
          },
          "title": {
            "type": "string",
            "description": "Short summary: the HTTP status's reason phrase."
          },
          "type": {
            "type": "string",
            "description": "Problem type URI; `about:blank` means the HTTP status says it all."
          }
        }
      },
      "Project": {
        "type": "object",
        "description": "A project: one repository's pipeline, created on the first run for its\nrepository URL.",
        "required": [
          "name",
          "repo_url",
          "default_branch"
        ],
        "properties": {
          "default_branch": {
            "type": "string",
            "description": "The repository's default branch."
          },
          "history": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "$ref": "#/components/schemas/HistoryRun"
            },
            "description": "With `history=N`: its last N runs on the default branch, newest\nfirst."
          },
          "my_role": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ProjectRole",
                "description": "The caller's role on it (`read` for anyone on a public project),\nso a UI shows only what the caller may do."
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string",
            "description": "Project name, unique in its org."
          },
          "public": {
            "type": "boolean",
            "description": "Anyone, signed in or not, may read its runs, logs and files."
          },
          "repo_url": {
            "type": "string",
            "description": "Repository URL the project builds."
          },
          "slowest_job": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/SlowJob",
                "description": "With `history=N`: the job that took longest on average over those\nruns, if any of them ran a job to its end."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "ProjectList": {
        "type": "object",
        "description": "`GET /api/v1/orgs/{org}/projects`: an org's projects, sorted by name.",
        "required": [
          "projects"
        ],
        "properties": {
          "projects": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Project"
            },
            "description": "Projects, sorted by name."
          }
        }
      },
      "ProjectMember": {
        "type": "object",
        "description": "A member's own role on a project, raising what the org gives them.",
        "required": [
          "user",
          "name",
          "role"
        ],
        "properties": {
          "identities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Identity"
            },
            "description": "The user's identities at the server's providers."
          },
          "name": {
            "type": "string",
            "description": "The user's name."
          },
          "role": {
            "$ref": "#/components/schemas/ProjectRole",
            "description": "The role on the project."
          },
          "user": {
            "type": "string",
            "description": "The user's ID."
          }
        }
      },
      "ProjectMemberList": {
        "type": "object",
        "description": "`GET /api/v1/orgs/{org}/projects/{project}/members`: the roles granted\non a project, by name.",
        "required": [
          "members"
        ],
        "properties": {
          "members": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProjectMember"
            },
            "description": "The members with a role of their own on the project."
          }
        }
      },
      "ProjectRole": {
        "type": "string",
        "description": "A role on a project, lowest first: `read` sees runs, logs and files,\n`run` also triggers, cancels and reruns, `manage` also changes settings,\nsecrets, schedules and members.",
        "enum": [
          "read",
          "run",
          "manage"
        ]
      },
      "ReasonCode": {
        "type": "string",
        "description": "Why a job didn't succeed, for programs; `reason` says it for people.\nThe code decides the job's result ([`ReasonCode::result`]).",
        "enum": [
          "script",
          "missing_output",
          "bad_output",
          "bad_export",
          "post",
          "output_conflict",
          "secret",
          "expression",
          "config",
          "setup",
          "storage",
          "checkout",
          "runner_error",
          "runner_lost",
          "no_runner",
          "condition",
          "dependency",
          "cancelled",
          "superseded",
          "timeout",
          "log_limit"
        ]
      },
      "RerunJobs": {
        "type": "string",
        "description": "Which jobs a rerun runs again.",
        "enum": [
          "failed",
          "all"
        ]
      },
      "RerunRequest": {
        "type": "object",
        "description": "`POST …/runs/{number}/rerun`: run some of an ended run's jobs again, as\nthe run's next attempt.",
        "properties": {
          "jobs": {
            "$ref": "#/components/schemas/RerunJobs",
            "description": "Which jobs: `failed` (the default) reruns the jobs that ended with\n`failure`, `error`, `cancelled` or `timed_out` and every job that\nneeds them; `all` reruns every job."
          }
        },
        "additionalProperties": false
      },
      "ResolveComponents": {
        "type": "object",
        "description": "`POST /api/v1/orgs/{org}/components/resolve`: resolve published\ncomponents under the org's policy, for `hod component update`.",
        "required": [
          "refs"
        ],
        "properties": {
          "lock": {
            "type": "object",
            "description": "What `hod.lock` holds now, by reference: for the tag-move alarm and\nthe change report.",
            "additionalProperties": {
              "$ref": "#/components/schemas/LockedComponent"
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "now": {
            "type": "boolean",
            "description": "Skip the cooldown (`--now`)."
          },
          "refs": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The references, as `uses:` writes them."
          }
        },
        "additionalProperties": false
      },
      "ResolvedComponent": {
        "type": "object",
        "description": "One reference, resolved or not.",
        "required": [
          "reference"
        ],
        "properties": {
          "entry": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/LockedComponent",
                "description": "What to lock, unless `error` says why not."
              },
              {
                "type": "null"
              }
            ]
          },
          "error": {
            "type": [
              "string",
              "null"
            ],
            "description": "Why it can't be locked: policy, signatures, a moved tag, the\ncooldown."
          },
          "held": {
            "type": "array",
            "items": {
              "type": "array",
              "items": false,
              "prefixItems": [
                {
                  "type": "string"
                },
                {
                  "type": "integer",
                  "format": "int64"
                }
              ]
            },
            "description": "Newer versions the cooldown holds back, with their age in hours."
          },
          "manifest": {
            "type": [
              "string",
              "null"
            ],
            "description": "The resolved version's `component.yaml`, and the locked one's, for\nthe change report."
          },
          "previous_manifest": {
            "type": [
              "string",
              "null"
            ],
            "description": "The locked version's `component.yaml`, if it changes."
          },
          "reference": {
            "type": "string",
            "description": "As asked."
          }
        }
      },
      "ResolvedComponents": {
        "type": "object",
        "description": "What resolving found for each reference.",
        "required": [
          "components"
        ],
        "properties": {
          "components": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ResolvedComponent"
            },
            "description": "In the order asked."
          }
        }
      },
      "RoleRuleTrial": {
        "type": "object",
        "description": "What a role rule gives the caller.",
        "required": [
          "claims"
        ],
        "properties": {
          "claims": {
            "type": "object",
            "description": "The claims it was tried on: those of the sign-in that made the\ncaller's session."
          },
          "role": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/OrgRole",
                "description": "The role the rule gives; absent for none (`\"\"`)."
              },
              {
                "type": "null"
              }
            ]
          }
        }
      },
      "Run": {
        "type": "object",
        "description": "A run: one execution of a project's pipeline for an event.",
        "required": [
          "id",
          "org",
          "project",
          "number",
          "repo_url",
          "status",
          "attempt",
          "trigger",
          "sha",
          "ref",
          "created_at"
        ],
        "properties": {
          "actor": {
            "type": "string",
            "description": "Who started the run: the forge login for a webhook's run, the Hod\nuser's name (or `admin`) for a manual one; empty if unknown."
          },
          "attempt": {
            "type": "integer",
            "format": "int32",
            "description": "The run's attempt, from 1: rerunning its failed jobs starts the next."
          },
          "concurrency_group": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its concurrency group (design/pipeline-format.md, section 12),\nif it is in one; absent otherwise."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the run was created."
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When its last job ended."
          },
          "id": {
            "type": "string",
            "description": "Run ID (a UUID)."
          },
          "jobs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Job"
            },
            "description": "Its jobs, sorted by name. In run lists, without their outputs,\nattempts and hints about why they wait."
          },
          "number": {
            "type": "integer",
            "format": "int64",
            "description": "Run number, counting from 1 within the project."
          },
          "org": {
            "type": "string",
            "description": "Org name."
          },
          "project": {
            "type": "string",
            "description": "Project name."
          },
          "reason": {
            "type": "string",
            "description": "Why a `waiting` run waits, such as \"waiting for concurrency group\nprod (web run #12 holds it)\"; empty otherwise. Only in the run\nendpoint."
          },
          "ref": {
            "type": "string",
            "description": "Full git ref, for example `refs/heads/main`."
          },
          "repo_url": {
            "type": "string",
            "description": "Repository URL of the project."
          },
          "result": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RunResult",
                "description": "How it ended; `null` until it has."
              },
              {
                "type": "null"
              }
            ]
          },
          "sha": {
            "type": "string",
            "description": "Commit the run builds."
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When its first job was assigned."
          },
          "status": {
            "$ref": "#/components/schemas/RunStatus",
            "description": "Derived from the jobs (design/server-state.md, section 3)."
          },
          "title": {
            "type": "string",
            "description": "What lists call the run: the pull request's title, else the commit's\nsubject. Empty for runs from before it was kept."
          },
          "trigger": {
            "type": "string",
            "description": "What started the run: the event type, `manual`, `push`, `tag` or\n`pull_request`."
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "description": "Change counter: every change to the run adds one. Live updates\n([`RunHint`]) older than the version held can be dropped."
          }
        }
      },
      "RunHint": {
        "type": "object",
        "description": "The data of a [`RUN_EVENT`]: a run's new version and the fields a run\nlist shows. Anything else is fetched from `GET …/runs/{number}`.",
        "required": [
          "id",
          "project",
          "number",
          "version",
          "status",
          "attempt"
        ],
        "properties": {
          "attempt": {
            "type": "integer",
            "format": "int32",
            "description": "The run's attempt."
          },
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When its last job ended."
          },
          "id": {
            "type": "string",
            "description": "Run ID (a UUID)."
          },
          "number": {
            "type": "integer",
            "format": "int64",
            "description": "Run number within the project."
          },
          "project": {
            "type": "string",
            "description": "Project name."
          },
          "result": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/RunResult",
                "description": "How it ended; `null` until it has."
              },
              {
                "type": "null"
              }
            ]
          },
          "started_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When its first job was assigned."
          },
          "status": {
            "$ref": "#/components/schemas/RunStatus",
            "description": "Status."
          },
          "version": {
            "type": "integer",
            "format": "int64",
            "description": "Its version now ([`Run::version`])."
          }
        }
      },
      "RunPage": {
        "type": "object",
        "description": "A page of runs, newest first.",
        "required": [
          "runs"
        ],
        "properties": {
          "next_cursor": {
            "type": [
              "string",
              "null"
            ],
            "description": "Pass as `cursor` to get the next page; `null` on the last page."
          },
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Run"
            },
            "description": "Runs, with their jobs' summaries."
          }
        }
      },
      "RunResult": {
        "type": "string",
        "description": "How a run ended.",
        "enum": [
          "success",
          "failure",
          "cancelled"
        ]
      },
      "RunStatus": {
        "type": "string",
        "description": "Where a run is (design/server-state.md, section 3).",
        "enum": [
          "queued",
          "waiting",
          "running",
          "canceling",
          "ended"
        ]
      },
      "RunnerDownload": {
        "type": "object",
        "description": "One hod-runner build: `GET /api/v1/runner-downloads/{target}`.",
        "required": [
          "target",
          "sha256",
          "size"
        ],
        "properties": {
          "sha256": {
            "type": "string",
            "description": "SHA-256 of the binary, in hex."
          },
          "size": {
            "type": "integer",
            "format": "int64",
            "description": "Its size in bytes.",
            "minimum": 0
          },
          "target": {
            "type": "string",
            "description": "Rust target triple, such as `x86_64-unknown-linux-musl`."
          }
        }
      },
      "RunnerDownloads": {
        "type": "object",
        "description": "`GET /api/v1/runner-downloads`: the hod-runner builds this server\nhands out, for `hod runner start` to install the server's own version.\nNeeds no token.",
        "required": [
          "version",
          "downloads"
        ],
        "properties": {
          "downloads": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RunnerDownload"
            },
            "description": "One build per target; empty when the server has none."
          },
          "version": {
            "type": "string",
            "description": "Hod version of the server, and so of these builds."
          }
        }
      },
      "RunnerList": {
        "type": "object",
        "description": "An org's runners: those not gone, then those gone in the last day.",
        "required": [
          "runners"
        ],
        "properties": {
          "runners": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RunnerSummary"
            },
            "description": "The runners."
          }
        }
      },
      "RunnerSummary": {
        "type": "object",
        "description": "A runner registered with the server.",
        "required": [
          "id",
          "name",
          "pool",
          "trust",
          "status",
          "labels",
          "capabilities",
          "version",
          "slots",
          "ephemeral",
          "created_at",
          "last_seen_at"
        ],
        "properties": {
          "busy": {
            "type": "integer",
            "format": "int64",
            "description": "How many jobs it holds a lease on now."
          },
          "capabilities": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Features it supports, such as `docker` and `dind`."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it registered."
          },
          "ephemeral": {
            "type": "boolean",
            "description": "It takes one job and is deregistered after it."
          },
          "id": {
            "type": "string",
            "description": "Runner ID (a UUID)."
          },
          "labels": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Labels it offers."
          },
          "last_seen_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it last called the server."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "pool": {
            "type": "string",
            "description": "Its pool."
          },
          "slots": {
            "type": "integer",
            "format": "int32",
            "description": "Jobs it runs at once."
          },
          "status": {
            "type": "string",
            "description": "`online`, `draining` or `gone`."
          },
          "trust": {
            "$ref": "#/components/schemas/RunnerTrust",
            "description": "Which runs it takes, from its registration token."
          },
          "version": {
            "type": "string",
            "description": "Hod version."
          }
        }
      },
      "RunnerToken": {
        "type": "object",
        "description": "A registration token. Its secret is shown only once, when it is created.",
        "required": [
          "id",
          "pool",
          "trust",
          "one_time",
          "configured",
          "created_at"
        ],
        "properties": {
          "configured": {
            "type": "boolean",
            "description": "It is one of the server's configured tokens (`HOD_RUNNER_TOKEN`,\n`HOD_RUNNER_TOKEN_UNPROTECTED`), which the API can't delete."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created."
          },
          "expires_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it stops working; `null` if never."
          },
          "id": {
            "type": "string",
            "description": "Token ID (a UUID)."
          },
          "one_time": {
            "type": "boolean",
            "description": "It registers one runner only."
          },
          "pool": {
            "type": "string",
            "description": "The pool runners join with it."
          },
          "token": {
            "type": [
              "string",
              "null"
            ],
            "description": "The secret, starting with `hod_reg_`. Only in the response that\ncreates the token."
          },
          "trust": {
            "$ref": "#/components/schemas/RunnerTrust",
            "description": "Which runs its runners take."
          },
          "used_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When a runner last registered with it; `null` if never."
          }
        }
      },
      "RunnerTokenList": {
        "type": "object",
        "description": "An org's registration tokens, newest first.",
        "required": [
          "tokens"
        ],
        "properties": {
          "tokens": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RunnerToken"
            },
            "description": "The tokens."
          }
        }
      },
      "RunnerTrust": {
        "type": "string",
        "description": "Which runs a runner takes (KIL-198, ADR-0003). Jobs of protected\nruns, on the default branch or a tag, go only to protected runners;\nevery other job, such as a pull request's, only to unprotected ones.\nSet by the registration token, never by the runner.",
        "enum": [
          "protected",
          "unprotected"
        ]
      },
      "Schedule": {
        "type": "object",
        "description": "A schedule: a project's pipeline run on a cron (design/scheduling.md).\nSchedules live on the server, not in the pipeline (ADR-0017).",
        "required": [
          "project",
          "name",
          "cron",
          "timezone",
          "branch",
          "overlap",
          "catch_up",
          "only_if_changed",
          "next",
          "created_by",
          "created_at"
        ],
        "properties": {
          "branch": {
            "type": "string",
            "description": "The branch it runs; empty for the repository's default branch."
          },
          "catch_up": {
            "type": "integer",
            "format": "int64",
            "description": "Seconds a slot may still fire late, after the server was down.",
            "minimum": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created."
          },
          "created_by": {
            "type": "string",
            "description": "Who created it."
          },
          "cron": {
            "type": "string",
            "description": "Five-field cron (`minute hour day-of-month month day-of-week`), or\n`@hourly`, `@daily`, `@weekly`, `@monthly`, `@yearly`. `H` in a\nfield is a value hashed from the schedule, the same every time."
          },
          "last_fire": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Fire",
                "description": "Its latest fire; `null` before the first."
              },
              {
                "type": "null"
              }
            ]
          },
          "name": {
            "type": "string",
            "description": "Its name, unique in the project: `event.name` and `HOD_SCHEDULE` in\nits runs."
          },
          "next": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Its next fire times, up to three; empty while paused."
          },
          "only_if_changed": {
            "type": "boolean",
            "description": "Skip a slot when the branch hasn't moved since the schedule's last\nrun."
          },
          "overlap": {
            "$ref": "#/components/schemas/Overlap",
            "description": "What a run does while the schedule's previous run is still going."
          },
          "paused_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was paused; `null` while active."
          },
          "project": {
            "type": "string",
            "description": "The project it runs."
          },
          "timezone": {
            "type": "string",
            "description": "The IANA time zone the cron is read in."
          },
          "warnings": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "What may stop its runs, found when it was saved: the pipeline at the\nbranch's head doesn't compile, or the repository couldn't be read.\nOnly in the answer to a create or change."
          }
        }
      },
      "ScheduleList": {
        "type": "object",
        "description": "`GET /api/v1/orgs/{org}/schedules`: schedules by project and name.",
        "required": [
          "schedules"
        ],
        "properties": {
          "schedules": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Schedule"
            },
            "description": "The schedules."
          }
        }
      },
      "SearchJob": {
        "type": "object",
        "description": "A failed job found by a search.",
        "required": [
          "project",
          "number",
          "run_title",
          "name",
          "reason"
        ],
        "properties": {
          "finished_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it ended."
          },
          "name": {
            "type": "string",
            "description": "Job name."
          },
          "number": {
            "type": "integer",
            "format": "int64",
            "description": "Its run's number."
          },
          "project": {
            "type": "string",
            "description": "Its run's project."
          },
          "reason": {
            "type": "string",
            "description": "Why, for people."
          },
          "reason_code": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ReasonCode",
                "description": "Why, for programs."
              },
              {
                "type": "null"
              }
            ]
          },
          "result": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/JobResult",
                "description": "How it ended."
              },
              {
                "type": "null"
              }
            ]
          },
          "run_title": {
            "type": "string",
            "description": "Its run's title."
          }
        }
      },
      "SearchResults": {
        "type": "object",
        "description": "`GET /api/v1/orgs/{org}/search`: what matched, for the UI's ⌘K.",
        "required": [
          "projects",
          "runs",
          "jobs"
        ],
        "properties": {
          "jobs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SearchJob"
            },
            "description": "Failed jobs of those runs, newest run first."
          },
          "projects": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Project"
            },
            "description": "Projects whose name or repository URL contains the text."
          },
          "runs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Run"
            },
            "description": "Runs the text matches, newest first, with their jobs' summaries."
          }
        }
      },
      "Secret": {
        "type": "object",
        "description": "A stored secret (design/secrets.md, section 4): org-wide, or one\nproject's. Never its value: values are write-only.",
        "required": [
          "name",
          "rule",
          "version",
          "created_by",
          "updated_by",
          "created_at",
          "updated_at"
        ],
        "properties": {
          "components": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The published components whose steps alone get it, by name without\na version (`hod/deploy`): the seal (design/components.md,\nsection 8). Empty for any step granted it."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When it was created."
          },
          "created_by": {
            "type": "string",
            "description": "Who created it."
          },
          "name": {
            "type": "string",
            "description": "Its name, as pipelines grant it (`secrets: [NAME]`)."
          },
          "pins": {
            "type": "object",
            "description": "The values those steps may give their components' inputs, by input\nname; a destination input with no pin takes only its default.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "project": {
            "type": [
              "string",
              "null"
            ],
            "description": "Its project; absent for an org-wide secret, which every project of\nthe org sees unless the project has one of the same name."
          },
          "rule": {
            "type": "string",
            "description": "A CEL rule over the run's `event` that must hold for the secret to\nbe released, such as `event.is_default_branch`; empty for none."
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "When its value or rule last changed."
          },
          "updated_by": {
            "type": "string",
            "description": "Who set its value or rule last."
          },
          "version": {
            "type": "integer",
            "format": "int32",
            "description": "Counts up with every new value."
          }
        }
      },
      "SecretList": {
        "type": "object",
        "description": "`GET /api/v1/orgs/{org}/secrets`: secrets, org-wide first, then by\nproject and name.",
        "required": [
          "secrets"
        ],
        "properties": {
          "secrets": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Secret"
            },
            "description": "The secrets."
          }
        }
      },
      "ServerInfo": {
        "type": "object",
        "description": "`GET /api/v1/server`: what the server is.",
        "required": [
          "version",
          "source",
          "org"
        ],
        "properties": {
          "org": {
            "type": "string",
            "description": "The server's org, used when a client doesn't name one."
          },
          "source": {
            "type": "string",
            "description": "Where the source of this version is. The server is AGPL-3.0-only, so\nwhoever runs a modified one offers its source here."
          },
          "version": {
            "type": "string",
            "description": "Hod version of the server."
          }
        }
      },
      "Service": {
        "type": "object",
        "description": "A service of a job attempt: a container that ran beside it.",
        "required": [
          "name",
          "image",
          "status"
        ],
        "properties": {
          "exit_code": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "Its exit code, if it stopped while the job ran."
          },
          "exited_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it stopped, if it stopped while the job ran."
          },
          "image": {
            "type": "string",
            "description": "Its image; empty until it was ready."
          },
          "name": {
            "type": "string",
            "description": "Its name, also its hostname in the job."
          },
          "ready_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When it was ready."
          },
          "status": {
            "$ref": "#/components/schemas/ServiceStatus",
            "description": "Where it got to."
          }
        }
      },
      "ServiceStatus": {
        "type": "string",
        "description": "Where a job's service got to.",
        "enum": [
          "starting",
          "ready",
          "exited"
        ]
      },
      "SetOrgMember": {
        "type": "object",
        "description": "`PUT /api/v1/orgs/{org}/members/{user}`: give a user a role in the org.",
        "required": [
          "role"
        ],
        "properties": {
          "role": {
            "$ref": "#/components/schemas/OrgRole",
            "description": "The role."
          }
        },
        "additionalProperties": false
      },
      "SetProjectMember": {
        "type": "object",
        "description": "`PUT /api/v1/orgs/{org}/projects/{project}/members/{user}`: give an org\nmember a role on the project.",
        "required": [
          "role"
        ],
        "properties": {
          "role": {
            "$ref": "#/components/schemas/ProjectRole",
            "description": "The role."
          }
        },
        "additionalProperties": false
      },
      "SetSecret": {
        "type": "object",
        "description": "`PUT /api/v1/orgs/{org}/secrets/{name}` or\n`PUT /api/v1/orgs/{org}/projects/{project}/secrets/{name}`: create a\nsecret or replace its value.",
        "required": [
          "value"
        ],
        "properties": {
          "components": {
            "type": [
              "array",
              "null"
            ],
            "items": {
              "type": "string"
            },
            "description": "The published components whose steps alone get it, by name without\na version (`hod/deploy`): the seal (design/components.md,\nsection 8). Empty for none. Absent: the current ones stay (none, for\na new secret)."
          },
          "pins": {
            "type": [
              "object",
              "null"
            ],
            "description": "The values steps running those components may give their inputs,\nby input name (`{\"registry\": [\"https://npm.acme.internal/\"]}`); each\nvalue exactly, several allowed. A component's destination inputs\nwith no pin take only their default. Empty for none; others need\nnon-empty `components` in the same request. Absent: the current ones stay\n(none, for a new secret), unless `components` names other\ncomponents than now, which clears them.",
            "additionalProperties": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "propertyNames": {
              "type": "string"
            }
          },
          "rule": {
            "type": [
              "string",
              "null"
            ],
            "description": "A new rule, as in [`Secret::rule`]; empty for none. Absent: the\ncurrent rule stays (none, for a new secret)."
          },
          "value": {
            "type": "string",
            "description": "The value: at least 8 bytes, whitespace around it not counted, and at\nmost 48 KiB. A multi-line value needs a line of 4 bytes or more."
          }
        },
        "additionalProperties": false
      },
      "SignIn": {
        "type": "object",
        "description": "`POST /api/v1/sessions`: sign a browser in, with exactly one of a login\ncode or the admin token. Experimental.",
        "properties": {
          "code": {
            "type": [
              "string",
              "null"
            ],
            "description": "A code from `POST /sessions/codes`."
          },
          "token": {
            "type": [
              "string",
              "null"
            ],
            "description": "The admin token."
          }
        },
        "additionalProperties": false
      },
      "SignInProvider": {
        "type": "object",
        "description": "A provider people sign in with: `/login/<name>` starts it.",
        "required": [
          "name",
          "kind"
        ],
        "properties": {
          "kind": {
            "type": "string",
            "description": "`github` (Hod's GitHub App) or `oidc`."
          },
          "name": {
            "type": "string",
            "description": "Its name in `/login/<name>`."
          }
        }
      },
      "SignInProviders": {
        "type": "object",
        "description": "`GET /api/v1/sessions/providers`: the providers people sign in with.",
        "required": [
          "providers"
        ],
        "properties": {
          "providers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SignInProvider"
            },
            "description": "GitHub first, then the OIDC providers in config order."
          }
        }
      },
      "SlowJob": {
        "type": "object",
        "description": "The job that takes longest, on average, over a project's history.",
        "required": [
          "name",
          "seconds"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Job name."
          },
          "seconds": {
            "type": "integer",
            "format": "int64",
            "description": "Its mean duration, in whole seconds."
          }
        }
      },
      "Step": {
        "type": "object",
        "description": "One step of a job attempt.",
        "required": [
          "index",
          "name",
          "reason"
        ],
        "properties": {
          "allowed": {
            "type": "boolean",
            "description": "Its failure is allowed (`allow_failure:`): the job went on."
          },
          "duration_ms": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "How long it took, in milliseconds."
          },
          "exit_code": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The script's exit code, when it ran."
          },
          "index": {
            "type": "integer",
            "format": "int32",
            "description": "Its index in the job, from 0."
          },
          "name": {
            "type": "string",
            "description": "Its name."
          },
          "outcome": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/StepOutcome",
                "description": "How it ended; `null` while it runs."
              },
              {
                "type": "null"
              }
            ]
          },
          "reason": {
            "type": "string",
            "description": "Why it was skipped or failed."
          }
        }
      },
      "StepOutcome": {
        "type": "string",
        "description": "How a step ended.",
        "enum": [
          "success",
          "failure",
          "skipped",
          "cached",
          "cancelled",
          "timed_out"
        ]
      },
      "TokenRole": {
        "type": "string",
        "description": "The most a personal token may do, lowest first; it also never does\nmore than its user may. `read` reads; `run` also triggers, cancels and\nreruns runs and creates projects; `manage` also changes project\nsettings, secrets and schedules; `owner` also the org's secrets,\nrunners, members and settings.",
        "enum": [
          "read",
          "run",
          "manage",
          "owner"
        ]
      },
      "TriggerRun": {
        "type": "object",
        "description": "`POST /api/v1/orgs/{org}/runs`: start a manual run of a repository at a\ncommit. The project is created on the first trigger for a repository URL.",
        "required": [
          "repo_url"
        ],
        "properties": {
          "ref": {
            "type": "string",
            "description": "Branch or tag the run is for: `main`, `refs/heads/main` or\n`refs/tags/v1.0`. Empty or absent means the repository's default\nbranch."
          },
          "repo_url": {
            "type": "string",
            "description": "Repository URL to fetch, for example `https://github.com/acme/app`.\nThe server only accepts the URL schemes it is configured for (https\nby default)."
          },
          "sha": {
            "type": "string",
            "description": "Full commit SHA (40 lowercase hex characters). SHA-256 repositories\naren't supported yet. It must be the commit `ref` points to now, or\nthe run is refused: a commit can't run as a ref it isn't the tip of.\nEmpty or absent: that commit, which the server reads from the\nrepository."
          }
        },
        "additionalProperties": false
      },
      "TryRoleRule": {
        "type": "object",
        "description": "`POST /api/v1/orgs/{org}/role-rule/try`: a role rule to try on the\nclaims of the caller's own sign-in, without saving it.",
        "required": [
          "rule"
        ],
        "properties": {
          "rule": {
            "type": "string",
            "description": "The rule: CEL over `claims`."
          }
        },
        "additionalProperties": false
      },
      "UpdateOrg": {
        "type": "object",
        "description": "`PATCH /api/v1/orgs/{org}`: change an org's settings. Absent fields stay.",
        "properties": {
          "default_project_role": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/ProjectRole",
                "description": "The project role every member gets."
              },
              {
                "type": "null"
              }
            ]
          },
          "role_rule": {
            "type": [
              "string",
              "null"
            ],
            "description": "The role rule, checked when saved; `\"\"` removes it. Removing it\nleaves the roles it gave."
          },
          "token_max_days": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int32",
            "description": "The longest a personal token may last, in days (1 to 3650). Tokens\nmade before keep their expiry.",
            "minimum": 0
          }
        },
        "additionalProperties": false
      },
      "UpdateProject": {
        "type": "object",
        "description": "`PATCH /api/v1/orgs/{org}/projects/{project}`: change a project's\nsettings. Absent fields stay.",
        "properties": {
          "public": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Let anyone, signed in or not, read its runs, logs and files."
          }
        },
        "additionalProperties": false
      },
      "UpdateSchedule": {
        "type": "object",
        "description": "`PATCH /api/v1/orgs/{org}/projects/{project}/schedules/{name}`: change\na schedule. Absent fields stay as they are.",
        "properties": {
          "branch": {
            "type": [
              "string",
              "null"
            ],
            "description": "The branch; empty for the default branch."
          },
          "catch_up": {
            "type": [
              "integer",
              "null"
            ],
            "format": "int64",
            "description": "Seconds a slot may fire late.",
            "minimum": 0
          },
          "cron": {
            "type": [
              "string",
              "null"
            ],
            "description": "When it fires."
          },
          "only_if_changed": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Skip a slot when the branch hasn't moved."
          },
          "overlap": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/Overlap",
                "description": "What a run does while the previous one is still going."
              },
              {
                "type": "null"
              }
            ]
          },
          "timezone": {
            "type": [
              "string",
              "null"
            ],
            "description": "An IANA time zone."
          }
        },
        "additionalProperties": false
      },
      "UpdateSecret": {
        "type": "object",
        "description": "`PATCH /api/v1/orgs/{org}/secrets/{name}` or\n`PATCH /api/v1/orgs/{org}/projects/{project}/secrets/{name}`: change a\nsecret's rule, keeping its value.",
        "required": [
          "rule"
        ],
        "properties": {
          "rule": {
            "type": "string",
            "description": "The rule, as in [`Secret::rule`]; empty for none."
          }
        },
        "additionalProperties": false
      },
      "UpdateUser": {
        "type": "object",
        "description": "`PATCH /api/v1/users/{user}`: disable or enable a user, or make them a\nserver admin. Absent fields stay.",
        "properties": {
          "disabled": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "Treat the user as signed out everywhere, and refuse their sign-ins."
          },
          "server_admin": {
            "type": [
              "boolean",
              "null"
            ],
            "description": "May do anything in every org."
          }
        },
        "additionalProperties": false
      },
      "User": {
        "type": "object",
        "description": "A user. Users are server-wide; orgs give them roles.",
        "required": [
          "id",
          "name",
          "server_admin",
          "disabled",
          "created_at"
        ],
        "properties": {
          "config_admin": {
            "type": "boolean",
            "description": "May do anything in every org because the server's config names one\nof their identities (`[auth] server_admins`)."
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the user was created."
          },
          "disabled": {
            "type": "boolean",
            "description": "Treated as signed out everywhere."
          },
          "email": {
            "type": [
              "string",
              "null"
            ],
            "description": "Email, for display only."
          },
          "id": {
            "type": "string",
            "description": "User ID (a UUID)."
          },
          "identities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Identity"
            },
            "description": "The user's identities at the server's providers."
          },
          "last_sign_in_at": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time",
            "description": "When the user last signed in through a provider."
          },
          "name": {
            "type": "string",
            "description": "Display name."
          },
          "server_admin": {
            "type": "boolean",
            "description": "May do anything in every org: granted through the API."
          }
        }
      },
      "UserList": {
        "type": "object",
        "description": "`GET /api/v1/users`: every user, oldest first.",
        "required": [
          "users"
        ],
        "properties": {
          "users": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/User"
            },
            "description": "The users."
          }
        }
      }
    },
    "securitySchemes": {
      "bearer_token": {
        "type": "http",
        "scheme": "bearer",
        "description": "The admin token (`HOD_ADMIN_TOKEN`), or a personal token (`hod_pat_`) acting for its user in one org, capped at its role. What a caller may do follows its roles (design/auth.md)."
      },
      "session_cookie": {
        "type": "apiKey",
        "in": "cookie",
        "name": "__Host-hod_session",
        "description": "The web UI's session cookie: `__Host-hod_session` over https, `hod_session_<port>` over plain http. Changes must come from Hod's own pages."
      }
    }
  },
  "security": [
    {
      "bearer_token": []
    },
    {
      "session_cookie": []
    }
  ]
}
