openapi: 3.1.0
info:
  title: ON ACCESSIBLE Scan API
  version: 2.0.0
  description: |
    Programmatic automated WCAG 2.2 accessibility checks for Premium accounts.

    Create API tokens in [Portal → API & Webhooks](https://www.onaccessible.com/portal/api).

    Rate limit: **60 requests/hour** per token.

    **Engine.** axe-core 4.14.0 runs inside real Chrome, together with ON ACCESSIBLE keyboard,
    reflow, text-spacing and focus checks. Results are mapped to WCAG 2.2 success criteria at
    levels A, AA and AAA, with a list of criteria that need manual review. When the browser
    engine is unavailable, the legacy markup-only checks run instead and the result is a
    **Limited scan**.

    **Not a conformance claim.** Automated testing finds a subset of accessibility issues. It
    cannot determine WCAG conformance or legal compliance. All 86 WCAG 2.2 success criteria need
    human verification. Every response says so: `conformanceClaim` is always `false`, `level` is an
    automated status (one of four fixed strings), and `disclaimer` carries the full text.

    **Summary mode** (`details: false`, default) returns the score, automated status, coverage,
    per-level criteria counts, issue counts and compact enrichments (`categoryScores`,
    `viewportProfiles.mobile`, `screenReaderPreview` regression counts, `historicalRegression`).

    **Details mode** (`details: true`) returns the full scan payload: one entry per rule in
    `violations`, `incomplete` and `passes`, the per-criterion `wcag` report, `coverageDetails`
    and the screen-reader announcements.

    **Changes in 2.0.0 (scanner v3; breaking: `score` can be `null`, new `level` values,
    `pixelContrast` removed)**
    - `level` is now an automated status: `Limited scan — results incomplete`,
      `Level A failures detected`, `Level AA failures detected` or
      `No automated A/AA failures — manual review required`. Earlier score-based labels are not
      WCAG conformance results.
    - `score` is `v3-axe-weighted`: weighted axe-core A/AA rules, shown as N/100, capped at 69
      when `automatedStatus` is `level_a_failures` and at 89 when it is `level_aa_failures`. It is
      `null` when the scan is limited and no comparable score exists. Never treat `null` as 0.
    - New: `automatedStatus`, `coverage`, `scoreModel`, `conformanceClaim`, `limitedReasons`,
      `engine`, `criteria`, `levels`, `disclaimer`, `summary.rules`.
    - `summary.totalIssues` and `summary.critical`…`minor` keep their meaning: failing A/AA
      **elements**. `summary.rules` adds the per-rule counts.
    - `violations`, `incomplete` and `passes` (details mode) hold one entry per rule; `nodeCount`
      gives the element count.
    - `pixelContrast` is no longer returned; contrast is checked by axe-core in the browser.
    - `headless: false` runs only the legacy markup checks and always returns a Limited scan.
    - New request field `profile` (`full`, `standard` or `quick`; default `full`).
    - Error bodies carry a machine-readable `code` when there is one. A scan that runs out of
      time answers `504` with `code: SCAN_TIMEOUT` (the whole call is bounded at about 120 s);
      `503` with the same code means there was no time left to start one. A scanner answer that
      is not a scan result is `502` with `code: SCAN_BAD_RESPONSE`.
  contact:
    name: ON ACCESSIBLE
    url: https://www.onaccessible.com/docs/api
  license:
    name: Proprietary
    url: https://www.onaccessible.com/terms
servers:
  - url: https://fxkfwwgfzanduvszfliv.supabase.co/functions/v1
    description: Production
paths:
  /scan-api:
    post:
      operationId: createScan
      summary: Run automated accessibility checks on a URL
      description: |
        Loads the page in real Chrome and runs axe-core 4.14.0 plus the ON ACCESSIBLE keyboard,
        reflow, text-spacing and focus checks. Returns an automated score (N/100), an automated
        status, coverage, per-level criteria counts and issue counts. Set `details: true` for the
        full scan payload. The response is never a conformance claim.
      security:
        - bearerAuth: []
      parameters:
        - name: apikey
          in: header
          required: true
          description: Supabase anon/publishable key (same as the web app).
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScanRequest'
            examples:
              basic:
                summary: Basic scan
                value:
                  url: https://example.com
              detailed:
                summary: Full scan payload with a mobile pass
                value:
                  url: https://example.com
                  details: true
                  mobileViewport: true
              quick:
                summary: Quick profile (axe-core only, fastest)
                value:
                  url: https://example.com/pricing
                  profile: quick
      responses:
        '200':
          description: |
            Scan completed. Summary mode returns `ScanSummaryResponse`; `details: true` returns
            `ScanDetailsResponse`. A Limited scan is still a 200 response: check `automatedStatus`
            (or `coverage`) before trusting the results.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ScanSummaryResponse'
                  - $ref: '#/components/schemas/ScanDetailsResponse'
              examples:
                summary:
                  summary: Summary mode (full real-browser checks)
                  value:
                    ok: true
                    score: 70
                    level: Level A failures detected
                    automatedStatus: level_a_failures
                    coverage: full real-browser checks
                    scoreModel: v3-axe-weighted
                    conformanceClaim: false
                    engine:
                      version: 3.0.0
                      axeVersion: 4.14.0
                      driver: cf-binding
                      profile: full
                    criteria:
                      A: { failed: 5, review: 5 }
                      AA: { failed: 10, review: 1 }
                      AAA: { failed: 6, review: 0 }
                    levels:
                      A: { total: 31, failed: 5, needsReview: 5, noAutomatedFailures: 7, notApplicable: 0, manual: 14, withAutomatedChecks: 17 }
                      AA: { total: 24, failed: 10, needsReview: 1, noAutomatedFailures: 0, notApplicable: 0, manual: 13, withAutomatedChecks: 11 }
                      AAA: { total: 31, failed: 6, needsReview: 0, noAutomatedFailures: 3, notApplicable: 0, manual: 22, withAutomatedChecks: 9 }
                    disclaimer: Automated testing finds a subset of accessibility issues. It cannot determine WCAG conformance or legal compliance. All 86 WCAG 2.2 success criteria need human verification. Automated checks touched 37; 49 have no automated test.
                    summary:
                      totalIssues: 30
                      critical: 4
                      serious: 25
                      moderate: 1
                      minor: 0
                      passed: 37
                      incomplete: 12
                      rules: { failed: 18, critical: 4, serious: 13, moderate: 1, minor: 0, aaa: 5, bestPractice: 4, review: 12 }
                limited:
                  summary: Limited scan (sign-in page reached, no comparable score)
                  value:
                    ok: true
                    score: null
                    level: Limited scan — results incomplete
                    automatedStatus: limited
                    coverage: axe-core only
                    scoreModel: v3-axe-weighted
                    conformanceClaim: false
                    limitedReasons: [login_redirect]
                    engine: { version: 3.0.0, axeVersion: 4.14.0, driver: cf-binding, profile: full }
                    criteria:
                      A: { failed: 0, review: 0 }
                      AA: { failed: 1, review: 1 }
                      AAA: { failed: 1, review: 0 }
                    levels:
                      A: { total: 31, failed: 0, needsReview: 0, noAutomatedFailures: 13, notApplicable: 4, manual: 14, withAutomatedChecks: 15 }
                      AA: { total: 24, failed: 1, needsReview: 1, noAutomatedFailures: 5, notApplicable: 2, manual: 15, withAutomatedChecks: 7 }
                      AAA: { total: 31, failed: 1, needsReview: 0, noAutomatedFailures: 4, notApplicable: 4, manual: 22, withAutomatedChecks: 5 }
                    disclaimer: Automated testing finds a subset of accessibility issues. It cannot determine WCAG conformance or legal compliance. All 86 WCAG 2.2 success criteria need human verification. Automated checks touched 27; 59 have no automated test.
                    summary:
                      totalIssues: 2
                      critical: 0
                      serious: 2
                      moderate: 0
                      minor: 0
                      passed: 25
                      incomplete: 2
                      rules: { failed: 1, critical: 0, serious: 1, moderate: 0, minor: 0, aaa: 1, bestPractice: 2, review: 2 }
        '400':
          description: |
            Invalid request: `url` is missing, `profile` is not one of `full`, `standard`, `quick`,
            or the URL cannot be scanned (for example a private or internal address,
            `code: SSRF_BLOCKED`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                missingUrl:
                  summary: No url
                  value:
                    error: url required
                invalidProfile:
                  summary: Unknown profile
                  value:
                    error: 'profile must be one of: full, standard, quick'
        '401':
          description: Missing or invalid API token
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Premium plan required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Unexpected error in the API itself.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '502':
          description: |
            The scan produced no result. `code` says why:
            - the scanned site failed: `TARGET_HTTP_ERROR` (`details.upstreamStatus` has the
              site's HTTP status when known), `NAVIGATION_FAILED`, `NOT_HTML`, `FETCH_FAILED`,
              `FETCH_TIMEOUT`, `BOT_CHALLENGE`, `BLOCKED_PAGE`;
            - the scanner failed: `SCAN_FAILED`;
            - the scanner answered with something that is not a scan result: `SCAN_BAD_RESPONSE`.

            `code` is absent when the scanner could not be reached. A 5xx status from the scanner
            itself is passed through unchanged.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                targetHttpError:
                  summary: The scanned page returned HTTP 503
                  value:
                    error: 'Failed to fetch website: HTTP 503'
                    code: TARGET_HTTP_ERROR
                    details:
                      success: false
                      error: 'Failed to fetch website: HTTP 503'
                      code: TARGET_HTTP_ERROR
                      upstreamStatus: 503
                badResponse:
                  summary: The scanner answered with something that is not a scan result
                  value:
                    error: Unexpected scan response
                    code: SCAN_BAD_RESPONSE
        '503':
          description: |
            Not enough time was left to start the scan (`code: SCAN_TIMEOUT`). Nothing was
            scanned; retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Not enough time left to start the scan
                code: SCAN_TIMEOUT
        '504':
          description: |
            The scan did not finish within the time budget (about 120 s for the whole call;
            `code: SCAN_TIMEOUT`). Retry, or use `profile: quick` for slow pages.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: Scan timed out
                code: SCAN_TIMEOUT
webhooks:
  scan.completed:
    post:
      summary: A scan finished (dashboard or API scan)
      description: |
        Sent to each active `scan.completed` endpoint. Signature header:
        `X-OnAccessible-Signature: t=<unix>,v1=<hex>` where `v1 = HMAC-SHA256(secret, "t." + rawBody)`.
        `level` is the automated status, not a conformance level, and `score` may be `null`.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScanWebhookPayload'
      responses:
        '200':
          description: Any 2xx acknowledges delivery.
  scheduled.audit:
    post:
      summary: A scheduled audit of a monitored site finished
      description: Same payload as `scan.completed`, plus `site_id` and `site_name`.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScanWebhookPayload'
      responses:
        '200':
          description: Any 2xx acknowledges delivery.
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API token from Portal → API & Webhooks (prefix `oa_`).
  schemas:
    ScanRequest:
      type: object
      required:
        - url
      properties:
        url:
          type: string
          format: uri
          example: https://example.com
        profile:
          type: string
          enum: [full, standard, quick]
          default: full
          description: |
            Which checks run (any other value is a `400`). Returned as `engine.profile`.
            - `full` (default): axe-core plus the contrast, motion, reflow, text-spacing and
              keyboard checks, and the mobile pass when `mobileViewport` is `true`.
            - `standard`: the same checks with smaller motion, keyboard and contrast budgets, and
              no mobile pass (`mobileViewport` is ignored).
            - `quick`: axe-core, the static checks and the screen-reader preview only. Coverage is
              never `full real-browser checks`; use it for fast checks of many pages.
        useAI:
          type: boolean
          default: false
          description: |
            Request advisory AI suggestions (counts against the AI quota). AI output is returned
            only in details mode (`aiInsights`, marked advisory) and never changes the score,
            status or level.
        headless:
          type: boolean
          default: true
          deprecated: true
          description: |
            Keep `true` (default): the page is loaded in real Chrome. `false` runs only the legacy
            markup checks without a browser. The result is then always a Limited scan
            (`automatedStatus: limited`, `scoreModel: legacy-markup`, `limitedReasons` includes
            `legacy_driver`), and its score is not comparable with v3 scores.
        mobileViewport:
          type: boolean
          default: false
          description: Run a second pass at 390×844 (paid plans / API keys only). Returns `viewportProfiles.mobile`.
        scanAuth:
          type: object
          description: |
            Authenticated scan: cookies or headers for signed-in pages (Premium API / paid
            dashboard only). Credentials are sent only to the scanned site's own origin (or the
            same registrable domain during the first navigation). If the session is lost, the
            result is limited (`limitedReasons: [auth_lost]`) and no score is returned.
          properties:
            cookieHeader:
              type: string
              description: Raw Cookie header value (e.g. session_id=abc; token=xyz).
            cookies:
              type: array
              items:
                type: object
                required: [name, value]
                properties:
                  name: { type: string }
                  value: { type: string }
                  domain: { type: string }
                  path: { type: string }
            extraHeaders:
              type: object
              additionalProperties: { type: string }
              description: Extra request headers (e.g. Authorization).
            httpAuth:
              type: object
              properties:
                username: { type: string }
                password: { type: string }
        details:
          type: boolean
          default: false
          description: Return the full scan payload (`ScanDetailsResponse`).

    AutomatedStatus:
      type: string
      enum: [limited, level_a_failures, level_aa_failures, no_automated_a_aa_failures]
      description: |
        Automated status, not a conformance level.
        - `limited`: the real-browser checks did not run or could not test enough of the page
          (see `limitedReasons`).
        - `level_a_failures`: a definite automated failure on at least one A-level success criterion.
        - `level_aa_failures`: no A-level failures, and a definite automated failure on at least one
          AA-level success criterion.
        - `no_automated_a_aa_failures`: no automated A/AA failures; manual review is still required.
        AAA results never change the status; they appear only in `criteria` / `levels`.
    AutomatedStatusLabel:
      type: string
      enum:
        - Limited scan — results incomplete
        - Level A failures detected
        - Level AA failures detected
        - No automated A/AA failures — manual review required
      description: The display text for `AutomatedStatus` (same order). Automated status, not a conformance level.
    Coverage:
      type: [string, 'null']
      enum: [axe-core only, full real-browser checks, null]
      description: |
        Which checks ran. `full real-browser checks`: axe-core plus the keyboard, reflow and
        text-spacing stages. `axe-core only`: the browser stages were skipped or failed (for
        example the quick crawl profile). `null`: no browser engine ran (legacy markup checks).
        Show it next to the status.
    ScoreModel:
      type: string
      enum: [v3-axe-weighted, legacy-markup]
      description: |
        `v3-axe-weighted`: axe-core A/AA rule runs (pass or fail) from the desktop pass, each with
        a fixed weight from its default impact (critical 10, serious 7, moderate 3, minor 1).
        Custom checks add findings and change the status; they never enter the weighted ratio,
        but the score is capped by the status they help set: at most 69 with any automated
        Level A failure (axe or custom check), at most 89 with any automated Level AA failure.
        Fewer than 8 applicable A/AA rules gives `score: null`. `legacy-markup`: the legacy markup checks'
        integer score. Scores from different models are not comparable.
    LimitedReason:
      type: string
      enum:
        - legacy_driver
        - axe_not_run
        - too_few_applicable_rules
        - thin_page
        - login_redirect
        - auth_lost
        - blocked
        - challenge
        - http_error
      description: |
        Why a result is limited (several can apply): the legacy markup checks ran instead of the
        browser engine (`legacy_driver`, also for `headless: false`); the desktop axe-core pass did
        not run; fewer than 8 A/AA axe-core rules applied; the page had too little content; an
        unauthenticated scan landed on a sign-in page; an authenticated session was lost; a
        firewall block page or bot challenge was served; the page returned an HTTP error.
    EngineInfo:
      type: object
      required: [version, axeVersion, driver, profile]
      properties:
        version:
          type: string
          description: |
            ON ACCESSIBLE scan engine version (e.g. `3.0.0`), or `legacy-markup` for results from the
            legacy markup checks (not a release number). Tell engines apart by `driver`.
          example: 3.0.0
        axeVersion:
          type: [string, 'null']
          description: axe-core version (`null` for the legacy markup checks).
          example: 4.14.0
        driver:
          type: string
          enum: [cf-binding, local, legacy-markup]
          description: '`cf-binding`: real Chrome in the scanner Worker. `legacy-markup`: markup checks, no browser.'
        profile:
          type: string
          enum: [full, standard, quick]
          description: The `profile` the scan ran with.
    CriteriaCount:
      type: object
      required: [failed, review]
      properties:
        failed:
          type: integer
          description: Success criteria at this level with a definite automated failure.
        review:
          type: integer
          description: Success criteria at this level that need review.
    CriteriaPerLevel:
      type: object
      description: Failed and needs-review success criteria per WCAG level (same numbers as in webhooks).
      required: [A, AA, AAA]
      properties:
        A: { $ref: '#/components/schemas/CriteriaCount' }
        AA: { $ref: '#/components/schemas/CriteriaCount' }
        AAA: { $ref: '#/components/schemas/CriteriaCount' }
    LevelSummary:
      type: object
      required: [total, failed, needsReview, noAutomatedFailures, notApplicable, manual, withAutomatedChecks]
      properties:
        total:
          type: integer
          description: Active WCAG 2.2 success criteria at this level (A 31, AA 24, AAA 31).
        failed: { type: integer }
        needsReview: { type: integer }
        noAutomatedFailures:
          type: integer
          description: Criteria where automated checks ran and found nothing. Not a pass; manual review is still required.
        notApplicable:
          type: integer
          description: Set only by explicit probes (no media; no form controls), never from axe-core "inapplicable".
        manual:
          type: integer
          description: Criteria with no automated check in this scan.
        withAutomatedChecks:
          type: integer
          description: Criteria at this level that have any automated check in this engine (e.g. "9 of 31 AAA criteria have automated checks").
    LevelsPerLevel:
      type: object
      required: [A, AA, AAA]
      properties:
        A: { $ref: '#/components/schemas/LevelSummary' }
        AA: { $ref: '#/components/schemas/LevelSummary' }
        AAA: { $ref: '#/components/schemas/LevelSummary' }
    SummaryRuleCounts:
      type: object
      description: Rule counts (one per rule, not per element).
      required: [failed, critical, serious, moderate, minor, aaa, bestPractice, review]
      properties:
        failed:
          type: integer
          description: Failing A/AA rules.
        critical: { type: integer }
        serious: { type: integer }
        moderate: { type: integer }
        minor: { type: integer }
        aaa:
          type: integer
          description: Failing AAA rules (never part of the status).
        bestPractice:
          type: integer
          description: Failing best-practice rules (not WCAG failures).
        review:
          type: integer
          description: Findings that need manual review.
    ScanSummary:
      type: object
      required: [totalIssues, critical, serious, moderate, minor, passed, incomplete]
      properties:
        totalIssues:
          type: integer
          description: Failing A/AA elements (sum of `nodeCount` over failing A/AA rules). Same meaning as in 1.1.0.
        critical:
          type: integer
          description: Failing A/AA elements with critical impact.
        serious:
          type: integer
          description: Failing A/AA elements with serious impact.
        moderate:
          type: integer
        minor:
          type: integer
        passed:
          type: integer
          description: Rules with no automated failures in the desktop pass (equals the length of `passes` in details mode).
        incomplete:
          type: integer
          description: Findings that need review (one per rule).
        rules:
          $ref: '#/components/schemas/SummaryRuleCounts'
    CategoryScore:
      type: object
      properties:
        principle:
          type: string
          enum: [perceivable, operable, understandable, robust]
        label:
          type: string
        score:
          type: [integer, 'null']
          description: Same model as `score`, over the axe-core A/AA rules of this principle; `null` when fewer than 3 apply.
        violations:
          type: integer
        passes:
          type: integer
        incomplete:
          type: integer
    CategoryScoreDelta:
      type: object
      properties:
        principle:
          type: string
          enum: [perceivable, operable, understandable, robust]
        label:
          type: string
        desktopScore:
          type: [integer, 'null']
        mobileScore:
          type: [integer, 'null']
        delta:
          type: [integer, 'null']
    ScreenReaderRegression:
      type: object
      properties:
        mobileOnlyCount:
          type: integer
        desktopOnlyCount:
          type: integer
        mobileOnlySamples:
          type: array
          items:
            type: object
            properties:
              role: { type: string }
              utterance: { type: string }
    ScreenReaderSummary:
      type: object
      description: Compact screen-reader preview (summary mode). Full announcements in details mode.
      properties:
        engine:
          type: string
          enum: [chromium-ax-tree]
        announcementCount:
          type: integer
        truncated:
          type: boolean
        regression:
          $ref: '#/components/schemas/ScreenReaderRegression'
        mobileAnnouncementCount:
          type: integer
    HistoricalRegression:
      type: object
      description: |
        Diff against your previous snapshot of the same URL. Omitted when the current score is
        `null`, when the previous snapshot used a different score model, or when there is no
        previous snapshot with a fingerprint.
      properties:
        priorSnapshotId:
          type: string
          format: uuid
        priorScannedAt:
          type: string
          format: date-time
        priorScore:
          type: integer
        scoreDelta:
          type: integer
        priorAnnouncementCount:
          type: integer
        announcementCountDelta:
          type: integer
        newCount:
          type: integer
        removedCount:
          type: integer
        newSamples:
          type: array
          items:
            type: object
            properties:
              role: { type: string }
              utterance: { type: string }
        removedSamples:
          type: array
          items:
            type: object
            properties:
              role: { type: string }
              text: { type: string }
    A11yTreeFingerprint:
      type: object
      description: Fingerprint for future historical diffs (stored in snapshots).
      properties:
        announcementCount:
          type: integer
        keys:
          type: array
          items:
            type: string
    ScanV3Fields:
      type: object
      description: Fields every scanner v3 response carries (summary and details mode).
      required: [automatedStatus, coverage, scoreModel, conformanceClaim, summary]
      properties:
        automatedStatus:
          $ref: '#/components/schemas/AutomatedStatus'
        coverage:
          $ref: '#/components/schemas/Coverage'
        scoreModel:
          $ref: '#/components/schemas/ScoreModel'
        conformanceClaim:
          const: false
          description: Always `false`. Automated testing cannot determine WCAG conformance.
        limitedReasons:
          type: array
          items:
            $ref: '#/components/schemas/LimitedReason'
        summary:
          $ref: '#/components/schemas/ScanSummary'
        categoryScores:
          type: array
          items:
            $ref: '#/components/schemas/CategoryScore'
        historicalRegression:
          $ref: '#/components/schemas/HistoricalRegression'
        a11yTreeFingerprint:
          $ref: '#/components/schemas/A11yTreeFingerprint'
    ScanSummaryResponse:
      description: 'Summary mode (`details: false`).'
      allOf:
        - $ref: '#/components/schemas/ScanV3Fields'
        - type: object
          required: [ok, score, level, engine, criteria, levels, disclaimer]
          properties:
            ok:
              const: true
            score:
              type: [number, 'null']
              minimum: 0
              maximum: 100
              example: 70
              description: |
                Automated score 0–100 (`scoreModel`). Display as "N/100", never as a percentage;
                it is not a conformance or legal measure. `null` = no comparable score (the scan
                is limited); never treat it as 0.
            level:
              $ref: '#/components/schemas/AutomatedStatusLabel'
            engine:
              $ref: '#/components/schemas/EngineInfo'
            criteria:
              $ref: '#/components/schemas/CriteriaPerLevel'
            levels:
              $ref: '#/components/schemas/LevelsPerLevel'
            disclaimer:
              type: string
              description: Show with the results. Example in the 200 response.
            viewportProfiles:
              type: object
              properties:
                mobile:
                  type: object
                  properties:
                    viewport:
                      type: object
                      properties:
                        width: { type: integer }
                        height: { type: integer }
                        label: { type: string, enum: [mobile] }
                    complianceScore:
                      type: [number, 'null']
                      description: Mobile automated score (same model as `score`).
                    complianceLevel:
                      $ref: '#/components/schemas/AutomatedStatusLabel'
                    automatedStatus:
                      $ref: '#/components/schemas/AutomatedStatus'
                    scoreDelta:
                      type: [integer, 'null']
                    mobileOnlyIssueIds:
                      type: array
                      items:
                        type: string
                    categoryScoreDeltas:
                      type: array
                      items:
                        $ref: '#/components/schemas/CategoryScoreDelta'
            screenReaderPreview:
              $ref: '#/components/schemas/ScreenReaderSummary'
    FindingNode:
      type: object
      properties:
        target:
          type: array
          items: { type: string }
          description: Selector path; one entry per iframe or shadow-DOM hop.
        html: { type: string }
        failureSummary: { type: string }
        evidence:
          type: object
          additionalProperties: { type: [number, string, boolean] }
          description: Check-specific measurements (contrast ratio, hit area, ...).
    AccessibilityIssue:
      type: object
      description: One entry per rule.
      required: [id, impact, description, help, helpUrl, tags, nodes]
      properties:
        id:
          type: string
          description: axe-core rule id, ON ACCESSIBLE check id (`oa-…`), or legacy rule id.
        impact:
          type: string
          enum: [critical, serious, moderate, minor]
        description: { type: string }
        help: { type: string }
        helpUrl: { type: string }
        tags:
          type: array
          items: { type: string }
        nodes:
          type: array
          items:
            $ref: '#/components/schemas/FindingNode'
          description: First 25 elements at most (empty in `passes`). See `nodeCount`.
        sc:
          type: array
          items: { type: string }
          description: WCAG success criteria, e.g. ["1.4.3"].
        level:
          type: [string, 'null']
          enum: [A, AA, AAA, null]
          description: Lowest WCAG level among `sc`; `null` for best practice.
        wcagVersion:
          type: [string, 'null']
          enum: ['2.0', '2.1', '2.2', null]
        engine:
          type: string
          enum: [axe, oa, legacy]
        outcome:
          type: string
          enum: [fail, review]
        confidence:
          type: string
          enum: [definite, likely, heuristic]
        nodeCount:
          type: integer
          description: Number of affected elements.
        bestPractice: { type: boolean }
        experimental: { type: boolean }
        reviewReason: { type: string }
        reviewPriority:
          type: string
          enum: [high, normal]
        stage: { type: string }
        viewport:
          type: string
          enum: [desktop, mobile]
    CriterionResult:
      type: object
      properties:
        sc: { type: string }
        name: { type: string }
        level:
          type: string
          enum: [A, AA, AAA]
        introducedIn:
          type: string
          enum: ['2.0', '2.1', '2.2']
        principle:
          type: string
          enum: [perceivable, operable, understandable, robust]
        automation:
          type: string
          enum: [F, P, R, M]
          description: F automatable (default page state); P and R partially testable; M manual only.
        status:
          type: string
          enum: [fail, review, no_automated_failures, not_applicable, manual]
          description: '`no_automated_failures` is not a pass. `not_applicable` only from explicit probes.'
        coverage:
          type: string
          enum: [full, partial, none]
        coverageNote:
          type: string
          description: e.g. "tested 36 of 87 tab stops".
        notApplicableBasis:
          type: string
          enum: [no_media, no_form_controls]
        ruleIds:
          type: array
          items: { type: string }
        failCount: { type: integer }
        reviewCount: { type: integer }
        checksRun: { type: integer }
        understandingUrl: { type: string }
    WcagReport:
      type: object
      properties:
        version:
          type: string
          enum: ['2.2']
        catalog: { type: string }
        totalCriteria:
          type: integer
          description: 86 active WCAG 2.2 success criteria (4.1.1 is obsolete).
        touched:
          type: integer
          description: Criteria with at least one automated check in this scan.
        levels:
          $ref: '#/components/schemas/LevelsPerLevel'
        criteria:
          type: array
          items:
            $ref: '#/components/schemas/CriterionResult'
        bestPractice:
          type: object
          properties:
            failed: { type: integer }
            review: { type: integer }
        disclaimer: { type: string }
    CoverageDetails:
      type: object
      properties:
        label:
          $ref: '#/components/schemas/Coverage'
        profile:
          type: string
          enum: [full, standard, quick]
        stagesRun:
          type: array
          items: { type: string }
        stagesSkipped:
          type: array
          items:
            type: object
            properties:
              stage: { type: string }
              status: { type: string }
              reason: { type: string }
        framesScanned: { type: integer }
        framesSkipped: { type: integer }
        thirdPartyFrameOrigins:
          type: array
          description: Cross-origin iframes that were not scanned, by origin.
          items:
            type: object
            properties:
              origin: { type: string }
              frames: { type: integer }
        keyboard:
          type: object
          properties:
            stops: { type: integer }
            expected: { type: integer }
            completed: { type: boolean }
    ScanDetailsResponse:
      description: 'Details mode (`details: true`). Uses the `complianceScore` / `complianceLevel` names.'
      allOf:
        - $ref: '#/components/schemas/ScanV3Fields'
        - type: object
          required: [ok, success, url, complianceScore, complianceLevel, violations, incomplete, passes, engine, wcag]
          properties:
            ok:
              const: true
            success:
              const: true
            url:
              type: string
            timestamp:
              type: string
              format: date-time
            scanType:
              type: string
              enum: [regular, advanced]
            complianceScore:
              type: [number, 'null']
              description: Same value as `score` in summary mode (N/100, `null` when limited).
            complianceLevel:
              $ref: '#/components/schemas/AutomatedStatusLabel'
            violations:
              type: array
              description: Definite failures, one entry per rule; A → AA → AAA → best practice.
              items:
                $ref: '#/components/schemas/AccessibilityIssue'
            incomplete:
              type: array
              description: Findings that need review, one entry per rule.
              items:
                $ref: '#/components/schemas/AccessibilityIssue'
            passes:
              type: array
              description: Rules with no automated failures in the desktop pass (`nodes` is empty).
              items:
                $ref: '#/components/schemas/AccessibilityIssue'
            pageInfo:
              type: object
              properties:
                title: { type: string }
                lang: { type: string }
                renderMode:
                  type: string
                  enum: [headless, static]
                wcagVersion:
                  type: string
                  enum: ['2.2']
                finalUrl: { type: string }
                httpStatus: { type: [integer, 'null'] }
                pageState:
                  type: string
                  enum: [ok, thin, login_redirect, auth_lost, blocked, challenge, http_error]
            engine:
              type: object
              description: Engine provenance and per-stage results.
              properties:
                engine: { type: string, enum: [oa-scan-engine] }
                engineVersion: { type: string }
                contractVersion: { type: string }
                axeVersion: { type: [string, 'null'] }
                driver:
                  type: string
                  enum: [cf-binding, local, legacy-markup]
                profile:
                  type: string
                  enum: [full, standard, quick]
                browser: { type: [string, 'null'] }
                cspMode:
                  type: string
                  enum: [bypassed, enforced, not_applicable]
                durationMs: { type: integer }
                fallbackFrom:
                  type: array
                  items: { type: string }
                stages:
                  type: object
                  additionalProperties:
                    type: object
                    properties:
                      status:
                        type: string
                        enum: [ok, partial, skipped, timeout, error, not_run]
                      ms: { type: integer }
                      reason: { type: string }
            wcag:
              $ref: '#/components/schemas/WcagReport'
            coverageDetails:
              $ref: '#/components/schemas/CoverageDetails'
            viewportProfiles:
              type: object
              properties:
                desktop: { type: object }
                mobile: { type: object }
            screenReaderPreview:
              type: object
              description: Desktop announcements (at most 120), optional mobile list and regression.
              properties:
                engine:
                  type: string
                  enum: [chromium-ax-tree]
                announcementCount:
                  type: integer
                truncated:
                  type: boolean
                announcements:
                  type: array
                  items:
                    type: object
                    properties:
                      order: { type: integer }
                      role: { type: string }
                      text: { type: string }
                      utterance: { type: string }
                      utteranceJaws: { type: string }
                mobile:
                  type: object
                  properties:
                    announcementCount: { type: integer }
                    truncated: { type: boolean }
                    announcements:
                      type: array
                      items:
                        type: object
                regression:
                  $ref: '#/components/schemas/ScreenReaderRegression'
            aiInsights:
              type: object
              description: Advisory AI suggestions (with `useAI`). Unverified; never changes the score, status or level.
            snapshotId:
              type: [string, 'null']
            snapshotSkipped:
              type: string
              enum: [not_requested, unverified_user, score_unavailable, auth_lost, page_state, persist_failed]
    ScanWebhookPayload:
      type: object
      description: |
        Webhook body (snake_case). `score` may be `null`; `level` is the automated status, not a
        conformance level.
      required: [event, url, score, level, summary, scanned_at]
      properties:
        event:
          type: string
          enum: [scan.completed, scheduled.audit]
        url: { type: string }
        score:
          type: [number, 'null']
          description: Automated score (N/100); `null` when the scan is limited.
        level:
          $ref: '#/components/schemas/AutomatedStatusLabel'
        summary:
          $ref: '#/components/schemas/ScanSummary'
        scan_type:
          type: string
          enum: [regular, advanced]
        scanned_at:
          type: string
          format: date-time
        site_id:
          type: string
          description: scheduled.audit only.
        site_name:
          type: string
          description: scheduled.audit only.
        automated_status:
          $ref: '#/components/schemas/AutomatedStatus'
        score_model:
          $ref: '#/components/schemas/ScoreModel'
        engine_version:
          type: string
          description: Same as `engine.version` in the API (`legacy-markup` for legacy markup results).
        coverage:
          $ref: '#/components/schemas/Coverage'
        conformance_claim:
          const: false
        criteria:
          $ref: '#/components/schemas/CriteriaPerLevel'
    ErrorResponse:
      type: object
      required: [error]
      properties:
        error:
          type: string
          description: Human-readable message. Do not parse it; use `code`.
        code:
          type: string
          description: |
            Machine-readable reason, when there is one. Known values (the list can grow):
            `SCAN_TIMEOUT` (503, 504), `SCAN_BAD_RESPONSE` (502), `SCAN_FAILED` (502),
            `SSRF_BLOCKED` (400), and the scanned-site failures `TARGET_HTTP_ERROR`,
            `NAVIGATION_FAILED`, `NOT_HTML`, `FETCH_FAILED`, `FETCH_TIMEOUT`, `BOT_CHALLENGE`,
            `BLOCKED_PAGE` (502). The API's own checks (missing `url`, invalid `profile`, token,
            plan and hourly rate limit) answer without a `code`.
          example: SCAN_TIMEOUT
        details:
          type: [object, string, 'null']
          description: |
            The scanner's own error body, when there is one: `success: false`, `error`, `code`
            and, for `TARGET_HTTP_ERROR`, `upstreamStatus`. A string when that body was not JSON.
          properties:
            success:
              const: false
            error: { type: string }
            code: { type: string }
            upstreamStatus: { type: integer }
