{
  "openapi": "3.1.0",
  "info": {
    "title": "GitApprove API",
    "version": "1.0.0",
    "description": "Versioned REST API for GitApprove — pull request intelligence: PRs, tagged\ncode chunks, review comments, reviewer guidance, sync, and billing.\n\nAuthentication: every request carries an org-scoped API key as a bearer\ntoken (`Authorization: Bearer gtap_...`). Keys are created and revoked by\norg admins in the Team page of the GitApprove web app. Plaintext keys are\nshown once at creation and never again.\nThe exceptions are the three `/api/v1/evidence/action/*` endpoints of the\nGitApprove/evidence action, which take a GitHub Actions OIDC token\ninstead of a key.\n\nAll timestamps are INTEGER epoch milliseconds. 404 on any PR endpoint\nmeans the PR does not exist or does not belong to the key's org.\n\nPlans: every endpoint works on every plan (Standard, High, BYOK,\nPassthrough) and during the trial, except:\n- `POST /api/v1/sync` and `POST /api/v1/prs/{id}/comments` need an active\n  subscription or trial (they answer 402 without one).\n- `GET /api/v1/audit` requires the High, BYOK or Passthrough plan (and the\n  `audit:read` scope); on Standard it answers 403.\n- The evidence endpoints answer `{ \"enabled\": false }` (or 404 for\n  captures) unless the organization has joined the evidence beta.\nOperations limited to some plans list them in `x-gitapprove-plans`.\n",
    "license": {
      "name": "Proprietary"
    }
  },
  "servers": [
    {
      "url": "https://gitapprove.com",
      "description": "Production"
    },
    {
      "url": "http://localhost:8080",
      "description": "Local development"
    }
  ],
  "security": [
    {
      "bearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "PRs",
      "description": "Pull request listings and details"
    },
    {
      "name": "Chunks",
      "description": "Tagged code chunks per file"
    },
    {
      "name": "Comments",
      "description": "Line-level review comments"
    },
    {
      "name": "Sync",
      "description": "GitHub sync triggers"
    },
    {
      "name": "Billing",
      "description": "Subscription state"
    },
    {
      "name": "Audit",
      "description": "The organization audit trail (audit:read scope)"
    },
    {
      "name": "Evidence variables",
      "description": "Environment variables for evidence test runs, and their rotation (evidence:read to list and read history, evidence:write to change)"
    },
    {
      "name": "Private registries",
      "description": "Credentials for private package registries the evidence dependency install uses (evidence:read to list, evidence:write to change)"
    },
    {
      "name": "Private dependencies",
      "description": "Which of the GitHub App installation's repositories the evidence dependency install may read (evidence:read to read, evidence:write to change)"
    },
    {
      "name": "Test network",
      "description": "Whether the tests in GitApprove's sandbox may reach the network, and which hosts (evidence:read to read, evidence:write to change)"
    },
    {
      "name": "Evidence from GitHub Actions",
      "description": "The GitApprove/evidence action runs the evidence runner in the organization's own workflow and sends the results (GitHub Actions OIDC token, no API key)"
    }
  ],
  "paths": {
    "/api/v1/prs": {
      "get": {
        "operationId": "listPRs",
        "tags": [
          "PRs"
        ],
        "summary": "List PRs for the key's org",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string"
            },
            "description": "Opaque nextCursor from the preceding page. Keep filters unchanged."
          },
          {
            "in": "query",
            "name": "number",
            "schema": {
              "type": "integer",
              "minimum": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "PRs ordered by creation time and ID, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PRPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid pagination parameter"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    },
    "/api/v1/prs/{id}": {
      "get": {
        "operationId": "getPR",
        "tags": [
          "PRs"
        ],
        "summary": "PR detail with per-file change stats",
        "parameters": [
          {
            "$ref": "#/components/parameters/PRId"
          }
        ],
        "responses": {
          "200": {
            "description": "PR detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PRDetail"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/prs/{id}/chunks": {
      "get": {
        "operationId": "listPRChunks",
        "tags": [
          "Chunks"
        ],
        "summary": "Tagged code chunks per file",
        "description": "Logical code chunks (hunks attributed to their enclosing symbol) for\nevery file in the PR, each carrying one or more tags from the fixed\ntaxonomy, plus optional subtags that say why. `tag` and `subtag` may\nrepeat; a chunk is returned when it matches ANY given tag or subtag\n(OR semantics — same as the web UI filter). With neither param it\nreturns every chunk.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PRId"
          },
          {
            "name": "tag",
            "in": "query",
            "description": "Chunk tag to filter by (repeatable, OR semantics)",
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "security sensitive",
                  "performance sensitive",
                  "reliability",
                  "core logic",
                  "tests",
                  "data access",
                  "api surface",
                  "config",
                  "docs",
                  "boilerplate",
                  "ui",
                  "migrations"
                ]
              }
            }
          },
          {
            "name": "subtag",
            "in": "query",
            "description": "Chunk subtag to filter by (repeatable). A chunk is returned when it\nmatches ANY given `tag` or ANY given `subtag`.\n",
            "schema": {
              "type": "array",
              "items": {
                "$ref": "#/components/schemas/ChunkSubtag"
              }
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Chunks grouped by file",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/FileChunks"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/prs/{id}/comments": {
      "get": {
        "operationId": "listPRComments",
        "tags": [
          "Comments"
        ],
        "summary": "List enriched comments on a PR",
        "parameters": [
          {
            "$ref": "#/components/parameters/PRId"
          }
        ],
        "responses": {
          "200": {
            "description": "Comments, oldest first",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Comment"
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      },
      "post": {
        "operationId": "createPRComment",
        "tags": [
          "Comments"
        ],
        "summary": "Post a comment on a PR",
        "description": "Requires a creator-bound API key with comments:write scope and a\nGitHub user token for that same human in X-GitHub-Token.\nGitHub publishes the comment as its author. GitApprove stores the\nresulting GitHub comment ID. Conviction and importance appear\nin a compact footer when set.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PRId"
          },
          {
            "in": "header",
            "name": "X-GitHub-Token",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "GitHub user access token belonging to the API key creator. Demo mode does not require this token."
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewComment"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created comment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Comment"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "The organization has no active subscription or unused trial"
          },
          "403": {
            "description": "Missing write scope or mismatched human identity"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "429": {
            "description": "Rate limit exceeded for this API key"
          }
        }
      }
    },
    "/api/v1/prs/{id}/guidance": {
      "get": {
        "operationId": "getPRGuidance",
        "tags": [
          "PRs"
        ],
        "summary": "Reviewer guidance for a PR",
        "description": "A concrete approve / comment / request-changes / skip recommendation\nwith grounded rationale bullets, derived from diff scoring, CI\nchecks, and diff stats.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PRId"
          }
        ],
        "responses": {
          "200": {
            "description": "Guidance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Guidance"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/prs/{id}/evidence": {
      "get": {
        "operationId": "getPREvidence",
        "tags": [
          "PRs"
        ],
        "summary": "Evidence run status for a PR (evidence beta)",
        "description": "Whether evidence is enabled for the organization and the state of the\nnewest run for this PR: what the repository's own tests did on the base\nand head revisions. `{ \"enabled\": false }` when evidence is off. A run\nfor an older commit has `stale: true`; its captures are never shown as\ncurrent. `previewLinks` are the team's own preview deployments from the\nevidence configuration at the PR's base.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PRId"
          }
        ],
        "responses": {
          "200": {
            "description": "Evidence status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/prs/{id}/evidence/captures": {
      "get": {
        "operationId": "getPREvidenceCaptures",
        "tags": [
          "PRs"
        ],
        "summary": "Evidence captures for a file range (evidence beta)",
        "description": "Captures (screenshots for frontend code, request/response pairs for\nbackend code) for the changed code in a file range, for the PR's current\nhead only, and only when the latest run is `ready` or `partial`. Backend\ncaptures are returned as summaries (breaking flag and changed field\npaths), never as bodies. Media bytes are not served by this API.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/PRId"
          },
          {
            "name": "file",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Repository-relative path of a file in the PR"
          },
          {
            "name": "start",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "First line of the range (new side)"
          },
          {
            "name": "end",
            "in": "query",
            "required": true,
            "schema": {
              "type": "integer",
              "minimum": 1
            },
            "description": "Last line of the range, not before `start`"
          }
        ],
        "responses": {
          "200": {
            "description": "Captures overlapping the range",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceCaptures"
                }
              }
            }
          },
          "400": {
            "description": "Missing or invalid file, start or end"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          }
        }
      }
    },
    "/api/v1/evidence/env-vars": {
      "get": {
        "operationId": "listEvidenceEnvVars",
        "tags": [
          "Evidence variables"
        ],
        "summary": "List the org's evidence variables",
        "description": "Environment variables the evidence runner gives the test phase of an\nevidence run (never the dependency install). Requires the\n`evidence:read` or `evidence:write` scope; the key's creator must still\nbe an org owner or admin. A secret's value is never returned: `value`\nis null and the `fingerprint` and `version` show when it changed.\n",
        "responses": {
          "200": {
            "description": "The variables, by name",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceEnvVarList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key has neither the evidence:read nor the evidence:write scope"
          },
          "429": {
            "description": "Rate limit exceeded for this API key"
          }
        }
      },
      "post": {
        "operationId": "createEvidenceEnvVar",
        "tags": [
          "Evidence variables"
        ],
        "summary": "Create an evidence variable",
        "description": "Names are upper case, digits and underscores (`^[A-Z_][A-Z0-9_]*$`) and\nmay not be one the runner sets or one that makes a runtime load code\n(PATH, HOME, NODE_OPTIONS, LD_PRELOAD, JAVA_TOOL_OPTIONS, EVIDENCE_*, …).\n`secret` defaults to true. There is no minimum length and an empty\nvalue is allowed (never redacted); a secret shorter than 6 characters\nis redacted from results only where it stands as a whole token. Two variables may share a name only\nwhen their repositories do not overlap; one scoped to a repository wins\nover an organization-wide one. At most 100 variables per organization.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewEvidenceEnvVar"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created variable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceEnvVar"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key lacks the evidence:write scope"
          },
          "409": {
            "description": "A variable of this name already applies to one of these repositories, or the organization has 100 variables"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/v1/evidence/env-vars/{varId}": {
      "patch": {
        "operationId": "updateEvidenceEnvVar",
        "tags": [
          "Evidence variables"
        ],
        "summary": "Change an evidence variable's name, scope, expiry or policy",
        "description": "Every field is optional. A plain variable can be made secret; a secret\ncannot be made plain (delete it and create a plain one). A plain\nvariable's `value` may be changed here (a new version); a secret's value\nis changed only with the rotate operation.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/EnvVarId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvidenceEnvVarPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated variable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceEnvVar"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key lacks the evidence:write scope"
          },
          "404": {
            "description": "No such variable in the key's org"
          },
          "409": {
            "description": "Name and repositories conflict with another variable, or the variable changed meanwhile"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      },
      "delete": {
        "operationId": "deleteEvidenceEnvVar",
        "tags": [
          "Evidence variables"
        ],
        "summary": "Delete an evidence variable and its history",
        "parameters": [
          {
            "$ref": "#/components/parameters/EnvVarId"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key lacks the evidence:write scope"
          },
          "404": {
            "description": "No such variable in the key's org"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/v1/evidence/env-vars/{varId}/rotate": {
      "post": {
        "operationId": "rotateEvidenceEnvVar",
        "tags": [
          "Evidence variables"
        ],
        "summary": "Set a new value for an evidence variable",
        "description": "The version goes up and the old value is not kept. `expiresAt` belongs\nto the value: omitted, the new value has no expiry. Rotation resets the\nrotation reminder. Runs already started keep the value they were given.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/EnvVarId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvidenceEnvVarRotation"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The variable with its new version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceEnvVar"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key lacks the evidence:write scope"
          },
          "404": {
            "description": "No such variable in the key's org"
          },
          "409": {
            "description": "The variable changed meanwhile; retry"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/v1/evidence/env-vars/{varId}/history": {
      "get": {
        "operationId": "getEvidenceEnvVarHistory",
        "tags": [
          "Evidence variables"
        ],
        "summary": "Every value an evidence variable has had (never the values)",
        "parameters": [
          {
            "$ref": "#/components/parameters/EnvVarId"
          }
        ],
        "responses": {
          "200": {
            "description": "Versions, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceEnvVarHistory"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key has neither the evidence:read nor the evidence:write scope"
          },
          "404": {
            "description": "No such variable in the key's org"
          }
        }
      }
    },
    "/api/v1/evidence/env-vars/bulk-rotate": {
      "post": {
        "operationId": "bulkRotateEvidenceEnvVars",
        "tags": [
          "Evidence variables"
        ],
        "summary": "Set new values for several evidence variables at once",
        "description": "Every item is validated before any is written; an invalid item fails\nthe whole request with 400. A variable that changed meanwhile is\nreported in `failed` and the others are still rotated.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvidenceEnvVarBulkRotation"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "What was rotated",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceEnvVarBulkResult"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key lacks the evidence:write scope"
          },
          "404": {
            "description": "An item names no variable in the key's org"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/v1/evidence/private-dependencies": {
      "get": {
        "operationId": "getEvidencePrivateDependencies",
        "tags": [
          "Private dependencies"
        ],
        "summary": "Read the org's private dependency repositories",
        "description": "For a pull request whose head is in the base repository, the evidence\ndependency install reads private GitHub dependencies (git over HTTPS,\nGo modules, GitHub archives) with a GitHub App token minted for that\nrepository and the repositories listed here, or for every repository\nof the installation with `allRepositories` (which also lets GitHub\nPackages through). Default: none, the pull request's repository only.\nA pull request's code runs in the install, so it can read every\nrepository the token covers. Pull requests from forks get no token\nfor private content. `available` lists the installation's\nrepositories. Requires `evidence:read` or `evidence:write`.\n",
        "responses": {
          "200": {
            "description": "The setting and the repositories to choose from",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidencePrivateDependencies"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key has neither the evidence:read nor the evidence:write scope"
          },
          "429": {
            "description": "Rate limit exceeded for this API key"
          }
        }
      },
      "put": {
        "operationId": "setEvidencePrivateDependencies",
        "tags": [
          "Private dependencies"
        ],
        "summary": "Set the org's private dependency repositories",
        "description": "Either field may be left out to keep it. Each repository must be one\nof the installation's (`owner/name`, any case) or already listed; at\nmost 100. Audited as `evidence.private_dependencies.updated`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvidencePrivateDependenciesUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new setting",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidencePrivateDependencies"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key lacks the evidence:write scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/v1/evidence/test-network": {
      "get": {
        "operationId": "getEvidenceTestNetwork",
        "tags": [
          "Test network"
        ],
        "summary": "Read the org's sandbox test network",
        "description": "By default (`mode: none`) the tests in GitApprove's sandbox have no\noutbound network. With `allowlist`, their requests go through\nGitApprove's egress gateway and may reach the public package\nregistries the dependency install uses (`registries`) and the\norganization's `hosts`: `api.example.com`, `*.example.com` (any\nsubdomain at any depth, not the apex), `http://host` (plain HTTP for\nthat host only; everything else is HTTPS), a public IP address, or\n`*` (every public host; `warning` is set). No credential is added to\nthese requests; addresses in private, loopback, link-local and\nmetadata ranges are refused, also when a name resolves to one (checked\nat every request and redirect); every request is recorded as evidence.\nRuns in the organization's own GitHub Actions already have the\nrunner's network; this setting does not apply to them. Requires\n`evidence:read` or `evidence:write`.\n",
        "responses": {
          "200": {
            "description": "The setting",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceTestNetwork"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key has neither the evidence:read nor the evidence:write scope"
          },
          "429": {
            "description": "Rate limit exceeded for this API key"
          }
        }
      },
      "put": {
        "operationId": "setEvidenceTestNetwork",
        "tags": [
          "Test network"
        ],
        "summary": "Set the org's sandbox test network",
        "description": "Either field may be left out to keep it. At most 100 hosts; each is\nvalidated (host names in their IDNA form, no path, port or user; no\nprivate or reserved address; `http://` and wildcards do not combine).\nAudited as `evidence.test_network.updated`.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvidenceTestNetworkUpdate"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The new setting",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceTestNetwork"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key lacks the evidence:write scope"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/v1/evidence/registries": {
      "get": {
        "operationId": "listEvidenceRegistries",
        "tags": [
          "Private registries"
        ],
        "summary": "List the org's private registries",
        "description": "Package registries the evidence dependency install may reach for this\norganization, with a credential the install gateway adds to requests\nunder the host and path prefix (never visible to the install or the\ntests, never used for pull requests from forks). Requires the\n`evidence:read` or `evidence:write` scope; the key's creator must still\nbe an org owner or admin. The credential is never returned.\n",
        "responses": {
          "200": {
            "description": "The registries",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceRegistryList"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key has neither the evidence:read nor the evidence:write scope"
          },
          "429": {
            "description": "Rate limit exceeded for this API key"
          }
        }
      },
      "post": {
        "operationId": "createEvidenceRegistry",
        "tags": [
          "Private registries"
        ],
        "summary": "Add a private registry",
        "description": "`host` is an exact host name (https, port 443). It cannot be a GitHub\nhost (private repositories and GitHub Packages are set with the\nprivate dependencies operations) or a public registry the install\nalready reaches, except registry.npmjs.org for npm organization scopes\n(ecosystem `npm`, with `scopes`, and no `pathPrefix`). Every other\nregistry needs `pathPrefix`, the repository's path on the host (at\nleast one segment, for example `/artifactory/api/npm/npm-private/`):\nthe install reaches the host under that path only, and only those\nrequests get the credential. A request gets it only when its path,\nwith percent escapes of unreserved characters decoded, is under the\nprefix and holds no encoded `/` or `\\` (`%2F`, `%5C`), `;`, `..` or\n`//` (npm's `@scope%2Fname` right after the prefix aside); a response\nthat repeats the credential (headers, or a body up to 1 MiB) is\nrefused. At most 20 registries per organization.\n",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/NewEvidenceRegistry"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Created registry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceRegistry"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key lacks the evidence:write scope"
          },
          "409": {
            "description": "A registry already exists for this host and prefix (or these npm scopes), or the organization has 20"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/v1/evidence/registries/{registryId}": {
      "patch": {
        "operationId": "updateEvidenceRegistry",
        "tags": [
          "Private registries"
        ],
        "summary": "Change a private registry's path prefix, ecosystem, scopes or description",
        "description": "Every field is optional. The host cannot change (delete the registry\nand add it again); the credential is changed with the rotate\noperation, except that a change sending it further (a path prefix\nthat is not the old one or under it; on registry.npmjs.org, an added\nscope) needs `auth` again (409 without it), which then replaces the\nstored credential (version up). `auth` is refused on any other change.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/RegistryId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvidenceRegistryPatch"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Updated registry",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceRegistry"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key lacks the evidence:write scope"
          },
          "404": {
            "description": "No such registry in the key's org"
          },
          "409": {
            "description": "Conflicts with another registry, widens where the credential goes without `auth`, or the registry changed meanwhile"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      },
      "delete": {
        "operationId": "deleteEvidenceRegistry",
        "tags": [
          "Private registries"
        ],
        "summary": "Delete a private registry and its credential",
        "parameters": [
          {
            "$ref": "#/components/parameters/RegistryId"
          }
        ],
        "responses": {
          "200": {
            "description": "Deleted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key lacks the evidence:write scope"
          },
          "404": {
            "description": "No such registry in the key's org"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/v1/evidence/registries/{registryId}/rotate": {
      "post": {
        "operationId": "rotateEvidenceRegistry",
        "tags": [
          "Private registries"
        ],
        "summary": "Set a new credential for a private registry",
        "description": "The version goes up and the old credential is not kept. The kind of\ncredential may change. Runs already installing keep the one they had.\n",
        "parameters": [
          {
            "$ref": "#/components/parameters/RegistryId"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvidenceRegistryRotation"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The registry with its new version",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceRegistry"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key lacks the evidence:write scope"
          },
          "404": {
            "description": "No such registry in the key's org"
          },
          "409": {
            "description": "The registry changed meanwhile; retry"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/v1/evidence/action/plan": {
      "post": {
        "operationId": "planEvidenceActionRun",
        "tags": [
          "Evidence from GitHub Actions"
        ],
        "summary": "Ask which tests the GitApprove/evidence action should run",
        "description": "Called by the GitApprove/evidence action from a `pull_request` workflow\njob, after the job's own setup steps. Authentication is the job's GitHub\nActions OIDC ID token (`permissions: id-token: write`) with the\nGitApprove URL as its audience; no API key. The token is verified\nagainst GitHub's published keys (issuer, audience, expiry, at most 15\nminutes old). The organization is the one whose GitHub account id is\nthe token's `repository_owner_id`; it needs the evidence add-on and\n\"Accept evidence from GitHub Actions\" on. The event must be\n`pull_request` (`pull_request_target` is refused) and the ref\n`refs/pull/<n>/merge`; GitHub must agree that the pull request's base\nrepository is the token's `repository_id`, that it is not from a fork,\nand that its head is `headSha`.\n\nGitApprove selects the tests from the uploaded index and the pull\nrequest's changed files, creates (or claims) an evidence run with\nsource `github-actions` bound to the workflow run and attempt, and\nreturns the plan. The same run and attempt asking again get the same\nplan. `skip: true` (200) means there is nothing to run: the\norganization's source is the sandbox, the monthly allowance is used up,\na draft, or no eligible change.\n",
        "security": [
          {
            "githubActionsOidc": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvidenceActionPlanRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The plan, or why there is nothing to run",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceActionPlan"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "Missing or invalid OIDC token"
          },
          "403": {
            "description": "The setting is off, the account, repository or event is not accepted, or the pull request is from a fork"
          },
          "404": {
            "description": "The pull request is not on GitHub or not in GitApprove yet (retry)"
          },
          "409": {
            "description": "The head moved on, or GitApprove has not seen the commit yet (retry)"
          },
          "413": {
            "description": "Request body over 8 MiB"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "503": {
            "description": "GitHub's keys or the pull request could not be read; retry"
          }
        }
      }
    },
    "/api/v1/evidence/action/author": {
      "post": {
        "operationId": "reportEvidenceActionAuthoring",
        "tags": [
          "Evidence from GitHub Actions"
        ],
        "summary": "Report the runs GitApprove's authoring agent asked for",
        "description": "When a plan carries `authoring` (a step of GitApprove's authoring\nagent), the action is the agent's test executor: it writes the step's\n`files` into the checkout of each revision a run needs (reserved\n`gitapprove-evidence` names; `discard` deleted), runs each of `runs`\non its revision, and posts each run's artifact directory here, by run\nid. Authenticated like the plan and accepted only from the workflow\nrun and attempt the plan was issued to, for the run's current step; a\nrepeated report of an answered step gets the same answer. The answer\nis the agent's next step or, with `final: true`, the tests it kept\n(`accept`) and the repository's tests it used (`include`), to run with\nthe plan's files on both revisions. Authored tests are never\ncommitted; the action deletes them before it ends.\n",
        "security": [
          {
            "githubActionsOidc": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvidenceActionAuthorRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The agent's next step",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceAuthoringStep"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "Missing or invalid OIDC token"
          },
          "403": {
            "description": "Not from the workflow run the plan was issued to, or the setting is off"
          },
          "404": {
            "description": "No such evidence run for this pull request"
          },
          "409": {
            "description": "Not the current step, the run finished, or the head moved on"
          },
          "413": {
            "description": "Request body too large"
          },
          "429": {
            "description": "Rate limit exceeded"
          }
        }
      }
    },
    "/api/v1/evidence/action/results": {
      "post": {
        "operationId": "uploadEvidenceActionResults",
        "tags": [
          "Evidence from GitHub Actions"
        ],
        "summary": "Upload what the planned tests produced",
        "description": "The manifests (`manifest.json`) and artifacts (screenshots, screen\nrecordings) the runner wrote for the head and base revisions. Authenticated like the\nplan, and accepted only from the workflow run and attempt the plan was\nissued to, for the same head, while the pull request still has it.\nEverything is validated like a sandbox instance's output (names,\nsizes, the manifest schema, PNG structure and re-encoding), results for\ntests outside the plan are dropped, the organization's secret evidence\nvariables are redacted, and the run is stored and shown in the review\nas \"Ran in your GitHub Actions\". The run counts one evidence minute per\nstarted block of 40 screenshots, at least one.\n\nTwo calls. The first carries the manifests (text) and names each\nartifact with its size; nothing is stored, and the answer (202) is\nwhere to upload each file: a short-lived signed URL for one PUT of\nexactly that size, or one per 16 MiB part for a multipart upload. The\nartifacts go straight to storage, never through GitApprove's API. The\nsecond call repeats the body with `uploaded` (each file, and each\npart's ETag); it completes the uploads and stores the run. An artifact\nis at most 100 MiB (screen recordings; the action re-encodes larger\nones with ffmpeg, or leaves them out), all of a run's at most 300 MiB.\n\nIdempotent: the second call claims the run before anything is stored,\nso the same results sent twice are stored once. A repeat of either call\nfor results already stored gets the same 200 body again; one sent while\nthe first is being stored gets 409 \"...; retry\".\n",
        "security": [
          {
            "githubActionsOidc": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/EvidenceActionResultsRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The stored run",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceActionResults"
                }
              }
            }
          },
          "202": {
            "description": "Where to upload each artifact (the first call)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EvidenceActionUploadTickets"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "description": "Missing or invalid OIDC token"
          },
          "403": {
            "description": "Not accepted (as for the plan), or not the workflow run the plan was issued to"
          },
          "404": {
            "description": "No such run for this pull request"
          },
          "409": {
            "description": "The run ended some other way (cancelled, timed out), the head moved on, or another upload of these results is being stored (retry)"
          },
          "413": {
            "description": "A body over 16 MiB, or the run's artifacts over 300 MiB"
          },
          "429": {
            "description": "Rate limit exceeded"
          },
          "503": {
            "description": "GitHub's keys or the pull request could not be read; retry"
          }
        }
      }
    },
    "/api/v1/sync": {
      "post": {
        "operationId": "syncPRs",
        "tags": [
          "Sync"
        ],
        "summary": "Trigger a full PR sync for the key's org",
        "description": "Pulls the latest open PRs, file diffs, and CI checks from GitHub\ninto GitApprove. Idempotent — re-running converges to the same rows.\n",
        "responses": {
          "200": {
            "description": "Sync result",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SyncResult"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "description": "The organization has no active subscription or unused trial"
          },
          "403": {
            "description": "The API key lacks the sync:write scope"
          },
          "429": {
            "description": "Rate limit exceeded for this API key"
          }
        }
      }
    },
    "/api/v1/audit": {
      "get": {
        "operationId": "listAuditEvents",
        "tags": [
          "Audit"
        ],
        "summary": "The key's org audit trail, newest first (High, BYOK and Passthrough plans)",
        "x-gitapprove-plans": [
          "high",
          "byok",
          "passthrough"
        ],
        "description": "Requires the `audit:read` scope; a key with only `read` cannot read the\naudit trail. The key's creator must still be an org owner or admin, and\nthe org must be on a plan that includes the audit log (not Standard).\nEvents are kept 30 days (review actions) or 1 year (everything else).\nUnknown filter values return an empty page. `api_version` versions the\nevent shape: new actions and categories are additive.\n",
        "parameters": [
          {
            "in": "query",
            "name": "limit",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            }
          },
          {
            "in": "query",
            "name": "cursor",
            "schema": {
              "type": "string"
            },
            "description": "Opaque nextCursor from the preceding page. Keep filters unchanged."
          },
          {
            "in": "query",
            "name": "actor",
            "schema": {
              "type": "string"
            },
            "description": "A user id, or an API key or system actor id"
          },
          {
            "in": "query",
            "name": "action",
            "schema": {
              "type": "string"
            },
            "description": "Event type, for example `credential.ai_key.set`"
          },
          {
            "in": "query",
            "name": "category",
            "schema": {
              "type": "string",
              "enum": [
                "review",
                "membership",
                "credentials",
                "org_settings",
                "billing",
                "data",
                "system"
              ]
            }
          },
          {
            "in": "query",
            "name": "target_type",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "target_id",
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "from",
            "schema": {
              "type": "integer"
            },
            "description": "Earliest event time, epoch milliseconds"
          },
          {
            "in": "query",
            "name": "to",
            "schema": {
              "type": "integer"
            },
            "description": "Latest event time, epoch milliseconds"
          }
        ],
        "responses": {
          "200": {
            "description": "Audit events, newest first",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditPage"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "description": "The key lacks the audit:read scope, or the plan does not include the audit log"
          },
          "429": {
            "description": "Rate limit exceeded for this API key"
          }
        }
      }
    },
    "/api/v1/billing/status": {
      "get": {
        "operationId": "getBillingStatus",
        "tags": [
          "Billing"
        ],
        "summary": "Subscription state for the key's org",
        "responses": {
          "200": {
            "description": "Billing status",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BillingStatus"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Org-scoped API key, e.g. `Authorization: Bearer gtap_abc123…`.\nCreate keys in the Team page (org admins only).\n"
      },
      "githubActionsOidc": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "A GitHub Actions OIDC ID token whose audience is the GitApprove URL\n(only for the GitApprove/evidence action).\n"
      }
    },
    "parameters": {
      "PRId": {
        "name": "id",
        "in": "path",
        "required": true,
        "description": "GitApprove PR id (opaque string)",
        "schema": {
          "type": "string"
        }
      },
      "EnvVarId": {
        "name": "varId",
        "in": "path",
        "required": true,
        "description": "Evidence variable id (opaque string)",
        "schema": {
          "type": "string"
        }
      },
      "RegistryId": {
        "name": "registryId",
        "in": "path",
        "required": true,
        "description": "Private registry id (opaque string)",
        "schema": {
          "type": "string"
        }
      }
    },
    "responses": {
      "Unauthorized": {
        "description": "Missing, invalid, or revoked API key",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "NotFound": {
        "description": "PR not found (or not in the key's org)",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      },
      "BadRequest": {
        "description": "Invalid request",
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            }
          }
        }
      }
    },
    "schemas": {
      "Ok": {
        "type": "object",
        "required": [
          "ok"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          }
        }
      },
      "EvidenceEnvVar": {
        "type": "object",
        "required": [
          "id",
          "name",
          "secret",
          "value",
          "valueReadable",
          "repositories",
          "description",
          "version",
          "fingerprint",
          "valueSetAt",
          "expiresAt",
          "rotateAfterDays",
          "rotationStatus",
          "createdBy",
          "createdAt",
          "updatedBy",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string",
            "example": "STAGING_API_TOKEN"
          },
          "secret": {
            "type": "boolean",
            "description": "Write-only value, redacted from results, never given to pull requests from forks"
          },
          "value": {
            "type": "string",
            "nullable": true,
            "description": "A plain variable's value; always null for a secret"
          },
          "valueReadable": {
            "type": "boolean",
            "description": "False when the stored value cannot be decrypted (the encryption key changed); rotate it"
          },
          "repositories": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "string"
            },
            "description": "Repository full names; null means every repository in the organization"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "version": {
            "type": "integer",
            "description": "Goes up each time the value is set"
          },
          "fingerprint": {
            "type": "string",
            "description": "Keyed hash of the value (12 hex characters); shows a change, reveals nothing"
          },
          "valueSetAt": {
            "type": "integer",
            "description": "When the current value was set (epoch ms)"
          },
          "expiresAt": {
            "type": "integer",
            "nullable": true,
            "description": "When the value stops working (epoch ms)"
          },
          "rotateAfterDays": {
            "type": "integer",
            "nullable": true,
            "description": "Rotation policy",
            "from valueSetAt": null
          },
          "rotationStatus": {
            "type": "string",
            "enum": [
              "ok",
              "due-soon",
              "overdue",
              "expired"
            ],
            "description": "due-soon is within 7 days of expiry or of the policy's date; an expired variable is not given to runs"
          },
          "createdBy": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "integer"
          },
          "updatedBy": {
            "type": "string",
            "nullable": true
          },
          "updatedAt": {
            "type": "integer"
          }
        }
      },
      "EvidenceRegistry": {
        "type": "object",
        "required": [
          "id",
          "host",
          "pathPrefix",
          "ecosystem",
          "authType",
          "headerName",
          "scopes",
          "description",
          "version",
          "fingerprint",
          "credentialReadable",
          "valueSetAt",
          "createdBy",
          "createdAt",
          "updatedBy",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "host": {
            "type": "string",
            "example": "acme.jfrog.io"
          },
          "pathPrefix": {
            "type": "string",
            "nullable": true,
            "description": "The repository's path on the host; requests under it only. Null only on registry.npmjs.org (npm scopes decide)",
            "example": "/artifactory/api/npm/npm-private"
          },
          "ecosystem": {
            "$ref": "#/components/schemas/EvidenceRegistryEcosystem"
          },
          "authType": {
            "type": "string",
            "enum": [
              "bearer",
              "basic",
              "header"
            ]
          },
          "headerName": {
            "type": "string",
            "nullable": true,
            "description": "The custom header's name (authType header); not secret"
          },
          "scopes": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "npm scopes (`@acme`) the credential is for, or Go module path patterns (GONOSUMDB)"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "version": {
            "type": "integer",
            "description": "Goes up each time the credential is set"
          },
          "fingerprint": {
            "type": "string",
            "description": "Keyed hash of the credential (12 hex characters); shows a change, reveals nothing"
          },
          "credentialReadable": {
            "type": "boolean",
            "description": "False when the stored credential cannot be decrypted (the encryption key changed); rotate it"
          },
          "valueSetAt": {
            "type": "integer",
            "description": "When the current credential was set (epoch ms)"
          },
          "createdBy": {
            "type": "string",
            "nullable": true
          },
          "createdAt": {
            "type": "integer"
          },
          "updatedBy": {
            "type": "string",
            "nullable": true
          },
          "updatedAt": {
            "type": "integer"
          }
        }
      },
      "EvidenceRegistryEcosystem": {
        "type": "string",
        "enum": [
          "npm",
          "pypi",
          "maven",
          "nuget",
          "rubygems",
          "composer",
          "go",
          "other"
        ],
        "description": "What the registry serves. `go` registries are asked before proxy.golang.org; `npm` scopes are required on registry.npmjs.org."
      },
      "EvidenceRegistryList": {
        "type": "object",
        "required": [
          "registries"
        ],
        "properties": {
          "registries": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvidenceRegistry"
            }
          }
        }
      },
      "EvidenceRegistryAuth": {
        "type": "object",
        "description": "The credential (write-only). `bearer` sends `Authorization: Bearer\n<token>`; `basic` sends `Authorization: Basic` of user and password\n(an AWS CodeArtifact token is `basic` with user `aws`, or `bearer`);\n`header` sends `<name>: <value>` (for example `X-JFrog-Art-Api`).\nPrintable ASCII on one line, at most 4096 characters each.\n",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "bearer",
              "basic",
              "header"
            ]
          },
          "token": {
            "type": "string",
            "description": "For bearer"
          },
          "username": {
            "type": "string",
            "description": "For basic; no ':'"
          },
          "password": {
            "type": "string",
            "description": "For basic"
          },
          "name": {
            "type": "string",
            "description": "For header: letters, digits and dashes"
          },
          "value": {
            "type": "string",
            "description": "For header"
          }
        }
      },
      "NewEvidenceRegistry": {
        "type": "object",
        "required": [
          "host",
          "ecosystem",
          "auth"
        ],
        "properties": {
          "host": {
            "type": "string",
            "example": "acme.jfrog.io"
          },
          "pathPrefix": {
            "type": "string",
            "nullable": true,
            "maxLength": 200,
            "description": "Required (the repository's path, at least one segment), except on registry.npmjs.org where it must be absent",
            "example": "/artifactory/api/npm/npm-private/"
          },
          "ecosystem": {
            "$ref": "#/components/schemas/EvidenceRegistryEcosystem"
          },
          "scopes": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string"
            }
          },
          "auth": {
            "$ref": "#/components/schemas/EvidenceRegistryAuth"
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 300
          }
        }
      },
      "EvidenceRegistryPatch": {
        "type": "object",
        "properties": {
          "pathPrefix": {
            "type": "string",
            "nullable": true,
            "maxLength": 200
          },
          "ecosystem": {
            "$ref": "#/components/schemas/EvidenceRegistryEcosystem"
          },
          "scopes": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string"
            }
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 300
          },
          "auth": {
            "$ref": "#/components/schemas/EvidenceRegistryAuth"
          }
        }
      },
      "EvidencePrivateDependencies": {
        "type": "object",
        "required": [
          "allRepositories",
          "repositories",
          "available"
        ],
        "properties": {
          "allRepositories": {
            "type": "boolean",
            "description": "The install's token reads every repository of the installation, and GitHub Packages"
          },
          "repositories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Repositories (`owner/name`) the install's token reads besides the pull request's own",
            "example": [
              "acme/shared-lib"
            ]
          },
          "available": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The installation's repositories to choose from"
          }
        }
      },
      "EvidencePrivateDependenciesUpdate": {
        "type": "object",
        "properties": {
          "allRepositories": {
            "type": "boolean"
          },
          "repositories": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string"
            }
          }
        }
      },
      "EvidenceTestNetwork": {
        "type": "object",
        "required": [
          "mode",
          "hosts",
          "registries",
          "warning"
        ],
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "none",
              "allowlist"
            ],
            "description": "`none`: no outbound network for sandbox tests (default)"
          },
          "hosts": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "api.example.com",
              "*.cdn.example.com"
            ]
          },
          "registries": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "The public package registries also allowed with `allowlist`"
          },
          "warning": {
            "type": "string",
            "nullable": true,
            "description": "Set when `hosts` holds `*`"
          }
        }
      },
      "EvidenceTestNetworkUpdate": {
        "type": "object",
        "properties": {
          "mode": {
            "type": "string",
            "enum": [
              "none",
              "allowlist"
            ]
          },
          "hosts": {
            "type": "array",
            "maxItems": 100,
            "items": {
              "type": "string",
              "maxLength": 260
            }
          }
        }
      },
      "EvidenceRegistryRotation": {
        "type": "object",
        "required": [
          "auth"
        ],
        "properties": {
          "auth": {
            "$ref": "#/components/schemas/EvidenceRegistryAuth"
          }
        }
      },
      "EvidenceEnvVarList": {
        "type": "object",
        "required": [
          "variables"
        ],
        "properties": {
          "variables": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvidenceEnvVar"
            }
          }
        }
      },
      "NewEvidenceEnvVar": {
        "type": "object",
        "required": [
          "name",
          "value"
        ],
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[A-Z_][A-Z0-9_]*$",
            "maxLength": 128
          },
          "value": {
            "type": "string",
            "description": "At most 32 KiB; may be empty"
          },
          "secret": {
            "type": "boolean",
            "default": true
          },
          "repositories": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "string"
            },
            "description": "Repository full names (owner/name) or ids; null or absent means all"
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 300
          },
          "expiresAt": {
            "type": "integer",
            "nullable": true
          },
          "rotateAfterDays": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 3650
          }
        }
      },
      "EvidenceEnvVarPatch": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "pattern": "^[A-Z_][A-Z0-9_]*$",
            "maxLength": 128
          },
          "value": {
            "type": "string",
            "description": "Plain variables only"
          },
          "secret": {
            "type": "boolean",
            "description": "Only true is accepted for a variable that is already secret"
          },
          "repositories": {
            "type": "array",
            "nullable": true,
            "items": {
              "type": "string"
            }
          },
          "description": {
            "type": "string",
            "nullable": true,
            "maxLength": 300
          },
          "expiresAt": {
            "type": "integer",
            "nullable": true
          },
          "rotateAfterDays": {
            "type": "integer",
            "nullable": true,
            "minimum": 1,
            "maximum": 3650
          }
        }
      },
      "EvidenceEnvVarRotation": {
        "type": "object",
        "required": [
          "value"
        ],
        "properties": {
          "value": {
            "type": "string"
          },
          "expiresAt": {
            "type": "integer",
            "nullable": true,
            "description": "Expiry of the new value; absent means none"
          }
        }
      },
      "EvidenceEnvVarBulkRotation": {
        "type": "object",
        "required": [
          "items"
        ],
        "properties": {
          "items": {
            "type": "array",
            "minItems": 1,
            "maxItems": 100,
            "items": {
              "type": "object",
              "required": [
                "id",
                "value"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                },
                "expiresAt": {
                  "type": "integer",
                  "nullable": true
                }
              }
            }
          }
        }
      },
      "EvidenceEnvVarBulkResult": {
        "type": "object",
        "required": [
          "rotated",
          "failed"
        ],
        "properties": {
          "rotated": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvidenceEnvVar"
            }
          },
          "failed": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "error"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "error": {
                  "type": "string"
                }
              }
            }
          }
        }
      },
      "EvidenceEnvVarVersion": {
        "type": "object",
        "required": [
          "version",
          "fingerprint",
          "action",
          "actor",
          "createdAt"
        ],
        "properties": {
          "version": {
            "type": "integer"
          },
          "fingerprint": {
            "type": "string"
          },
          "action": {
            "type": "string",
            "enum": [
              "create",
              "rotate"
            ]
          },
          "actor": {
            "type": "object",
            "required": [
              "type",
              "id",
              "display"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "user",
                  "api_key"
                ]
              },
              "id": {
                "type": "string",
                "nullable": true
              },
              "display": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "createdAt": {
            "type": "integer"
          }
        }
      },
      "EvidenceEnvVarHistory": {
        "type": "object",
        "required": [
          "versions"
        ],
        "properties": {
          "versions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EvidenceEnvVarVersion"
            }
          }
        }
      },
      "PRPage": {
        "type": "object",
        "required": [
          "items",
          "nextCursor"
        ],
        "properties": {
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PRSummary"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "AuditEvent": {
        "type": "object",
        "required": [
          "id",
          "org_id",
          "occurred_at",
          "actor",
          "action",
          "category",
          "target",
          "detail",
          "source_ip"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "org_id": {
            "type": "string"
          },
          "occurred_at": {
            "type": "integer",
            "description": "Epoch milliseconds"
          },
          "actor": {
            "type": "object",
            "required": [
              "type",
              "id",
              "display"
            ],
            "properties": {
              "type": {
                "type": "string",
                "enum": [
                  "user",
                  "api_key",
                  "system"
                ]
              },
              "id": {
                "type": "string",
                "nullable": true
              },
              "display": {
                "type": "string",
                "nullable": true,
                "description": "Name or key prefix at the time"
              }
            }
          },
          "action": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "review",
              "membership",
              "credentials",
              "org_settings",
              "billing",
              "data",
              "system"
            ]
          },
          "target": {
            "type": "object",
            "required": [
              "type",
              "id"
            ],
            "properties": {
              "type": {
                "type": "string",
                "nullable": true
              },
              "id": {
                "type": "string",
                "nullable": true
              }
            }
          },
          "detail": {
            "description": "Redacted JSON describing what changed. Never contains secrets or review text.",
            "nullable": true
          },
          "source_ip": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "AuditPage": {
        "type": "object",
        "required": [
          "api_version",
          "items",
          "nextCursor"
        ],
        "properties": {
          "api_version": {
            "type": "integer",
            "example": 1
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AuditEvent"
            }
          },
          "nextCursor": {
            "type": "string",
            "nullable": true
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "string",
            "example": "Invalid or revoked API key."
          }
        }
      },
      "ChunkTag": {
        "type": "string",
        "enum": [
          "security sensitive",
          "performance sensitive",
          "reliability",
          "core logic",
          "tests",
          "data access",
          "api surface",
          "config",
          "docs",
          "boilerplate",
          "ui",
          "migrations"
        ]
      },
      "ChunkSubtag": {
        "type": "string",
        "description": "A finer label under a chunk tag. A chunk that has a subtag always has\nthe subtag's parent tag too (for example `egress` is under `security\nsensitive`).\nA chunk may have a parent tag with no subtag: subtags are optional and the\nlist is not exhaustive.\n",
        "enum": [
          "auth",
          "secrets",
          "crypto",
          "untrusted input",
          "egress",
          "privacy",
          "tenant isolation",
          "transport security",
          "file handling",
          "abuse protection",
          "audit trail",
          "hot path",
          "query volume",
          "unbounded work",
          "metered cost",
          "memory",
          "caching",
          "payload size",
          "blocking",
          "indexing",
          "rendering",
          "concurrency",
          "error handling",
          "retries",
          "timeouts",
          "partial failure",
          "fallbacks",
          "cleanup",
          "observability",
          "money",
          "state machine",
          "ai prompt",
          "time",
          "parsing",
          "validation",
          "algorithm",
          "business rule",
          "destructive write",
          "transaction",
          "raw query",
          "public contract",
          "breaking change",
          "error contract",
          "infra",
          "dependencies",
          "feature flag",
          "environment",
          "access scopes",
          "irreversible",
          "backfill",
          "locking",
          "deploy ordering",
          "weakened test",
          "flaky risk",
          "accessibility",
          "copy",
          "client state"
        ]
      },
      "PRSummary": {
        "type": "object",
        "required": [
          "id",
          "number",
          "title",
          "state",
          "updatedAt"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "number": {
            "type": "integer"
          },
          "title": {
            "type": "string"
          },
          "state": {
            "type": "string",
            "enum": [
              "open",
              "merged",
              "closed"
            ]
          },
          "repoFullName": {
            "type": [
              "string",
              "null"
            ]
          },
          "authorName": {
            "type": "string"
          },
          "additions": {
            "type": "integer"
          },
          "deletions": {
            "type": "integer"
          },
          "changedFiles": {
            "type": "integer"
          },
          "ciStatus": {
            "type": "string",
            "enum": [
              "passing",
              "failing",
              "pending"
            ]
          },
          "headBranch": {
            "type": "string"
          },
          "updatedAt": {
            "type": "integer",
            "description": "Epoch milliseconds"
          }
        }
      },
      "PRFileSummary": {
        "type": "object",
        "required": [
          "filename",
          "status"
        ],
        "properties": {
          "filename": {
            "type": "string"
          },
          "status": {
            "type": "string",
            "enum": [
              "added",
              "modified",
              "removed",
              "renamed"
            ]
          },
          "additions": {
            "type": "integer"
          },
          "deletions": {
            "type": "integer"
          },
          "reviewValue": {
            "type": "string",
            "enum": [
              "high",
              "medium",
              "low"
            ]
          }
        }
      },
      "PRDetail": {
        "allOf": [
          {
            "$ref": "#/components/schemas/PRSummary"
          },
          {
            "type": "object",
            "properties": {
              "description": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "authorAvatar": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "baseBranch": {
                "type": "string"
              },
              "headSha": {
                "type": "string"
              },
              "createdAt": {
                "type": "integer",
                "description": "Epoch milliseconds"
              },
              "files": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/PRFileSummary"
                }
              }
            }
          }
        ]
      },
      "CodeChunk": {
        "type": "object",
        "required": [
          "id",
          "symbol",
          "tags",
          "subtags",
          "reviewScore",
          "startLine",
          "endLine"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Opaque chunk id (file id + chunk index)"
          },
          "symbol": {
            "type": "string",
            "description": "Enclosing function/class/block or \"module scope\""
          },
          "tags": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ChunkTag"
            }
          },
          "subtags": {
            "type": "array",
            "description": "Finer labels; each one's parent tag is also in `tags`",
            "items": {
              "$ref": "#/components/schemas/ChunkSubtag"
            }
          },
          "reviewScore": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "startLine": {
            "type": "integer",
            "description": "New-side start line, 1-based"
          },
          "endLine": {
            "type": "integer",
            "description": "New-side end line, 1-based"
          }
        }
      },
      "FileChunks": {
        "type": "object",
        "required": [
          "filename",
          "chunks"
        ],
        "properties": {
          "filename": {
            "type": "string"
          },
          "chunks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CodeChunk"
            }
          }
        }
      },
      "NewComment": {
        "type": "object",
        "required": [
          "filename",
          "body"
        ],
        "properties": {
          "filename": {
            "type": "string"
          },
          "line": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Line number; null = file-level comment"
          },
          "side": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "new",
              "old",
              null
            ],
            "description": "Diff side the comment anchors to (\"new\" = added/context line, \"old\" = deleted line). Defaults to \"new\" for line comments."
          },
          "startLine": {
            "type": [
              "integer",
              "null"
            ],
            "description": "First line of a multi-line comment (GitHub's start_line); `line` is the last. Must come before `line` on the same side, or be on the \"old\" side when `line` is on the \"new\" side."
          },
          "startSide": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "new",
              "old",
              null
            ],
            "description": "Diff side of `startLine`; defaults to `side`."
          },
          "body": {
            "type": "string",
            "maxLength": 60000
          },
          "conviction": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "low",
              "medium",
              "high",
              null
            ],
            "description": "Optional reviewer signal — how sure the reviewer is"
          },
          "importance": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "nit",
              "minor",
              "major",
              "blocker",
              null
            ],
            "description": "Optional reviewer signal — how much the comment matters. When set, synced to GitHub as a compact footer on the comment."
          }
        }
      },
      "Comment": {
        "type": "object",
        "required": [
          "id",
          "filename",
          "line",
          "body",
          "createdAt",
          "authorName"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "filename": {
            "type": "string"
          },
          "line": {
            "type": [
              "integer",
              "null"
            ]
          },
          "side": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "new",
              "old",
              null
            ],
            "description": "Diff side the comment is anchored to; null for legacy comments"
          },
          "startLine": {
            "type": [
              "integer",
              "null"
            ],
            "description": "First line of a multi-line comment; null for a single line"
          },
          "startSide": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "new",
              "old",
              null
            ]
          },
          "body": {
            "type": "string"
          },
          "conviction": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "low",
              "medium",
              "high",
              null
            ],
            "description": "How sure the reviewer is; null when unset"
          },
          "importance": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "nit",
              "minor",
              "major",
              "blocker",
              null
            ],
            "description": "How much the comment matters; null when unset"
          },
          "createdAt": {
            "type": "integer",
            "description": "Epoch milliseconds"
          },
          "authorName": {
            "type": "string",
            "description": "Display name of the commenting user (the API key creator for API-key-created comments)"
          },
          "githubCommentId": {
            "type": [
              "string",
              "null"
            ],
            "description": "GitHub-side comment id (string) when synced; null otherwise"
          }
        }
      },
      "Guidance": {
        "type": "object",
        "required": [
          "recommendation",
          "headline",
          "bullets"
        ],
        "properties": {
          "recommendation": {
            "type": "string",
            "enum": [
              "approve",
              "comment",
              "request-changes",
              "skip"
            ]
          },
          "headline": {
            "type": "string"
          },
          "bullets": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "EvidenceActionPlanRequest": {
        "type": "object",
        "required": [
          "protocol",
          "headSha",
          "checkout",
          "checkoutSha",
          "index",
          "authoredTests"
        ],
        "properties": {
          "protocol": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "headSha": {
            "type": "string",
            "description": "The pull request head the job ran for (40 hex characters)"
          },
          "checkout": {
            "type": "string",
            "enum": [
              "head",
              "merge"
            ],
            "description": "Whether the job checked out the head itself or GitHub's merge commit"
          },
          "checkoutSha": {
            "type": "string"
          },
          "index": {
            "type": "object",
            "description": "The evidence runner's index of the checkout (tests, imports, routes)"
          },
          "action": {
            "type": "object",
            "properties": {
              "version": {
                "type": "string"
              }
            }
          },
          "authoredTests": {
            "type": "boolean",
            "description": "The workflow's `authored-tests` input. False, GitApprove writes no tests for this job (it may still use the repository's own); items only a new test could show are reported as \"not produced: authored tests disabled in this workflow\"."
          }
        }
      },
      "EvidenceAuthoringStep": {
        "type": "object",
        "description": "One step of GitApprove's authoring agent for its test executor.",
        "required": [
          "round",
          "final",
          "files",
          "discard",
          "runs",
          "accept",
          "include"
        ],
        "properties": {
          "round": {
            "type": "integer"
          },
          "files": {
            "type": "array",
            "description": "The agent's test files as they are now; write them over the checkout of each revision a run needs.",
            "items": {
              "$ref": "#/components/schemas/EvidenceAuthoredFile"
            }
          },
          "discard": {
            "type": "array",
            "description": "Authored files the agent deleted; delete them from the checkouts.",
            "items": {
              "type": "string"
            }
          },
          "runs": {
            "type": "array",
            "description": "Test runs to do, in order (at most 4). Empty with `final` false means report back at once.",
            "maxItems": 4,
            "items": {
              "type": "object",
              "required": [
                "id",
                "revision",
                "files",
                "record"
              ],
              "properties": {
                "id": {
                  "type": "string"
                },
                "revision": {
                  "type": "string",
                  "enum": [
                    "head",
                    "base"
                  ]
                },
                "record": {
                  "type": "boolean",
                  "description": "Record a screen video of each Playwright test (reported, not stored, for the agent's runs)."
                },
                "files": {
                  "type": "array",
                  "description": "Repository test files and the agent's own (at most 20).",
                  "items": {
                    "type": "string"
                  }
                }
              }
            }
          },
          "final": {
            "type": "boolean",
            "description": "With `final`, `accept` and `include` hold the tests to run on both revisions."
          },
          "accept": {
            "type": "array",
            "description": "With `final`, the test files the agent kept.",
            "items": {
              "$ref": "#/components/schemas/EvidenceAuthoredFile"
            }
          },
          "include": {
            "type": "array",
            "description": "With `final`, the repository's own tests the agent used that the plan did not list.",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "EvidenceAuthoredFile": {
        "type": "object",
        "required": [
          "path",
          "content"
        ],
        "properties": {
          "path": {
            "type": "string",
            "description": "A reserved `gitapprove-evidence` file name beside the tests it belongs with."
          },
          "content": {
            "type": "string"
          }
        }
      },
      "EvidenceActionAuthorRequest": {
        "type": "object",
        "required": [
          "protocol",
          "runId",
          "headSha",
          "round",
          "index",
          "runs"
        ],
        "properties": {
          "protocol": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "runId": {
            "type": "string"
          },
          "headSha": {
            "type": "string"
          },
          "round": {
            "type": "integer"
          },
          "index": {
            "type": "object",
            "description": "The same index the plan was made from."
          },
          "runs": {
            "type": "array",
            "maxItems": 4,
            "description": "One entry per run of the step, by its id.",
            "items": {
              "allOf": [
                {
                  "$ref": "#/components/schemas/EvidenceActionUploadSide"
                },
                {
                  "type": "object",
                  "required": [
                    "id"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "error": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Why the run did not happen (its `files` are then empty)."
                    }
                  }
                }
              ]
            }
          }
        }
      },
      "EvidenceActionPlan": {
        "type": "object",
        "required": [
          "skip"
        ],
        "properties": {
          "authoring": {
            "description": "The authoring agent's first step, or null when the run has no agent.",
            "oneOf": [
              {
                "$ref": "#/components/schemas/EvidenceAuthoringStep"
              },
              {
                "type": "null"
              }
            ]
          },
          "skip": {
            "type": "boolean"
          },
          "reason": {
            "type": "string",
            "description": "With skip, why there is nothing to run"
          },
          "runId": {
            "type": "string"
          },
          "reviewUrl": {
            "type": "string"
          },
          "baseSha": {
            "type": "string"
          },
          "headSha": {
            "type": "string"
          },
          "files": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Test files to run"
          },
          "left": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "file": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                }
              }
            }
          },
          "timeoutMs": {
            "type": "integer"
          },
          "performanceRuns": {
            "type": "integer",
            "minimum": 0,
            "maximum": 3
          },
          "variables": {
            "type": "array",
            "description": "The organization's plain evidence variables (secret ones are never sent)",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "value": {
                  "type": "string"
                }
              }
            }
          },
          "withheld": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string"
                },
                "reason": {
                  "type": "string",
                  "enum": [
                    "secret",
                    "expired",
                    "undecryptable"
                  ]
                }
              }
            }
          },
          "limits": {
            "type": "object",
            "properties": {
              "maxUploadRawBytes": {
                "type": "integer",
                "description": "Inline artifact bytes of one authoring report"
              },
              "maxFiles": {
                "type": "integer"
              },
              "maxFileBytes": {
                "type": "integer",
                "description": "One screenshot or manifest"
              },
              "maxArtifactBytes": {
                "type": "integer",
                "description": "One artifact uploaded to storage (a recording); 100 MiB"
              },
              "maxRunUploadBytes": {
                "type": "integer",
                "description": "All artifacts of the run uploaded to storage; 300 MiB"
              }
            }
          }
        }
      },
      "EvidenceActionUploadSide": {
        "type": "object",
        "required": [
          "files",
          "durationMs"
        ],
        "properties": {
          "files": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "name",
                "data"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "data": {
                  "type": "string",
                  "description": "The file's bytes, base64"
                }
              }
            }
          },
          "durationMs": {
            "type": "integer"
          }
        }
      },
      "EvidenceActionResultsRequest": {
        "type": "object",
        "required": [
          "protocol",
          "runId",
          "headSha",
          "index",
          "head",
          "base",
          "baseTests"
        ],
        "properties": {
          "protocol": {
            "type": "integer",
            "enum": [
              1
            ]
          },
          "runId": {
            "type": "string"
          },
          "headSha": {
            "type": "string"
          },
          "index": {
            "type": "object",
            "description": "The same index the plan was made from"
          },
          "head": {
            "$ref": "#/components/schemas/EvidenceActionResultsSide"
          },
          "base": {
            "oneOf": [
              {
                "$ref": "#/components/schemas/EvidenceActionResultsSide"
              },
              {
                "type": "null"
              }
            ]
          },
          "uploaded": {
            "type": "array",
            "description": "Absent on the first call. On the second, what was uploaded to each issued URL, with each part's ETag for a multipart upload.",
            "items": {
              "type": "object",
              "required": [
                "side",
                "name",
                "parts"
              ],
              "properties": {
                "side": {
                  "type": "string",
                  "enum": [
                    "head",
                    "base"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "parts": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "partNumber",
                      "etag"
                    ],
                    "properties": {
                      "partNumber": {
                        "type": "integer"
                      },
                      "etag": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "baseError": {
            "type": [
              "string",
              "null"
            ]
          },
          "baseTests": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "notes": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        }
      },
      "EvidenceActionResultsSide": {
        "type": "object",
        "required": [
          "manifest",
          "artifacts",
          "durationMs"
        ],
        "properties": {
          "manifest": {
            "type": "string",
            "description": "The revision's manifest.json, as text (at most 4 MiB)"
          },
          "artifacts": {
            "type": "array",
            "description": "Each artifact by name and size; the bytes go to the URLs the first call answers with",
            "items": {
              "type": "object",
              "required": [
                "name",
                "size"
              ],
              "properties": {
                "name": {
                  "type": "string"
                },
                "size": {
                  "type": "integer",
                  "maximum": 104857600
                }
              }
            }
          },
          "durationMs": {
            "type": "integer"
          }
        }
      },
      "EvidenceActionUploadTickets": {
        "type": "object",
        "required": [
          "upload",
          "runId",
          "uploads"
        ],
        "properties": {
          "upload": {
            "type": "boolean",
            "enum": [
              true
            ]
          },
          "runId": {
            "type": "string"
          },
          "uploads": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "side",
                "name",
                "url",
                "parts"
              ],
              "properties": {
                "side": {
                  "type": "string",
                  "enum": [
                    "head",
                    "base"
                  ]
                },
                "name": {
                  "type": "string"
                },
                "url": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "One PUT of the whole file with exactly its size (`Content-Length`), or null for a multipart upload"
                },
                "parts": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "partNumber",
                      "url",
                      "size"
                    ],
                    "properties": {
                      "partNumber": {
                        "type": "integer"
                      },
                      "url": {
                        "type": "string"
                      },
                      "size": {
                        "type": "integer"
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "EvidenceActionResults": {
        "type": "object",
        "properties": {
          "runId": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "reason": {
            "type": [
              "string",
              "null"
            ]
          },
          "reviewUrl": {
            "type": "string"
          },
          "minutes": {
            "type": "integer"
          },
          "tests": {
            "type": "object",
            "properties": {
              "base": {
                "type": "integer"
              },
              "head": {
                "type": "integer"
              }
            }
          },
          "stored": {
            "type": "integer"
          }
        }
      },
      "EvidenceStatus": {
        "type": "object",
        "required": [
          "enabled"
        ],
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "evidenceSource": {
            "type": "string",
            "enum": [
              "sandbox",
              "github-actions",
              "both"
            ],
            "description": "Where the organization's new evidence comes from."
          },
          "headSha": {
            "type": "string"
          },
          "previewLinks": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "site",
                "url"
              ],
              "properties": {
                "site": {
                  "type": "string"
                },
                "url": {
                  "type": "string"
                }
              }
            }
          },
          "run": {
            "type": [
              "object",
              "null"
            ],
            "properties": {
              "id": {
                "type": "string"
              },
              "status": {
                "type": "string",
                "enum": [
                  "waiting",
                  "building",
                  "storing",
                  "ready",
                  "partial",
                  "failed",
                  "skipped",
                  "blocked",
                  "cap-reached",
                  "unsupported",
                  "cancelled"
                ]
              },
              "reason": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "source": {
                "type": "string",
                "enum": [
                  "sandbox",
                  "github-actions"
                ],
                "description": "Where the run's tests ran. `github-actions`: the organization's\nown workflow (the GitApprove/evidence action); the sandbox's\nisolation (no network, the maliciousness screen) does not apply.\n"
              },
              "headSha": {
                "type": "string"
              },
              "stale": {
                "type": "boolean"
              },
              "createdAt": {
                "type": "integer"
              },
              "startedAt": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "finishedAt": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          }
        }
      },
      "EvidenceCaptures": {
        "type": "object",
        "required": [
          "runStatus",
          "partial",
          "captures"
        ],
        "properties": {
          "items": {
            "type": "array",
            "description": "What GitApprove's authoring agent was asked to show for the changed\nchunks in the range, each with the captures (by id, from `captures`)\nthat show it and the test behind them, or the reason it is not shown.\n",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "file": {
                  "type": "string"
                },
                "startLine": {
                  "type": "integer"
                },
                "endLine": {
                  "type": "integer"
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "ui",
                    "http",
                    "side-effect",
                    "perf"
                  ]
                },
                "description": {
                  "type": "string",
                  "description": "What was asked, such as \"POST /api/orders without an item is rejected with 422\"."
                },
                "route": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "method": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "satisfied",
                    "unsatisfied"
                  ]
                },
                "reason": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "Why it is not shown (marked impossible, the agent's budget, not reproduced)."
                },
                "note": {
                  "type": [
                    "string",
                    "null"
                  ],
                  "description": "The agent's note on how the captures show it."
                },
                "captureIds": {
                  "type": "array",
                  "items": {
                    "type": "string"
                  }
                },
                "test": {
                  "description": "The test behind the captures (the same shape as a capture's `test`), or null.",
                  "type": [
                    "object",
                    "null"
                  ]
                }
              }
            }
          },
          "runStatus": {
            "type": [
              "string",
              "null"
            ]
          },
          "partial": {
            "type": "boolean"
          },
          "source": {
            "type": [
              "string",
              "null"
            ],
            "description": "Where the tests behind these captures ran (`sandbox` or `github-actions`); null when there are none."
          },
          "captures": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string"
                },
                "file": {
                  "type": "string"
                },
                "startLine": {
                  "type": "integer"
                },
                "endLine": {
                  "type": "integer"
                },
                "symbol": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "site": {
                  "type": "string"
                },
                "state": {
                  "type": "string",
                  "description": "Role and route, such as \"authenticated /users\""
                },
                "kind": {
                  "type": "string",
                  "enum": [
                    "screenshot",
                    "request-response",
                    "recording"
                  ]
                },
                "pairing": {
                  "type": "string",
                  "enum": [
                    "paired",
                    "new",
                    "not-reproduced"
                  ],
                  "description": "`new` exists only on head; `not-reproduced` only on base (the head's\ntest did not reach that state, which is not the same as removal).\n"
                },
                "differs": {
                  "type": "boolean"
                },
                "breaking": {
                  "type": "boolean"
                },
                "testChanged": {
                  "type": "boolean"
                },
                "mappingSignal": {
                  "type": "string"
                },
                "hasBaseMedia": {
                  "type": "boolean"
                },
                "hasHeadMedia": {
                  "type": "boolean"
                },
                "diffSummary": {
                  "description": "For screenshots, `fraction` of changed pixels and the bounding `box`.\nFor exchanges, `breaking` and `summary` (changed field paths).\n",
                  "type": [
                    "object",
                    "null"
                  ]
                },
                "test": {
                  "description": "The test behind the capture: `repo` (the repository's own test, \"Your\ntest\") or `authored` (written by GitApprove for this change, with its\nsource; never committed to the repository).\n",
                  "type": "object",
                  "properties": {
                    "kind": {
                      "type": "string",
                      "enum": [
                        "repo",
                        "authored"
                      ]
                    },
                    "path": {
                      "type": "string"
                    },
                    "id": {
                      "type": "string"
                    },
                    "basedOn": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "The repository's test it was copied from and adapted; null when written new."
                    },
                    "source": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "baseOutcome": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "`passed`, `failed` or `not-run` on the base revision; a failure makes its head states new behavior."
                    }
                  }
                },
                "performance": {
                  "description": "Measured timing for a paired state, or for a new (head-only) state, from\nthe PR's own tests in the evidence container (not a user device). `null`\nwhen nothing was measured or the state exists only on the base. A\nmeasurement for the reviewer, never a verdict.\n",
                  "type": [
                    "object",
                    "null"
                  ],
                  "required": [
                    "v",
                    "kind",
                    "lines",
                    "note"
                  ],
                  "properties": {
                    "v": {
                      "type": "integer",
                      "enum": [
                        1
                      ]
                    },
                    "kind": {
                      "type": "string",
                      "enum": [
                        "backend",
                        "frontend"
                      ]
                    },
                    "headOnly": {
                      "type": "boolean",
                      "description": "Present and `true` for a new state that only the head ran. Each line then\ncarries the head's numbers only: `base`, `delta` and `deltaPct` are `null`,\n`highlight` is `false`, and the missing base is not labelled `no-data`.\nAbsent means a base-to-head comparison.\n"
                    },
                    "note": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "description": "Set when behavior differs too, so the timing is not like for like."
                    },
                    "lines": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "required": [
                          "metric",
                          "unit",
                          "base",
                          "head",
                          "delta",
                          "deltaPct",
                          "highlight",
                          "labels"
                        ],
                        "properties": {
                          "metric": {
                            "type": "string",
                            "enum": [
                              "latency",
                              "queries",
                              "render",
                              "longTasks"
                            ]
                          },
                          "unit": {
                            "type": "string",
                            "enum": [
                              "ms",
                              "queries"
                            ]
                          },
                          "base": {
                            "$ref": "#/components/schemas/EvidencePerfSide"
                          },
                          "head": {
                            "$ref": "#/components/schemas/EvidencePerfSide"
                          },
                          "delta": {
                            "type": [
                              "number",
                              "null"
                            ],
                            "description": "Head median minus base median, when both sides measured."
                          },
                          "deltaPct": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Relative delta in percent, when the base median is above zero."
                          },
                          "highlight": {
                            "type": "boolean",
                            "description": "The delta passes the metric's absolute and relative floors and is not noisy."
                          },
                          "labels": {
                            "type": "array",
                            "items": {
                              "type": "string",
                              "enum": [
                                "few-samples",
                                "noisy",
                                "no-data"
                              ]
                            }
                          },
                          "source": {
                            "type": "string",
                            "enum": [
                              "app",
                              "mixed"
                            ],
                            "description": "Only on the `queries` line, and only when the application reported some or\nall of the counts itself (response headers or a request log) instead of the\nrunner's own driver hooks counting them: `app` when all, `mixed` when some.\nAbsent means the runner's hooks counted. Like every number in evidence it\ncomes from the PR's own code: a measurement, not a control.\n"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      },
      "EvidencePerfSide": {
        "description": "Median, sample count and spread (max minus min) of one revision's measured runs; null when nothing was measured.",
        "type": [
          "object",
          "null"
        ],
        "required": [
          "median",
          "n",
          "spread"
        ],
        "properties": {
          "median": {
            "type": "number"
          },
          "n": {
            "type": "integer"
          },
          "spread": {
            "type": "number"
          }
        }
      },
      "SyncResult": {
        "type": "object",
        "required": [
          "ok",
          "orgId",
          "repos",
          "prs",
          "lastSyncedAt"
        ],
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "orgId": {
            "type": "string"
          },
          "repos": {
            "type": "integer"
          },
          "prs": {
            "type": "integer"
          },
          "lastSyncedAt": {
            "type": "integer",
            "description": "Epoch milliseconds"
          }
        }
      },
      "BillingStatus": {
        "type": "object",
        "required": [
          "state",
          "seats",
          "trialEndsAt",
          "allowed"
        ],
        "properties": {
          "state": {
            "type": "string",
            "enum": [
              "trial",
              "trialing",
              "active",
              "past_due",
              "expired",
              "canceled"
            ],
            "description": "Subscription state"
          },
          "seats": {
            "type": "integer"
          },
          "trialEndsAt": {
            "type": [
              "integer",
              "null"
            ],
            "description": "Epoch milliseconds; null when not trialing"
          },
          "allowed": {
            "type": "boolean",
            "description": "True when the org may use paid features"
          }
        }
      }
    }
  }
}
