{
  "openapi": "3.1.0",
  "info": {
    "title": "Atrium API",
    "version": "1.0.0",
    "description": "The public Atrium API: submit a document, follow the scan, read the compliance report, export the accessible deliverables, run the AI drafting pass, and hand a job to the Atrium review interface. Authenticate every call with a per-tenant API key, sent either as an x-api-key header or as an Authorization: Bearer token. Each key carries scopes; the scope each endpoint requires is stated in its description."
  },
  "paths": {
    "/api/v1/auth/me": {
      "get": {
        "tags": [
          "v1"
        ],
        "summary": "Introspect the calling key",
        "description": "Returns the tenant and key the call is authenticated as, the key's scopes, and the usage, limits and entitlement envelope, so an integration can check its remaining quota without a separate dashboard call. Scope: `scan:read`.",
        "operationId": "v1_auth_me_api_v1_auth_me_get",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response V1 Auth Me Api V1 Auth Me Get"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/scan/upload": {
      "post": {
        "tags": [
          "v1"
        ],
        "summary": "Submit a document for scanning",
        "description": "Uploads one document (multipart form field `file`, up to 50 MB) and starts a scan job. Set `generate_descriptions=true` to have AI-drafted image descriptions produced during the scan; keys without the `ai-enhance:run` scope cannot set it. Send an `Idempotency-Key` header to make retries safe: a repeated key returns the job the first request created instead of starting another. Returns the job record; poll `GET /api/v1/scan/jobs/{job_id}` until `status` is `completed`. Scope: `scan:submit`.",
        "operationId": "v1_scan_upload_api_v1_scan_upload_post",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/Body_v1_scan_upload_api_v1_scan_upload_post"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanJobResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/scan/jobs/{job_id}": {
      "get": {
        "tags": [
          "v1"
        ],
        "summary": "Read a scan job's status",
        "description": "Returns the job record: `status` (`pending`, `processing`, `completed`, `partial`, `failed`), progress and error messages, `page_count`, timestamps, and for PDF inputs the pre-scan structural report (`native_scan_report`: tagging classification, validator status, and coverage). Scope: `scan:read`.",
        "operationId": "v1_get_scan_job_api_v1_scan_jobs__job_id__get",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Job Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScanJobResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/scan/jobs/{job_id}/compliance": {
      "get": {
        "tags": [
          "v1"
        ],
        "summary": "Read the compliance report",
        "description": "Returns the persisted compliance report for a completed job: the 0-100 score, the versioned checking-engine identifier, every issue with its rule, severity, WCAG criterion and element path, and the per-category summary. This is a read: nothing is re-checked or rewritten. `400` if the job is not yet completed, `403` if the key lacks the scope, `404` if the job is not in the caller's tenant. Scope: `scan:read`.",
        "operationId": "v1_get_compliance_api_v1_scan_jobs__job_id__compliance_get",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Job Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Compliance report for a completed job. For a completed job whose report was never computed, the body is the empty report with no `score`; treat the absence of `score` as 'report not available'.",
            "content": {
              "application/json": {
                "schema": {},
                "example": {
                  "wcag_target": "2.1 AA",
                  "score": 94,
                  "total_issues": 1,
                  "issues_by_severity": {
                    "error": 1,
                    "warning": 0,
                    "info": 0
                  },
                  "issues": [
                    {
                      "issue_id": "f0caef963acafe69",
                      "rule_id": "img-alt-missing",
                      "wcag_criterion": "1.1.1",
                      "severity": "error",
                      "element_path": "pictures[0]",
                      "element_type": "image",
                      "message": "Image has no alt attribute",
                      "remediation_hint": "Add an alt attribute describing the image content, or alt=\"\" if decorative.",
                      "auto_fixable": true,
                      "page": 1
                    }
                  ],
                  "summary": {
                    "images": {
                      "total": 1,
                      "passing": 0,
                      "failing": 1,
                      "scope": "figure-rules"
                    },
                    "tables": {
                      "total": 0,
                      "passing": 0,
                      "failing": 0,
                      "scope": "table-rules"
                    }
                  },
                  "report_revision": 0
                }
              }
            }
          },
          "400": {
            "description": "Job is not in a terminal 'completed' state."
          },
          "403": {
            "description": "API key lacks the scan:read scope."
          },
          "404": {
            "description": "Scan job not found in the caller's tenant (also covers a cross-tenant id). Body: `{\"detail\": {\"error\": \"scan_job_not_found\"}}`."
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/scan/jobs/{job_id}/export": {
      "get": {
        "tags": [
          "v1"
        ],
        "summary": "Export a deliverable",
        "description": "Streams one deliverable for a completed job, chosen by `format`: `accessible_html` (the remediated, accessibility-serialized HTML), `pdf` (the tagged PDF declaring PDF/UA-1, the primary remediated deliverable for PDF inputs), `html` (the plain HTML rendering), `markdown`, or `json` (the structured document data). `disposition=original` with `format=pdf` returns the untouched source PDF as a labeled diagnostic download, never as a conformance claim. When the tagged PDF cannot honestly be produced for a document, the response is `409` with the verdict, its basis, and the choices available (download the original as a diagnostic, or set `force_raster=true` to export through the raster route). Export requires a paid plan (`403` with code `FEATURE_GATED` otherwise). Scope: `scan:read`.",
        "operationId": "v1_export_scan_api_v1_scan_jobs__job_id__export_get",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Job Id"
            }
          },
          {
            "name": "format",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "html",
              "title": "Format"
            }
          },
          {
            "name": "force_raster",
            "in": "query",
            "required": false,
            "schema": {
              "type": "boolean",
              "default": false,
              "title": "Force Raster"
            }
          },
          {
            "name": "disposition",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "default": "conformant",
              "title": "Disposition"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "The export artifact, streamed. `format=pdf` returns the tagged PDF with its conformance verdict in the response headers; `disposition=original` returns the untouched original labeled as a diagnostic, never a conformance claim; the other formats stream their content types.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              },
              "application/pdf": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "text/html": {
                "schema": {
                  "type": "string"
                }
              },
              "text/markdown": {
                "schema": {
                  "type": "string"
                }
              }
            },
            "headers": {
              "X-PDFUA-Conformance": {
                "description": "Conformance status of the returned PDF (pass / fail / unavailable / best_effort / unsupported); fixed 'unavailable' on disposition=original. pdf format only.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Export-Mechanism": {
                "description": "Structure-tree authority of the returned PDF (A / C / passthrough); fixed 'original-diagnostic' on disposition=original. pdf format only.",
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "409": {
            "description": "`format=pdf` only: the tagged export is not applicable to this document. `verdict_basis` distinguishes `degraded` (an infrastructure gap; retry) from `completed` (a verdict on document evidence; remediate). The two choices are actionable via `disposition=original` and `force_raster=true`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ExportNotApplicableEnvelope"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/scan/jobs/{job_id}/ai-enhance": {
      "post": {
        "tags": [
          "v1"
        ],
        "summary": "Run the AI drafting pass",
        "description": "Drafts fixes for the job's AI-fixable issues (image descriptions, table captions, long descriptions), applies them as provenance-tracked edits, regenerates the accessible HTML and re-runs the compliance check. Pass `only` as a comma-separated list of issue IDs to limit the pass. The response lists every issue as succeeded, failed, or skipped with a reason; slots holding author-preserved or human-written text are skipped (`source_document_explicit_target_required`, `human_edit_protected`) rather than overwritten. Headers: `If-Match` (the report revision the caller last saw; the request is refused if the report has moved), `Idempotency-Key`, and the optional `X-Parent-Operation-Id` / `X-Attempt-Id` correlation headers. Includes the cost summary, the AI usage-cap status, the updated accessible HTML, and the updated compliance report. Requires a plan with AI enhancement enabled. Scope: `ai-enhance:run`.",
        "operationId": "v1_ai_enhance_api_v1_scan_jobs__job_id__ai_enhance_post",
        "parameters": [
          {
            "name": "job_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "title": "Job Id"
            }
          },
          {
            "name": "only",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Only"
            }
          },
          {
            "name": "If-Match",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "If-Match"
            }
          },
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Idempotency-Key"
            }
          },
          {
            "name": "X-Parent-Operation-Id",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Parent-Operation-Id"
            }
          },
          {
            "name": "X-Attempt-Id",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Attempt-Id"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AIEnhanceResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/handoff/tokens": {
      "post": {
        "tags": [
          "v1"
        ],
        "summary": "Mint a review-handoff token",
        "description": "Creates a single-use token bound to one job that opens the Atrium review interface for that job without a separate login, so an integration (for example the WordPress plugin) can send a reviewer straight to the issues that need a decision. Body: `job_id`, `connector` (`wordpress` or `drupal`), and optional caller-asserted reviewer identity fields (`asserted_display_name`, `asserted_email`, `asserted_external_subject`, `site_url`), which are recorded as asserted and not verified. The raw token is returned once, in this response only, and is never logged. `503` while the review-interface origin is not configured for the deployment. Scope: `handoff:mint` (the key must also hold `scan:read`).",
        "operationId": "v1_mint_handoff_token_api_v1_handoff_tokens_post",
        "parameters": [
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/HandoffMintRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "additionalProperties": true,
                  "title": "Response V1 Mint Handoff Token Api V1 Handoff Tokens Post"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/audit/events": {
      "get": {
        "tags": [
          "v1"
        ],
        "summary": "List audit events",
        "description": "Returns the tenant's audit log, newest first, filterable by `event_type` (repeatable), `resource_type`, `resource_id`, `actor_type`, `actor_user_id`, `actor_api_key_id`, and a `from` / `to` time window; page with `limit` and the returned `cursor`. Send `Accept: text/csv` for a CSV export instead of JSON. Every row is scoped to the caller's tenant. Scope: `audit:read`.",
        "operationId": "list_audit_events_api_v1_audit_events_get",
        "security": [
          {
            "OAuth2PasswordBearer": []
          }
        ],
        "parameters": [
          {
            "name": "event_type",
            "in": "query",
            "required": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              },
              "default": [],
              "title": "Event Type"
            }
          },
          {
            "name": "resource_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Resource Type"
            }
          },
          {
            "name": "resource_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Resource Id"
            }
          },
          {
            "name": "actor_type",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor Type"
            }
          },
          {
            "name": "actor_user_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor User Id"
            }
          },
          {
            "name": "actor_api_key_id",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Actor Api Key Id"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "From"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "format": "date-time"
                },
                {
                  "type": "null"
                }
              ],
              "title": "To"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 200,
              "minimum": 1,
              "default": 50,
              "title": "Limit"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            }
          },
          {
            "name": "accept",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Accept"
            }
          },
          {
            "name": "authorization",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Authorization"
            }
          },
          {
            "name": "x-api-key",
            "in": "header",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "X-Api-Key"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AuditEventsListResponse"
                }
              },
              "text/csv": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AICapStatus": {
        "properties": {
          "images_used": {
            "type": "integer",
            "title": "Images Used"
          },
          "images_cap": {
            "type": "integer",
            "title": "Images Cap"
          },
          "tables_used": {
            "type": "integer",
            "title": "Tables Used"
          },
          "tables_cap": {
            "type": "integer",
            "title": "Tables Cap"
          },
          "exhausted": {
            "type": "boolean",
            "title": "Exhausted"
          }
        },
        "type": "object",
        "required": [
          "images_used",
          "images_cap",
          "tables_used",
          "tables_cap",
          "exhausted"
        ],
        "title": "AICapStatus",
        "description": "Per-backend lifetime cap status, computed at handler-finalize time.\n\nWire-only: there is no persisted DB column and no `/result` field.\nComputed by the ai-enhance handler from live `ScanJob` counters\n+ caps resolved at request time, then placed on `AIEnhanceResponse.cap_exhausted`.\nThe mutation response is the only surface that carries cap state\nin this version; refresh-time visibility is not yet available."
      },
      "AIEnhanceResponse": {
        "properties": {
          "operation_id": {
            "type": "string",
            "title": "Operation Id"
          },
          "parent_operation_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Parent Operation Id"
          },
          "report_revision": {
            "type": "integer",
            "title": "Report Revision"
          },
          "base_report_revision": {
            "type": "integer",
            "title": "Base Report Revision"
          },
          "succeeded": {
            "items": {
              "$ref": "#/components/schemas/IssueOutcome"
            },
            "type": "array",
            "title": "Succeeded",
            "default": []
          },
          "failed": {
            "items": {
              "$ref": "#/components/schemas/IssueFailure"
            },
            "type": "array",
            "title": "Failed",
            "default": []
          },
          "skipped": {
            "items": {
              "$ref": "#/components/schemas/IssueSkip"
            },
            "type": "array",
            "title": "Skipped",
            "default": []
          },
          "cost": {
            "$ref": "#/components/schemas/CostSummary"
          },
          "accessible_html_export": {
            "type": "string",
            "title": "Accessible Html Export"
          },
          "compliance_report": {
            "additionalProperties": true,
            "type": "object",
            "title": "Compliance Report"
          },
          "cap_exhausted": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AICapStatus"
              },
              {
                "type": "null"
              }
            ]
          },
          "manifest_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Manifest Version"
          },
          "regenerated": {
            "items": {
              "$ref": "#/components/schemas/RegenerateOutcome"
            },
            "type": "array",
            "title": "Regenerated",
            "default": []
          }
        },
        "type": "object",
        "required": [
          "operation_id",
          "report_revision",
          "base_report_revision",
          "cost",
          "accessible_html_export",
          "compliance_report"
        ],
        "title": "AIEnhanceResponse",
        "description": "The full result of one AI drafting operation, persisted with the operation and returned verbatim on an idempotent replay. `parent_operation_id` is null for a top-level operation; a retry of failed issues references the operation it retries, so retry chains can be reconstructed."
      },
      "AccessibilityEdit": {
        "properties": {
          "issue_id": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Issue Id"
          },
          "edit_type": {
            "type": "string",
            "title": "Edit Type"
          },
          "element_path": {
            "type": "string",
            "title": "Element Path"
          },
          "value": {
            "type": "string",
            "title": "Value"
          },
          "source": {
            "anyOf": [
              {
                "type": "string",
                "enum": [
                  "human",
                  "auto_fix",
                  "vlm",
                  "llm",
                  "source_document"
                ]
              },
              {
                "type": "null"
              }
            ],
            "title": "Source"
          },
          "confidence": {
            "anyOf": [
              {
                "type": "number",
                "maximum": 1.0,
                "minimum": 0.0
              },
              {
                "type": "null"
              }
            ],
            "title": "Confidence"
          },
          "reasoning": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reasoning"
          },
          "updated_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Updated At"
          },
          "last_editor": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Last Editor"
          },
          "reviewed_at": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewed At"
          },
          "reviewed_by": {
            "anyOf": [
              {
                "additionalProperties": true,
                "type": "object"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reviewed By"
          }
        },
        "type": "object",
        "required": [
          "edit_type",
          "element_path",
          "value"
        ],
        "title": "AccessibilityEdit"
      },
      "Body_v1_scan_upload_api_v1_scan_upload_post": {
        "properties": {
          "file": {
            "type": "string",
            "contentMediaType": "application/octet-stream",
            "title": "File"
          },
          "generate_descriptions": {
            "type": "boolean",
            "title": "Generate Descriptions",
            "default": false
          }
        },
        "type": "object",
        "required": [
          "file"
        ],
        "title": "Body_v1_scan_upload_api_v1_scan_upload_post"
      },
      "CostSummary": {
        "properties": {
          "cents": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Cents"
          },
          "breakdown": {
            "additionalProperties": {
              "type": "integer"
            },
            "type": "object",
            "title": "Breakdown",
            "default": {}
          }
        },
        "type": "object",
        "title": "CostSummary",
        "description": "Per-operation cost accounting in integer cents with a per-rule breakdown. `cents` is null when dollar-denominated cost was not computed for the run (the current behavior); token tallies are always recorded on the job."
      },
      "ExportChoice": {
        "properties": {
          "action": {
            "type": "string",
            "enum": [
              "download_original_diagnostic",
              "force_raster"
            ],
            "title": "Action"
          },
          "params": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object",
            "title": "Params"
          }
        },
        "type": "object",
        "required": [
          "action",
          "params"
        ],
        "title": "ExportChoice"
      },
      "ExportNotApplicableDetail": {
        "properties": {
          "error": {
            "type": "string",
            "const": "export_not_applicable",
            "title": "Error",
            "default": "export_not_applicable"
          },
          "verdict": {
            "$ref": "#/components/schemas/ExportVerdictSummary"
          },
          "verdict_basis": {
            "type": "string",
            "enum": [
              "degraded",
              "completed"
            ],
            "title": "Verdict Basis"
          },
          "degraded_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Degraded Reason"
          },
          "edits_unapplied": {
            "type": "boolean",
            "title": "Edits Unapplied",
            "default": false
          },
          "safety_refusal": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Safety Refusal"
          },
          "choices": {
            "items": {
              "$ref": "#/components/schemas/ExportChoice"
            },
            "type": "array",
            "title": "Choices"
          }
        },
        "type": "object",
        "required": [
          "verdict",
          "verdict_basis",
          "choices"
        ],
        "title": "ExportNotApplicableDetail",
        "description": "The body of the export `409`. `verdict_basis` `degraded` means an infrastructure gap (capacity, timeout, crash, or validator missing; remedy: retry), while `completed` means a genuine verdict on document evidence (remedy: remediate). `completed` can coexist with `verdict.analysis_status` `partial`: a partial parse is document evidence, not degradation."
      },
      "ExportNotApplicableEnvelope": {
        "properties": {
          "detail": {
            "$ref": "#/components/schemas/ExportNotApplicableDetail"
          }
        },
        "type": "object",
        "required": [
          "detail"
        ],
        "title": "ExportNotApplicableEnvelope",
        "description": "Wire shape of the export `409`: the detail object is nested under a top-level `detail` key."
      },
      "ExportVerdictSummary": {
        "properties": {
          "classification": {
            "type": "string",
            "title": "Classification"
          },
          "analysis_status": {
            "type": "string",
            "title": "Analysis Status"
          },
          "source_kind": {
            "type": "string",
            "title": "Source Kind"
          },
          "structural_triage_score": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Structural Triage Score"
          },
          "score_status": {
            "type": "string",
            "title": "Score Status"
          },
          "parse_coverage": {
            "type": "number",
            "title": "Parse Coverage"
          },
          "verapdf_status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Verapdf Status"
          },
          "scanner_version": {
            "type": "string",
            "title": "Scanner Version"
          },
          "rule_manifest_version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Rule Manifest Version"
          },
          "scanned_at": {
            "type": "string",
            "title": "Scanned At"
          },
          "semantics_unverified": {
            "type": "boolean",
            "const": true,
            "title": "Semantics Unverified",
            "default": true
          },
          "failure_reasons": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Failure Reasons",
            "default": []
          }
        },
        "type": "object",
        "required": [
          "classification",
          "analysis_status",
          "source_kind",
          "score_status",
          "parse_coverage",
          "scanner_version",
          "scanned_at"
        ],
        "title": "ExportVerdictSummary",
        "description": "The export-time structural verdict on the document, summarized."
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "HandoffMintRequest": {
        "properties": {
          "job_id": {
            "type": "string",
            "maxLength": 36,
            "minLength": 1,
            "title": "Job Id"
          },
          "connector": {
            "type": "string",
            "title": "Connector"
          },
          "asserted_display_name": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 200
              },
              {
                "type": "null"
              }
            ],
            "title": "Asserted Display Name"
          },
          "asserted_email": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 320
              },
              {
                "type": "null"
              }
            ],
            "title": "Asserted Email"
          },
          "asserted_external_subject": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 64
              },
              {
                "type": "null"
              }
            ],
            "title": "Asserted External Subject"
          },
          "site_url": {
            "anyOf": [
              {
                "type": "string",
                "maxLength": 500
              },
              {
                "type": "null"
              }
            ],
            "title": "Site Url"
          }
        },
        "type": "object",
        "required": [
          "job_id",
          "connector"
        ],
        "title": "HandoffMintRequest",
        "description": "Review-handoff mint request. The `asserted_*` fields are caller-asserted reviewer identity, validated for shape and length only and never verified by Atrium. `connector` names the calling integration."
      },
      "IssueFailure": {
        "properties": {
          "issue_id": {
            "type": "string",
            "title": "Issue Id"
          },
          "reason": {
            "type": "string",
            "title": "Reason"
          }
        },
        "type": "object",
        "required": [
          "issue_id",
          "reason"
        ],
        "title": "IssueFailure",
        "description": "One AI-enhance target that raised — surfaced to the client in the\n200 response. Business-level failures (e.g. VLM returned empty alt\ntext) are reported here rather than as a 5xx on the whole request."
      },
      "IssueOutcome": {
        "properties": {
          "issue_id": {
            "type": "string",
            "title": "Issue Id"
          },
          "applied_edit": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AccessibilityEdit"
              },
              {
                "type": "null"
              }
            ]
          },
          "applied_edits": {
            "items": {
              "$ref": "#/components/schemas/AccessibilityEdit"
            },
            "type": "array",
            "title": "Applied Edits",
            "default": []
          }
        },
        "type": "object",
        "required": [
          "issue_id"
        ],
        "title": "IssueOutcome",
        "description": "One AI-enhanced issue that produced an applied edit. `applied_edits` is the full list: one description act can produce two edits at one element, a short `alt_text` and a `long_description`. `applied_edit` carries the issue-closing edit for older clients."
      },
      "IssueSkip": {
        "properties": {
          "issue_id": {
            "type": "string",
            "title": "Issue Id"
          },
          "reason": {
            "type": "string",
            "title": "Reason"
          }
        },
        "type": "object",
        "required": [
          "issue_id",
          "reason"
        ],
        "title": "IssueSkip",
        "description": "One AI-enhance target that was skipped (no applicable strategy,\ncost cap reached, missing issue_id, etc.)."
      },
      "NativeScanCoverage": {
        "properties": {
          "machine_checkable_rules_evaluated": {
            "type": "integer",
            "title": "Machine Checkable Rules Evaluated"
          },
          "machine_checkable_rules_total_at_scan": {
            "type": "integer",
            "title": "Machine Checkable Rules Total At Scan"
          },
          "evaluated_rule_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Evaluated Rule Ids",
            "default": []
          },
          "not_evaluated_rule_ids": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Not Evaluated Rule Ids",
            "default": []
          },
          "rule_manifest_version": {
            "type": "string",
            "title": "Rule Manifest Version"
          },
          "semantics_unverified": {
            "type": "boolean",
            "const": true,
            "title": "Semantics Unverified",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "machine_checkable_rules_evaluated",
          "machine_checkable_rules_total_at_scan",
          "rule_manifest_version"
        ],
        "title": "NativeScanCoverage"
      },
      "NativeScanEvidence": {
        "properties": {
          "has_struct_tree": {
            "type": "boolean",
            "title": "Has Struct Tree",
            "default": false
          },
          "marked": {
            "type": "boolean",
            "title": "Marked",
            "default": false
          },
          "parent_tree_ok": {
            "type": "boolean",
            "title": "Parent Tree Ok",
            "default": true
          },
          "lang": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Lang"
          },
          "title_present": {
            "type": "boolean",
            "title": "Title Present",
            "default": false
          },
          "tagged_page_count": {
            "type": "integer",
            "title": "Tagged Page Count",
            "default": 0
          },
          "untagged_page_count": {
            "type": "integer",
            "title": "Untagged Page Count",
            "default": 0
          }
        },
        "type": "object",
        "title": "NativeScanEvidence"
      },
      "NativeScanFinding": {
        "properties": {
          "rule_id": {
            "type": "string",
            "title": "Rule Id"
          },
          "wcag_criterion": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Wcag Criterion"
          },
          "severity": {
            "type": "string",
            "title": "Severity"
          },
          "source": {
            "type": "string",
            "enum": [
              "verapdf",
              "pdf_struct_tree",
              "heuristic"
            ],
            "title": "Source"
          },
          "checkability_class": {
            "type": "string",
            "enum": [
              "structural",
              "hybrid"
            ],
            "title": "Checkability Class"
          },
          "element_path": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Element Path"
          },
          "page": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Page"
          },
          "message": {
            "type": "string",
            "title": "Message"
          },
          "confidence": {
            "anyOf": [
              {
                "type": "number"
              },
              {
                "type": "null"
              }
            ],
            "title": "Confidence"
          }
        },
        "type": "object",
        "required": [
          "rule_id",
          "severity",
          "source",
          "checkability_class",
          "message"
        ],
        "title": "NativeScanFinding"
      },
      "NativeScanPageEvidence": {
        "properties": {
          "page": {
            "type": "integer",
            "title": "Page"
          },
          "tagged": {
            "type": "boolean",
            "title": "Tagged"
          },
          "raster_coverage": {
            "type": "number",
            "title": "Raster Coverage",
            "default": 0.0
          },
          "struct_parents_ok": {
            "type": "boolean",
            "title": "Struct Parents Ok",
            "default": true
          }
        },
        "type": "object",
        "required": [
          "page",
          "tagged"
        ],
        "title": "NativeScanPageEvidence"
      },
      "NativeScanPassThroughPreconditions": {
        "properties": {
          "structurally_clean": {
            "type": "boolean",
            "title": "Structurally Clean"
          },
          "born_digital_vector": {
            "type": "boolean",
            "title": "Born Digital Vector"
          },
          "verapdf_pass": {
            "type": "boolean",
            "title": "Verapdf Pass"
          },
          "policy_version": {
            "type": "string",
            "title": "Policy Version"
          }
        },
        "type": "object",
        "required": [
          "structurally_clean",
          "born_digital_vector",
          "verapdf_pass",
          "policy_version"
        ],
        "title": "NativeScanPassThroughPreconditions"
      },
      "NativeScanReport": {
        "properties": {
          "report_type": {
            "type": "string",
            "const": "pdf_native_structural_triage",
            "title": "Report Type",
            "default": "pdf_native_structural_triage"
          },
          "schema_version": {
            "type": "integer",
            "title": "Schema Version",
            "default": 1
          },
          "analysis_status": {
            "type": "string",
            "enum": [
              "completed",
              "partial",
              "unavailable",
              "error"
            ],
            "title": "Analysis Status"
          },
          "classification": {
            "type": "string",
            "enum": [
              "untagged",
              "tagged_inconsistent",
              "tagged_deficient",
              "tagged_clean",
              "inconclusive",
              "unsupported"
            ],
            "title": "Classification"
          },
          "source_kind": {
            "type": "string",
            "enum": [
              "born_digital_vector",
              "raster_first",
              "unknown"
            ],
            "title": "Source Kind"
          },
          "structural_triage_score": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Structural Triage Score"
          },
          "score_status": {
            "type": "string",
            "enum": [
              "scored",
              "not_scored_due_to_conformance_failure",
              "not_scored_validator_unavailable",
              "not_scored_insufficient_coverage",
              "not_applicable"
            ],
            "title": "Score Status"
          },
          "parse_coverage": {
            "type": "number",
            "title": "Parse Coverage"
          },
          "coverage": {
            "$ref": "#/components/schemas/NativeScanCoverage"
          },
          "verapdf": {
            "$ref": "#/components/schemas/NativeScanVeraPdf"
          },
          "findings": {
            "items": {
              "$ref": "#/components/schemas/NativeScanFinding"
            },
            "type": "array",
            "title": "Findings",
            "default": []
          },
          "pass_through_preconditions": {
            "$ref": "#/components/schemas/NativeScanPassThroughPreconditions"
          },
          "evidence": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/NativeScanEvidence"
              },
              {
                "type": "null"
              }
            ]
          },
          "page_evidence": {
            "items": {
              "$ref": "#/components/schemas/NativeScanPageEvidence"
            },
            "type": "array",
            "title": "Page Evidence",
            "default": []
          },
          "failure_reasons": {
            "items": {
              "type": "string"
            },
            "type": "array",
            "title": "Failure Reasons",
            "default": []
          },
          "source_pdf_sha256": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Source Pdf Sha256"
          },
          "scanner_version": {
            "type": "string",
            "title": "Scanner Version"
          },
          "scanned_at": {
            "type": "string",
            "title": "Scanned At"
          }
        },
        "type": "object",
        "required": [
          "analysis_status",
          "classification",
          "source_kind",
          "score_status",
          "parse_coverage",
          "coverage",
          "verapdf",
          "pass_through_preconditions",
          "scanner_version",
          "scanned_at"
        ],
        "title": "NativeScanReport"
      },
      "NativeScanVeraPdf": {
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "pass",
              "fail",
              "unavailable"
            ],
            "title": "Status"
          },
          "flavour": {
            "type": "string",
            "title": "Flavour",
            "default": "ua1"
          },
          "version": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Version"
          },
          "failed_checks": {
            "items": {
              "additionalProperties": true,
              "type": "object"
            },
            "type": "array",
            "title": "Failed Checks",
            "default": []
          },
          "error_detail": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Detail"
          }
        },
        "type": "object",
        "required": [
          "status"
        ],
        "title": "NativeScanVeraPdf"
      },
      "RegenerateOutcome": {
        "properties": {
          "element_path": {
            "type": "string",
            "title": "Element Path"
          },
          "edit_type": {
            "type": "string",
            "title": "Edit Type"
          },
          "status": {
            "type": "string",
            "enum": [
              "succeeded",
              "failed",
              "skipped"
            ],
            "title": "Status"
          },
          "reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Reason"
          },
          "applied_edit": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/AccessibilityEdit"
              },
              {
                "type": "null"
              }
            ]
          },
          "applied_edits": {
            "items": {
              "$ref": "#/components/schemas/AccessibilityEdit"
            },
            "type": "array",
            "title": "Applied Edits",
            "default": []
          }
        },
        "type": "object",
        "required": [
          "element_path",
          "edit_type",
          "status"
        ],
        "title": "RegenerateOutcome",
        "description": "Per-target outcome of a regeneration request, keyed by `element_path`. Regeneration targets elements whose issues are already resolved, so outcomes are keyed by element rather than by issue."
      },
      "ScanJobResponse": {
        "properties": {
          "id": {
            "type": "string",
            "title": "Id"
          },
          "filename": {
            "type": "string",
            "title": "Filename"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "progress_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Progress Message"
          },
          "error_message": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Error Message"
          },
          "failure_class": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Failure Class"
          },
          "page_count": {
            "type": "integer",
            "title": "Page Count",
            "default": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          },
          "descriptions_skip_reason": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Descriptions Skip Reason"
          },
          "native_scan_report": {
            "anyOf": [
              {
                "$ref": "#/components/schemas/NativeScanReport"
              },
              {
                "type": "null"
              }
            ]
          },
          "recent_mutation_ids": {
            "anyOf": [
              {
                "items": {
                  "type": "string"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Recent Mutation Ids"
          }
        },
        "type": "object",
        "required": [
          "id",
          "filename",
          "status",
          "created_at"
        ],
        "title": "ScanJobResponse"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          },
          "input": {
            "title": "Input"
          },
          "ctx": {
            "type": "object",
            "title": "Context"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "OAuth2PasswordBearer": {
        "type": "oauth2",
        "flows": {
          "password": {
            "scopes": {},
            "tokenUrl": "/api/auth/login"
          }
        }
      },
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "x-api-key",
        "description": "Per-tenant API key. Format: acs_<32 base62>"
      },
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key as Bearer token (alternative to x-api-key)"
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    }
  ]
}