openapi: 3.1.0
info:
  title: Cyberblade Assay API
  version: 0.1.0
  summary: The /v1 surface of Assay, the adversarial exposure validation engine.
  description: |
    Assay proves which exposures in an environment are actually reachable, under a
    signed engagement authorization, and refuses anything that authorization does
    not cover.

    This document is the single source of truth for the `/v1` surface. A test walks
    the built router and fails the build when a route here is not served, or a
    served route is not here, so the spec cannot drift from the code. The spec is
    also linted as OpenAPI 3.1 in CI.

    ## Which service serves what

    Assay runs eight services from one composition root, and each mounts only its
    own routes. The build version and the contract metadata are served by every
    service. Grants, authorization checks and the kill-switch are served by the
    `authz` service. Event ingestion is served by the `asset` service. This
    document describes the whole product surface; which paths answer on a given
    host depends on which service that host runs.

    ## Guardrail semantics

    Authorization is default-deny and enforced at a single choke-point. A refusal
    is an ordinary outcome rather than an error: the authorization check answers
    200 with `allowed` false and a `reason` naming the step that refused. Absence
    of a grant is a refusal, and every decision is recorded in a hash-chained
    audit log before it is returned.

    A grant that allows `active-intrusive` work is never signed on one person's
    say-so. It is held as pending and answered 202 with a digest, and becomes an
    authorization only when a second principal approves that exact digest.

    No endpoint turns a guardrail off, because no such endpoint exists. Scope
    enforcement, safety-class classification, audit, the blast-radius ceilings and
    the kill-switch are in every build and are not entitlement-gated.

    ## Self-hosted

    Assay runs on infrastructure the customer operates. It calls no vendor
    endpoint, and no customer data leaves the deployment.
  license:
    name: Apache-2.0
    identifier: Apache-2.0
servers:
  - url: https://{host}
    description: >-
      The service's own listener, on infrastructure the customer operates. The
      admin listener that carries /livez, /readyz and /metrics binds to a
      separate address and is not part of this surface.
    variables:
      host:
        default: localhost:8443
        description: Host and port of the Assay service.
tags:
  - name: Public
    description: >-
      Unauthenticated, read-only endpoints. A peer product negotiates contract
      compatibility before it holds credentials, and neither endpoint reveals
      anything about an engagement.
  - name: Auth
    description: >-
      Local account authentication. Served by the authz service; unauthenticated
      by necessity, since this is how a caller gets a credential in the first
      place.
  - name: SSO
    description: >-
      Per-tenant OIDC and SAML federation against an operator's OWN
      external identity provider (their own Okta, Azure AD, Google
      Workspace, ADFS, Shibboleth, ...) — a real browser-redirect OAuth2
      Authorization Code flow with PKCE for OIDC, a signed SAML assertion
      for SAML. Covers both the admin configuration surface (issuer/entity
      id, client id, client secret; security-admin write,
      operator/security-admin/auditor read; served by the authz service)
      and the public login routes. Proves identity only: a signed-in
      account's role and tenant always come from the local account record
      this installation already holds, matched by the identity provider's
      own verified email — never from anything the identity provider
      itself asserts.
  - name: Account
    description: >-
      Self-service account management: view your own profile and MFA state,
      change your own password, and enroll, confirm, disable or regenerate
      recovery codes for your own second factor. Every authenticated role
      gets these — they are not privileged acts against someone else's
      account. Served by the authz service.
  - name: User management
    description: >-
      Tenant identity/access management: list, create, change the roles of,
      disable and re-enable a local login account. security-admin and
      global-admin only, read and write — every role every account in the
      caller's own tenant, never another tenant's. Served by the authz
      service.
  - name: SCIM provisioning
    description: >-
      Minting, listing and revoking the bearer credential an identity
      provider (Okta, Azure AD, ...) uses against `/scim/v2/*` to provision
      accounts automatically. `/scim/v2/*` itself is RFC 7643/7644, a
      third-party protocol this product implements but does not own the
      shape of, and is not part of this document — see
      tests/guardrails/apicheck_test.go's own doc comment for why. This
      management surface is Assay's own `/v1` contract and is documented
      here in full. security-admin and global-admin only, read and write.
      Served by the authz service.
  - name: Grants
    description: >-
      The lifecycle of a signed engagement authorization: issue, amend, approve,
      revoke, list. Served by the authz service.
  - name: Authorization
    description: >-
      The choke-point every action against a target clears. Served by the authz
      service.
  - name: Kill switch
    description: >-
      The global emergency brake. Served by the authz service.
  - name: Licensing
    description: >-
      The vendor's own license issuance and overview — global-admin only, and
      meaningful only on the instance holding the vendor's private signing key.
      Every install mounts these routes; a customer instance answers them
      unavailable. Served by the authz service.
  - name: Safe mode
    description: >-
      What this installation is able to run against a target, and at what safety
      class. Served by the safemode service.
  - name: Events
    description: >-
      The consume half of the suite event contract. Served by the asset service.
  - name: Exposure graph
    description: >-
      The assets a deployment holds, what discovery asserted about them, and the
      proven paths through them. Served by the asset service.
  - name: Crown jewels
    description: >-
      The assets an operator has declared the engagement is about. They are what
      reachability is measured against. Served by the asset service.
  - name: Connectors
    description: >-
      Per-tenant configuration for third-party scanner/vuln-source connectors
      (Tenable and, over time, siblings). A connector's reported vulnerabilities
      are never proof — see the exposure graph and prioritization docs for why
      Assay ranks only by demonstrated reachability. Served by the asset
      service.
  - name: Verification
    description: >-
      Dispatching a technique against a target — for the first time, or as a
      re-run confirming a fix — and the exposure trend built from that history.
      Every dispatch, first or repeat, clears the same choke-point. Served by
      the verify service.
  - name: Reports
    description: >-
      Building an engagement report from ranked findings and a trend, and reading
      the reports a build stored. A report verifies the evidence behind every
      finding it presents and dispatches nothing against a target. Served by the
      report service.
  - name: Export destinations
    description: >-
      Per-tenant, multi-destination configuration for where a built report's
      proven findings are sent — a customer's own SIEM, SOAR or ticketing
      collector. A tenant may configure several destinations at once, each
      independently named, enabled and tested. Served by the report service,
      the same service that runs the delivery worker reading this
      configuration.
  - name: Plans
    description: >-
      Proposing what to validate next from the tenant's own asset graph and an
      operator-configured model, and reading back past planning cycles. The
      planner proposes only — it holds no dispatcher and cannot act on
      anything; every proposal is independently checked at dispatch time.
      Served by the planner service.
security:
  - bearerAuth: []
  - apiKeyAuth: []
paths:
  /v1/version:
    get:
      operationId: getVersion
      tags: [Public]
      summary: Build stamp and contract version
      description: |
        Reports which build this process is running and which contract version it
        speaks. Public and unauthenticated by design: contract negotiation happens
        before a peer product holds credentials, and nothing here describes an
        engagement.

        The `edition` field reports the compiled build, CE or EE. It comes from a
        compile-time constant, so "the deployed image is the build we intended" is
        checkable rather than assumed.
      security: []
      responses:
        '200':
          description: The build stamp and the contract version.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VersionInfo'
  /v1/contracts/version:
    get:
      operationId: getContractVersion
      tags: [Public]
      summary: Contract version and schema inventory
      description: |
        Reports the shared contract version this build carries and the names of the
        JSON Schemas it can serve. Public for the same reason as the build version.

        The handler is Forge's own. It is mounted on this concrete path rather than
        behind a wildcard, so the spec and the router compare as literal paths.
      security: []
      responses:
        '200':
          description: The contract version and the available schema names.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ContractVersion'
  /v1/contracts/schema/{name}:
    get:
      operationId: getContractSchema
      tags: [Public]
      summary: One contract JSON Schema
      description: |
        Returns the JSON Schema registered under `name`, so a peer can fetch the
        exact shape this service implements rather than only its version. The
        valid names are the ones listed by the contract version endpoint.
      security: []
      parameters:
        - name: name
          in: path
          required: true
          description: Schema name, as listed by the contract version endpoint.
          schema:
            type: string
          example: Envelope
      responses:
        '200':
          description: The JSON Schema document.
          content:
            application/schema+json:
              schema:
                type: object
                description: A JSON Schema document.
                additionalProperties: true
        '404':
          description: >-
            No schema is registered under that name. The response lists the names
            that are. This body is the metadata handler's own shape, not the
            uniform error envelope used elsewhere.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnknownSchema'
  /v1/techniques:
    get:
      operationId: listTechniques
      tags: [Safe mode]
      summary: The validation techniques this installation can run
      description: |
        Lists every validation technique this build implements — its stable id,
        the safety class it declares, the target kinds it accepts and the evidence
        it produces — plus the deployment-wide safe-mode ceiling. This is the
        capability surface a suite peer reads to learn what it can ask this
        installation to validate.

        The list is passive and active-safe techniques only. An active-intrusive
        technique is never first-party code and never appears here; where a
        separately licensed restricted component is present it is dispatched only
        through a grant that authorizes it, never advertised as a capability.

        The list describes what could be dispatched; it authorizes nothing. Every
        dispatch is still checked at the choke-point against the grant that
        authorized the action and against this ceiling, because between load and
        dispatch a grant can be amended, revoked or replaced by a narrower revision.
      responses:
        '200':
          description: The registered techniques and the deployment safety ceiling.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TechniqueList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
  /v1/auth/login:
    post:
      operationId: login
      tags: [Auth]
      summary: Exchange local account credentials for an access token
      description: |
        Verifies an email and password against this installation's own account
        store — local authentication is authoritative; the optional suite identity
        broker only supplements it — and, once the account has enrolled a second
        factor, a TOTP code. Returns a signed access token on success.

        Served only by the authz service, which owns the account store, and only
        when a secrets backend is configured: a TOTP secret is stored as OpenBao
        Transit ciphertext, so an installation with no secrets backend cannot
        verify one and refuses to serve logins at all (`login_unavailable`).

        Every failed or incomplete attempt is rate-limited and audited the same
        way a successful one is. An unknown email, a wrong password and a
        disabled account all answer identically (`invalid_credentials`): a
        response a caller could tell apart is an oracle for which emails have
        accounts. `totp_required` is safe to distinguish because it is only ever
        returned once the password has already been proven correct.
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LoginRequest'
      responses:
        '200':
          description: The password (and, if required, the TOTP code) verified.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          description: >-
            No such account, a wrong password, or a disabled account
            (`invalid_credentials`, indistinguishable from one another); the
            password was correct but a second factor is required and was
            not given (`totp_required`); or a given TOTP code did not
            verify (`invalid_totp`). A `totp_required` response carries two
            extra top-level fields beyond the ordinary error envelope —
            `pending_login_reference` and `methods` — see
            LoginMFARequiredResponse; every other 401 reason here is the
            plain Error envelope with nothing extra.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginMFARequiredResponse'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or this
            account has too many recent failed attempts and is temporarily
            locked out (`locked_out`). Retry after the interval named in the
            Retry-After header, or in the error message for a lockout.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            This installation has no secrets backend configured, so it cannot
            serve local logins (`login_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/auth/webauthn/login/begin:
    post:
      operationId: authWebAuthnLoginBegin
      tags: [Auth]
      summary: Start the WebAuthn half of a login already in progress
      description: |
        The second half of WebAuthn as a login-time second factor,
        alongside a TOTP code: `POST /v1/auth/login` answers `totp_required`
        with a `pending_login_reference` (and a `methods` list) once the
        password has already verified. Presenting that reference here scopes
        the ceremony to exactly the account's own registered security keys
        — never an empty or discoverable-credential ceremony, which is what
        keeps this a second factor rather than a passwordless flow. There is
        deliberately no variant of this call that accepts a bare tenant and
        email instead of the reference: that would reopen the account-
        enumeration oracle `POST /v1/auth/login`'s own decoy-hash logic
        exists to close.

        The reference is read, not consumed: this call may be retried (a
        network hiccup) without burning the one password verification it
        represents. `POST /v1/auth/webauthn/login/finish` is what consumes
        it.

        Public by the identical necessity `POST /v1/auth/login` is — no
        principal exists yet — served only by the authz service, and only
        once an operator has configured `ASSAY_WEBAUTHN_RP_ID`
        (`webauthn_unavailable` otherwise).
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebAuthnLoginBeginRequest'
      responses:
        '200':
          description: A fresh WebAuthn login ceremony.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebAuthnLoginBeginResponse'
        '400':
          description: >-
            The body could not be decoded (`malformed_json`/`unknown_field`),
            or this account has no registered security keys
            (`webauthn_not_registered`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            The pending-login reference is missing, expired, or was already
            used (`pending_login_expired`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            this login attempt has too many recent failures and is
            temporarily locked out (`locked_out`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: This installation has not configured WebAuthn (`webauthn_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/auth/webauthn/login/finish:
    post:
      operationId: authWebAuthnLoginFinish
      tags: [Auth]
      summary: Complete the WebAuthn half of a login and receive an access token
      description: |
        Verifies the browser's signed assertion against the ceremony
        `POST /v1/auth/webauthn/login/begin` started, and — on success —
        completes the login exactly the way `POST /v1/auth/login` itself
        does for a TOTP code: the login is recorded in the audit trail
        (refusing the whole request if that write fails — an unaudited
        login is never acceptable, WebAuthn included) and an access token is
        issued whose `amr` includes `pwd`, `mfa` and `webauthn`.

        Both the pending-login reference and the ceremony itself are
        consumed here — single use. A replayed call, or one presenting
        either value a second time, fails cleanly rather than
        re-authenticating.

        Public and served only by the authz service, matching
        `POST /v1/auth/webauthn/login/begin` exactly.
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebAuthnLoginFinishRequest'
      responses:
        '200':
          description: The security key verified; here is an access token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
        '400':
          description: >-
            The body could not be decoded, or the ceremony has expired or
            was already used (`ceremony_not_found`), or the credential
            response could not be parsed (`malformed_credential`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            The pending-login reference is missing, expired, or already
            used (`pending_login_expired`); the account behind it is gone or
            disabled (`invalid_credentials`); or the security key's signed
            assertion did not verify (`webauthn_verification_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            this login attempt has too many recent failures and is
            temporarily locked out (`locked_out`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: The token could not be issued (`token_issue_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: This installation has not configured WebAuthn (`webauthn_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/auth/saml/{tenant}/start:
    get:
      operationId: samlLoginStart
      tags: [Auth]
      summary: Start SAML single sign-on for an organization
      description: |
        Begins SP-initiated SAML 2.0 sign-on against the organization's own identity
        provider, and redirects the browser there carrying a signed AuthnRequest.
        This is a real browser redirect, not an API call.

        The request id is recorded server-side before the redirect is issued, so the
        assertion consumer can later prove an assertion answers a request this
        deployment actually made, and can consume that request exactly once. There is
        no IdP-initiated entry point: an assertion that answers no pending request is
        refused.

        **The identity provider proves identity and nothing else.** Account
        resolution is a lookup of an account that already exists here, matched by
        email; roles come from that record. An assertion carrying groups, roles or a
        tenant carries values this product ignores, and no account is ever created
        from one. Local password sign-in always remains available, so a misconfigured
        provider cannot lock an operator out.

        404 covers both "not configured" and "configured but disabled", deliberately
        undistinguished: which one it is, is not something an unauthenticated caller
        needs to learn about another organization.
      security: []
      parameters:
        - name: tenant
          in: path
          required: true
          schema: { type: string }
          description: The organization whose identity provider to use.
        - name: next
          in: query
          required: false
          schema: { type: string }
          description: >-
            Where to land after signing in, carried through the provider as
            RelayState. Validated on the way back as a same-site path only; anything
            else is ignored, because a value returning through the browser is
            untrusted regardless of what was sent.
      responses:
        '302':
          description: Redirect to the organization's identity provider.
        '400': { $ref: '#/components/responses/ValidationFailed' }
        '403':
          description: This installation is not entitled to single sign-on (`sso_unavailable`).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '404':
          description: Single sign-on is not set up for this organization (`saml_not_configured`).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '503':
          description: This installation is not configured for SAML (`saml_unavailable`).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
  /v1/auth/saml/acs:
    post:
      operationId: samlAssertionConsumer
      tags: [Auth]
      summary: Consume a SAML assertion (assertion consumer service)
      description: |
        Where the identity provider POSTs its signed assertion, as a browser form
        submission. Unauthenticated by necessity and tenant-less by construction:
        nothing in the request establishes an organization until the pending request
        the assertion answers has been looked up, which is what binds the two.

        Verification, in order: the assertion must answer a pending request this
        deployment made (InResponseTo), that request is consumed single-use, and the
        assertion is then verified against **that** organization's configured
        provider certificate. A fabricated request id therefore selects only which
        configuration is loaded; producing an assertion that verifies against it is
        the part an attacker cannot do.

        Always answers with a redirect to the console, carrying either a session or
        an error code in the fragment -- never a JSON body, because a person's
        browser lands here directly.
      security: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required: [SAMLResponse]
              properties:
                SAMLResponse:
                  type: string
                  description: The base64 SAML response document.
                RelayState:
                  type: string
                  description: >-
                    Carried through from the start endpoint. Accepted only as a
                    same-site path; it passed through the browser and the provider,
                    so it is untrusted on return.
      responses:
        '302':
          description: >-
            Redirect to the console with a session, or with an error code when the
            assertion was refused.
        '503':
          description: This installation is not configured for SAML (`saml_unavailable`).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
  /v1/auth/saml/{tenant}/metadata:
    get:
      operationId: samlMetadata
      tags: [Auth]
      summary: This deployment's SAML service-provider metadata
      description: |
        The SP metadata document an operator hands to their identity provider. Public
        and unauthenticated because an identity provider fetches it with no
        credential, and it carries only public material: the SP entity id, the
        assertion consumer URL, and the SP's public certificate. The private half of
        that key pair is sealed and never served.

        What this advertises is derived from the same values the assertion consumer
        validates against, so the two cannot drift.
      security: []
      parameters:
        - name: tenant
          in: path
          required: true
          schema: { type: string }
      responses:
        '200':
          description: The SP metadata document.
          content:
            application/samlmetadata+xml:
              schema: { type: string }
        '404':
          description: Single sign-on is not set up for this organization (`saml_not_configured`).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '503':
          description: This installation is not configured for SAML (`saml_unavailable`).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
  /v1/auth/oidc/{tenant}/login:
    get:
      operationId: authOIDCLoginBegin
      tags: [SSO]
      summary: Start a Layer A OIDC sign-in for one tenant
      description: |
        A real browser navigation, not a call a caller's own code makes
        directly: a client redirects the user's browser here, and this
        route in turn issues a real `302` to the tenant's configured
        external identity provider's own authorization endpoint, with a
        freshly minted, single-use `state` (CSRF), `nonce` (ID-token replay
        defense) and PKCE `code_challenge` — mandatory here, not optional,
        since this is a public-facing redirect flow.

        Public and served only by the authz service, rate-limited the same
        way `POST /v1/auth/login` is: there is no authenticated principal
        yet to key the limiter on, so it falls back to source IP.
      security: []
      parameters:
        - name: tenant
          in: path
          required: true
          schema:
            type: string
          description: The tenant whose configured OIDC provider to sign in against.
      responses:
        '302':
          description: Redirect to the tenant's configured external identity provider.
        '400':
          $ref: '#/components/responses/MalformedBody'
        '404':
          description: No OIDC provider is configured for this tenant (`oidc_not_configured`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: >-
            This installation is not entitled to OIDC single sign-on for
            this tenant (`sso_unavailable`); this installation has not
            configured `ASSAY_PUBLIC_BASE_URL`, so it cannot construct a
            `redirect_uri` an external identity provider would accept
            (`oidc_unavailable`); or this installation cannot serve OIDC
            single sign-on at all, no secrets backend configured
            (`oidc_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/auth/oidc/{tenant}/callback:
    get:
      operationId: authOIDCLoginCallback
      tags: [SSO]
      summary: Complete a Layer A OIDC sign-in
      description: |
        Where the identity provider redirects the browser back to after the
        person signs in there. Not a JSON API a caller's own code calls
        directly, and not one either: every outcome here is itself a
        redirect back to this deployment's own frontend
        (`ASSAY_PUBLIC_BASE_URL` + `/auth/callback`) — success carries a
        freshly issued access token in the URL fragment (never sent to any
        server on the next request), failure carries a machine-readable
        `sso_error` query parameter. The one exception is
        `ASSAY_PUBLIC_BASE_URL` itself being unset, which — with no known
        frontend origin to redirect to at all — still answers plain JSON.

        GETDEL's the single-use state record minted by
        `GET /v1/auth/oidc/{tenant}/login` (a replayed or forged state
        fails closed), confirms it was minted for THIS path's own tenant
        (never the other way around), exchanges the code with the stored
        PKCE verifier, verifies the ID token's signature/issuer/audience
        and separately checks the nonce, requires `email_verified`, and
        looks up an existing local account by that verified email —
        case-insensitive, matching `POST /v1/auth/login`'s own lookup.
        **No account found: refused outright — this does not create one.**
        The identity provider's own claims are trusted for identity only:
        role and tenant always come from the local account record.

        Every attempt, success or failure, is audited the same invariant
        `POST /v1/auth/login` already holds.

        Public and served only by the authz service, rate-limited the same
        way `GET /v1/auth/oidc/{tenant}/login` is.
      security: []
      parameters:
        - name: tenant
          in: path
          required: true
          schema:
            type: string
        - name: state
          in: query
          required: true
          schema:
            type: string
        - name: code
          in: query
          required: false
          schema:
            type: string
          description: Absent when the identity provider itself reports an error instead (its own `error` query parameter).
        - name: error
          in: query
          required: false
          schema:
            type: string
          description: Set by the identity provider itself when it declined the sign-in attempt, instead of `code`.
      responses:
        '302':
          description: >-
            Redirect back to this deployment's own frontend — on success,
            an access token in the URL fragment; on any failure, an
            `sso_error` query parameter naming why.
        '400':
          $ref: '#/components/responses/MalformedBody'
        '503':
          description: >-
            This installation has not configured `ASSAY_PUBLIC_BASE_URL`
            (`oidc_unavailable`), the one failure here that cannot itself
            redirect anywhere.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/public/demo:
    get:
      operationId: publicDemoStatus
      tags: [Public]
      summary: Whether the public live-demo mint endpoint is available
      description: |
        Reports whether `POST /v1/public/demo/session` will serve a session right
        now. `enabled` is false on every build compiled without the `demo` build
        tag — the whole of the community, enterprise and customer builds — and on
        a `demo`-tagged build until `ASSAY_PUBLIC_DEMO` is set and every
        dependency the mint needs is wired.

        Mounted on every build regardless of `enabled`, tagged and untagged
        alike, so this path's presence in the served surface never depends on
        which build compiled it — only the value behind it does.
      security: []
      responses:
        '200':
          description: Whether a mint request would currently succeed.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicDemoStatus'
  /v1/public/demo/session:
    post:
      operationId: publicDemoSession
      tags: [Public]
      summary: Mint a short-lived, read-only session against the public demo tenant
      description: |
        The vendor's own public live-demo endpoint (a deliberate,
        narrowly-scoped hosted-SaaS exception, alongside HashWatch) — never present in a
        customer's own deployment behavior, since it does nothing unless this
        exact build was compiled with `-tags demo` and `ASSAY_PUBLIC_DEMO` is set.

        On first successful call, idempotently seeds a synthetic, RLS-isolated
        demo tenant with a small asset graph, a crown jewel, and pre-baked,
        signed evidence for a couple of already-proven reachability steps — no
        live technique ever runs. Every call after that mints a fresh token
        against the same synthetic data.

        The returned principal holds the read-only auditor role plus a demo
        marker role that a dedicated middleware uses to refuse every write for
        the life of the session, and the demo tenant carries no authorization
        grant at all, so the authorization choke-point's own default-deny
        independently refuses a dispatch attempt regardless. The token is short-
        lived (60 minutes) and cannot be renewed by any means other than calling
        this endpoint again.

        Rate-limited on the caller's source IP with its own small, dedicated
        budget, entirely separate from the per-tenant/per-principal API limiter.
      security: []
      responses:
        '200':
          description: A fresh demo session.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoginResponse'
        '404':
          description: >-
            The public demo is not available on this installation (`not_found`)
            — either this build carries no `demo`-tagged implementation, or
            `ASSAY_PUBLIC_DEMO` is unset.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The mint endpoint's own per-IP budget was exceeded (`rate_limited`).
            Retry after the interval named in the Retry-After header.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '500':
          description: >-
            The demo session could not be created (`demo_mint_failed`) — most
            likely a first-mint seed failure (e.g. the evidence signing key was
            unreachable).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/account:
    get:
      operationId: accountView
      tags: [Account]
      summary: Your own account profile
      description: |
        Your own email, roles, and MFA state — whether TOTP is enrolled and how
        many recovery codes remain. Never a password hash or a recovery-code
        hash; those never leave the server once set.

        Every authenticated role may read this. It answers only for the caller's
        own account: there is no way to name a different account here.
      responses:
        '200':
          description: Your account profile.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountProfile'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Your account could not be found (`account_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve accounts (`accounts_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/account/password:
    post:
      operationId: accountChangePassword
      tags: [Account]
      summary: Change your own password
      description: |
        Sets a new password for the caller's own account, after verifying the
        current one — the safeguard against a hijacked-but-not-fully-
        compromised session, since a bearer token alone is not enough to lock
        the real owner out. Requires no second factor beyond that: this must
        work for an account that has not enrolled MFA at all.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AccountChangePasswordRequest'
      responses:
        '204':
          description: The password was changed.
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The authenticated role may not reach this route (`forbidden`), or
            the current password given did not match (`wrong_password`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Your account could not be found (`account_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve accounts (`accounts_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/account/mfa/totp/enroll:
    post:
      operationId: mfaTOTPEnroll
      tags: [Account]
      summary: Start (or replace) enrolling a second factor
      description: |
        Generates a fresh TOTP secret and stores it, pending — `POST
        /v1/account/mfa/totp/confirm` is what proves the caller's
        authenticator app is actually synced before it takes effect and
        before any recovery code is minted. Returns the `otpauth://` URI
        and the raw base32 secret separately, since not every authenticator
        app supports URI import.

        A body is always required, even when empty (`{}`): `code` is read
        only when MFA is already enabled on the account, in which case a
        valid current one-time code is required before a new secret may be
        generated — enrolling a replacement is a "replace my second
        factor" operation, and a hijacked bearer token must not be able to
        do that unchallenged. A first-time enrollment (MFA not yet enabled)
        needs no code.

        Every authenticated role may call this for their own account.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MFACodeRequest'
      responses:
        '200':
          description: A pending enrollment was created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MFATOTPEnrollResponse'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The authenticated role may not reach this route (`forbidden`),
            or the current one-time code given did not match
            (`invalid_totp`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Your account could not be found (`account_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            too many wrong one-time codes were presented (`locked_out`).
            Retry after the interval named in the Retry-After header, where
            present.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            This installation cannot enroll or verify a second factor
            (`mfa_unavailable`) — no secrets backend is configured.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/account/mfa/totp/confirm:
    post:
      operationId: mfaTOTPConfirm
      tags: [Account]
      summary: Confirm a pending second-factor enrollment
      description: |
        Verifies a one-time code against the secret `POST
        /v1/account/mfa/totp/enroll` just wrote. On success, mints a fresh
        set of 10 recovery codes, stores their hashes, and enables MFA. The
        recovery codes are returned once, in the clear — they are never
        retrievable again; only regenerate mints a new set.

        Refused with no side effect if there is no pending enrollment to
        confirm (`no_pending_enrollment`) or if MFA is already enabled
        (`mfa_already_enabled`) — confirming an already-confirmed account
        again would silently replace its recovery codes.

        Every authenticated role may call this for their own account.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MFACodeRequest'
      responses:
        '200':
          description: MFA is now enabled; here are the recovery codes, once.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MFARecoveryCodesResponse'
        '400':
          description: There is no pending enrollment to confirm (`no_pending_enrollment`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The authenticated role may not reach this route (`forbidden`),
            or the one-time code given did not match (`invalid_totp`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Your account could not be found (`account_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: MFA is already enabled; there is nothing to confirm (`mfa_already_enabled`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            too many wrong one-time codes were presented (`locked_out`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            This installation cannot enroll or verify a second factor
            (`mfa_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/account/mfa/totp/disable:
    post:
      operationId: mfaTOTPDisable
      tags: [Account]
      summary: Disable your own second factor
      description: |
        Clears the stored TOTP secret, the enabled flag, and every
        recovery-code hash — together, in one call, the same as `cbctl
        assay user disable-totp`. A valid current one-time code is always
        required: this always acts on an already-enrolled account, so
        there is always a secret to check the code against.

        Every authenticated role may call this for their own account.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MFACodeRequest'
      responses:
        '204':
          description: MFA was disabled.
        '400':
          description: MFA is not enabled on this account (`mfa_not_enabled`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The authenticated role may not reach this route (`forbidden`),
            or the one-time code given did not match (`invalid_totp`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Your account could not be found (`account_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            too many wrong one-time codes were presented (`locked_out`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            This installation cannot enroll or verify a second factor
            (`mfa_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/account/mfa/recovery-codes/regenerate:
    post:
      operationId: mfaRecoveryCodesRegenerate
      tags: [Account]
      summary: Replace your own recovery codes
      description: |
        Mints a fresh set of 10 recovery codes, replacing whatever set the
        account had, without touching the TOTP secret itself. For a user
        who has used or lost some and wants a clean set. A valid current
        one-time code is always required: recovery codes are meaningless
        without MFA already enabled, so there is always a secret to check
        the code against.

        Every authenticated role may call this for their own account.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MFACodeRequest'
      responses:
        '200':
          description: Here are the new recovery codes, once.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MFARecoveryCodesResponse'
        '400':
          description: MFA is not enabled on this account (`mfa_not_enabled`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The authenticated role may not reach this route (`forbidden`),
            or the one-time code given did not match (`invalid_totp`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Your account could not be found (`account_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            too many wrong one-time codes were presented (`locked_out`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            This installation cannot enroll or verify a second factor
            (`mfa_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/account/webauthn/register/begin:
    post:
      operationId: webauthnRegisterBegin
      tags: [Account]
      summary: Start registering a WebAuthn security key
      description: |
        Starts a registration ceremony for the caller's own account: a
        hardware security key or a platform authenticator (Touch ID,
        Windows Hello) as an alternative way to prove the second factor at
        login — never a passwordless replacement for the password itself.
        Returns a ceremony id and the challenge to pass to the browser's
        `navigator.credentials.create()`.

        A body is always required, even when empty (`{}`): `code` is read
        only when the account already has TOTP enrolled, in which case a
        valid current one-time code is required before a new key may be
        registered — the same "replace/extend my second factor" reasoning
        `POST /v1/account/mfa/totp/enroll` already documents for itself. An
        account with a security key already registered but NO TOTP enrolled
        cannot satisfy this step-up in the current release and is refused
        with `totp_not_enrolled` rather than silently skipping the check;
        enroll TOTP first, or ask an operator for help. A first-time
        registration (no second factor enrolled at all yet) needs no code.

        Every authenticated role may call this for their own account.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MFACodeRequest'
      responses:
        '200':
          description: A fresh registration ceremony.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebAuthnRegisterBeginResponse'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The authenticated role may not reach this route (`forbidden`),
            or the current one-time code given did not match
            (`invalid_totp`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Your account could not be found (`account_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            A security key is already registered but TOTP is not enrolled,
            so there is no current code to prove step-up with
            (`totp_not_enrolled`) — see this operation's own description.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            too many wrong one-time codes were presented (`locked_out`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: This installation has not configured WebAuthn (`webauthn_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/account/webauthn/register/finish:
    post:
      operationId: webauthnRegisterFinish
      tags: [Account]
      summary: Complete registering a WebAuthn security key
      description: |
        Verifies the browser's attestation response against the ceremony
        `POST /v1/account/webauthn/register/begin` started, and stores the
        resulting credential under the given nickname. The ceremony is
        single-use: a replayed finish call is refused
        (`ceremony_not_found`), not silently re-verified.

        Every authenticated role may call this for their own account.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WebAuthnRegisterFinishRequest'
      responses:
        '200':
          description: The security key was registered.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebAuthnCredential'
        '400':
          description: >-
            The ceremony has expired or was already used
            (`ceremony_not_found`), or the security key's response could
            not be parsed (`malformed_credential`) or verified
            (`webauthn_verification_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: Your account could not be found (`account_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: That security key is already registered (`credential_already_registered`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation has not configured WebAuthn (`webauthn_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/account/webauthn/credentials:
    get:
      operationId: webauthnCredentialsList
      tags: [Account]
      summary: List your own registered security keys
      description: |
        The caller's own registered WebAuthn credentials: id, nickname,
        created_at, last_used_at. Never the public key or any other
        credential internal.

        Every authenticated role may call this for their own account.
      responses:
        '200':
          description: The caller's own security keys.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WebAuthnCredentialList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation has not configured WebAuthn (`webauthn_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/account/webauthn/credentials/{id}:
    delete:
      operationId: webauthnCredentialDelete
      tags: [Account]
      summary: Remove one of your own security keys
      description: |
        Removes one of the caller's own registered credentials, named by
        the base64url-encoded id `GET /v1/account/webauthn/credentials`
        returned. A valid current TOTP code is always required — this
        always acts on an account that has at least one credential to
        remove, mirroring `POST /v1/account/mfa/totp/disable`'s own
        unconditional step-up rule exactly, since removing a security key
        is equally sensitive. An account with a security key but no TOTP
        enrolled cannot satisfy this in the current release and is refused
        with `totp_not_enrolled` — the identical gap
        `POST /v1/account/webauthn/register/begin` documents for itself.

        Every authenticated role may call this for their own account; it
        can never reach another account's credential, even by guessing its
        id.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The base64url-encoded credential id.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MFACodeRequest'
      responses:
        '204':
          description: The security key was removed.
        '400':
          description: That is not a valid credential id (`invalid_credential_id`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The authenticated role may not reach this route (`forbidden`),
            or the one-time code given did not match (`invalid_totp`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such security key (`not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            TOTP is not enrolled, so there is no current code to prove
            step-up with (`totp_not_enrolled`) — see this operation's own
            description.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            too many wrong one-time codes were presented (`locked_out`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: This installation has not configured WebAuthn (`webauthn_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/users:
    get:
      operationId: listUsers
      tags: [User management]
      summary: List the caller's own tenant's accounts
      description: |
        Every local login account in the caller's own tenant, oldest first.
        Never a password hash, TOTP secret, or recovery-code hash — only
        `totp_enabled` reports MFA state, as a boolean.

        security-admin and global-admin only.
      responses:
        '200':
          description: The tenant's accounts.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAccountList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The accounts could not be listed (`list_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: This installation cannot serve accounts (`accounts_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      operationId: createUser
      tags: [User management]
      summary: Create a local login account
      description: |
        Adds a new account to the caller's own tenant. `roles` defaults to
        `["operator"]` when omitted; every role named must be one this
        installation recognizes (`demo` is never assignable — it is a
        marker the public live-demo endpoint alone ever sets).

        There is no password field: the server mints a fresh, random
        password and returns it once in `initial_password`, never again —
        this installation has no outbound email to deliver a credential
        over any other way. Relay it to the new user out of band; their
        first act should be `POST /v1/account/password`.

        Refused with `409 seat_cap_exceeded` once the tenant's active
        account count reaches its licensed seat count, and — when the new
        account holds an admin role — with `409 admin_cap_exceeded` once the
        tenant's active admin count reaches its licensed admin count. No
        license, or one that leaves a count unset, means no cap. Both caps
        fail open: a cap that cannot be resolved allows the create and is
        logged, never a refusal. `409 email_taken` if an account already
        exists for that email in this tenant.

        Granting `global-admin` requires the caller to hold `global-admin`;
        a caller without it is refused `403 insufficient_role_to_grant`.

        security-admin and global-admin only, and requires a second factor.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserRequest'
      responses:
        '201':
          description: The account was created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateUserResponse'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The caller may not perform this action, or is not a global-admin
            and tried to grant the `global-admin` role
            (`insufficient_role_to_grant`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The tenant is already at its licensed seat cap
            (`seat_cap_exceeded`) or admin cap (`admin_cap_exceeded`), or an
            account already exists for that email (`email_taken`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve accounts (`accounts_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/users/{id}:
    get:
      operationId: getUser
      tags: [User management]
      summary: Read one account in the caller's own tenant
      description: |
        404 if no such account exists in the caller's own tenant — including
        an id that belongs to a different tenant, which is reported
        identically to a nonexistent one rather than distinguished.

        security-admin and global-admin only.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The account.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAccount'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No such account in the caller's own tenant (`user_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The account could not be read (`lookup_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: This installation cannot serve accounts (`accounts_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/users/{id}/roles:
    post:
      operationId: updateUserRoles
      tags: [User management]
      summary: Replace an account's role set
      description: |
        The one field this surface lets an admin change on someone else's
        account: email, password, TOTP and recovery codes each have their
        own dedicated path (self-service, or their own CLI command) and are
        not reachable here.

        A caller may not change their own roles (`self_role_update_forbidden`).
        Setting the `global-admin` role requires the caller to hold
        `global-admin`; a caller without it is refused
        `403 insufficient_role_to_grant`, including when the account already
        holds the role.

        security-admin and global-admin only, and requires a second factor.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateUserRolesRequest'
      responses:
        '200':
          description: The account, with its roles updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAccount'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The caller may not change their own roles
            (`self_role_update_forbidden`), or is not a global-admin and tried
            to set the `global-admin` role (`insufficient_role_to_grant`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such account in the caller's own tenant (`user_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve accounts (`accounts_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/users/{id}/disable:
    post:
      operationId: disableUser
      tags: [User management]
      summary: Block an account from signing in
      description: |
        Sets the account's disabled state; a disabled account is refused at
        login (never mid-session — an already-issued token still expires on
        its own schedule). Reversible with the enable route below; nothing
        is deleted.

        Refused with `403 self_disable_forbidden` when the target is the
        caller's own account — unconditionally, not "unless another admin
        remains," so two admins cannot each count on the other as the
        safety net and disable each other in the same instant.

        security-admin and global-admin only, and requires a second factor.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The account, now disabled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAccount'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The authenticated role may not reach this route (`forbidden`),
            the action requires a second factor the credential does not
            carry (`mfa_required`), or the target is the caller's own
            account (`self_disable_forbidden`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No such account in the caller's own tenant (`user_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve accounts (`accounts_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/users/{id}/enable:
    post:
      operationId: enableUser
      tags: [User management]
      summary: Clear an account's disabled state
      description: |
        The disable route's other direction. Carries no self-service
        restriction: re-enabling your own account is never how an account
        locks itself out.

        security-admin and global-admin only, and requires a second factor.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The account, now enabled.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAccount'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No such account in the caller's own tenant (`user_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve accounts (`accounts_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/scim/tokens:
    get:
      operationId: listSCIMTokens
      tags: [SCIM provisioning]
      summary: List SCIM provisioning tokens
      description: |
        Every SCIM provisioning token in the caller's own tenant — active and
        revoked alike — oldest first. Never the secret or its argon2id hash.

        security-admin and global-admin only.
      responses:
        '200':
          description: The tenant's SCIM tokens.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SCIMTokenList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The tokens could not be listed (`list_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: This installation cannot manage SCIM tokens (`scim_tokens_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      operationId: createSCIMToken
      tags: [SCIM provisioning]
      summary: Mint a new SCIM provisioning token
      description: |
        Mints a bearer credential an identity provider (Okta, Azure AD, ...)
        presents to `/scim/v2/*` to provision accounts automatically. No
        request body: there is nothing to specify beyond who and when, both
        already known from the authenticated principal and the clock.

        The response's `secret` is readable exactly once, in the clear — only
        its argon2id hash is stored, so this is the only time it is ever
        readable again. Relay it to the identity provider's own SCIM app
        configuration out of band.

        security-admin and global-admin only, and requires a second factor.
      responses:
        '201':
          description: The token was minted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateSCIMTokenResponse'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The token could not be created (`generate_failed`, `create_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: This installation cannot manage SCIM tokens (`scim_tokens_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/scim/tokens/{id}/revoke:
    post:
      operationId: revokeSCIMToken
      tags: [SCIM provisioning]
      summary: Revoke a SCIM provisioning token
      description: |
        Withdraws one token — a hard revoke (`scim_token.revoke`), never a row
        delete, matching this product's own revoke-not-delete pattern for a
        grant or a license. An identity provider integration configured with
        a revoked token is refused at `/scim/v2/*` immediately, reported
        absent like an unknown token, not found-then-rejected.

        security-admin and global-admin only, and requires a second factor.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: The token was revoked.
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No such token in the caller's own tenant (`scim_token_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot manage SCIM tokens (`scim_tokens_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/grants:
    post:
      operationId: issueGrant
      tags: [Grants]
      summary: Issue or amend an engagement authorization
      description: |
        Issues a signed engagement authorization. Naming an existing `grant_id`
        amends that grant instead: an amendment is a new revision, and only the
        highest active revision authorizes anything.

        The tenant and the requester come from the authenticated principal. The
        body carries neither, so a request cannot claim to act for someone else.

        A grant allowing only `passive` and `active-safe` work is signed and
        active on return (201). A grant whose `allowed_classes` include
        `active-intrusive` is not signed. It is held as pending and answered 202
        with a digest that the approver must present, binding the approval to
        exactly those contents. An `approver_id` in the body only records who is
        expected to approve; it is never evidence of approval and never satisfies
        the two-person rule on its own.

        A standard installation has no built intrusive component and cannot issue
        an intrusive grant at all: it answers 409 `intrusive_unavailable`.

        A grant may only make the deployment blast-radius ceilings stricter. One
        that tries to widen them is refused with 422 `invalid_grant`.

        Requires the `operator` or `security-admin` role, and a second factor.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/IssueGrantRequest'
      responses:
        '201':
          description: The signed grant. It is active from `not_before`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Grant'
        '202':
          description: >-
            The grant allows active-intrusive work and is held for a second
            principal's approval. Nothing is signed and nothing is authorized
            until the approval lands.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PendingApproval'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The principal may not issue grants (`forbidden`), or the request
            carries no second factor (`mfa_required`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The grant asks for `active-intrusive` and this installation has no
            built, licensed intrusive component (`intrusive_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          description: >-
            A field failed validation (`validation_failed`), or the grant is not
            issuable as written (`invalid_grant`): an unknown safety class, an
            unparseable rate, an empty scope, or ceilings wider than the
            deployment allows.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The grant could not be issued (`issue_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          $ref: '#/components/responses/NoSigningKey'
    get:
      operationId: listGrants
      tags: [Grants]
      summary: List the tenant's active grants
      description: |
        Lists the active grants for the authenticated principal's tenant. The
        tenant comes from the credential, so there is no way to ask about another.

        The signature and the pinned public key are omitted. They are verification
        material rather than something a client needs, and publishing them invites
        a client to run its own verification and reach its own conclusion about
        what is authorized.

        Requires the `operator`, `approver`, `security-admin` or `auditor` role.
      responses:
        '200':
          description: The tenant's active grants.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GrantList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The principal's roles do not permit reading grants (`forbidden`).
            Reading needs no second factor, so a credential without one is not
            refused here.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The grants could not be read (`list_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/grants/{id}/approve:
    post:
      operationId: approveGrant
      tags: [Grants]
      summary: Approve a pending intrusive grant
      description: |
        Approves a grant that is being held for a second principal, and signs it.

        The approval is an authenticated act, not a string in someone else's
        request: it must come from a different principal than the requester, carry
        a second factor, and quote the `digest` returned when the grant was held.
        A digest that does not match the grant's current contents is refused with
        409, so an amended request needs a fresh approval.

        Requires the `approver` role.
      parameters:
        - $ref: '#/components/parameters/GrantID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApproveRequest'
      responses:
        '200':
          description: The grant, now signed and active.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Grant'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The principal may not approve, or is the requester approving their own
            grant (`forbidden`), or the request carries no second factor
            (`mfa_required`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: No grant is awaiting approval under that id (`not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The digest does not cover this grant's current contents
            (`digest_mismatch`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The grant could not be approved (`approve_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          $ref: '#/components/responses/NoSigningKey'
  /v1/grants/{id}/revoke:
    post:
      operationId: revokeGrant
      tags: [Grants]
      summary: Revoke an engagement authorization
      description: |
        Revokes every revision of a grant. The choke-point checks revocation on
        each authorization, so the next check against a target the grant covered
        refuses with reason `revoked`.

        The reason is recorded in the audit chain as evidence. Revocation is not
        reversible: resuming work means issuing a new grant, deliberately.

        Requires the `operator` or `security-admin` role, and a second factor.
      parameters:
        - $ref: '#/components/parameters/GrantID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RevokeRequest'
      responses:
        '204':
          description: The grant is revoked. No body.
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The principal may not revoke this grant (`forbidden`), or the request
            carries no second factor (`mfa_required`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The grant could not be revoked (`revoke_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          $ref: '#/components/responses/NoSigningKey'
  /v1/authorize:
    post:
      operationId: authorize
      tags: [Authorization]
      summary: Ask whether an action would be permitted
      description: |
        Runs a target and safety class through the authorization choke-point and
        returns the decision.

        A refusal is a normal outcome, not an error. The response is 200 with
        `allowed` false and a `reason` naming the step that refused: no grant, the
        kill-switch, revocation, the time window, supersession, scope, an excluded
        target, or a safety class the grant does not allow. Default-deny means
        anything the choke-point cannot positively authorize is refused, and the
        decision is recorded in the audit chain either way.

        The decision is all that is returned. A clearance, the in-process
        permission to act now, is deliberately never serialized: a clearance that
        could travel over the wire would be a bearer token for touching a
        customer's systems. This endpoint releases the clearance it mints
        immediately, because nothing here dispatches.

        Set exactly one of `target` or `asset_id`. An unrecognized class is not an
        input error: it goes through the choke-point and is refused with reason
        `unknown_class`, so the attempt is on the audit record.

        Requires the `operator` or `security-admin` role.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AuthorizeRequest'
      responses:
        '200':
          description: >-
            The decision. Check `allowed`; a false value with a `reason` is a
            complete, successful answer.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Decision'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: >-
            The choke-point could not complete the check, because the grant store
            or the audit chain was unavailable. The body is the same decision
            shape, refusing, with reason `authorization_unavailable` or
            `audit_unavailable`. An unaudited allow is worse than a false deny, so
            a failed audit write flips an allow to a refusal.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Decision'
  /v1/kill:
    post:
      operationId: engageKillSwitch
      tags: [Kill switch]
      summary: Engage the kill-switch
      description: |
        Halts validation for the tenant and withdraws authorization already handed
        out: it sets the stored kill state, revokes every active grant, and retires
        every clearance the choke-point has minted. Later authorization checks
        refuse with reason `kill_switch_engaged`.

        The brake is not a paid feature and cannot be turned off by policy. Anyone
        who can reach this endpoint with the `operator`, `approver` or
        `security-admin` role can engage it; only a `security-admin` can release
        it. A second factor is required.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KillRequest'
      responses:
        '200':
          description: The kill-switch is engaged.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KillState'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The kill-switch could not be engaged (`kill_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/kill/release:
    post:
      operationId: releaseKillSwitch
      tags: [Kill switch]
      summary: Release the kill-switch
      description: |
        Lifts the kill-switch. It restores nothing: grants revoked by an engage stay
        revoked and are re-issued deliberately, because resuming work must be an
        explicit act rather than an undo.

        Requires the `security-admin` role and a second factor.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/KillRequest'
      responses:
        '200':
          description: The kill-switch is released.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KillState'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The kill-switch could not be released (`release_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/license/generator:
    get:
      operationId: licenseGeneratorInfo
      tags: [Licensing]
      summary: License-generator capability probe
      description: |
        Reports whether this instance can issue licenses (it holds the vendor's
        private signing key), the public half of that key (to confirm it matches
        the pinned verification key), and the tiers and default feature presets
        the generator offers. `available` is false on every customer install —
        only the vendor's own instance ever holds the private key.

        Requires the `global-admin` role and a second factor.
      responses:
        '200':
          description: The generator's capability and presets.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LicenseGeneratorInfo'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/LicenseGeneratorUnavailable'
  /v1/admin/license/generate:
    post:
      operationId: generateLicense
      tags: [Licensing]
      summary: Mint a signed customer license
      description: |
        Signs an offline, Ed25519-verifiable license for a customer and returns
        it as a downloadable JSON file. Every issuance is audited before the
        file is returned — an issuance this instance failed to record is
        refused rather than handed out unaudited — and best-effort recorded in
        the issued-license registry `GET /v1/admin/licenses` reads.

        Refused with `503 generator_unavailable` on every instance but the
        vendor's own. Requires the `global-admin` role and a second factor.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LicenseGenerateRequest'
      responses:
        '200':
          description: The signed license, as a downloadable JSON file.
          content:
            application/json:
              schema:
                type: object
                description: A signed entitlement.License document.
                additionalProperties: true
        '400':
          $ref: '#/components/responses/ValidationFailed'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/LicenseGeneratorUnavailable'
  /v1/admin/licenses:
    get:
      operationId: listIssuedLicenses
      tags: [Licensing]
      summary: The vendor's overview of every license it has issued
      description: |
        Lists every license this instance has minted, each with its lifecycle
        state — `active`, `grace`, or `expired` — derived from the issued-
        license registry and the post-expiry grace window. The "who has
        lapsed" view: most-in-need-of-attention state first.

        Meaningful only on the vendor's own instance; a customer install has
        issued nothing, so this reports an empty list rather than an error.
        Requires the `global-admin` role and a second factor.
      responses:
        '200':
          description: Every license this instance has issued.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IssuedLicenseList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The issued-license registry could not be read (`list_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/licenses/{id}/revoke:
    post:
      operationId: revokeLicense
      tags: [Licensing]
      summary: Mark an issued license withdrawn in the vendor's own record
      description: |
        Sets `revoked_at` on the named license in this instance's issued-
        license registry and audits the act. This updates only the vendor's
        own bookkeeping: `entitlement.License`'s signed payload deliberately
        excludes `revoked_at`, so a customer's own self-hosted licensing
        service could serve a freshly-revoked copy without re-signing it, but
        delivering that to a specific install is the customer's own
        operational choice — a fully air-gapped install will not see this
        until it is handed a fresh license file, and its real backstop is the
        license's own bounded expiry.

        404 (`license_not_found`) if this instance never issued a license
        with that id. Refused with `503 generator_unavailable` on every
        instance but the vendor's own. Requires the `global-admin` role and a
        second factor.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The license's updated lifecycle view.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IssuedLicense'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No license with that id has been issued by this instance (`license_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The license could not be updated (`revoke_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          $ref: '#/components/responses/LicenseGeneratorUnavailable'
  /v1/admin/licenses/{id}/reinstate:
    post:
      operationId: reinstateLicense
      tags: [Licensing]
      summary: Clear a license's revoked mark in the vendor's own record
      description: |
        The other direction of `revokeLicense`: clears `revoked_at` on the
        named license, for a revocation issued in error or a dispute resolved
        in the customer's favor. Same delivery caveat as revocation — this
        changes only what this instance's admin overview reports.

        404 (`license_not_found`) if this instance never issued a license
        with that id. Refused with `503 generator_unavailable` on every
        instance but the vendor's own. Requires the `global-admin` role and a
        second factor.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The license's updated lifecycle view.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/IssuedLicense'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No license with that id has been issued by this instance (`license_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The license could not be updated (`reinstate_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          $ref: '#/components/responses/LicenseGeneratorUnavailable'
  /v1/activation/checkin:
    post:
      operationId: licenseCheckIn
      tags: [Licensing]
      summary: Receive a license check-in (vendor side)
      description: |
        The vendor's own side of license activation: the endpoint a customer's
        installation calls to learn whether its license has been withdrawn and to
        collect a renewal. It is the counterpart to `POST
        /v1/admin/activation/check`, which is the same exchange seen from the
        install that initiates it.

        **Authentication is the signed license itself.** The caller holds no
        credential on this instance and must never be issued one, so the request
        carries the signed license blob and its Ed25519 signature is verified
        against the issuing key before anything is read or written. The check is
        the SIGNATURE only, deliberately not the license's validity window: a
        revoked license must be able to check in (or the revocation could never be
        delivered) and an expired one must too (a renewal is what it is calling
        for).

        **The request carries license state only** -- license id, an opaque
        per-install id, product, build version, the signed blob, a nonce -- and
        never a finding, an asset, an engagement or a scan result.

        Answers 200 with the verdict, including when the verdict is that the
        license is revoked: a non-2xx makes the calling client discard the answer,
        so a revocation delivered as an error is a revocation not delivered. 401 is
        a caller presenting a license this instance did not issue, and says nothing
        about whether the id exists. 404 is a license this instance has no record
        of issuing, which is not a verdict. 503 is an installation that is not a
        licensing server -- every customer install, which mounts this route and
        refuses it.

        Rate-limited on the caller's source IP with its own small, dedicated
        budget, separate from both the per-tenant API limiter and the demo mint's.
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LicenseCheckInRequest'
      responses:
        '200':
          description: The vendor's verdict for the license checked in.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LicenseCheckInResponse'
        '400':
          description: >-
            The body is malformed, or the presented license names a different
            license than the request checks in for (`license_mismatch`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: >-
            The check-in presented no license this installation issued
            (`license_unauthenticated`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: >-
            This installation has no record of issuing that license
            (`license_unknown`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            This installation does not serve license check-ins
            (`activation_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/activation:
    get:
      operationId: getActivationStatus
      tags: [Licensing]
      summary: The license check-in state of this installation
      description: |
        Reports whether this installation checks in with the vendor's licensing
        endpoint, and how that is going. Advisory throughout: nothing here gates a
        feature or a guardrail.

        An installation with no endpoint configured answers 200 with
        `configured: false`, not an error. Running offline is a supported posture,
        not a failure, and a console that received an error for it could not tell
        "switched off" from "broken" -- which is the distinction this surface
        exists to make legible. Requires the security-admin or global-admin role.
      responses:
        '200':
          description: The current check-in state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivationStatus'
        '401': { $ref: '#/components/responses/Unauthenticated' }
        '403': { $ref: '#/components/responses/Forbidden' }
  /v1/admin/activation/check:
    post:
      operationId: checkInNow
      tags: [Licensing]
      summary: Check in with the licensing endpoint now
      description: |
        Runs one check-in immediately rather than waiting for the periodic one, and
        applies whatever the vendor has decided. The revocation verdict rides any
        successful check-in, on-demand included, so the cadence never decides
        whether a revocation is honored -- only how stale the worst case is. Use it
        after a license is reinstated, or to confirm enforcement has landed.

        It changes nothing about this installation on its own: it asks what the
        vendor has decided and applies that answer, and it cannot invent a
        revocation.

        A FAILED check-in still answers 200 with the resulting state. An
        unreachable vendor is a fact about reachability, reported in `last_failure`
        as a stable token, not a server error -- returning 5xx would make an
        unreachable vendor look like a broken installation, which is the opposite
        of the fail-open posture the whole path is built on. 503 means only that no
        endpoint is configured, so there is nothing to check in with.
        Requires the security-admin or global-admin role.
      responses:
        '200':
          description: The state after the attempt, whether or not it succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ActivationStatus'
        '401': { $ref: '#/components/responses/Unauthenticated' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '503':
          description: No check-in endpoint is configured (`activation_offline`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/license:
    get:
      operationId: getCurrentLicense
      tags: [Licensing]
      summary: This installation's own currently-running license
      description: |
        Reports the license THIS installation is currently running under —
        the caller's own tenant's license, decoded once at boot from
        `ASSAY_LICENSE_FILE` — and its local revocation state, if any. The
        opposite direction from `GET /v1/admin/licenses`, which is the
        vendor's own list of licenses it has issued to others.

        404 (`no_license_configured`), not 200 with null fields, when no
        license file is configured at all: a fresh Community install has no
        current license to report on. Requires the `global-admin` role.
      responses:
        '200':
          description: The current license and its revocation state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CurrentLicense'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NoCurrentLicense'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The revocation state could not be read (`lookup_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/license/revoke:
    post:
      operationId: revokeCurrentLicense
      tags: [Licensing]
      summary: Immediately revoke this installation's own license
      description: |
        An operator's own local kill-switch on the license THIS installation
        is currently running under — the opposite direction from
        `POST /v1/admin/licenses/{id}/revoke`, which is the vendor withdrawing
        a license it issued to someone else. Unlike waiting for
        `valid_until` to lapse, this takes effect immediately: every
        subsequent entitlement check for this tenant degrades to the
        community tier.

        Acts on the caller's own tenant and this installation's boot-time-
        loaded license id; there is no actor-precedence gate on this
        direction, so a local operator can always impose a revocation, even
        over one a live licensing service last reported.

        404 (`no_license_configured`) when no license file is configured.
        Requires the `global-admin` role and a second factor.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LicenseRevokeRequest'
      responses:
        '200':
          description: The current license, now revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CurrentLicense'
        '400':
          $ref: '#/components/responses/ValidationFailed'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NoCurrentLicense'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The license could not be revoked (`revoke_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          $ref: '#/components/responses/LicenseRevocationUnavailable'
  /v1/admin/license/unrevoke:
    post:
      operationId: unrevokeCurrentLicense
      tags: [Licensing]
      summary: Lift a local revocation on this installation's own license
      description: |
        The other direction of `revokeCurrentLicense`: clears a LOCAL
        revocation. Same target resolution (caller's own tenant, boot-loaded
        license id).

        409 (`revoked_by_vendor`), not 500, when a DIFFERENT actor —
        in practice a vendor-imposed cloud-sync revocation, cached durably
        from a live licensing service — currently holds the revocation: a
        local operator's own unrevoke can never clear that by design.

        404 (`no_license_configured`) when no license file is configured.
        Requires the `global-admin` role and a second factor.
      responses:
        '200':
          description: The current license, no longer locally revoked.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CurrentLicense'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NoCurrentLicense'
        '409':
          description: >-
            This license was revoked by the vendor; contact them to have it
            reinstated (`revoked_by_vendor`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          description: The revocation could not be cleared (`unrevoke_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          $ref: '#/components/responses/LicenseRevocationUnavailable'
  /v1/events:
    post:
      operationId: ingestEvents
      tags: [Events]
      summary: Ingest a batch of suite events
      description: |
        Consumes a batch of event envelopes from another product in the suite and
        applies the discovery in them to the exposure graph. The envelope is the
        shared contract shape; fetch its authoritative JSON Schema from the
        contract schema endpoint under the name `Envelope`.

        Delivery between products is at-least-once, so ingestion is idempotent.
        Every applied `event_id` is recorded, and a redelivery is reported as a
        duplicate rather than applied twice or failed.

        The tenant comes from the authenticated credential and from nowhere else.
        An envelope whose `tenant_ref` is a different tenant is rejected with reason
        `tenant_mismatch`; it is never remapped to the caller's tenant, because a
        silent remap turns a producer's bug into cross-tenant contamination that
        nothing in the record shows.

        Ingestion is default-deny in a second way: the calling credential must also
        hold a grant for the tenant and the stream it is posting. An unmapped peer,
        tenant or stream is rejected with reason `peer_not_permitted`, and an
        installation with no grants configured accepts nothing.

        Each envelope is judged on its own. A failure that a retry cannot fix is
        listed in `rejected` with its index and must not be sent again; a failure
        that a retry could fix is listed in `deferred`, and the producer re-sends
        only those events. A batch carrying a deferred event answers 200, so a
        passing storage failure is never mistaken for a permanent refusal.

        Requires the `operator` role. Served by the asset service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EventBatch'
      responses:
        '200':
          description: >-
            The batch was processed and at least one event was accepted, recognized
            as a duplicate, or deferred. Individually refused envelopes are listed
            in `rejected` with their index; ones to send again are listed in
            `deferred`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Ack'
        '400':
          description: >-
            The batch is empty (`empty_batch`) or the body could not be parsed
            (`malformed_json`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The principal may not ingest events (`forbidden`), the credential does
            not carry a second factor the principal's roles require
            (`mfa_required`), or the credential is not scoped to a tenant so no
            event can be attributed (`no_tenant`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '413':
          description: The batch carries more than 500 events (`batch_too_large`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          description: >-
            Nothing landed and nothing will. Either every envelope was rejected, in
            which case the body is the acknowledgement carrying the per-index
            reasons, or the batch failed contract validation in a way this build
            could not attribute to an envelope (`invalid_batch`), which fails
            closed. A batch with even one deferred event answers 200 instead.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/Ack'
                  - $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
  /v1/assets:
    get:
      operationId: listAssets
      tags: [Exposure graph]
      summary: List the assets this tenant holds
      description: |
        Returns the exposure graph's assets, most recently seen first, each with
        the source that asserted it. A graph that cannot say who claimed
        something cannot be argued with, and an engagement report is an argument.

        The page is bounded and the applied `limit` is echoed back, so a caller
        can tell a short page from an exhausted one without guessing which cap
        was in force.

        Requires the `operator`, `security-admin` or `auditor` role. Served by
        the asset service.
      parameters:
        - $ref: '#/components/parameters/AssetLimit'
      responses:
        '200':
          description: The assets held for this tenant.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssetList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/GraphUnavailable'
    post:
      operationId: upsertAssets
      tags: [Exposure graph]
      summary: Record assets an operator supplied
      description: |
        Adds assets to the graph from an operator's own inventory, attributed to
        the `operator` source. The submission carries assets and nothing else: no
        relationships, and no proof. A person can say a host exists, and the
        graph records who said so; whether an attacker can reach it is settled by
        running a technique under a signed authorization, never by typing it in.

        Each value is canonicalized on the way in, so an operator writing
        `EXAMPLE.com.` and a scanner reporting `example.com` land on one asset
        rather than two. An item that will not canonicalize is refused with its
        index and a reason rather than dropped, so the line that was typed wrong
        can be found. A submission where nothing landed answers 422 with the same
        body, so a client reading only the status does not mistake a wholly
        refused list for success.

        Requires the `operator` or `security-admin` role. Served by the asset
        service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InventoryRequest'
      responses:
        '200':
          description: At least one asset was stored. Refused items are listed with their index.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InventoryResult'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '413':
          description: The submission carries more than 500 assets (`batch_too_large`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          description: >-
            Nothing was stored. Either the list was empty or malformed
            (`validation_failed`), or every item was refused, in which case the
            body is the result carrying the per-index reasons.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/InventoryResult'
                  - $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/GraphUnavailable'
  /v1/assets/{key}:
    get:
      operationId: getAsset
      tags: [Exposure graph]
      summary: One asset and the relationships discovery asserted from it
      description: |
        Returns the asset stored under a canonical key, together with the
        discovered edges leaving it.

        Those edges describe structure, not reachability: an FQDN resolves to an
        address, a service is affected by a CVE. Anyone can assert one. Whether
        an attacker can traverse a relationship is a separate claim, answered by
        the reachability endpoint from proven steps. The two are stored apart and
        returned apart so a discovery assertion is never read as evidence.

        Requires the `operator`, `security-admin` or `auditor` role. Served by
        the asset service.
      parameters:
        - $ref: '#/components/parameters/AssetKey'
      responses:
        '200':
          description: The asset and its discovered edges.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssetDetail'
        '400':
          description: The key is not valid percent-encoded text, or is empty (`invalid_key`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '404':
          $ref: '#/components/responses/AssetNotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/GraphUnavailable'
  /v1/assets/{key}/reachability:
    get:
      operationId: getAssetReachability
      tags: [Exposure graph]
      summary: Proven paths from this asset to a crown jewel
      description: |
        Returns the chains of proven steps that lead from this asset to an asset
        an operator has declared a crown jewel. It walks proven steps, never
        discovered edges: a step records that a path was demonstrated under a
        signed authorization, and carries the technique that ran, the evidence
        bundle it produced and the grant revision that allowed it, so a reader
        who doubts a chain can check every hop of it. A superseded step is
        excluded, because a path a remediation closed is not an exposure.

        Shorter chains come first. A crown jewel ends a path rather than
        continuing through it, and an asset is never revisited within one path.

        Two fields decide how the answer should be read. `truncated` says a bound
        was hit and the search is incomplete; a capped result that presented
        itself as exhaustive would turn "no path to your crown jewels" into a
        claim nobody checked. `crown_jewels` says how many targets the answer was
        measured against: with none declared, an empty path list means nobody has
        said what matters yet, not that nothing is reachable.

        An unknown key answers 404 rather than an empty list, so a mistyped key
        cannot read as an all-clear.

        Requires the `operator`, `security-admin` or `auditor` role. Served by
        the asset service.
      parameters:
        - $ref: '#/components/parameters/AssetKey'
        - name: max_depth
          in: query
          required: false
          description: >-
            Longest chain to report, in hops. Defaults to 8, capped at 32. Beyond
            a handful of hops a chain stops being something a remediation team
            can act on.
          schema:
            type: integer
            minimum: 1
            maximum: 32
            default: 8
        - name: max_paths
          in: query
          required: false
          description: Most distinct paths to return. Defaults to 100, capped at 1000.
          schema:
            type: integer
            minimum: 1
            maximum: 1000
            default: 100
      responses:
        '200':
          description: >-
            The proven chains found, and whether the search was complete. An empty
            list with `truncated` false means no proven chain exists among the
            steps and crown jewels this tenant holds.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Reachability'
        '400':
          description: The key is not valid percent-encoded text, or is empty (`invalid_key`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '404':
          $ref: '#/components/responses/AssetNotFound'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/GraphUnavailable'
  /v1/crown-jewels:
    get:
      operationId: listCrownJewels
      tags: [Crown jewels]
      summary: The assets this engagement is about
      description: |
        Lists the assets an operator has declared critical, highest criticality
        first. Nothing infers this list. Which systems matter is a business
        judgement, and a product that guessed would rank the wrong things
        confidently.

        Requires the `operator`, `security-admin` or `auditor` role. Served by
        the asset service.
      responses:
        '200':
          description: The crown jewels declared for this tenant.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CrownJewelList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/GraphUnavailable'
  /v1/crown-jewels/{key}:
    put:
      operationId: setCrownJewel
      tags: [Crown jewels]
      summary: Declare an asset a crown jewel
      description: |
        Records that an asset is what the engagement is ultimately about. It is
        an audited operator action: what is declared here decides what the
        product ranks first, so the change is written to the hash-chained audit
        log before the call returns. An auditor asking why one finding outranked
        another can then see when the target was declared and by whom. If the
        audit log cannot be written the call answers 503, and the change may
        already have landed, so re-apply it once the log is reachable.

        The asset must already be in the graph. A crown jewel naming a key
        nothing holds can never be the end of a path, so a typo would make the
        prioritizer rank against a target that is unreachable by construction and
        report the engagement clean.

        The actor and the timestamp come from the credential and the clock; a
        body cannot claim either. Requires the `operator` or `security-admin`
        role, and a second factor for a security admin. Served by the asset
        service.
      parameters:
        - $ref: '#/components/parameters/AssetKey'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CrownJewelRequest'
      responses:
        '200':
          description: The crown jewel as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CrownJewel'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '404':
          description: >-
            No asset is held under that key (`not_found`). Add it to the
            inventory first.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: >-
            The graph could not be reached (`graph_unavailable` or
            `no_asset_store`), or the change could not be written to the audit
            log (`audit_unavailable`). An unrecorded change to what the product
            prioritizes is not accepted silently.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: clearCrownJewel
      tags: [Crown jewels]
      summary: Withdraw a crown-jewel declaration
      description: |
        Removes the assertion that an asset is critical. Audited for the same
        reason setting one is: it changes what the product ranks first, and the
        chain has to carry when a target stopped being one.

        Clearing is a separate action from setting, so an operator's correction
        and a deliberate withdrawal are distinguishable in the audit chain and in
        policy. Requires the `operator` or `security-admin` role, and a second
        factor for a security admin. Served by the asset service.
      parameters:
        - $ref: '#/components/parameters/AssetKey'
      responses:
        '204':
          description: The declaration was withdrawn.
        '400':
          description: The key is not valid percent-encoded text, or is empty (`invalid_key`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '404':
          description: No crown jewel is set on that asset (`not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: >-
            The graph could not be reached (`graph_unavailable` or
            `no_asset_store`), or the change could not be written to the audit
            log (`audit_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/sso/saml:
    get:
      operationId: getSAMLSettings
      tags: [Admin]
      summary: This organization's SAML single sign-on configuration
      description: |
        Returns the stored SAML provider configuration, or `configured: false` when
        there is none. The service-provider private key is never included in any
        form: the response carries only the public certificate.
        Requires the security-admin role.
      responses:
        '200':
          description: The configuration, or that there is none.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SAMLSettingsResponse' }
        '401': { $ref: '#/components/responses/Unauthenticated' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '503':
          description: This installation is not configured for SAML (`saml_unavailable`).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
    put:
      operationId: saveSAMLSettings
      tags: [Admin]
      summary: Configure SAML single sign-on for this organization
      description: |
        Stores the identity provider's trust material and mints this deployment's own
        service-provider key pair the first time one is needed, sealing the private
        half through the secrets backend. Re-saving keeps the existing key pair:
        rotating it silently would invalidate the registration with the provider and
        break every sign-in until somebody noticed.

        Either the provider's metadata document, or its sign-on URL together with its
        signing certificate, must be supplied. A configuration with no certificate is
        refused rather than stored: there would be nothing to verify an assertion
        against.

        The organization is always the caller's own and is never read from the body.
        Requires the security-admin role.
      requestBody:
        required: true
        content:
          application/json:
            schema: { $ref: '#/components/schemas/SAMLSettings' }
      responses:
        '200':
          description: The stored configuration.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SAMLSettingsResponse' }
        '400':
          description: The configuration is unusable (`saml_invalid`).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
        '401': { $ref: '#/components/responses/Unauthenticated' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '503':
          description: This installation is not configured for SAML (`saml_unavailable`).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
    delete:
      operationId: deleteSAMLSettings
      tags: [Admin]
      summary: Clear this organization's SAML configuration
      description: |
        Removes the configuration outright, including the service-provider key pair.
        Re-enabling afterwards mints a fresh key pair, so the provider has to be
        re-registered. Local password sign-in is unaffected.
        Requires the security-admin role.
      responses:
        '200':
          description: The configuration is cleared.
          content:
            application/json:
              schema: { $ref: '#/components/schemas/SAMLSettingsResponse' }
        '401': { $ref: '#/components/responses/Unauthenticated' }
        '403': { $ref: '#/components/responses/Forbidden' }
        '503':
          description: This installation is not configured for SAML (`saml_unavailable`).
          content:
            application/json:
              schema: { $ref: '#/components/schemas/Error' }
  /v1/admin/sso/oidc:
    get:
      operationId: oidcView
      tags: [SSO]
      summary: This tenant's Layer A OIDC provider configuration
      description: |
        Whether an external OIDC provider is configured and enabled, its
        issuer and client id, and whether a client secret is stored — never
        the secret itself. `operator`, `security-admin` and `auditor` may
        all read this; only a `security-admin` may change it. One provider
        per tenant — an operator integrates with THEIR ONE IdP, not several.
        Served by the authz service.
      responses:
        '200':
          description: The provider's configuration (or not_configured if none is stored).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OIDCProviderSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve OIDC single sign-on (`oidc_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: oidcSave
      tags: [SSO]
      summary: Configure or replace this tenant's Layer A OIDC provider
      description: |
        `client_secret` is write-only and never returned by GET; an empty
        value on this call clears any previously stored secret outright —
        there is no partial update, since a secret this service never
        decrypts to compare cannot be silently left alone without the
        caller re-confirming they mean to. An empty secret is a legitimate,
        supported posture too — a public, PKCE-only OAuth client. Requires
        the `security-admin` role and a second factor — storing a
        third-party identity provider's client credentials is a more
        sensitive act than most writes in this API. Served by the authz
        service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OIDCProviderSaveRequest'
      responses:
        '200':
          description: The provider's configuration as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OIDCProviderSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve OIDC single sign-on (`oidc_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: oidcDelete
      tags: [SSO]
      summary: Clear this tenant's Layer A OIDC provider
      description: |
        Deletes the stored provider configuration outright — not a disable
        flag. Requires the `security-admin` role and a second factor.
        Served by the authz service.
      responses:
        '204':
          description: The provider's configuration was cleared (idempotent — also 204 if none was configured).
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve OIDC single sign-on (`oidc_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/tenable:
    get:
      operationId: tenableView
      tags: [Connectors]
      summary: This tenant's Tenable connector configuration
      description: |
        Whether a Tenable.io connector is configured and enabled, and its base
        URL — never the access or secret key. `operator`, `security-admin` and
        `auditor` may all read this; only a `security-admin` may change it.
        Served by the asset service.
      responses:
        '200':
          description: The connector's configuration (or not_configured if none is stored).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TenableSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Tenable connector (`tenable_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: tenableSave
      tags: [Connectors]
      summary: Configure or replace this tenant's Tenable connector
      description: |
        Both the access key and the secret key are always required, even when
        only the base URL or the enabled flag is changing: credentials are
        write-only and never returned by GET, so there is no value to leave
        implicitly unchanged. Requires the `security-admin` role and a second
        factor — storing a live third-party API credential is a more
        sensitive act than most writes in this API. Served by the asset
        service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TenableSaveRequest'
      responses:
        '200':
          description: The connector's configuration as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TenableSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Tenable connector (`tenable_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: tenableDelete
      tags: [Connectors]
      summary: Clear this tenant's Tenable connector
      description: |
        Deletes the stored credentials outright — not a disable flag. Requires
        the `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '204':
          description: The connector's configuration was cleared (idempotent — also 204 if none was configured).
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Tenable connector (`tenable_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/tenable/test:
    post:
      operationId: tenableTest
      tags: [Connectors]
      summary: Test this tenant's stored Tenable credentials
      description: |
        Resolves the stored credentials and makes a real call to Tenable's own
        API (listing scans) — proving the keys actually work, not just that
        something is stored. Never echoes the credentials or the raw scan
        list, only a count. Requires the `security-admin` role and a second
        factor. Served by the asset service.
      responses:
        '200':
          description: The credentials verified; scan_count is how many scans Tenable returned.
          content:
            application/json:
              schema:
                type: object
                required: [ok, scan_count]
                properties:
                  ok:
                    type: boolean
                  scan_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Tenable rejected the stored access and secret key (`tenable_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            Tenable itself rate-limited this request (`tenable_rate_limited`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Tenable could not be reached (`tenable_unreachable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: No Tenable connector is configured for this tenant, or this installation cannot serve one (`tenable_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/tenable/sync:
    post:
      operationId: tenableSync
      tags: [Connectors]
      summary: Pull this tenant's current Tenable vulnerabilities
      description: |
        Resolves the stored credentials and pulls the tenant's current
        vulnerability data via Tenable's own Vulnerability Export API,
        recording it as scanner-observed assets and findings in Assay's own
        graph — never as proof; a finding is a vendor's claim, checked only
        by the engine actually running a technique under a grant. Requires
        the `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '200':
          description: The sync completed; finding_count is how many open findings this pull recorded.
          content:
            application/json:
              schema:
                type: object
                required: [ok, finding_count]
                properties:
                  ok:
                    type: boolean
                  finding_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          description: A Tenable vulnerability export is already running for this account (`tenable_export_in_progress`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: Tenable rejected the stored access and secret key (`tenable_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            Tenable itself rate-limited this request (`tenable_rate_limited`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Could not reach Tenable to pull vulnerability data (`tenable_sync_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            No Tenable connector is configured for this tenant
            (`tenable_unavailable`), this installation has not been wired to
            pull scanner data (`tenable_sync_unavailable`), or this
            installation cannot serve the connector at all
            (`tenable_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/qualys:
    get:
      operationId: qualysView
      tags: [Connectors]
      summary: This tenant's Qualys connector configuration
      description: |
        Whether a Qualys VMDR connector is configured and enabled, and its
        base URL — never the username or password. `operator`, `security-admin`
        and `auditor` may all read this; only a `security-admin` may change
        it. Served by the asset service.
      responses:
        '200':
          description: The connector's configuration (or not_configured if none is stored).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QualysSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Qualys connector (`qualys_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: qualysSave
      tags: [Connectors]
      summary: Configure or replace this tenant's Qualys connector
      description: |
        Both the username and the password are always required, even when
        only the base URL or the enabled flag is changing: credentials are
        write-only and never returned by GET, so there is no value to leave
        implicitly unchanged. Requires the `security-admin` role and a second
        factor — storing a live third-party account credential is a more
        sensitive act than most writes in this API. Served by the asset
        service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QualysSaveRequest'
      responses:
        '200':
          description: The connector's configuration as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QualysSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Qualys connector (`qualys_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: qualysDelete
      tags: [Connectors]
      summary: Clear this tenant's Qualys connector
      description: |
        Deletes the stored credentials outright — not a disable flag. Requires
        the `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '204':
          description: The connector's configuration was cleared (idempotent — also 204 if none was configured).
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Qualys connector (`qualys_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/qualys/test:
    post:
      operationId: qualysTest
      tags: [Connectors]
      summary: Test this tenant's stored Qualys credentials
      description: |
        Resolves the stored credentials and makes a real call to Qualys's own
        API (listing scans) — proving the credentials actually work, not just
        that something is stored. Never echoes the credentials or the raw
        scan list, only a count. Requires the `security-admin` role and a
        second factor. Served by the asset service.
      responses:
        '200':
          description: The credentials verified; scan_count is how many scans Qualys returned.
          content:
            application/json:
              schema:
                type: object
                required: [ok, scan_count]
                properties:
                  ok:
                    type: boolean
                  scan_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Qualys rejected the stored username and password (`qualys_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            Qualys itself rate-limited this request (`qualys_rate_limited`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Qualys could not be reached (`qualys_unreachable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: No Qualys connector is configured for this tenant, or this installation cannot serve one (`qualys_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/qualys/sync:
    post:
      operationId: qualysSync
      tags: [Connectors]
      summary: Pull this tenant's current Qualys vulnerability detections
      description: |
        Resolves the stored credentials and pulls the tenant's current
        vulnerability data via Qualys's own Host List Detection and
        KnowledgeBase APIs, recording it as scanner-observed assets and
        findings in Assay's own graph — never as proof; a finding is a
        vendor's claim, checked only by the engine actually running a
        technique under a grant. Requires the `security-admin` role and a
        second factor. Served by the asset service.
      responses:
        '200':
          description: The sync completed; finding_count is how many open findings this pull recorded.
          content:
            application/json:
              schema:
                type: object
                required: [ok, finding_count]
                properties:
                  ok:
                    type: boolean
                  finding_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Qualys rejected the stored username and password (`qualys_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            Qualys itself rate-limited this request (`qualys_rate_limited`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Could not pull vulnerability data from Qualys (`qualys_sync_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            No Qualys connector is configured for this tenant
            (`qualys_unavailable`), this installation has not been wired to
            pull scanner data (`qualys_sync_unavailable`), or this
            installation cannot serve the connector at all
            (`qualys_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/snyk:
    get:
      operationId: snykView
      tags: [Connectors]
      summary: This tenant's Snyk connector configuration
      description: |
        Whether a Snyk connector is configured and enabled, its base URL and
        organization id — never the API token. `operator`, `security-admin`
        and `auditor` may all read this; only a `security-admin` may change
        it. Served by the asset service.
      responses:
        '200':
          description: The connector's configuration (or not_configured if none is stored).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SnykSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Snyk connector (`snyk_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: snykSave
      tags: [Connectors]
      summary: Configure or replace this tenant's Snyk connector
      description: |
        The organization id and the API token are always required, even when
        only the base URL or the enabled flag is changing: the token is
        write-only and never returned by GET, so there is no value to leave
        implicitly unchanged. Requires the `security-admin` role and a second
        factor — storing a live third-party API credential is a more
        sensitive act than most writes in this API. Served by the asset
        service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SnykSaveRequest'
      responses:
        '200':
          description: The connector's configuration as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SnykSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Snyk connector (`snyk_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: snykDelete
      tags: [Connectors]
      summary: Clear this tenant's Snyk connector
      description: |
        Deletes the stored credentials outright — not a disable flag. Requires
        the `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '204':
          description: The connector's configuration was cleared (idempotent — also 204 if none was configured).
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Snyk connector (`snyk_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/snyk/test:
    post:
      operationId: snykTest
      tags: [Connectors]
      summary: Test this tenant's stored Snyk credentials
      description: |
        Resolves the stored credentials and makes a real call to Snyk's own
        API (listing this organization's projects) — proving the token
        actually works, not just that something is stored. Never echoes the
        token or the raw project list, only a count. Requires the
        `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '200':
          description: The credentials verified; project_count is how many projects Snyk returned.
          content:
            application/json:
              schema:
                type: object
                required: [ok, project_count]
                properties:
                  ok:
                    type: boolean
                  project_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Snyk rejected the stored API token (`snyk_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            Snyk itself rate-limited this request (`snyk_rate_limited`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Snyk could not be reached (`snyk_unreachable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: No Snyk connector is configured for this tenant, or this installation cannot serve one (`snyk_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/snyk/sync:
    post:
      operationId: snykSync
      tags: [Connectors]
      summary: Pull this tenant's current Snyk issues
      description: |
        Resolves the stored credentials and pulls the tenant's current issue
        data via Snyk's own REST API, recording it as scanner-observed assets
        and findings in Assay's own graph — never as proof; a finding is a
        vendor's claim, checked only by the engine actually running a
        technique under a grant. Requires the `security-admin` role and a
        second factor. Served by the asset service.
      responses:
        '200':
          description: The sync completed; finding_count is how many open findings this pull recorded.
          content:
            application/json:
              schema:
                type: object
                required: [ok, finding_count]
                properties:
                  ok:
                    type: boolean
                  finding_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Snyk rejected the stored API token (`snyk_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            Snyk itself rate-limited this request (`snyk_rate_limited`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Could not reach Snyk to pull vulnerability data (`snyk_sync_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            No Snyk connector is configured for this tenant
            (`snyk_unavailable`), this installation has not been wired to
            pull scanner data (`snyk_sync_unavailable`), or this
            installation cannot serve the connector at all
            (`snyk_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/ghscan:
    get:
      operationId: ghscanView
      tags: [Connectors]
      summary: This tenant's GitHub code scanning connector configuration
      description: |
        Whether a GitHub code scanning connector is configured and enabled,
        its base URL and organization — never the token. `operator`,
        `security-admin` and `auditor` may all read this; only a
        `security-admin` may change it. Served by the asset service.
      responses:
        '200':
          description: The connector's configuration (or not_configured if none is stored).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GHScanSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the GitHub code scanning connector (`ghscan_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: ghscanSave
      tags: [Connectors]
      summary: Configure or replace this tenant's GitHub code scanning connector
      description: |
        The organization and the token are always required, even when only
        the base URL or the enabled flag is changing: the token is
        write-only and never returned by GET, so there is no value to leave
        implicitly unchanged. Requires the `security-admin` role and a second
        factor — storing a live third-party API credential is a more
        sensitive act than most writes in this API. Served by the asset
        service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GHScanSaveRequest'
      responses:
        '200':
          description: The connector's configuration as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GHScanSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the GitHub code scanning connector (`ghscan_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: ghscanDelete
      tags: [Connectors]
      summary: Clear this tenant's GitHub code scanning connector
      description: |
        Deletes the stored credentials outright — not a disable flag. Requires
        the `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '204':
          description: The connector's configuration was cleared (idempotent — also 204 if none was configured).
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the GitHub code scanning connector (`ghscan_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/ghscan/test:
    post:
      operationId: ghscanTest
      tags: [Connectors]
      summary: Test this tenant's stored GitHub code scanning credentials
      description: |
        Resolves the stored credentials and makes a real call to GitHub's own
        API (listing this organization's open code scanning alerts) —
        proving the token actually works, not just that something is stored.
        Never echoes the token or the raw alert list, only a count. Requires
        the `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '200':
          description: The credentials verified; alert_count is how many open alerts GitHub returned.
          content:
            application/json:
              schema:
                type: object
                required: [ok, alert_count]
                properties:
                  ok:
                    type: boolean
                  alert_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: GitHub rejected the stored token (`ghscan_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            GitHub itself rate-limited this request (`ghscan_rate_limited`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: GitHub could not be reached (`ghscan_unreachable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: No GitHub code scanning connector is configured for this tenant, or this installation cannot serve one (`ghscan_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/ghscan/sync:
    post:
      operationId: ghscanSync
      tags: [Connectors]
      summary: Pull this tenant's current GitHub code scanning alerts
      description: |
        Resolves the stored credentials and pulls the configured
        organization's current code scanning alerts via GitHub's own REST
        API, walking every page (GitHub's own documented Link-header
        pagination), and recording them as scanner-observed assets and
        findings in Assay's own graph — never as proof; a finding is a
        vendor's claim, checked only by the engine actually running a
        technique under a grant. Requires the `security-admin` role and a
        second factor. Served by the asset service.
      responses:
        '200':
          description: The sync completed; finding_count is how many findings this pull recorded.
          content:
            application/json:
              schema:
                type: object
                required: [ok, finding_count]
                properties:
                  ok:
                    type: boolean
                  finding_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: GitHub rejected the stored token (`ghscan_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            GitHub itself rate-limited this request (`ghscan_rate_limited`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Could not reach GitHub to pull code scanning alerts (`ghscan_sync_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            No GitHub code scanning connector is configured for this tenant
            (`ghscan_unavailable`), this installation has not been wired to
            pull scanner data (`ghscan_sync_unavailable`), or this
            installation cannot serve the connector at all
            (`ghscan_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/insightvm:
    get:
      operationId: insightvmView
      tags: [Connectors]
      summary: This tenant's InsightVM connector configuration
      description: |
        Whether an InsightVM connector is configured and enabled, and its
        base URL — never the username or password. `operator`,
        `security-admin` and `auditor` may all read this; only a
        `security-admin` may change it. Served by the asset service.
      responses:
        '200':
          description: The connector's configuration (or not_configured if none is stored).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InsightVMSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the InsightVM connector (`insightvm_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: insightvmSave
      tags: [Connectors]
      summary: Configure or replace this tenant's InsightVM connector
      description: |
        Unlike this API's other scanner connectors, the base URL is also
        required here, alongside the username and password: a customer's
        InsightVM Security Console is entirely self-hosted, with no
        cloud/regional host to default to. All three are always required,
        even when only the enabled flag is changing: the credentials are
        write-only and never returned by GET, so there is no value to leave
        implicitly unchanged. Requires the `security-admin` role and a
        second factor. Served by the asset service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InsightVMSaveRequest'
      responses:
        '200':
          description: The connector's configuration as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InsightVMSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the InsightVM connector (`insightvm_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: insightvmDelete
      tags: [Connectors]
      summary: Clear this tenant's InsightVM connector
      description: |
        Deletes the stored credentials outright — not a disable flag. Requires
        the `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '204':
          description: The connector's configuration was cleared (idempotent — also 204 if none was configured).
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the InsightVM connector (`insightvm_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/insightvm/test:
    post:
      operationId: insightvmTest
      tags: [Connectors]
      summary: Test this tenant's stored InsightVM credentials
      description: |
        Resolves the stored credentials and makes a real call to the
        console's own API (listing sites) — proving the credentials
        actually work, not just that something is stored. Never echoes the
        credentials or the raw site list, only the console's own reported
        total site count. Requires the `security-admin` role and a second
        factor. Served by the asset service.
      responses:
        '200':
          description: The credentials verified; site_count is the console's own total across every page, not just one page's worth.
          content:
            application/json:
              schema:
                type: object
                required: [ok, site_count]
                properties:
                  ok:
                    type: boolean
                  site_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: InsightVM rejected the stored username and password (`insightvm_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          description: InsightVM could not be reached (`insightvm_unreachable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: No InsightVM connector is configured for this tenant, or this installation cannot serve one (`insightvm_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/insightvm/sync:
    post:
      operationId: insightvmSync
      tags: [Connectors]
      summary: Pull this tenant's current InsightVM vulnerability findings
      description: |
        Resolves the stored credentials and pulls the tenant's current
        vulnerability findings by walking the console's own assets and each
        asset's own reported vulnerabilities, recording it as
        scanner-observed assets and findings in Assay's own graph — never
        as proof; a finding is a vendor's claim, checked only by the engine
        actually running a technique under a grant. Unlike this API's other
        scanner connectors, there is no export-in-progress conflict here:
        InsightVM's own API has no asynchronous export job to collide with,
        only a plain paginated walk. Requires the `security-admin` role and
        a second factor. Served by the asset service.
      responses:
        '200':
          description: The sync completed; finding_count is how many open findings this pull recorded.
          content:
            application/json:
              schema:
                type: object
                required: [ok, finding_count]
                properties:
                  ok:
                    type: boolean
                  finding_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: InsightVM rejected the stored username and password (`insightvm_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          description: Could not reach InsightVM to pull vulnerability data (`insightvm_sync_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            No InsightVM connector is configured for this tenant
            (`insightvm_unavailable`), this installation has not been wired
            to pull scanner data (`insightvm_sync_unavailable`), or this
            installation cannot serve the connector at all
            (`insightvm_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/semgrep:
    get:
      operationId: semgrepView
      tags: [Connectors]
      summary: This tenant's Semgrep connector configuration
      description: |
        Whether a Semgrep connector is configured and enabled — never the
        token. Unlike this API's other scanner connectors there is no base
        URL or scoping identifier: Semgrep's own auth model ties a token to
        exactly one deployment already. `operator`, `security-admin` and
        `auditor` may all read this; only a `security-admin` may change it.
        Served by the asset service.
      responses:
        '200':
          description: The connector's configuration (or not_configured if none is stored).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SemgrepSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Semgrep connector (`semgrep_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: semgrepSave
      tags: [Connectors]
      summary: Configure or replace this tenant's Semgrep connector
      description: |
        The token is always required, even when only the enabled flag is
        changing: it is write-only and never returned by GET, so there is no
        value to leave implicitly unchanged. Requires the `security-admin`
        role and a second factor. Served by the asset service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SemgrepSaveRequest'
      responses:
        '200':
          description: The connector's configuration as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SemgrepSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Semgrep connector (`semgrep_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: semgrepDelete
      tags: [Connectors]
      summary: Clear this tenant's Semgrep connector
      description: |
        Deletes the stored token outright — not a disable flag. Requires the
        `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '204':
          description: The connector's configuration was cleared (idempotent — also 204 if none was configured).
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Semgrep connector (`semgrep_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/semgrep/test:
    post:
      operationId: semgrepTest
      tags: [Connectors]
      summary: Test this tenant's stored Semgrep credentials
      description: |
        Resolves the stored token and makes a real call to Semgrep's own API
        (listing deployments) — proving the token actually works, not just
        that something is stored. Never echoes the token, only a
        deployment count (always at most 1, since a token's auth scope never
        extends past the single deployment it belongs to). Requires the
        `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '200':
          description: The token verified; deployment_count is always 0 or 1.
          content:
            application/json:
              schema:
                type: object
                required: [ok, deployment_count]
                properties:
                  ok:
                    type: boolean
                  deployment_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Semgrep rejected the stored token (`semgrep_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          description: Semgrep could not be reached (`semgrep_unreachable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: No Semgrep connector is configured for this tenant, or this installation cannot serve one (`semgrep_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/semgrep/sync:
    post:
      operationId: semgrepSync
      tags: [Connectors]
      summary: Pull this tenant's current Semgrep SAST findings
      description: |
        Resolves the stored token and pulls the tenant's current SAST (Code)
        findings via Semgrep's own findings API, recording them as
        scanner-observed assets and findings in Assay's own graph — never as
        proof; a finding is a vendor's claim, checked only by the engine
        actually running a technique under a grant. Requires the
        `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '200':
          description: The sync completed; finding_count is how many findings this pull recorded.
          content:
            application/json:
              schema:
                type: object
                required: [ok, finding_count]
                properties:
                  ok:
                    type: boolean
                  finding_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: >-
            Semgrep rejected the stored token (`semgrep_auth_failed`), or the
            token is not scoped to any deployment (`semgrep_no_deployment`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          description: Could not reach Semgrep to pull finding data (`semgrep_sync_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            No Semgrep connector is configured for this tenant
            (`semgrep_unavailable`), this installation has not been wired to
            pull scanner data (`semgrep_sync_unavailable`), or this
            installation cannot serve the connector at all
            (`semgrep_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/veracode:
    get:
      operationId: veracodeView
      tags: [Connectors]
      summary: This tenant's Veracode connector configuration
      description: |
        Whether a Veracode connector is configured and enabled, and its base
        URL — never the API ID or secret key. `operator`, `security-admin`
        and `auditor` may all read this; only a `security-admin` may change
        it. Served by the asset service.
      responses:
        '200':
          description: The connector's configuration (or not_configured if none is stored).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VeracodeSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Veracode connector (`veracode_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: veracodeSave
      tags: [Connectors]
      summary: Configure or replace this tenant's Veracode connector
      description: |
        The API ID and secret key are always required, even when only the
        base URL or the enabled flag is changing: credentials are
        write-only and never returned by GET, so there is no value to leave
        implicitly unchanged. The secret key must be a valid hex-encoded
        string once any region prefix ("vera01ei-" and similar) is
        stripped — Veracode's own signing algorithm requires it, and this is
        checked at save time rather than deferred to a confusing
        signature-mismatch failure later. Requires the `security-admin`
        role and a second factor. Served by the asset service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VeracodeSaveRequest'
      responses:
        '200':
          description: The connector's configuration as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VeracodeSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Veracode connector (`veracode_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: veracodeDelete
      tags: [Connectors]
      summary: Clear this tenant's Veracode connector
      description: |
        Deletes the stored credentials outright — not a disable flag. Requires
        the `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '204':
          description: The connector's configuration was cleared (idempotent — also 204 if none was configured).
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Veracode connector (`veracode_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/veracode/test:
    post:
      operationId: veracodeTest
      tags: [Connectors]
      summary: Test this tenant's stored Veracode credentials
      description: |
        Resolves the stored credentials and makes a real call to Veracode's
        own API (listing applications) — proving the credentials actually
        work, not just that something is stored. Never echoes the
        credentials or the raw application list, only a count. Requires the
        `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '200':
          description: The credentials verified; application_count is how many applications Veracode returned.
          content:
            application/json:
              schema:
                type: object
                required: [ok, application_count]
                properties:
                  ok:
                    type: boolean
                  application_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Veracode rejected the stored API ID and secret key (`veracode_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            Veracode itself rate-limited this request (`veracode_rate_limited`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Veracode could not be reached (`veracode_unreachable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: No Veracode connector is configured for this tenant, or this installation cannot serve one (`veracode_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/veracode/sync:
    post:
      operationId: veracodeSync
      tags: [Connectors]
      summary: Pull this tenant's current Veracode findings
      description: |
        Resolves the stored credentials, enumerates every application in the
        account, and pulls each one's current findings via Veracode's own
        Findings REST API, recording them as scanner-observed assets and
        findings in Assay's own graph — never as proof; a finding is a
        vendor's claim, checked only by the engine actually running a
        technique under a grant. Requires the `security-admin` role and a
        second factor. Served by the asset service.
      responses:
        '200':
          description: The sync completed; finding_count is how many findings this pull recorded.
          content:
            application/json:
              schema:
                type: object
                required: [ok, finding_count]
                properties:
                  ok:
                    type: boolean
                  finding_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Veracode rejected the stored API ID and secret key (`veracode_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            Veracode itself rate-limited this request (`veracode_rate_limited`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Could not reach Veracode to pull finding data (`veracode_sync_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            No Veracode connector is configured for this tenant
            (`veracode_unavailable`), this installation has not been wired to
            pull scanner data (`veracode_sync_unavailable`), or this
            installation cannot serve the connector at all
            (`veracode_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/checkmarx:
    get:
      operationId: checkmarxView
      tags: [Connectors]
      summary: This tenant's Checkmarx connector configuration
      description: |
        Whether a Checkmarx connector is configured and enabled, its base
        URLs and tenant name — never the API key. `operator`,
        `security-admin` and `auditor` may all read this; only a
        `security-admin` may change it. Served by the asset service.
      responses:
        '200':
          description: The connector's configuration (or not_configured if none is stored).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckmarxSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Checkmarx connector (`checkmarx_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: checkmarxSave
      tags: [Connectors]
      summary: Configure or replace this tenant's Checkmarx connector
      description: |
        The tenant name and API key are always required, even when only a
        base URL or the enabled flag is changing: the key is write-only and
        never returned by GET, so there is no value to leave implicitly
        unchanged. The API key is a Checkmarx One "API key" (an OAuth2
        refresh token), not a customer-created OAuth client secret.
        Requires the `security-admin` role and a second factor. Served by
        the asset service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CheckmarxSaveRequest'
      responses:
        '200':
          description: The connector's configuration as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CheckmarxSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Checkmarx connector (`checkmarx_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: checkmarxDelete
      tags: [Connectors]
      summary: Clear this tenant's Checkmarx connector
      description: |
        Deletes the stored credentials outright — not a disable flag. Requires
        the `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '204':
          description: The connector's configuration was cleared (idempotent — also 204 if none was configured).
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Checkmarx connector (`checkmarx_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/checkmarx/test:
    post:
      operationId: checkmarxTest
      tags: [Connectors]
      summary: Test this tenant's stored Checkmarx credentials
      description: |
        Resolves the stored API key, exchanges it for a short-lived access
        token, and calls Checkmarx's own API (listing projects) — proving
        the key actually works, not just that something is stored. Never
        echoes the key or the raw project list, only a count. Requires the
        `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '200':
          description: The credentials verified; project_count is how many projects Checkmarx returned.
          content:
            application/json:
              schema:
                type: object
                required: [ok, project_count]
                properties:
                  ok:
                    type: boolean
                  project_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Checkmarx rejected the stored tenant name and API key (`checkmarx_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            Checkmarx itself rate-limited this request (`checkmarx_rate_limited`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Checkmarx could not be reached (`checkmarx_unreachable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: No Checkmarx connector is configured for this tenant, or this installation cannot serve one (`checkmarx_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/checkmarx/sync:
    post:
      operationId: checkmarxSync
      tags: [Connectors]
      summary: Pull this tenant's current Checkmarx One SAST results
      description: |
        Resolves the stored API key and pulls the tenant's current SAST
        results — walking every project, and for each one with a
        repository url and a completed scan, that scan's own current
        results via Checkmarx's own projects/scans/sast-results API —
        recording them as scanner-observed assets and findings in Assay's
        own graph — never as proof; a finding is a vendor's claim, checked
        only by the engine actually running a technique under a grant.
        Requires the `security-admin` role and a second factor. Served by
        the asset service.
      responses:
        '200':
          description: The sync completed; finding_count is how many findings this pull recorded.
          content:
            application/json:
              schema:
                type: object
                required: [ok, finding_count]
                properties:
                  ok:
                    type: boolean
                  finding_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Checkmarx rejected the stored tenant name and API key (`checkmarx_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            The per-identity rate limit was exceeded (`rate_limited`), or
            Checkmarx itself rate-limited this request (`checkmarx_rate_limited`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '502':
          description: Could not reach Checkmarx to pull SAST result data (`checkmarx_sync_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            No Checkmarx connector is configured for this tenant
            (`checkmarx_unavailable`), this installation has not been wired to
            pull scanner data (`checkmarx_sync_unavailable`), or this
            installation cannot serve the connector at all
            (`checkmarx_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/openvas:
    get:
      operationId: openvasView
      tags: [Connectors]
      summary: This tenant's OpenVAS connector configuration
      description: |
        Whether an OpenVAS (Greenbone Vulnerability Management) connector is
        configured and enabled, and its manager host and port — never the
        username or password. `operator`, `security-admin` and `auditor`
        may all read this; only a `security-admin` may change it. Served by
        the asset service.
      responses:
        '200':
          description: The connector's configuration (or not_configured if none is stored).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenVASSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the OpenVAS connector (`openvas_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: openvasSave
      tags: [Connectors]
      summary: Configure or replace this tenant's OpenVAS connector
      description: |
        Unlike this API's other scanner connectors, the manager is
        addressed by host and port rather than a base URL: GVM's own
        Greenbone Management Protocol (GMP) is not HTTP, so there is no
        scheme or path. Host is required, the same as InsightVM's own
        base_url and for the same reason — a customer's GVM manager is
        entirely self-hosted, with no cloud/regional host to fall back to.
        Port is optional and defaults to GMP's own documented manager port
        (9390) when omitted. Username and password are always required,
        even when only the host, port or enabled flag is changing: they are
        write-only and never returned by GET, so there is no value to leave
        implicitly unchanged. Requires the `security-admin` role and a
        second factor. Served by the asset service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OpenVASSaveRequest'
      responses:
        '200':
          description: The connector's configuration as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OpenVASSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the OpenVAS connector (`openvas_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: openvasDelete
      tags: [Connectors]
      summary: Clear this tenant's OpenVAS connector
      description: |
        Deletes the stored credentials outright — not a disable flag. Requires
        the `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '204':
          description: The connector's configuration was cleared (idempotent — also 204 if none was configured).
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the OpenVAS connector (`openvas_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/openvas/test:
    post:
      operationId: openvasTest
      tags: [Connectors]
      summary: Test this tenant's stored OpenVAS credentials
      description: |
        Resolves the stored credentials and makes a real call over the
        Greenbone Management Protocol (GMP) to the manager — authenticate,
        then get_version on that same session — proving the credentials
        actually work, not just that something is stored. Never echoes the
        credentials, only the manager's own reported GMP protocol version.
        Requires the `security-admin` role and a second factor. Served by
        the asset service.
      responses:
        '200':
          description: The credentials verified; version is the manager's own reported GMP protocol version.
          content:
            application/json:
              schema:
                type: object
                required: [ok, version]
                properties:
                  ok:
                    type: boolean
                  version:
                    type: string
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: OpenVAS rejected the stored username and password (`openvas_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          description: OpenVAS could not be reached (`openvas_unreachable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: No OpenVAS connector is configured for this tenant, or this installation cannot serve one (`openvas_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/openvas/sync:
    post:
      operationId: openvasSync
      tags: [Connectors]
      summary: Pull this tenant's current OpenVAS scan results
      description: |
        Resolves the stored credentials and pulls the tenant's current scan
        results over the Greenbone Management Protocol (GMP) — listing every
        task (get_tasks), then, for each task with a finished report, that
        report's own results (get_results filtered to report_id) — recording
        them as scanner-observed assets and findings in Assay's own graph —
        never as proof; a finding is a vendor's claim, checked only by the
        engine actually running a technique under a grant. Unlike this API's
        other scanner connectors, resolution relies entirely on this
        endpoint's own repeat calls: GMP gives a result no persistent
        cross-scan open/closed field, so a finding this sync's own report no
        longer mentions at all is the only signal it was fixed or the host
        is gone. Requires the `security-admin` role and a second factor.
        Served by the asset service.
      responses:
        '200':
          description: The sync completed; finding_count is how many findings this pull recorded.
          content:
            application/json:
              schema:
                type: object
                required: [ok, finding_count]
                properties:
                  ok:
                    type: boolean
                  finding_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: OpenVAS rejected the stored username and password (`openvas_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          description: Could not reach OpenVAS to pull scan result data (`openvas_sync_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            No OpenVAS connector is configured for this tenant
            (`openvas_unavailable`), this installation has not been wired to
            pull scanner data (`openvas_sync_unavailable`), or this
            installation cannot serve the connector at all
            (`openvas_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/burpenterprise:
    get:
      operationId: burpenterpriseView
      tags: [Connectors]
      summary: This tenant's Burp Suite Enterprise Edition connector configuration
      description: |
        Whether a Burp Suite Enterprise Edition connector is configured and
        enabled, and its base URL — never the API key. `operator`,
        `security-admin` and `auditor` may all read this; only a
        `security-admin` may change it. Served by the asset service.
      responses:
        '200':
          description: The connector's configuration (or not_configured if none is stored).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BurpEnterpriseSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Burp Suite Enterprise Edition connector (`burpenterprise_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: burpenterpriseSave
      tags: [Connectors]
      summary: Configure or replace this tenant's Burp Suite Enterprise Edition connector
      description: |
        Unlike most of this API's other scanner connectors, the base URL is
        also required here, alongside the API key: a customer's Burp Suite
        Enterprise Edition server is entirely self-hosted, with no
        cloud/regional host to default to. Both fields are always required,
        even when only the enabled flag is changing: the API key is
        write-only and never returned by GET, so there is no value to leave
        implicitly unchanged. Requires the `security-admin` role and a
        second factor. Served by the asset service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BurpEnterpriseSaveRequest'
      responses:
        '200':
          description: The connector's configuration as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BurpEnterpriseSettings'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Burp Suite Enterprise Edition connector (`burpenterprise_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: burpenterpriseDelete
      tags: [Connectors]
      summary: Clear this tenant's Burp Suite Enterprise Edition connector
      description: |
        Deletes the stored credentials outright — not a disable flag. Requires
        the `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '204':
          description: The connector's configuration was cleared (idempotent — also 204 if none was configured).
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve the Burp Suite Enterprise Edition connector (`burpenterprise_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/burpenterprise/test:
    post:
      operationId: burpenterpriseTest
      tags: [Connectors]
      summary: Test this tenant's stored Burp Suite Enterprise Edition credentials
      description: |
        Resolves the stored API key and makes a real call to the server's
        own GraphQL API (listing scan configurations) — proving the key
        actually works, not just that something is stored. Never echoes the
        key or the raw scan configuration list, only a count. Requires the
        `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '200':
          description: The credentials verified; scan_configuration_count is how many scan configurations the server returned.
          content:
            application/json:
              schema:
                type: object
                required: [ok, scan_configuration_count]
                properties:
                  ok:
                    type: boolean
                  scan_configuration_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Burp Suite Enterprise Edition rejected the stored API key (`burpenterprise_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          description: Burp Suite Enterprise Edition could not be reached (`burpenterprise_unreachable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: No Burp Suite Enterprise Edition connector is configured for this tenant, or this installation cannot serve one (`burpenterprise_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/burpenterprise/sync:
    post:
      operationId: burpenterpriseSync
      tags: [Connectors]
      summary: Pull this tenant's current Burp Suite Enterprise Edition scan issues
      description: |
        Resolves the stored API key and pulls the tenant's current scan
        issues via the server's own GraphQL API — walking every configured
        site, its most recently succeeded scan, and that scan's issues,
        resolving each to its durable issue record — and recording them as
        scanner-observed assets and findings in Assay's own graph — never as
        proof; a finding is a vendor's claim, checked only by the engine
        actually running a technique under a grant. Requires the
        `security-admin` role and a second factor. Served by the asset
        service.
      responses:
        '200':
          description: The sync completed; finding_count is how many findings this pull recorded.
          content:
            application/json:
              schema:
                type: object
                required: [ok, finding_count]
                properties:
                  ok:
                    type: boolean
                  finding_count:
                    type: integer
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '422':
          description: Burp Suite Enterprise Edition rejected the stored API key (`burpenterprise_auth_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          description: Could not pull scan data from Burp Suite Enterprise Edition (`burpenterprise_sync_failed`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            No Burp Suite Enterprise Edition connector is configured for
            this tenant (`burpenterprise_unavailable`), this installation
            has not been wired to pull scanner data
            (`burpenterprise_sync_unavailable`), or this installation
            cannot serve the connector at all (`burpenterprise_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/dispatch:
    post:
      operationId: dispatchTechnique
      tags: [Verification]
      summary: Run one technique against one target
      description: |
        Runs one technique against one target through the ordinary dispatch
        path: the authorization choke-point, the safe-mode class and
        target-kind check, and blast-radius admission, in that order, exactly
        as a re-verify's re-run clears them. This is that same path used for a
        target with no proven step yet — the run that produces one.

        `target` is a bare domain, address, CIDR member or URL, the same form
        the authorization choke-point itself expects — never a graph key.
        `asset_id` names an existing graph asset instead; exactly one of
        `target` or `asset_id` is required. There is no `target_kind` field:
        the kind safe mode checks against the technique's own declared target
        kinds is never taken from the request — it is whichever scope rule
        the choke-point itself matched the target against, so a request
        cannot claim a kind other than what the target actually resolves to.

        A refusal — no grant, out of scope, the kill-switch engaged, the
        technique does not declare this target kind — is a normal 200 body
        with `dispatched: false` and `reason` set, the same way verify and
        sweep never render "could not authorize" as an HTTP error. Only a hard
        failure in the dispatch machinery itself is a 5xx.

        The tenant comes from the credential. This dispatches work against a
        target, so it is a write: it requires the `operator` or
        `security-admin` role and a second factor, the same as issuing a
        grant or re-verifying a step. Served by the verify service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DispatchRequest'
      responses:
        '200':
          description: >-
            The dispatch outcome. A refusal is still a 200: read `dispatched`
            and `reason`, not the status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DispatchResult'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/DispatchUnavailable'
  /v1/verify/steps/{id}:
    post:
      operationId: verifyStep
      tags: [Verification]
      summary: Re-verify one proven step now
      description: |
        Re-runs the technique that proved one step, against the same target,
        through the ordinary dispatch path. The re-run clears the same
        authorization choke-point, safety-class ceiling and blast-radius
        governance as any other action: verification holds no privileged path and
        cannot re-run anything it could not freshly authorize.

        The outcome is one of three, and they are never conflated:

        - `reproduced`: the path was demonstrated again. The exposure is open. The
          dispatcher recorded a fresh step with new evidence, and the old step is
          superseded in favor of it.
        - `remediated`: the technique ran under a current authorization and this
          time proved nothing. That, and only that, is a confirmed fix. The step
          is superseded.
        - `inconclusive`: the re-run never happened — the grant expired, the
          target fell out of scope, the kill-switch is engaged, or the technique
          errored. The step is left exactly as it was, because a run that could
          not happen is not evidence that a path is gone. `reason` says why.

        The tenant comes from the credential; a body cannot claim another. This
        dispatches work against a target, so it is a write: it requires the
        `operator` or `security-admin` role and a second factor, the same as
        issuing a grant. Served by the verify service.
      parameters:
        - $ref: '#/components/parameters/StepID'
      responses:
        '200':
          description: The re-verification outcome for this step.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VerifyResult'
        '400':
          description: A step id was not supplied in the path (`invalid_id`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '404':
          description: No active proven step is held under that id (`not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/VerifyUnavailable'
  /v1/verify/sweep:
    post:
      operationId: verifySweep
      tags: [Verification]
      summary: Re-verify every due finding
      description: |
        Re-checks the active proven findings that are due under the policy, oldest
        first, each through the same dispatch path a single re-verify uses. One
        lapsed grant never stops the sweep: an expired authorization on one
        finding says nothing about the next, so that finding comes back
        `inconclusive` and the sweep continues.

        The body carries an optional `interval`. Absent or zero re-checks every
        active finding now. A positive interval re-checks only findings that have
        stood at least that long, measured from when each was established, so a
        routine sweep does not re-run everything on every pass. A refreshed
        finding carries a new timestamp, so a reproduced one is naturally
        re-checked from its refresh. Send `{}` to sweep everything now.

        When the sweep stops short — a cancelled request, or a re-check that
        errored hard — the report sets `stopped` and reports `unchecked`, the
        number of due findings it did not reach. A partial sweep is never reported
        as complete: reading `checked` alone would hide a stale exposure the
        sweep never got to.

        The tenant comes from the credential. This dispatches work against
        targets, so it is a write: it requires the `operator` or `security-admin`
        role and a second factor. Served by the verify service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SweepRequest'
      responses:
        '200':
          description: >-
            The sweep summary. A `stopped` report is still a 200: the partial
            result is read from `stopped` and `unchecked`, not from the status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SweepReport'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/VerifyUnavailable'
  /v1/verify/trend:
    get:
      operationId: getVerifyTrend
      tags: [Verification]
      summary: Exposure trend over a window
      description: |
        Reports the exposure trend across a time window, bucketed. It is derived
        from recorded verifications, not from the current graph, so it shows
        movement over time rather than a single snapshot. It draws no conclusion
        the records do not support: it counts what was observed and leaves the
        reading to the report.

        Every bucket across the window is returned, empty ones included, so a
        period with no verifications shows as a gap rather than vanishing. Each
        bucket carries `inconclusive` alongside `reproduced` and `remediated`,
        never folded into either: a bucket that is all inconclusive is "we could
        not check", which is not "nothing is exposed", and collapsing it would
        draw a falling line over an engagement that stopped looking.

        `since`, `until` and `bucket` are all required and are not defaulted: a
        window guessed on the caller's behalf would report a trend nobody asked
        for. The number of buckets the window and bucket size produce is bounded;
        a window too fine for its span is refused rather than allocated.

        The tenant comes from the credential. Reading the trend requires the
        `operator`, `security-admin` or `auditor` role. Served by the verify
        service.
      parameters:
        - name: since
          in: query
          required: true
          description: Start of the window, inclusive, as an RFC 3339 timestamp.
          schema:
            type: string
            format: date-time
        - name: until
          in: query
          required: true
          description: >-
            End of the window, exclusive, as an RFC 3339 timestamp. Must be after
            `since`.
          schema:
            type: string
            format: date-time
        - name: bucket
          in: query
          required: true
          description: >-
            Bucket width, as a Go duration such as `24h`. Must be positive, and
            wide enough that the window holds at most 5000 buckets.
          schema:
            type: string
          example: 24h
      responses:
        '200':
          description: The trend, one entry per bucket across the window.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TrendResponse'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/VerifyUnavailable'
  /v1/reports:
    post:
      operationId: buildReport
      tags: [Reports]
      summary: Build and store a report
      description: |
        Builds an engagement report from the supplied findings and trend,
        verifies the signed evidence behind every finding it presents, persists
        the document, and returns it with the id it was stored under.

        The build is deterministic: the same findings and the same trend produce
        the same document. A finding survives into the remediation list only if it
        was proven upstream and every evidence bundle in its chains verifies here.
        One whose evidence does not verify is moved to `unsupported` with a note
        rather than presented as proven; one the prioritizer already downgraded is
        carried in `unproven`. The report is only as trustworthy as the proof
        under it, and the builder enforces that rather than assuming it.

        Findings and trend are both optional. Supplying either uses exactly what
        was given, which is how an operator builds from a saved or offline
        snapshot. Leaving both empty assembles them from the prioritizer and the
        verifier's stored history instead of building an empty report. The
        Community report is complete on its own; a compliance-mapping pack, when
        the Enterprise build is running, adds a cross-reference under
        `extensions` and never a finding or a count.

        Emitting the built findings onto `/v1/events` for the suite (Engage) and
        shipping them to an operator-configured SIEM, SOAR or ticketing
        destination both happen after the report is stored, and both are
        best-effort: neither failing turns a successful build into a failed
        request, and neither is configured by default.

        The tenant comes from the credential; a body cannot build a report for
        another. Building requires the `operator` or `security-admin` role. It
        writes a document but dispatches nothing against a target, so it carries
        no second factor. Served by the report service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BuildReportRequest'
      responses:
        '201':
          description: The built report, with the id it was stored under.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoredReport'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/ReportUnavailable'
    get:
      operationId: listReports
      tags: [Reports]
      summary: List stored reports
      description: |
        Lists the reports this tenant has stored, newest first, as summaries.
        Each entry carries the report's id, title, generation time and summary
        counts, so a caller can pick one and fetch the whole document by id
        without loading every document to build the list.

        The tenant comes from the credential. Reading the list requires the
        `operator`, `security-admin` or `auditor` role. Served by the report
        service.
      parameters:
        - $ref: '#/components/parameters/ReportLimit'
      responses:
        '200':
          description: The stored reports, newest first.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/ReportUnavailable'
  /v1/reports/{id}:
    get:
      operationId: getReport
      tags: [Reports]
      summary: Fetch one stored report
      description: |
        Returns one stored report by id, as the build produced it. The lookup is
        tenant-scoped: a report stored under another tenant reports `not_found`
        rather than confirming the id exists elsewhere.

        The tenant comes from the credential. Reading a report requires the
        `operator`, `security-admin` or `auditor` role. Served by the report
        service.
      parameters:
        - $ref: '#/components/parameters/ReportID'
      responses:
        '200':
          description: The stored report.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StoredReport'
        '400':
          description: A report id was not supplied in the path (`invalid_id`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '404':
          description: No report is held under that id (`not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/ReportUnavailable'
  /v1/admin/export-destinations:
    get:
      operationId: listExportDestinations
      tags: [Export destinations]
      summary: List this tenant's export destinations
      description: |
        Every export destination configured for this tenant — a SIEM, a SOAR
        endpoint, a ticketing webhook, or several at once — with each
        destination's own name, URL, format and enabled state. The
        destination's own bearer token, if it has one, is never returned;
        only `has_token` reports whether one is configured.

        `operator`, `security-admin` and `auditor` may all read this; only a
        `security-admin` may write. Served by the report service, the same
        service that runs the delivery worker reading this table.
      responses:
        '200':
          description: The tenant's export destinations.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportDestinationList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve export destinations (`export_destinations_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    post:
      operationId: createExportDestination
      tags: [Export destinations]
      summary: Configure a new export destination
      description: |
        Adds a new destination to this tenant — a tenant may hold several at
        once, unlike a connector's own single fixed resource. `name` is
        required (1-100 characters) and is what an admin actually sees and
        picks in the console. `url` and `format` are validated the same way
        `integrations/export` validates every destination at delivery time
        (https to any host, or http only to a loopback address; no
        credentials embedded in the URL): a destination this installation
        would refuse to send to is refused here, at configuration time,
        rather than only discovered later. `token` is optional — a
        destination need not require a bearer credential.

        Requires the `security-admin` role and a second factor — storing a
        third-party destination's credential is a more sensitive act than
        most writes in this API, the same posture every connector's own save
        takes. Served by the report service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExportDestinationSaveRequest'
      responses:
        '201':
          description: The destination as stored.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportDestination'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve export destinations (`export_destinations_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/export-destinations/{id}:
    get:
      operationId: getExportDestination
      tags: [Export destinations]
      summary: Read one export destination
      description: |
        404 if no such destination exists in the caller's own tenant —
        including an id that belongs to a different tenant, which is
        reported identically rather than distinguished.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The destination.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportDestination'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No such export destination in the caller's own tenant (`export_destination_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve export destinations (`export_destinations_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    put:
      operationId: updateExportDestination
      tags: [Export destinations]
      summary: Replace an export destination outright
      description: |
        Every field is replaced, including `token`: an update is never
        partial, the same "resupply the whole thing" shape every connector's
        own save already takes — omitting `token` clears it, it does not
        leave the stored one unchanged. Validated exactly like create.

        Requires the `security-admin` role and a second factor.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExportDestinationSaveRequest'
      responses:
        '200':
          description: The destination, updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExportDestination'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No such export destination in the caller's own tenant (`export_destination_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve export destinations (`export_destinations_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    delete:
      operationId: deleteExportDestination
      tags: [Export destinations]
      summary: Delete an export destination
      description: |
        Removes the destination outright. Unlike a connector's own DELETE
        (idempotent — at most one row per tenant, so clearing whatever is
        there, if anything, always succeeds), this is a genuine collection:
        an id that does not exist, or belongs to a different tenant, is a
        real 404 rather than a silent no-op.

        Requires the `security-admin` role and a second factor.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: The destination was deleted.
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No such export destination in the caller's own tenant (`export_destination_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This installation cannot serve export destinations (`export_destinations_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/admin/export-destinations/{id}/test:
    post:
      operationId: testExportDestination
      tags: [Export destinations]
      summary: Test one export destination
      description: |
        Resolves this destination's stored token (if any) and sends a small,
        clearly-labeled synthetic connectivity-test record to its configured
        URL and format — proving the destination is actually reachable,
        never delivering a real report. Not audited: a read-like probe, the
        same posture the Tenable connector's own test route takes.

        Requires the `security-admin` role and a second factor.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The destination is reachable.
          content:
            application/json:
              schema:
                type: object
                required: [ok]
                properties:
                  ok:
                    type: boolean
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          description: No such export destination in the caller's own tenant (`export_destination_not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: The stored destination is no longer a valid one (`export_destination_invalid`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          description: Could not reach the destination to verify it (`export_destination_unreachable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: This installation cannot serve export destinations (`export_destinations_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/plans:
    post:
      operationId: proposePlan
      tags: [Plans]
      summary: Propose what to validate next
      description: |
        Builds a fresh brief from the tenant's own asset graph — asset keys and
        types, crown-jewel objectives, what is already proven, the techniques
        this installation can run, and a bounded, deterministic summary of open
        connector-reported findings per asset — and asks the configured model
        for the next few checks worth running. The model proposes; it does not
        authorize or act. Every proposal is independently checked against the
        engagement's authorization, its permitted safety classes, and its rate
        and concurrency limits at dispatch time, and may still be refused there.

        The planner is optional: with no model endpoint configured
        (`ASSAY_PLANNER_MODEL_URL`), this answers `planner_disabled` — the
        air-gapped posture, a supported one, not a fault. This installation
        also authors no validation technique itself (an operator's own adapter,
        registered outside this repository, is what a real deployment's menu
        would ever hold), so a real call here answers with an empty
        `techniques` list until one exists — the model is never asked to
        propose against a menu it was not shown.

        Every cycle is recorded — the model, the prompt, the raw response and
        what was parsed out of it — under `replay_id`, readable back via
        `GET /v1/plans/{id}`. That record is this action's own audit trail;
        proposing is not separately logged as an admin operation, since it
        changes no tenant configuration.

        The tenant comes from the credential. Proposing requires the
        `operator` or `security-admin` role. Served by the planner service.
      responses:
        '201':
          description: The plan — the proposals, any refusals, and the replay id to read the cycle back by.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Plan'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          description: The configured model endpoint did not answer usably (`planner_model_unreachable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '503':
          description: >-
            No planner is wired for this installation (`planner_unavailable`),
            or one is wired but no model endpoint is configured
            (`planner_disabled` — the air-gapped posture).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    get:
      operationId: listPlans
      tags: [Plans]
      summary: List past planning cycles
      description: |
        Lists this tenant's own past planning cycles, newest first — each the
        full replay record (model, prompt, response, proposals and refusals).

        The tenant comes from the credential. Reading requires the `operator`,
        `security-admin` or `auditor` role. Served by the planner service.
      parameters:
        - name: limit
          in: query
          required: false
          schema:
            type: integer
          description: Caps how many records are returned. Defaults to 50, capped at 200.
      responses:
        '200':
          description: The stored planning cycles, newest first.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlanRecordList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: No planner is wired for this installation (`planner_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/plans/execute:
    post:
      operationId: executePlan
      tags: [Plans]
      summary: Dispatch an approved batch of proposals
      description: |
        Dispatches an operator-approved set of proposals through the engine,
        one at a time, under a budget, and records the batch as one audited
        unit. This is the executor half of the planner/executor split: the
        planner proposes (POST /v1/plans), the operator reviews, and submits
        the set they approve here.

        The batch holds no authority of its own. Every proposal is dispatched
        through the ordinary path — the authorization choke-point, the
        safe-mode class and target-kind check, and blast-radius admission —
        under the submitting operator's own principal, so a proposal for a
        target that operator is not authorized for is refused at the
        choke-point exactly as a hand-typed dispatch would be, and the batch
        moves on. The batch can only ever dispatch a subset of what the
        choke-point would independently allow.

        `budget.max_dispatches` caps how many dispatches the batch may attempt
        in total; `budget.max_per_target` optionally caps them per target. The
        budget only ever subtracts: it stops dispatches the choke-point would
        allow and can never permit one it would refuse. A `proposals[].target`
        is the planner's own type-qualified graph key or a bare target, the
        same value the planner proposed.

        A refusal of any single proposal is not an error: the report enumerates
        every proposal's disposition, and a batch stopped early by the budget, a
        cancelled request, or a hard dispatch failure says so. The tenant comes
        from the credential. Executing a batch is dispatching, so it requires
        the same `operator` or `security-admin` role and second factor as a
        single `POST /v1/dispatch`. Served by the verify service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PlanExecuteRequest'
      responses:
        '200':
          description: >-
            The batch report: every proposal's disposition, the tallies, and
            whether the batch stopped early. A refused proposal is reported in
            the body, never as an HTTP error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BatchReport'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          description: >-
            The principal's roles do not permit this action (`forbidden`), the
            action requires a second factor the credential does not carry
            (`mfa_required`), the credential is not scoped to a tenant
            (`no_tenant`), or `plan_id` was set and no matching digest-bound
            approval exists for that plan (`plan_not_approved`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This service was not wired with a batch executor (`no_orchestrator`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/plans/{id}:
    get:
      operationId: getPlan
      tags: [Plans]
      summary: Fetch one stored planning cycle
      description: |
        Returns one stored planning cycle by id, for reviewing or arguing with
        a past plan. The lookup is tenant-scoped: a plan stored under another
        tenant reports `not_found` rather than confirming the id exists
        elsewhere.

        The tenant comes from the credential. Reading requires the `operator`,
        `security-admin` or `auditor` role. Served by the planner service.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The stored planning cycle.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PlanRecord'
        '400':
          description: A plan id was not supplied in the path (`invalid_id`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '404':
          description: No plan is held under that id (`not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: No planner is wired for this installation (`planner_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/plans/{id}/approve:
    post:
      operationId: approvePlan
      tags: [Plans]
      summary: Approve a proposal set for execution
      description: |
        A reviewing operator approves an exact set of proposals from a proposed
        plan, binding the approval to a digest of that set. The approver must be
        a different principal than the plan's proposer, so approval is the
        two-person half of the planner/executor split.

        The approval is defense-in-depth over the engine choke-point, not a
        replacement for it: a later `POST /v1/plans/execute` that names this
        plan must present a proposal set whose digest matches this approval, and
        every proposal it dispatches still runs the authorization choke-point,
        the safe-mode class check and blast-radius admission under the executing
        operator's own principal. An approval widens nothing the choke-point
        would independently refuse.

        The tenant comes from the credential. Approving requires the `operator`
        or `security-admin` role and a second factor. Served by the planner
        service.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApprovePlanRequest'
      responses:
        '200':
          description: The approval, bound to the digest of the approved proposal set.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Approval'
        '400':
          description: >-
            A plan id was not supplied in the path (`invalid_id`), or the body
            could not be decoded (`malformed_json`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '404':
          description: No plan is held under that id (`not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '409':
          description: >-
            The approver is the plan's proposer; the two-person rule forbids
            approving one's own plan (`self_approval`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '422':
          description: >-
            The approved set is not valid (`bad_proposals`): it is empty, too
            large, or a proposal is missing a technique or target.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: No planner is wired for this installation (`planner_unavailable`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/engagements:
    post:
      operationId: createEngagement
      tags: [Engagements]
      summary: Create an autonomous engagement
      description: |
        Creates a durable autonomous engagement bounded by a pinned grant: a
        plan-execute-re-plan run that acts with no human reviewing each batch.

        This is a privileged action, so it requires the operator or
        security-admin role and a second factor, the same as issuing a grant.
        The hard gate is enforced here: an engagement can be created only against
        a grant that carries a durable lifetime dispatch budget
        (`max_total_dispatches` greater than zero), because that budget is the
        only bound on cumulative autonomous action once the human is out of the
        loop. Absent it, creation is refused with `no_durable_budget`.

        The engagement dispatches as tenant plus system, pinned to the named
        grant; the authorizing operator is recorded on the engagement as an audit
        fact, never as an authority. Creation is written to the tamper-evident
        audit log with who, the grant, and the caps. Served by the verify service.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEngagementRequest'
      responses:
        '201':
          description: The created engagement.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Engagement'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '415':
          $ref: '#/components/responses/UnsupportedMediaType'
        '422':
          $ref: '#/components/responses/ValidationFailed'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This service was not wired with autonomous engagements (`no_engagements`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
    get:
      operationId: listEngagements
      tags: [Engagements]
      summary: List autonomous engagements
      description: |
        Lists this tenant's autonomous engagements, newest first. Reading
        requires the operator, security-admin or auditor role. Served by the
        verify service.
      responses:
        '200':
          description: The tenant's engagements.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EngagementList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This service was not wired with autonomous engagements (`no_engagements`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/engagements/{id}:
    get:
      operationId: getEngagement
      tags: [Engagements]
      summary: Read one autonomous engagement
      description: |
        Reads one engagement by id, tenant-scoped. Requires the operator,
        security-admin or auditor role. Served by the verify service.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The engagement.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Engagement'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '404':
          description: No engagement is held under that id (`not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
  /v1/engagements/{id}/stop:
    post:
      operationId: stopEngagement
      tags: [Engagements]
      summary: Stop an autonomous engagement
      description: |
        Requests a running engagement stop. Idempotent: stopping an
        already-terminal engagement returns its current state unchanged. It
        requires the operator or security-admin role and a second factor, the
        same as creating one, and is recorded in the audit log. Served by the
        verify service.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: The engagement's current state.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Engagement'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '404':
          description: No engagement is held under that id (`not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
  /v1/findings/{id}/validate:
    post:
      operationId: validateFinding
      tags: [Findings]
      summary: Validate a scanner finding into a verdict
      description: |
        Replicates a scanner finding's condition with an active-safe technique and
        records a verdict: `exploitable` (the technique proved it), `false_positive`
        (it ran but could not), `benign` (present but unreachable), `exposed`
        (reachable and running a version the exploited-vulnerability catalogue
        marks known-exploitable -- reachability proven, the precondition asserted
        from the observed version, never proven by an exploit), or `inconclusive`
        (no technique maps to the finding's class, or the dispatch was refused).

        Replicating a finding dispatches a technique, so this carries the same
        dispatch privilege as a first dispatch, and it runs only against a target
        one of the tenant's signed grants already covers -- refused at the
        choke-point otherwise, which reads back as an inconclusive verdict rather
        than an error. The operator is recorded in the tamper-evident audit log.
        Served by the verify service.
      parameters:
        - name: id
          in: path
          required: true
          schema: { type: string }
          description: The finding's connector id.
      responses:
        '200':
          description: The recorded verdict.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FindingValidation'
        '400':
          $ref: '#/components/responses/MalformedBody'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '404':
          description: No finding is held under that id (`not_found`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This service was not wired to validate findings (`no_validation`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/findings/{id}/validations:
    get:
      operationId: listFindingValidations
      tags: [Findings]
      summary: Read a finding's validation history
      description: |
        Lists one finding's verdicts, newest first; the current verdict is the
        first entry. Reading requires the operator, security-admin or auditor
        role. Served by the verify service.
      parameters:
        - name: id
          in: path
          required: true
          schema: { type: string }
          description: The finding's connector id.
      responses:
        '200':
          description: The finding's validation history.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FindingValidationList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This service was not wired to validate findings (`no_validation`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/assets/{key}/findings:
    get:
      operationId: listAssetFindings
      tags: [Findings]
      summary: List an asset's scanner findings
      description: |
        Lists the scanner findings reported against one asset, most recently seen
        first -- the surface an operator picks a finding to validate from. Reading
        requires the operator, security-admin or auditor role. Served by the
        verify service.
      parameters:
        - name: key
          in: path
          required: true
          schema: { type: string }
          description: The asset's canonical key.
      responses:
        '200':
          description: The asset's scanner findings.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScannerFindingList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This service was not wired to validate findings (`no_validation`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
  /v1/findings:
    get:
      operationId: listFindings
      tags: [Findings]
      summary: List all of the tenant's findings
      description: |
        Lists every finding this tenant holds, so an operator sees what a run or a
        connector produced without first choosing an asset -- the tenant-wide
        inbox. Reading requires the operator, security-admin or auditor role.
        Served by the verify service.
      responses:
        '200':
          description: The tenant's findings.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScannerFindingList'
        '401':
          $ref: '#/components/responses/Unauthenticated'
        '403':
          $ref: '#/components/responses/GraphForbidden'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          description: This service was not wired to validate findings (`no_validation`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        An access token issued by this installation. Local verification is the
        only authentication path.
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        An Assay API key. The stored form is an argon2id hash keyed by the key's
        non-secret prefix; the secret itself is never stored. Every rejection
        returns the same answer, so the endpoint is not a prefix-enumeration
        oracle.
  parameters:
    GrantID:
      name: id
      in: path
      required: true
      description: The grant identifier.
      schema:
        type: string
    AssetKey:
      name: key
      in: path
      required: true
      description: >-
        The asset's canonical key, as returned by the asset list. It must be
        percent-encoded: a URL asset's key carries slashes, and an unencoded one
        would be read as several path segments.
      schema:
        type: string
      example: app.example.com
    AssetLimit:
      name: limit
      in: query
      required: false
      description: Maximum assets to return. Defaults to 100, capped at 500.
      schema:
        type: integer
        minimum: 1
        maximum: 500
        default: 100
    StepID:
      name: id
      in: path
      required: true
      description: The proven step's identifier, as carried on a reachability path's steps.
      schema:
        type: string
    ReportID:
      name: id
      in: path
      required: true
      description: The stored report's identifier, as returned when it was built.
      schema:
        type: string
    ReportLimit:
      name: limit
      in: query
      required: false
      description: Maximum reports to return. Defaults to 50, capped at 200.
      schema:
        type: integer
        minimum: 1
        maximum: 200
        default: 50
  responses:
    Unauthenticated:
      description: >-
        No credential, or one that did not verify (`unauthenticated`). The reason
        is never distinguished to the caller.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Forbidden:
      description: >-
        The principal's roles do not permit this action (`forbidden`), or the
        action requires a second factor the credential does not carry
        (`mfa_required`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    MalformedBody:
      description: >-
        The body could not be decoded (`malformed_json`), or it carried a field
        this endpoint does not read (`unknown_field`). Unknown fields are rejected
        rather than ignored, so a client that sends a field the handler would not
        honor is told so.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    UnsupportedMediaType:
      description: The request declared a content type other than application/json.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    RateLimited:
      description: >-
        The per-identity rate limit was exceeded (`rate_limited`). Retry after the
        interval named in the Retry-After header.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NoSigningKey:
      description: >-
        This installation has no engagement signing key, so it cannot issue,
        amend or approve an authorization (`no_signing_key`). It can still enforce
        the grants it already holds: verification uses the public key pinned on
        each grant and needs no signer.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    LicenseGeneratorUnavailable:
      description: >-
        This installation has no license signing key installed, so it cannot
        issue licenses (`generator_unavailable`). True on every install but the
        vendor's own.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NoCurrentLicense:
      description: >-
        This installation has no `ASSAY_LICENSE_FILE` configured, so there is
        no current license to report on or revoke (`no_license_configured`).
        True on a fresh Community install.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    LicenseRevocationUnavailable:
      description: >-
        This installation cannot record a license revocation
        (`license_revocation_unavailable`) — the revocation store is not
        wired on this service instance.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ValidationFailed:
      description: >-
        The request failed validation (`validation_failed`). The `fields` object
        names each problem.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    GraphForbidden:
      description: >-
        The principal's roles do not permit this action (`forbidden`), the action
        requires a second factor the credential does not carry (`mfa_required`),
        or the credential is not scoped to a tenant, so no asset can be
        attributed to it (`no_tenant`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    AssetNotFound:
      description: No asset is held under that key (`not_found`).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    GraphUnavailable:
      description: >-
        The exposure graph could not be reached (`graph_unavailable`), or this
        process was not wired with one (`no_asset_store`). The query that failed
        stays in the service log, correlated by the request id.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    VerifyUnavailable:
      description: >-
        The re-validation store or audit sink could not be reached
        (`verify_unavailable`), or this process was not wired with a dispatcher
        (`no_verifier`). A re-run that could not authorize is not this: that is a
        normal `inconclusive` result at 200. The failure detail stays in the
        service log, correlated by the request id.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    DispatchUnavailable:
      description: >-
        The dispatch machinery itself failed (`dispatch_unavailable`) — the
        kill-switch or grant store unreachable, evidence unsignable or
        unstorable — or this process was not wired with a dispatcher
        (`no_dispatcher`). A dispatch that could not authorize is not this:
        that is a normal `dispatched: false` result at 200. The failure detail
        stays in the service log, correlated by the request id.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    ReportUnavailable:
      description: >-
        The report could not be built or stored (`report_unavailable`), or this
        process was not wired with a report builder (`no_reporter`) or store
        (`no_report_store`). A finding whose evidence did not verify is not this:
        that finding is carried in `unsupported` in a report returned at 200 or
        201. The failure detail stays in the service log, correlated by the
        request id.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    ErrorDetail:
      type: object
      description: The error payload inside the uniform envelope's `error` field.
      required: [code, message]
      properties:
        code:
          type: string
          description: Stable, machine-readable identifier.
          examples: [forbidden]
        message:
          type: string
          description: >-
            Human-readable and safe to show a user. It carries no internal
            detail.
        request_id:
          type: string
          description: >-
            Quote this to an operator; it correlates with the server log.
        fields:
          type: object
          description: Per-field validation problems, on a validation failure.
          additionalProperties:
            type: string
    Error:
      type: object
      description: The uniform error body. Branch on `code`, never on `message`.
      required: [error]
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
    TechniqueList:
      type: object
      required: [techniques, deployment_class_ceiling]
      properties:
        techniques:
          type: array
          items:
            $ref: '#/components/schemas/Technique'
        deployment_class_ceiling:
          type: string
          description: |
            The safe-mode default for this deployment (ASSAY_SAFEMODE_DEFAULT). A
            grant can narrow what runs below this; nothing can widen it, and
            `active-intrusive` can never appear here.
          example: passive,active-safe
    Technique:
      type: object
      required: [id, name, safety_class, target_kinds, evidence, requires_beacon]
      properties:
        id:
          type: string
          description: Stable identifier used in evidence, audit records and reports.
        name:
          type: string
        description:
          type: string
        safety_class:
          type: string
          enum: [passive, active-safe]
          description: |
            The most this technique does to a target. `active-intrusive` never
            appears: no intrusive technique is authored in this product.
        target_kinds:
          type: array
          items:
            type: string
            enum: [domain, ip, cidr, url, asn, asset]
          description: |
            The scope rule kinds this technique can act on. A technique dispatched
            against a kind it does not declare is refused.
        evidence:
          type: array
          items:
            type: string
            enum: [observation, canary_read, beacon_callback, benign_marker]
          description: The forms of proof this technique produces.
        requires_beacon:
          type: boolean
          description: |
            Whether the proof depends on an out-of-band callback, in which case the
            engine must issue a beacon token before dispatch.
        params:
          type: array
          items:
            $ref: '#/components/schemas/TechniqueParam'
          description: |
            The parameters this technique accepts, supplied in a dispatch request's
            `params`. A required parameter missing from a dispatch is refused, so a
            console can render an input per entry and gate the run rather than
            discover the requirement from a 400.
        reach_target_param:
          type: string
          description: |
            The name of the parameter (when any) that carries a SECOND target whose
            reachability this technique proves — authorized separately against the
            engagement scope. Empty for a technique that only touches its own target.
    TechniqueParam:
      type: object
      required: [name, type, required]
      properties:
        name:
          type: string
          description: The parameter name — the key under which its value is sent in a dispatch request's `params`.
        type:
          type: string
          enum: [string, int, bool, enum, duration]
          description: |
            The value shape. `enum` is constrained to `values`; `string` to
            `pattern` and `max_len`; `int` and `duration` to `min` and `max`.
        description:
          type: string
        required:
          type: boolean
          description: Whether a dispatch is refused when this parameter is absent.
        pattern:
          type: string
          description: Anchored regular expression a `string` value must match.
        max_len:
          type: integer
          description: Maximum length of a `string` value.
        min:
          type: integer
          format: int64
          description: Minimum of an `int` or `duration` value, in the type's own unit.
        max:
          type: integer
          format: int64
          description: Maximum of an `int` or `duration` value, in the type's own unit.
        values:
          type: array
          items:
            type: string
          description: The legal values for an `enum` parameter.
    VersionInfo:
      type: object
      description: >-
        The build stamp of one Assay service. GET /v1/version is soft-authenticated:
        product/contract_version/schema_version answer an anonymous caller too (a peer
        product negotiates contract compatibility before it has credentials), but
        version/commit/edition/service appear only when the caller already has a valid
        credential — an exact commit hash is a fingerprint an anonymous scanner has no
        legitimate reason to read off a live edge.
      required: [product, contract_version, schema_version]
      properties:
        product:
          type: string
          const: assay
        version:
          type: string
          description: Build version, stamped at link time. A development build reports "dev".
        commit:
          type: string
          description: Git revision this build came from.
        edition:
          type: string
          description: Which build is running.
          enum: [CE, EE]
        service:
          type: string
          description: Which of the eight services this process is.
          enum: [authz, safemode, asset, engine, planner, prioritize, verify, report]
        contract_version:
          type: string
          description: Version of the shared suite contract this build carries.
        schema_version:
          type: string
          description: Major and minor version of the contract schemas.
    ContractVersion:
      type: object
      description: The contract version and the schemas this build can serve.
      required: [version, schema_version, schemas]
      properties:
        version:
          type: string
        schema_version:
          type: string
        schemas:
          type: array
          description: Names accepted by the contract schema endpoint.
          items:
            type: string
          examples:
            - [Edge, Entity, Envelope, Provenance]
    UnknownSchema:
      type: object
      description: >-
        The contract metadata handler's 404 body. It is not the uniform error
        envelope.
      required: [error, message, available]
      properties:
        error:
          type: string
          const: unknown_schema
        message:
          type: string
        available:
          type: array
          items:
            type: string
    SafetyClass:
      type: string
      description: |
        What a technique is permitted to do to a target. The set is closed: an
        unrecognized class is refused rather than treated as the safest one.

        `passive` observes only and changes no state. `active-safe` proves a
        condition by evidence rather than effect, such as reading a planted canary
        or an out-of-band beacon callback; no shells, writes, persistence,
        exfiltration or denial of service. `active-intrusive` changes state or can
        affect availability; it is off by default, needs a two-person-approved
        grant, and this build ships no intrusive technique.
      enum: [passive, active-safe, active-intrusive]
    ScopeRule:
      type: object
      description: >-
        One line of an engagement's scope. An empty scope authorizes nothing, and
        a deny rule beats any include however specific.
      required: [kind, value]
      properties:
        kind:
          type: string
          enum: [domain, ip, cidr, url, asn, asset]
        value:
          type: string
          description: >-
            The target expression: a domain, an address, a CIDR block, a URL, an
            AS number, or an asset id.
          examples: ["example.com"]
        exclude:
          type: boolean
          default: false
          description: Makes this a deny rule.
        exact_only:
          type: boolean
          default: false
          description: >-
            Restricts a domain rule to the exact name, excluding subdomains.
            Meaningless for other kinds.
        note:
          type: string
          description: >-
            The operator's own justification for this rule, such as a change-ticket
            or asset-owner reference. It is a free-text note, evidence only, and
            gates nothing.
    Rate:
      type: string
      description: A request ceiling written as count per unit, "5/s", "30/m" or "600/h".
      pattern: '^[0-9]+/[smh]$'
      examples: ["30/m"]
    OIDCProviderSettings:
      type: object
      required: [enabled, has_client_secret]
      properties:
        issuer:
          type: string
          description: The external identity provider's own OIDC issuer URL.
        client_id:
          type: string
        enabled:
          type: boolean
        has_client_secret:
          type: boolean
          description: False is a legitimate posture — a public, PKCE-only OAuth client — not a degraded one.
        updated_at:
          type: string
          format: date-time
        created_by:
          type: string
        not_configured:
          type: boolean
          description: True (with every other field absent) when no provider is stored for this tenant.
    OIDCProviderSaveRequest:
      type: object
      required: [issuer, client_id]
      properties:
        issuer:
          type: string
          description: Must be an http(s) URL. Not validated for reachability at save time — that happens for real on the next login attempt.
        client_id:
          type: string
        client_secret:
          type: string
          format: password
          description: Optional — empty is a valid public (PKCE-only) client. Omitting or clearing this on an update removes any previously stored secret outright.
        enabled:
          type: boolean
    TenableSettings:
      type: object
      required: [enabled, has_access_key, has_secret_key]
      properties:
        base_url:
          type: string
        enabled:
          type: boolean
        has_access_key:
          type: boolean
        has_secret_key:
          type: boolean
        updated_at:
          type: string
          format: date-time
        not_configured:
          type: boolean
          description: True (with every other field absent) when no connector is stored for this tenant.
    TenableSaveRequest:
      type: object
      required: [access_key, secret_key]
      properties:
        base_url:
          type: string
          description: Defaults to Tenable.io's own cloud API if omitted. Tenable.sc is a different product and is not supported.
        access_key:
          type: string
        secret_key:
          type: string
          format: password
        enabled:
          type: boolean
    QualysSettings:
      type: object
      required: [enabled, has_username, has_password]
      properties:
        base_url:
          type: string
        enabled:
          type: boolean
        has_username:
          type: boolean
        has_password:
          type: boolean
        updated_at:
          type: string
          format: date-time
        not_configured:
          type: boolean
          description: True (with every other field absent) when no connector is stored for this tenant.
    QualysSaveRequest:
      type: object
      required: [username, password]
      properties:
        base_url:
          type: string
          description: >-
            Defaults to Qualys's US Platform 1 API host if omitted. Most
            Qualys accounts are provisioned onto a different regional platform
            pod — find your own API server URL under Help > About in the
            Qualys portal and set it here if so.
        username:
          type: string
        password:
          type: string
          format: password
        enabled:
          type: boolean
    SnykSettings:
      type: object
      required: [enabled, has_api_token]
      properties:
        base_url:
          type: string
        org_id:
          type: string
        enabled:
          type: boolean
        has_api_token:
          type: boolean
        updated_at:
          type: string
          format: date-time
        not_configured:
          type: boolean
          description: True (with every other field absent) when no connector is stored for this tenant.
    SnykSaveRequest:
      type: object
      required: [org_id, api_token]
      properties:
        base_url:
          type: string
          description: >-
            Defaults to Snyk's default region (SNYK-US-01) if omitted. Snyk
            tokens are region-specific — an account on SNYK-US-02, SNYK-EU-01
            or SNYK-AU-01 must set this to that region's own API host, since
            a token is rejected outright by every other region's host.
        org_id:
          type: string
          description: The Snyk organization to query. Not secret — visible in that organization's own Snyk UI URLs.
        api_token:
          type: string
          format: password
        enabled:
          type: boolean
    GHScanSettings:
      type: object
      required: [enabled, has_token]
      properties:
        base_url:
          type: string
        org:
          type: string
        enabled:
          type: boolean
        has_token:
          type: boolean
        updated_at:
          type: string
          format: date-time
        not_configured:
          type: boolean
          description: True (with every other field absent) when no connector is stored for this tenant.
    GHScanSaveRequest:
      type: object
      required: [org, token]
      properties:
        base_url:
          type: string
          description: >-
            Defaults to GitHub.com's own cloud API if omitted. A GitHub
            Enterprise Server (self-hosted) customer must set this to
            https://HOSTNAME/api/v3 — a structurally different path, not
            just a different hostname.
        org:
          type: string
          description: The GitHub organization to query. Not secret — visible in that organization's own GitHub URL.
        token:
          type: string
          format: password
        enabled:
          type: boolean
    InsightVMSettings:
      type: object
      required: [enabled, has_username, has_password]
      properties:
        base_url:
          type: string
        enabled:
          type: boolean
        has_username:
          type: boolean
        has_password:
          type: boolean
        updated_at:
          type: string
          format: date-time
        not_configured:
          type: boolean
          description: True (with every other field absent) when no connector is stored for this tenant.
    InsightVMSaveRequest:
      type: object
      required: [base_url, username, password]
      properties:
        base_url:
          type: string
          description: >-
            The customer's own InsightVM Security Console, e.g.
            https://console.example.internal:3780. Unlike this API's other
            scanner connectors, there is no default — InsightVM is entirely
            self-hosted, with no cloud/regional host to fall back to.
        username:
          type: string
        password:
          type: string
          format: password
        enabled:
          type: boolean
    SemgrepSettings:
      type: object
      required: [enabled, has_token]
      properties:
        enabled:
          type: boolean
        has_token:
          type: boolean
        updated_at:
          type: string
          format: date-time
        not_configured:
          type: boolean
          description: True (with every other field absent) when no connector is stored for this tenant.
    SemgrepSaveRequest:
      type: object
      required: [token]
      properties:
        token:
          type: string
          format: password
        enabled:
          type: boolean
    VeracodeSettings:
      type: object
      required: [enabled, has_api_id, has_api_secret]
      properties:
        base_url:
          type: string
        enabled:
          type: boolean
        has_api_id:
          type: boolean
        has_api_secret:
          type: boolean
        updated_at:
          type: string
          format: date-time
        not_configured:
          type: boolean
          description: True (with every other field absent) when no connector is stored for this tenant.
    VeracodeSaveRequest:
      type: object
      required: [api_id, api_secret]
      properties:
        base_url:
          type: string
          description: >-
            Defaults to Veracode's Commercial region API host if omitted.
            European accounts must set this to https://api.veracode.eu and
            US Federal accounts to https://api.veracode.us.
        api_id:
          type: string
        api_secret:
          type: string
          format: password
          description: >-
            Must be a valid hex-encoded string once any region prefix
            ("vera01ei-" and similar) is stripped.
        enabled:
          type: boolean
    CheckmarxSettings:
      type: object
      required: [enabled, has_api_key]
      properties:
        base_url:
          type: string
        iam_base_url:
          type: string
        tenant_name:
          type: string
        enabled:
          type: boolean
        has_api_key:
          type: boolean
        updated_at:
          type: string
          format: date-time
        not_configured:
          type: boolean
          description: True (with every other field absent) when no connector is stored for this tenant.
    CheckmarxSaveRequest:
      type: object
      required: [tenant_name, api_key]
      properties:
        base_url:
          type: string
          description: Defaults to Checkmarx One's own commercial API host if omitted.
        iam_base_url:
          type: string
          description: Defaults to Checkmarx One's own commercial identity provider host if omitted.
        tenant_name:
          type: string
          description: The customer's own Checkmarx One account/tenant name, visible in their own login URL. Not secret.
        api_key:
          type: string
          format: password
          description: A Checkmarx One "API key" (an OAuth2 refresh token generated in account settings), not a customer-created OAuth client secret.
        enabled:
          type: boolean
    OpenVASSettings:
      type: object
      required: [enabled, has_username, has_password]
      properties:
        host:
          type: string
        port:
          type: integer
        enabled:
          type: boolean
        has_username:
          type: boolean
        has_password:
          type: boolean
        updated_at:
          type: string
          format: date-time
        not_configured:
          type: boolean
          description: True (with every other field absent) when no connector is stored for this tenant.
    OpenVASSaveRequest:
      type: object
      required: [host, username, password]
      properties:
        host:
          type: string
          description: >-
            The customer's own GVM/OpenVAS manager host, e.g.
            gvm.example.internal. Unlike this API's other scanner
            connectors this is not a URL — the Greenbone Management
            Protocol (GMP) is not HTTP, so there is no scheme or path. No
            default — GVM is entirely self-hosted, with no cloud/regional
            host to fall back to.
        port:
          type: integer
          description: Defaults to GMP's own documented manager port (9390) if omitted or zero.
        username:
          type: string
        password:
          type: string
          format: password
        enabled:
          type: boolean
    BurpEnterpriseSettings:
      type: object
      required: [enabled, has_api_key]
      properties:
        base_url:
          type: string
        enabled:
          type: boolean
        has_api_key:
          type: boolean
        updated_at:
          type: string
          format: date-time
        not_configured:
          type: boolean
          description: True (with every other field absent) when no connector is stored for this tenant.
    BurpEnterpriseSaveRequest:
      type: object
      required: [base_url, api_key]
      properties:
        base_url:
          type: string
          description: >-
            The customer's own Burp Suite Enterprise Edition server, e.g.
            https://burp.example.internal. Unlike most of this API's other
            scanner connectors, there is no default — Burp Suite Enterprise
            Edition is entirely self-hosted, with no cloud/regional host to
            fall back to.
        api_key:
          type: string
          format: password
          description: >-
            An API key created for a dedicated API user (Team > Add a new
            user, login type "API Key") in the Burp Suite Enterprise Edition
            server's own admin UI. The server does not allow an existing
            key to be retrieved again once issued.
        enabled:
          type: boolean
    AccountProfile:
      type: object
      required: [email, roles, totp_enabled, recovery_codes_remaining]
      properties:
        email:
          type: string
          format: email
        roles:
          type: array
          items:
            type: string
        totp_enabled:
          type: boolean
        recovery_codes_remaining:
          type: integer
          description: How many single-use recovery codes are still unconsumed. Zero if TOTP was never enrolled.
    AccountChangePasswordRequest:
      type: object
      required: [current_password, new_password]
      properties:
        current_password:
          type: string
          format: password
        new_password:
          type: string
          format: password
          description: Refused if shorter than 12 characters.
    MFACodeRequest:
      type: object
      description: >-
        A one-time code, required whenever the operation needs step-up
        proof — see each /v1/account/mfa/* operation's own description for
        exactly when — otherwise ignored. A body is always required even
        when `code` itself is not (send `{}`).
      properties:
        code:
          type: string
          description: A current six-digit TOTP code.
    MFATOTPEnrollResponse:
      type: object
      required: [otpauth_uri, secret]
      properties:
        otpauth_uri:
          type: string
          description: The otpauth:// URI to render as a QR code. Contains the secret.
        secret:
          type: string
          description: The raw base32 secret, for an authenticator app that only supports manual entry.
    MFARecoveryCodesResponse:
      type: object
      required: [recovery_codes]
      properties:
        recovery_codes:
          type: array
          items:
            type: string
          description: >-
            10 single-use fallback codes, in the clear. Shown exactly once
            — only their hashes are stored, and this response is the only
            place they are ever readable again.
    WebAuthnCeremonyOptions:
      type: object
      additionalProperties: true
      description: >-
        The WebAuthn options object exactly as the W3C WebAuthn Level 3
        specification's `PublicKeyCredentialCreationOptionsJSON` (register)
        or `PublicKeyCredentialRequestOptionsJSON` (login) defines it, with
        every binary field already base64url-encoded. A modern browser's
        `PublicKeyCredential.parseCreationOptionsFromJSON()` /
        `parseRequestOptionsFromJSON()` decodes this object directly into
        the argument `navigator.credentials.create()` / `.get()` expects;
        this schema is deliberately not modeled field-by-field, since the
        browser — not this API's own client code — is the only consumer
        that needs to interpret its contents.
    WebAuthnRegisterBeginResponse:
      type: object
      required: [ceremony_id, publicKey]
      properties:
        ceremony_id:
          type: string
          description: Pass back unchanged to POST /v1/account/webauthn/register/finish.
        publicKey:
          $ref: '#/components/schemas/WebAuthnCeremonyOptions'
    WebAuthnCeremonyResponse:
      type: object
      additionalProperties: true
      description: >-
        The browser's own response to `navigator.credentials.create()` or
        `.get()`, exactly as its `PublicKeyCredential.toJSON()` method
        produces it (W3C WebAuthn Level 3) — every binary field already
        base64url-encoded. Deliberately not modeled field-by-field for the
        identical reason WebAuthnCeremonyOptions is not: this API's own
        client code passes it through unopened.
    WebAuthnRegisterFinishRequest:
      type: object
      required: [ceremony_id, nickname, credential]
      properties:
        ceremony_id:
          type: string
          description: The value POST /v1/account/webauthn/register/begin returned.
        nickname:
          type: string
          description: A user-chosen label, e.g. "YubiKey 5C".
        credential:
          $ref: '#/components/schemas/WebAuthnCeremonyResponse'
    WebAuthnCredential:
      type: object
      required: [id, nickname, created_at]
      properties:
        id:
          type: string
          description: The base64url-encoded credential id.
        nickname:
          type: string
        created_at:
          type: string
          format: date-time
        last_used_at:
          type: string
          format: date-time
          description: Absent until the credential's first successful login.
    WebAuthnCredentialList:
      type: object
      required: [credentials]
      properties:
        credentials:
          type: array
          items:
            $ref: '#/components/schemas/WebAuthnCredential'
    WebAuthnLoginBeginRequest:
      type: object
      required: [pending_login_reference]
      properties:
        pending_login_reference:
          type: string
          description: >-
            The value POST /v1/auth/login returned alongside a
            totp_required response.
    WebAuthnLoginBeginResponse:
      type: object
      required: [ceremony_id, publicKey]
      properties:
        ceremony_id:
          type: string
          description: Pass back unchanged to POST /v1/auth/webauthn/login/finish.
        publicKey:
          $ref: '#/components/schemas/WebAuthnCeremonyOptions'
    WebAuthnLoginFinishRequest:
      type: object
      required: [pending_login_reference, ceremony_id, credential]
      properties:
        pending_login_reference:
          type: string
          description: The same value passed to POST /v1/auth/webauthn/login/begin.
        ceremony_id:
          type: string
          description: The value POST /v1/auth/webauthn/login/begin returned.
        credential:
          $ref: '#/components/schemas/WebAuthnCeremonyResponse'
    UserAccount:
      type: object
      description: >-
        A local login account, as the /v1/admin/users surface exposes it.
        Never a password hash, TOTP secret, or recovery-code hash —
        totp_enabled is a boolean only.
      required: [id, email, roles, totp_enabled, disabled, created_at, updated_at]
      properties:
        id:
          type: string
        email:
          type: string
          format: email
        roles:
          type: array
          items:
            type: string
        totp_enabled:
          type: boolean
        disabled:
          type: boolean
        disabled_at:
          type: string
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    UserAccountList:
      type: object
      required: [users]
      properties:
        users:
          type: array
          items:
            $ref: '#/components/schemas/UserAccount'
    CreateUserRequest:
      type: object
      required: [email]
      properties:
        email:
          type: string
          format: email
        roles:
          type: array
          items:
            type: string
          description: Defaults to ["operator"] when omitted.
    CreateUserResponse:
      allOf:
        - $ref: '#/components/schemas/UserAccount'
        - type: object
          required: [initial_password]
          properties:
            initial_password:
              type: string
              description: >-
                The account's freshly generated password, in the clear.
                Returned exactly once — only its hash is stored, so this
                response is the only time it is ever readable again.
    UpdateUserRolesRequest:
      type: object
      required: [roles]
      properties:
        roles:
          type: array
          minItems: 1
          items:
            type: string
    SCIMToken:
      type: object
      description: >-
        A SCIM provisioning token's metadata — never the secret or its
        argon2id hash.
      required: [id, prefix, created_at, created_by]
      properties:
        id:
          type: string
        prefix:
          type: string
          description: The clear-text lookup handle (12 characters). Not a secret on its own.
        created_at:
          type: string
          format: date-time
        created_by:
          type: string
          description: The subject of the admin principal that minted this token.
        revoked_at:
          type: string
          format: date-time
        last_used_at:
          type: string
          format: date-time
          description: >-
            Stamped when this token's prefix was presented to /scim/v2/* and
            the token was not revoked — an operational signal, not proof the
            secret verified.
    SCIMTokenList:
      type: object
      required: [tokens]
      properties:
        tokens:
          type: array
          items:
            $ref: '#/components/schemas/SCIMToken'
    CreateSCIMTokenResponse:
      allOf:
        - $ref: '#/components/schemas/SCIMToken'
        - type: object
          required: [secret]
          properties:
            secret:
              type: string
              description: >-
                The token's freshly generated secret, in the clear. Returned
                exactly once — only its argon2id hash is stored, so this
                response is the only time it is ever readable again.
    LoginRequest:
      type: object
      required: [tenant_id, email, password]
      properties:
        tenant_id:
          type: string
          description: >-
            The tenant to authenticate against. Read from the body, unlike every
            authenticated endpoint: at this point there is no principal yet to
            take it from, so this is the one request in this API where a caller
            names its own tenant and is believed.
        email:
          type: string
          format: email
        password:
          type: string
          format: password
        totp_code:
          type: string
          description: >-
            Required once the account has enrolled a second factor. Omitted on
            the first attempt; a 401 with code `totp_required` tells the caller
            to collect one and retry with the same email and password.
        recovery_code:
          type: string
          description: >-
            The alternate second factor for a lost authenticator. Checked only
            when `totp_code` is empty; a match consumes it — it cannot be used
            again. A code that does not match answers 401 `invalid_totp`, the
            same code a wrong TOTP code answers, so a caller cannot tell which
            factor type was attempted from the error alone.
      example:
        tenant_id: tenant-a
        email: operator@example.com
        password: correct horse battery staple
    LoginResponse:
      type: object
      required: [access_token, token_type, expires_at]
      properties:
        access_token:
          type: string
          description: A signed JWT access token, bearing this account's roles and AMR.
        token_type:
          type: string
          enum: [Bearer]
        expires_at:
          type: string
          format: date-time
    LoginMFARequiredResponse:
      type: object
      description: >-
        The uniform error envelope, with two extra top-level fields present
        only when `error.code` is `totp_required`: `pending_login_reference`
        and `methods`. Every other 401 reason POST /v1/auth/login answers
        (`invalid_credentials`, `invalid_totp`) omits both — they are
        therefore optional here, not required, even though a real
        `totp_required` response always carries them.
      required: [error]
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetail'
        pending_login_reference:
          type: string
          description: >-
            A single-use, opaque reference proving the password already
            verified for this account. Pass it to
            POST /v1/auth/webauthn/login/begin, or resubmit
            POST /v1/auth/login with the same tenant/email/password plus a
            totp_code — both complete the same pending login. Expires after
            5 minutes.
        methods:
          type: array
          items:
            type: string
            enum: [totp, webauthn]
          description: Which second factors this account can complete the pending login with.
      example:
        error:
          code: totp_required
          message: a one-time code is required to complete this login
        pending_login_reference: 8J3z1vQyv9Z1o8w3n1x2K7r4tG6bH0aE5cF9dL2mN8s
        methods: [totp, webauthn]
    PublicDemoStatus:
      type: object
      required: [enabled]
      properties:
        enabled:
          type: boolean
          description: >-
            Whether POST /v1/public/demo/session would currently mint a
            session. False on every build without the demo build tag,
            regardless of ASSAY_PUBLIC_DEMO.
    LicenseGeneratorInfo:
      type: object
      required: [available, tiers, presets]
      properties:
        available:
          type: boolean
          description: Whether this instance holds the vendor's private signing key.
        public_key:
          type: string
          description: >-
            Base64 Ed25519 public key. Present only when available is true.
        tiers:
          type: array
          items:
            type: string
          example: [community, enterprise]
        presets:
          type: object
          description: Tier -> default feature slugs granted when a request names none.
          additionalProperties:
            type: array
            items:
              type: string
    LicenseGenerateRequest:
      type: object
      required: [tenant, tier, valid_until]
      properties:
        license_id:
          type: string
          description: Leave empty to auto-generate a stable, collision-resistant id.
        tenant:
          type: string
          description: The customer/organization this license is for.
        tier:
          type: string
          enum: [community, enterprise]
        features:
          type: array
          items:
            type: string
          description: Leave empty to use the tier's default preset.
        seats:
          type: integer
        valid_from:
          type: string
          description: RFC3339 timestamp or YYYY-MM-DD. Empty defaults to now.
        valid_until:
          type: string
          description: >-
            RFC3339 timestamp or YYYY-MM-DD. Required — a license is never
            issued without an expiry.
        jurisdiction:
          type: string
          description: Optional export-control or data-residency note.
      example:
        tenant: acme-corp
        tier: enterprise
        seats: 10
        valid_until: "2027-01-01"
    IssuedLicenseList:
      type: object
      required: [licenses, grace_days]
      properties:
        grace_days:
          type: integer
        licenses:
          type: array
          items:
            $ref: '#/components/schemas/IssuedLicense'
    IssuedLicense:
      type: object
      required: [license_id, valid_until, state]
      properties:
        license_id:
          type: string
        tenant:
          type: string
        tier:
          type: string
        seats:
          type: integer
        valid_until:
          type: string
          format: date-time
        state:
          type: string
          enum: [active, grace, expired, revoked]
        grace_until:
          type: string
          format: date-time
        revoked_at:
          type: string
          format: date-time
    CurrentLicense:
      type: object
      description: >-
        This installation's own currently-loaded license (as opposed to
        `IssuedLicense`, which is one the vendor has issued to a customer),
        plus its local revocation state, if any. `revoked_by`, `actor` and
        `reason` are populated only when `revoked` is true.
      required: [license_id, tenant, tier, valid_until, seats, revoked]
      properties:
        license_id:
          type: string
        tenant:
          type: string
        tier:
          type: string
        valid_until:
          type: string
          format: date-time
        seats:
          type: integer
        revoked:
          type: boolean
        revoked_at:
          type: string
          format: date-time
        actor:
          type: string
          enum: [local, cloud-sync]
          description: >-
            Which authority imposed the current revocation: a local
            operator's own kill-switch, or a durable cache of the last
            revoked state observed from a live licensing service.
        reason:
          type: string
        revoked_by:
          type: string
          description: The identity (email or subject) that imposed the revocation.
    LicenseRevokeRequest:
      type: object
      properties:
        reason:
          type: string
      example:
        reason: compromised signing key
    IssueGrantRequest:
      type: object
      description: >-
        An issue or amend request. It carries no tenant and no requester: both come
        from the authenticated principal.
      required: [scope, allowed_classes, not_before, not_after]
      properties:
        grant_id:
          type: string
          description: >-
            Empty on a first issue. Naming an existing grant amends it as a new
            revision.
        scope:
          type: array
          description: The target set. An empty scope authorizes nothing.
          items:
            $ref: '#/components/schemas/ScopeRule'
        allowed_classes:
          type: array
          description: >-
            The safety ceiling for work under this grant. Including
            `active-intrusive` holds the grant for a second approver.
          items:
            $ref: '#/components/schemas/SafetyClass'
        not_before:
          type: string
          format: date-time
          description: Start of the engagement window. Required; an unbounded grant is not one.
        not_after:
          type: string
          format: date-time
          description: End of the engagement window.
        max_concurrency:
          type: integer
          description: >-
            Concurrent work ceiling. It may only be stricter than the deployment
            ceiling; omit it to inherit that ceiling.
        max_rate_per_target:
          $ref: '#/components/schemas/Rate'
        max_total_dispatches:
          type: integer
          description: >-
            Lifetime dispatch ceiling: at most this many dispatches may ever run
            under the grant. Zero (the default) means no ceiling; a positive
            value is required for a grant that will drive an autonomous
            engagement, and once spent the grant authorizes nothing until it is
            re-issued.
        approver_id:
          type: string
          description: >-
            Who is expected to approve an intrusive grant. Recorded so the approver
            can find the request. It is not evidence of approval.
    Grant:
      type: object
      description: >-
        A signed engagement authorization as returned over the wire. The signature
        and the pinned public key are omitted: they are verification material, not
        something a client needs.
      required:
        [id, revision, scope, allowed_classes, not_before, not_after, requester_id,
         issued_at, signing_key]
      properties:
        id:
          type: string
        revision:
          type: integer
          format: int64
          description: >-
            A grant is never mutated. An amendment is a new revision, and only the
            highest active revision authorizes anything.
        scope:
          type: array
          items:
            $ref: '#/components/schemas/ScopeRule'
        allowed_classes:
          type: array
          items:
            $ref: '#/components/schemas/SafetyClass'
        not_before:
          type: string
          format: date-time
        not_after:
          type: string
          format: date-time
        max_concurrency:
          type: integer
        max_rate_per_target:
          $ref: '#/components/schemas/Rate'
        max_total_dispatches:
          type: integer
          description: Lifetime dispatch ceiling. Zero means no ceiling.
        requester_id:
          type: string
          description: The principal that asked for the grant.
        approver_id:
          type: string
          description: >-
            The second principal that approved it. Present on an intrusive grant.
        issued_at:
          type: string
          format: date-time
        revoked_at:
          type: [string, "null"]
          format: date-time
          description: Set once the grant is revoked.
        signing_key:
          type: string
          description: >-
            The Transit key and version that signed this revision, as
            "name@version". The version is pinned so a signature keeps verifying
            after a key rotation.
    GrantList:
      type: object
      required: [grants]
      properties:
        grants:
          type: array
          items:
            $ref: '#/components/schemas/Grant'
    PendingApproval:
      type: object
      description: >-
        An intrusive grant held for a second principal. Nothing is signed and
        nothing is authorized until the approval lands.
      required: [status, grant_id, digest, requested_at]
      properties:
        status:
          type: string
          const: pending_approval
        grant_id:
          type: string
        digest:
          type: string
          description: >-
            What the approver must present. It binds the approval to exactly these
            contents, so amending the request invalidates it.
        approver_id:
          type: string
          description: Who the requester expects to approve.
        requested_at:
          type: string
          format: date-time
    ApproveRequest:
      type: object
      required: [digest]
      properties:
        digest:
          type: string
          description: The digest returned when the grant was held.
    RevokeRequest:
      type: object
      required: [reason]
      properties:
        reason:
          type: string
          description: Why the grant is being revoked. Recorded in the audit chain.
    AuthorizeRequest:
      type: object
      description: >-
        What the caller wants to do. It carries no tenant and no timestamp: a
        caller-supplied tenant would select another tenant's grants and a
        caller-supplied clock would defeat the engagement window.
      required: [class]
      properties:
        target:
          type: string
          description: >-
            A domain, address, CIDR member or URL. Set this or `asset_id`.
          examples: ["api.example.com"]
        asset_id:
          type: string
          description: >-
            An OAM asset id, for a grant scoped by inventory rather than by network
            expression.
        class:
          $ref: '#/components/schemas/SafetyClass'
    Decision:
      type: object
      description: >-
        The outcome of an authorization check. A refusal is a complete answer, not
        an error.
      required: [allowed, reason, target, class, budget]
      properties:
        allowed:
          type: boolean
        reason:
          type: string
          description: Which step decided.
          enum:
            - allowed
            - no_tenant_context
            - no_grant
            - kill_switch_engaged
            - revoked
            - expired
            - not_yet_valid
            - superseded
            - not_in_scope
            - explicitly_excluded
            - invalid_target
            - class_not_allowed
            - unknown_class
            - unsafe_rule
            - signature_invalid
            - malformed_grant
            - authorization_unavailable
            - audit_unavailable
        grant_id:
          type: string
          description: The grant that authorized the action. Empty on a refusal.
        revision:
          type: integer
          format: int64
        target:
          type: string
          description: >-
            The canonical form of what was checked, which is what the audit record
            carries. It is not the raw input.
        class:
          type: string
          description: The safety class that was checked, echoed as sent.
        budget:
          type: object
          description: >-
            The blast-radius ceiling for work under this decision, clamped to the
            deployment ceiling. A grant may narrow it; nothing can widen it.
          required: [max_concurrency, max_rate_per_target]
          properties:
            max_concurrency:
              type: integer
            max_rate_per_target:
              $ref: '#/components/schemas/Rate'
    KillRequest:
      type: object
      required: [reason]
      properties:
        reason:
          type: string
          description: Why the brake is being used. Recorded in the audit chain.
    KillState:
      type: object
      required: [engaged]
      properties:
        engaged:
          type: boolean
    EventBatch:
      type: object
      description: A batch of event envelopes. At least one, at most 500.
      required: [events]
      properties:
        events:
          type: array
          minItems: 1
          maxItems: 500
          items:
            $ref: '#/components/schemas/EventEnvelope'
    EventEnvelope:
      type: object
      description: >-
        One event, as defined by the shared suite contract. The authoritative JSON
        Schema is served under the name `Envelope` by the contract schema endpoint;
        this description exists so the surface is readable without fetching it.
      required:
        [schema_version, event_id, source_product, source_instance, occurred_at,
         type, tenant_ref, provenance]
      properties:
        schema_version:
          type: string
          description: The contract major and minor version this envelope conforms to.
          examples: ["1.0"]
        event_id:
          type: string
          format: uuid
          description: >-
            Deduplication key. Delivery is at-least-once, so a redelivered id is
            answered as a duplicate.
        source_product:
          type: string
          description: Which product emitted this.
          enum: [vigil, engage, mosaic, forge]
        source_instance:
          type: string
          description: >-
            Opaque install id, so a consumer can tell two deployments of the same
            product apart.
        occurred_at:
          type: string
          format: date-time
          description: When the event happened, in UTC.
        type:
          type: string
          enum:
            - asset.discovered
            - asset.changed
            - finding.created
            - finding.updated
            - entity.observed
        tenant_ref:
          type: string
          maxLength: 128
          description: >-
            The tenant identifier, never data. It must equal the authenticated
            principal's tenant, or the envelope is rejected.
        oam_entity:
          type: object
          description: >-
            The OAM entity this event is about. Its schema is served under the name
            `Entity`. Required on `asset.discovered`, `asset.changed` and
            `entity.observed`: those carry no information without one.
          additionalProperties: true
        oam_edges:
          type: array
          description: >-
            Relationships asserted alongside the entity. The edge schema is served
            under the name `Edge`.
          items:
            type: object
            additionalProperties: true
        provenance:
          $ref: '#/components/schemas/Provenance'
        severity:
          type: string
          description: Present on finding events only.
          enum: [info, low, medium, high, critical]
        signature:
          type: string
          description: Optional detached signature, for trust across deployments.
        extra:
          type: object
          description: >-
            Forward-compatible additional data. A consumer on an older minor
            version keeps unknown top-level fields here rather than dropping them.
          additionalProperties: true
    Provenance:
      type: object
      description: >-
        The chain of custody for an event's claim: what tool said this, where it
        looked, when, and what exactly it saw.
      required: [collector, collected_at]
      properties:
        collector:
          type: string
          description: >-
            The tool and version that made the observation, as "name@version". The
            version matters: a finding from a version with a known false-positive
            class is worth less.
          examples: ["subfinder@2.6.3"]
        source_url:
          type: string
          format: uri
          description: Where the observation came from, when there is a URL.
        collected_at:
          type: string
          format: date-time
          description: >-
            When the observation was made, in UTC. Distinct from `occurred_at`: a
            scan may be processed hours after it ran.
        content_hash:
          type: string
          pattern: '^sha256:[0-9a-f]{64}$'
          description: >-
            Digest over the raw observed content. It is what tells "the same page,
            re-fetched" from "the page changed".
        method:
          type: string
          description: How it was obtained.
          examples: ["passive-dns"]
    Ack:
      type: object
      description: >-
        The verdict on a batch, per event. Duplicates are reported rather than
        silently dropped, so a producer can notice it is re-sending.
      required: [accepted, duplicates]
      properties:
        accepted:
          type: integer
        duplicates:
          type: integer
        rejected:
          type: array
          description: >-
            Permanently refused. The data is wrong for this consumer and re-sending
            it cannot change the outcome.
          items:
            $ref: '#/components/schemas/Reject'
        deferred:
          type: array
          description: >-
            Transiently failed. Send exactly these events again; the rest of the
            batch was handled.
          items:
            $ref: '#/components/schemas/Reject'
    Reject:
      type: object
      description: Why one envelope in the batch was refused or deferred.
      required: [event_id, index, reason]
      properties:
        event_id:
          type: string
          description: Echoed from the envelope, clipped to 64 characters.
        index:
          type: integer
          description: Position in the submitted batch.
        reason:
          type: string
          description: >-
            A stable code, optionally followed by a colon and detail for the
            producer's logs. Branch on the code, never on the detail. In `rejected`
            the codes are `invalid_envelope`, `tenant_mismatch`,
            `peer_not_permitted` and `consumer_rejected`. In `deferred` the code is
            `transient`.
          examples: ["tenant_mismatch"]
    EntityType:
      type: string
      description: >-
        An OAM entity type. The set is the shared suite vocabulary; a type
        outside it is refused rather than stored in a sub-graph nothing queries.
      enum:
        - FQDN
        - IPAddress
        - Netblock
        - ASN
        - TLSCertificate
        - Service
        - URL
        - EmailAddress
        - Person
        - Organization
        - Identifier
        - PhoneNumber
        - Account
        - Package
        - FileHash
        - CVE
    EdgeType:
      type: string
      description: >-
        An OAM relationship type. Each is constrained to the entity types it can
        meaningfully connect, except `associated_with`, which is the deliberate
        escape hatch.
      enum:
        - resolves_to
        - contains
        - announces
        - serves
        - secured_by
        - redirects_to
        - associated_with
        - owns
        - member_of
        - depends_on
        - affected_by
    AssetSource:
      type: string
      description: |
        Where an assertion came from. It is kept on every asset and every edge
        because a graph that cannot say who claimed something cannot be argued
        with.

        `vigil` is discovered surface that arrived over the event contract.
        `operator` is inventory a person supplied. `enrichment` is context from
        the optional enrichment gateway. `validation` is this engine recording
        what it observed while running a technique.
      enum: [vigil, operator, enrichment, validation]
    Tag:
      type: object
      description: >-
        An attributed assertion about an asset. Tags are additive and never
        overwrite each other: two sources disagreeing about whether a host is
        production is information, not a conflict to resolve by discarding one.
      required: [type, source]
      properties:
        type:
          type: string
        value:
          type: string
        confidence:
          type: number
          minimum: 0
          maximum: 1
        source:
          type: string
          description: Who asserted it. An unattributed tag cannot be reconciled and is refused.
        observed_at:
          type: string
          format: date-time
    Asset:
      type: object
      description: One asset in the exposure graph.
      required: [key, type, source, first_seen, last_seen]
      properties:
        key:
          type: string
          description: >-
            The canonical dedup key. It is computed by the shared model, never
            locally, because it is the identity the suite's products join on.
          examples: ["app.example.com"]
        type:
          $ref: '#/components/schemas/EntityType'
        content:
          type: object
          description: Typed, per-type detail carried from the source.
          additionalProperties: true
        tags:
          type: array
          items:
            $ref: '#/components/schemas/Tag'
        source:
          $ref: '#/components/schemas/AssetSource'
        first_seen:
          type: string
          format: date-time
          description: When this deployment first learned of the asset.
        last_seen:
          type: string
          format: date-time
          description: >-
            When it was last observed. It is the collector's own timestamp, not
            when the message was processed, so redelivering an old event does not
            report a decommissioned host as live.
    GraphEdge:
      type: object
      description: >-
        A discovered relationship between two assets. It describes structure, not
        reachability, and is stored apart from proven steps so a discovery
        assertion is never read later as evidence.
      required: [type, from_key, from_type, to_key, to_type, source, first_seen, last_seen]
      properties:
        type:
          $ref: '#/components/schemas/EdgeType'
        from_key:
          type: string
        from_type:
          $ref: '#/components/schemas/EntityType'
        to_key:
          type: string
        to_type:
          $ref: '#/components/schemas/EntityType'
        tags:
          type: array
          items:
            $ref: '#/components/schemas/Tag'
        source:
          $ref: '#/components/schemas/AssetSource'
        first_seen:
          type: string
          format: date-time
        last_seen:
          type: string
          format: date-time
    AssetList:
      type: object
      required: [assets, limit]
      properties:
        assets:
          type: array
          items:
            $ref: '#/components/schemas/Asset'
        limit:
          type: integer
          description: The cap that was applied, echoed so a short page is not mistaken for the end.
    AssetDetail:
      type: object
      required: [asset, edges]
      properties:
        asset:
          $ref: '#/components/schemas/Asset'
        edges:
          type: array
          description: The discovered relationships leaving this asset.
          items:
            $ref: '#/components/schemas/GraphEdge'
    InventoryRequest:
      type: object
      description: An operator's asset list. At least one, at most 500.
      required: [assets]
      properties:
        assets:
          type: array
          minItems: 1
          maxItems: 500
          items:
            $ref: '#/components/schemas/InventoryItem'
    InventoryItem:
      type: object
      required: [type, value]
      properties:
        type:
          $ref: '#/components/schemas/EntityType'
        value:
          type: string
          description: >-
            The raw value as a person would write it. It is canonicalized on the
            way in, so two spellings of one asset do not become two assets.
          examples: ["db.example.com"]
    InventoryResult:
      type: object
      description: What a submission changed.
      required: [entities, edges]
      properties:
        entities:
          type: integer
          description: How many assets were stored.
        edges:
          type: integer
          description: >-
            Always zero here. An operator supplies assets; relationships come
            from discovery and reachability comes from proof.
        refused:
          type: array
          description: >-
            Present only when something was refused. Nothing is dropped silently:
            a producer or an operator whose input is not being stored has to be
            able to see why.
          items:
            $ref: '#/components/schemas/AssetRefusal'
    AssetRefusal:
      type: object
      description: One assertion that was not stored, and why.
      required: [kind, index, ref, reason]
      properties:
        kind:
          type: string
          enum: [entity, edge]
        index:
          type: integer
          description: >-
            Position in the submitted list. It is -1 for the single entity on an
            event envelope, which has no position.
        ref:
          type: string
          description: What was refused, as it was supplied.
        reason:
          type: string
          description: >-
            Why it was refused: a value that will not canonicalize, a type
            outside the shared model, or a relationship that is meaningless
            between the two types it connects.
    SafetyRelation:
      type: string
      description: |
        What a proven step demonstrated. The vocabulary is deliberately small:
        each value has to mean something an operator can act on, and one that
        grows without discipline stops being comparable across engagements.

        `reaches` means the source can make the target respond. `can_read` means
        data belonging to the target was readable through the source,
        demonstrated with a planted canary rather than real data. `can_invoke`
        means the source can cause the target to act, proved out of band by a
        beacon callback. `exposes` means the source discloses information about
        the target that narrows an attacker's work.
      enum: [reaches, can_read, can_invoke, exposes]
    ProvenStep:
      type: object
      description: >-
        One demonstrated hop of an attacker path. It is a claim about an
        experiment rather than about the environment, so it carries what makes an
        experiment checkable: the technique that ran, the evidence bundle it
        produced, and the exact authorization revision under which it ran.
      required:
        [id, from_key, to_key, relation, technique_id, safety_class,
         evidence_bundle_id, grant_id, grant_revision, established_at]
      properties:
        id:
          type: string
        from_key:
          type: string
        to_key:
          type: string
        relation:
          $ref: '#/components/schemas/SafetyRelation'
        technique_id:
          type: string
        safety_class:
          type: string
          description: >-
            What the technique did to the target. `active-intrusive` never
            appears: no intrusive technique is authored in this product, and a
            step claiming that class did not come from this engine.
          enum: [passive, active-safe]
        evidence_bundle_id:
          type: string
          description: >-
            The signed bundle that proves this step. A step without one is an
            assertion, not proof, and is refused before it is stored.
        grant_id:
          type: string
        grant_revision:
          type: integer
          format: int64
        established_at:
          type: string
          format: date-time
        superseded_at:
          type: [string, "null"]
          format: date-time
          description: >-
            Set when a later run failed to reproduce the step. The record is kept
            rather than deleted: that a path once existed and no longer does is
            the evidence a remediation worked. A superseded step is excluded from
            reachability.
        synthetic:
          type: boolean
          description: >-
            True for a seeded public-demo step that is not real proof; absent or
            false on a genuine, technique-produced step. The console renders a
            synthetic step as clearly-labeled demo data, never as proof.
    ProvenPath:
      type: object
      description: A chain of proven steps ending at a crown jewel.
      required: [target, length, highest_class, keys, evidence_bundle_ids, steps]
      properties:
        target:
          $ref: '#/components/schemas/CrownJewel'
        length:
          type: integer
          description: Hops in the chain.
        highest_class:
          type: string
          description: >-
            The most invasive class used anywhere along the chain. A chain proved
            entirely by passive observation is a different conversation with a
            customer than one that needed active-safe input.
          enum: [passive, active-safe]
        keys:
          type: array
          description: The assets the chain passes through, in order.
          items:
            type: string
        evidence_bundle_ids:
          type: array
          description: The bundles that together prove the chain. Fetch these to check it.
          items:
            type: string
        steps:
          type: array
          items:
            $ref: '#/components/schemas/ProvenStep'
    Reachability:
      type: object
      description: The proven chains from one asset to this tenant's crown jewels.
      required: [from, paths, truncated, crown_jewels, max_depth, max_paths]
      properties:
        from:
          type: string
          description: The asset the search started from.
        paths:
          type: array
          items:
            $ref: '#/components/schemas/ProvenPath'
        truncated:
          type: boolean
          description: >-
            A bound was hit and the answer is incomplete. A capped result that
            presented itself as exhaustive is how "no path to your crown jewels"
            becomes a claim nobody checked.
        truncated_reason:
          type: string
          description: Which bound stopped the search. Empty when the search completed.
        crown_jewels:
          type: integer
          description: >-
            How many crown jewels the answer was measured against. Zero means
            nobody has declared what matters yet, so an empty path list says
            nothing about exposure.
        max_depth:
          type: integer
          description: The depth bound that was applied.
        max_paths:
          type: integer
          description: The path-count bound that was applied.
    CrownJewel:
      type: object
      description: >-
        An operator's assertion that an asset is what the engagement is about.
        Nothing infers it.
      required: [entity_key, label, criticality, set_by, set_at]
      properties:
        entity_key:
          type: string
          description: The canonical key of the asset. It must already be in the graph.
        label:
          type: string
          description: What the operator calls it. It is what the report names.
        criticality:
          type: integer
          minimum: 1
          maximum: 5
          description: Orders crown jewels against each other. Higher matters more.
        set_by:
          type: string
          description: The principal that declared it, taken from the credential.
        set_at:
          type: string
          format: date-time
        note:
          type: string
          description: >-
            Why this asset is critical. It is what a reader of the report needs
            and what an auditor asks about.
    CrownJewelList:
      type: object
      required: [crown_jewels]
      properties:
        crown_jewels:
          type: array
          items:
            $ref: '#/components/schemas/CrownJewel'
    CrownJewelRequest:
      type: object
      description: >-
        A crown-jewel declaration. It carries no actor and no timestamp: both come
        from the credential and the clock.
      required: [label, criticality]
      properties:
        label:
          type: string
          description: What to call this asset in the report.
        criticality:
          type: integer
          minimum: 1
          maximum: 5
        note:
          type: string
          description: Why it is critical.
    DispatchRequest:
      type: object
      description: >-
        What to run and against what. Exactly one of `target` or `asset_id` is
        required.
      required: [technique_id]
      properties:
        technique_id:
          type: string
          description: The technique to dispatch, as listed by GET /v1/techniques.
        target:
          type: string
          description: >-
            A bare domain, address, CIDR member or URL — the same form the
            authorization choke-point expects, never a graph key. Mutually
            exclusive with `asset_id`.
          examples: ["example.com"]
        asset_id:
          type: string
          description: >-
            An existing graph asset's key, for a grant scoped by inventory
            rather than by network expression. Mutually exclusive with
            `target`.
        params:
          type: object
          additionalProperties:
            type: string
          description: >-
            The technique's own declared parameters, by name. A technique with
            no parameters ignores this; an unknown or malformed parameter is
            refused with `dispatched: false`.
    DispatchResult:
      type: object
      description: The outcome of one dispatch attempt.
      required: [dispatched, proven]
      properties:
        dispatched:
          type: boolean
          description: >-
            Whether the technique actually ran. `false` with `reason` is the
            ordinary refusal outcome — never an HTTP error.
        reason:
          type: string
          description: >-
            Why dispatch was refused, or `dispatched` on success. Absent only
            when it would be redundant.
        proven:
          type: boolean
          description: What the technique concluded, when it ran. Meaningless if `dispatched` is false.
        conclusion:
          type: string
          description: The technique's own account of what it observed. Present when it ran.
        evidence_bundle_id:
          type: string
          description: The signed evidence bundle the run produced. Present when it ran.
        step_id:
          type: string
          description: >-
            The graph step recorded when the technique proved a path. Absent
            when it ran but proved nothing, or did not run.
        exposure:
          $ref: '#/components/schemas/DispatchExposure'
        exposure_error:
          type: string
          description: >-
            Set instead of `exposure` when a fired discovery technique proved an
            exposure that could not be recorded. The dispatch itself still
            succeeded and its evidence was saved, so this rides a 200 rather than
            an error status.
    DispatchExposure:
      type: object
      description: >-
        The finding a proven discovery dispatch recorded, with the fired verdict
        against it. Present on a dispatch result only when a discovery technique
        fired and proved a new exposure; absent otherwise.
      required: [finding, validation]
      properties:
        finding:
          $ref: '#/components/schemas/ScannerFinding'
        validation:
          $ref: '#/components/schemas/FindingValidation'
    PlanExecuteRequest:
      type: object
      description: An operator-approved set of proposals to dispatch as one batch, under a budget.
      required: [proposals, budget]
      properties:
        proposals:
          type: array
          description: The approved proposals, dispatched in submission order. At least one, at most fifty.
          items:
            $ref: '#/components/schemas/PlanExecuteProposal'
        budget:
          $ref: '#/components/schemas/PlanExecuteBudget'
        plan_id:
          type: string
          description: >-
            Optional. When set to a plan's (`planner_replay`) id, this dispatch
            requires a matching digest-bound approval for that plan: the
            submitted proposal set's digest must equal an approval recorded
            against the plan, or the batch is refused with `plan_not_approved`.
            When omitted, execute behaves as before and needs no approval.
    PlanExecuteProposal:
      type: object
      description: One approved proposal to dispatch. Its shape mirrors a planner proposal's dispatchable fields.
      required: [technique_id, target]
      properties:
        technique_id:
          type: string
          description: The technique to run.
        target:
          type: string
          description: >-
            The target, as the planner proposed it: a type-qualified graph key
            (`type:canonical`) or a bare target. It is resolved to the same bare
            form the choke-point authorizes.
        params:
          type: object
          additionalProperties:
            type: string
          description: Technique parameters.
    PlanExecuteBudget:
      type: object
      description: >-
        The batch's blast-radius ceiling. It only ever subtracts: it stops
        dispatches the choke-point would allow and can never permit one it would
        refuse.
      required: [max_dispatches]
      properties:
        max_dispatches:
          type: integer
          description: How many dispatches the batch may attempt in total. At least one.
        max_per_target:
          type: integer
          description: >-
            Optionally caps dispatches against any one target. Zero, the
            default, means no per-target cap beyond the total.
    BatchReport:
      type: object
      description: >-
        The outcome of one batch. Every submitted proposal is accounted for in
        `outcomes`, in submission order; a batch that stopped early says so and why.
      required: [batch_id, attempted, dispatched, proven, refused, skipped, outcomes]
      properties:
        batch_id:
          type: string
          description: Identifies this batch. Ties the outcomes here to the batch's audit record.
        attempted:
          type: integer
          description: How many proposals were actually dispatched. The budget counts these.
        dispatched:
          type: integer
          description: How many dispatches ran (a refusal is not counted here).
        proven:
          type: integer
          description: How many dispatches proved their condition.
        refused:
          type: integer
          description: How many dispatches ran the gates and were declined — out of scope, class, kill-switch.
        skipped:
          type: integer
          description: How many proposals the budget stopped before dispatch.
        stopped:
          type: boolean
          description: Whether the batch did not attempt every proposal (budget reached, context ended, or a hard failure).
        stop_reason:
          type: string
          description: Why the batch stopped, when it did.
        outcomes:
          type: array
          description: Every submitted proposal's disposition, in submission order.
          items:
            $ref: '#/components/schemas/BatchOutcome'
    BatchOutcome:
      type: object
      description: What became of one submitted proposal.
      required: [index, technique_id, target]
      properties:
        index:
          type: integer
          description: The proposal's position in the submitted set.
        technique_id:
          type: string
        target:
          type: string
          description: The submitted target, echoed even for a skipped proposal.
        dispatched:
          type: boolean
          description: Whether the dispatch ran.
        proven:
          type: boolean
          description: Whether the technique proved its condition.
        reason:
          type: string
          description: The dispatch outcome's reason, or why this proposal was skipped.
        evidence_bundle_id:
          type: string
          description: The signed evidence bundle the run produced, when it produced one.
        step_id:
          type: string
          description: The graph step recorded when the technique proved a path.
        skipped:
          type: boolean
          description: Whether the budget stopped this proposal before it was dispatched.
    ApprovePlanRequest:
      type: object
      description: A reviewing operator's approval of an exact set of a plan's proposals.
      required: [proposals]
      properties:
        proposals:
          type: array
          description: The exact proposal set being approved. The approval is bound to a digest of this set.
          items:
            $ref: '#/components/schemas/PlanExecuteProposal'
        note:
          type: string
          description: An optional reviewer note, recorded with the approval.
    Approval:
      type: object
      description: A recorded plan approval, bound to the digest of the approved proposal set.
      required: [plan_id, digest, approver_id, approved_at]
      properties:
        plan_id:
          type: string
          description: The plan (`planner_replay` id) this approval covers.
        digest:
          type: string
          description: The digest of the approved proposal set, which a later execute must match.
        approver_id:
          type: string
          description: The principal that approved, always distinct from the plan's proposer.
        approved_at:
          type: string
          format: date-time
          description: When the approval was recorded.
    CreateEngagementRequest:
      type: object
      description: An operator's request to create an autonomous engagement.
      required: [grant_id, max_cycles]
      properties:
        grant_id:
          type: string
          description: The grant to pin the engagement to. It must carry a durable lifetime dispatch budget.
        mode:
          type: string
          enum: [planner, validate]
          default: planner
          description: >-
            What each cycle does. planner (the default) drives the plan/execute
            loop and needs a configured planner model; validate works through the
            tenant's not-yet-validated findings under the pinned grant and needs no
            model, so it runs on an air-gapped install.
        max_dispatches:
          type: integer
          description: Per-cycle batch dispatch ceiling. Zero uses the default.
        max_per_target:
          type: integer
          description: Per-cycle, per-target dispatch ceiling. Zero means no per-target cap.
        max_cycles:
          type: integer
          description: The cycle-count ceiling for the whole run. At least one.
    Engagement:
      type: object
      description: One autonomous engagement.
      required: [id, grant_id, authorizer, status, mode, max_cycles, cycle, next_run_at, created_at, updated_at]
      properties:
        id:
          type: string
        grant_id:
          type: string
          description: The pinned grant; its signed budget and window bound the run.
        authorizer:
          type: string
          description: The operator who created it, recorded as an audit fact, not an authority.
        status:
          type: string
          enum: [running, stopped, completed, failed]
        mode:
          type: string
          enum: [planner, validate]
          description: "What each cycle does: drive the planner loop, or validate findings."
        stop_requested:
          type: boolean
        max_dispatches:
          type: integer
        max_per_target:
          type: integer
        max_cycles:
          type: integer
        cycle:
          type: integer
          description: How many cycles have completed. Durable across restarts.
        next_run_at:
          type: string
          format: date-time
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    EngagementList:
      type: object
      required: [engagements]
      properties:
        engagements:
          type: array
          items:
            $ref: '#/components/schemas/Engagement'
    FindingValidation:
      type: object
      description: One attempt to validate a scanner finding, and its verdict.
      required: [id, tenant_id, finding_id, verdict, reason, validated_at]
      properties:
        id: { type: string }
        tenant_id: { type: string }
        finding_id: { type: string }
        verdict:
          type: string
          enum: [exploitable, false_positive, benign, exposed, inconclusive]
          description: >-
            exploitable (the technique replicated the condition), false_positive
            (it ran but could not), benign (present but unreachable), exposed
            (reachable and running a catalogue-known-exploitable version --
            reachability proven, the exploitable precondition asserted from the
            version, never proven by an exploit), inconclusive (no technique maps
            to the class, or the dispatch was refused).
        provenance:
          type: string
          enum: [fired, asserted-by-tool, asserted-by-operator, ""]
          description: >-
            The evidence tier the verdict rests on. A verdict is
            confirmed-exploitable only when `verdict` is `exploitable` and
            `provenance` is `fired`; an asserted tier is exploitable-by-assertion
            and never renders as confirmed.
        technique_id: { type: string }
        target: { type: string }
        reason: { type: string }
        evidence_bundle_id:
          type: string
          description: The signed evidence bundle the technique produced, when it proved anything.
        step_id:
          type: string
          description: The graph step recorded for an edge-producing proof; empty for a self-property.
        validated_at: { type: string, format: date-time }
    FindingValidationList:
      type: object
      required: [validations]
      properties:
        validations:
          type: array
          items:
            $ref: '#/components/schemas/FindingValidation'
    ScannerFinding:
      type: object
      description: One scanner finding reported against an asset -- a vendor claim, never proof.
      required: [id, vendor, entity_key, entity_type, title, severity, first_seen, last_seen]
      properties:
        id: { type: string }
        vendor: { type: string }
        entity_key: { type: string }
        entity_type: { type: string }
        cve: { type: string }
        title: { type: string }
        severity: { type: string }
        cvss: { type: number, format: double }
        port: { type: integer, description: 'Service port the finding is against, when the connector reported one; absent/0 if unset.' }
        path: { type: string, description: 'URL path the finding is against, when the connector reported one; absent/empty if unset.' }
        first_seen: { type: string, format: date-time }
        last_seen: { type: string, format: date-time }
        resolved_at:
          type: string
          format: date-time
          description: The vendor's own signal it was remediated; absent while open.
    ScannerFindingList:
      type: object
      required: [findings]
      properties:
        findings:
          type: array
          items:
            $ref: '#/components/schemas/ScannerFinding'
    VerifyResult:
      type: object
      description: >-
        The outcome of re-verifying one proven step. The three outcomes are kept
        distinct: an inconclusive re-run is never reported as a remediation.
      required: [step_id, outcome, reason, at]
      properties:
        step_id:
          type: string
          description: The step that was re-checked.
        outcome:
          type: string
          enum: [reproduced, remediated, inconclusive]
          description: |
            What the re-run established.

            - `reproduced`: the path was demonstrated again; the exposure is open.
            - `remediated`: the re-run ran under a current authorization and proved
              nothing; the fix is confirmed. This is the only outcome that counts
              as a fix.
            - `inconclusive`: the re-run did not happen, so nothing was learned and
              the finding is untouched.
        reason:
          type: string
          description: >-
            For an inconclusive result, why the re-run could not run. For the other
            two, what the re-run reported. It is what lets an operator tell "we
            confirmed the fix" from "we could not check".
        new_evidence_bundle_id:
          type: string
          description: >-
            The bundle from the re-run, when one ran. A reproduced finding gets
            fresh evidence; a remediated one gets the evidence that the path is
            gone. Absent when inconclusive.
        new_step_id:
          type: string
          description: >-
            The fresh step the dispatcher recorded on a reproduce. The old step is
            superseded in favor of it, so the graph carries current evidence
            rather than a stale timestamp. Absent otherwise.
        at:
          type: string
          format: date-time
          description: When the re-verification ran.
    SweepRequest:
      type: object
      description: >-
        Options for a sweep. The body is required, but every field is optional:
        send `{}` to re-check every active finding now.
      properties:
        interval:
          type: string
          description: >-
            How long a finding must have stood to be due, as a Go duration such as
            `168h`. Absent or zero re-checks every active finding now. Must not be
            negative.
          example: 168h
    SweepReport:
      type: object
      description: The summary of one re-validation pass.
      required: [checked, reproduced, remediated, inconclusive, stopped, unchecked]
      properties:
        checked:
          type: integer
          description: How many findings were re-checked.
        reproduced:
          type: integer
          description: Of those, how many were demonstrated again.
        remediated:
          type: integer
          description: Of those, how many re-ran clean and are confirmed fixed.
        inconclusive:
          type: integer
          description: Of those, how many could not be re-run and were left untouched.
        results:
          type: array
          description: The per-step outcomes, in the order they were checked.
          items:
            $ref: '#/components/schemas/VerifyResult'
        stopped:
          type: boolean
          description: >-
            The sweep did not re-check every due finding. A capped or cancelled
            sweep reported as complete is how a stale exposure hides, so this is
            reported rather than inferred from a short result list.
        unchecked:
          type: integer
          description: How many due findings were left unchecked when the sweep stopped.
        stop_reason:
          type: string
          description: Why the sweep stopped. Empty when it finished.
    TrendResponse:
      type: object
      description: The exposure trend over a window, one entry per bucket.
      required: [since, until, bucket, points]
      properties:
        since:
          type: string
          format: date-time
          description: Start of the window that was measured.
        until:
          type: string
          format: date-time
          description: End of the window that was measured.
        bucket:
          type: string
          description: The bucket width that was applied, as a Go duration.
          example: 24h
        points:
          type: array
          description: >-
            One entry per bucket across the whole window, in order. Empty buckets
            are included: a gap is itself information, and dropping it would draw a
            continuous line over a period nothing was re-checked.
          items:
            $ref: '#/components/schemas/TrendPoint'
    TrendPoint:
      type: object
      description: One bucket of the exposure trend.
      required: [start, reproduced, remediated, inconclusive]
      properties:
        start:
          type: string
          format: date-time
          description: The bucket's start, inclusive.
        reproduced:
          type: integer
          description: Verifications in this bucket that demonstrated the path again.
        remediated:
          type: integer
          description: Verifications in this bucket that re-ran clean.
        inconclusive:
          type: integer
          description: >-
            Verifications in this bucket that could not be re-run. Reported on its
            own, never folded into the other two: a bucket that is all inconclusive
            is "we could not check", not "nothing is exposed".
    Priority:
      type: string
      description: >-
        The remediation bucket a finding lands in. `P0` is a short proven path to
        a high-criticality crown jewel, `P1` and `P2` are proven but longer or
        less critical, and `unproven` is an exposure with no demonstrated path: it
        is kept off the ranked list until something proves it belongs there.
      enum: [P0, P1, P2, unproven]
    FindingChain:
      type: object
      description: >-
        One proven path rendered on a ranked finding, carrying the evidence bundle
        ids rather than the evidence so the ranking layer never handles a
        customer's data.
      required:
        [target, target_label, criticality, hops, keys, highest_class,
         evidence_bundle_ids]
      properties:
        target:
          type: string
          description: The crown jewel the chain reaches.
        target_label:
          type: string
          description: What the operator calls that crown jewel.
        criticality:
          type: integer
          description: The crown jewel's operator-assigned rating, 1 to 5.
        hops:
          type: integer
          description: The number of hops in the chain.
        keys:
          type: [array, "null"]
          description: The assets the chain passes through, in order.
          items:
            type: string
        highest_class:
          type: string
          enum: [passive, active-safe]
          description: >-
            The most invasive safety class used anywhere along the chain.
            `active-intrusive` never appears: no intrusive technique is authored in
            this product.
        evidence_bundle_ids:
          type: [array, "null"]
          description: The bundles that together prove the chain.
          items:
            type: string
    Finding:
      type: object
      description: >-
        One prioritized exposure, as the prioritizer ranks it. This is a report
        input: the build verifies the evidence behind each finding before
        presenting it.
      required: [origin, priority, score, rationale, chains, downgraded]
      properties:
        origin:
          type: string
          description: The asset the chains start from, the exposure itself.
        priority:
          $ref: '#/components/schemas/Priority'
        score:
          type: integer
          description: The finding's score, 0 to 100.
        rationale:
          type: [array, "null"]
          description: Why the finding scored as it did, in plain sentences.
          items:
            type: string
        chains:
          type: [array, "null"]
          description: The proven paths behind the finding, shortest first.
          items:
            $ref: '#/components/schemas/FindingChain'
        downgraded:
          type: boolean
          description: >-
            The finding was explicitly de-prioritized for want of a proven path.
            A downgraded finding is carried in the report's `unproven` list.
    BuildReportRequest:
      type: object
      description: >-
        What a report is built from. The tenant is not carried: it comes from the
        credential, so a body cannot build a report for another. Findings and
        trend and validations are optional: supplying any of them uses exactly
        what was given; leaving all three empty assembles them from the
        prioritizer, the verifier's stored history and the recorded finding
        validations instead.
      required: [title]
      properties:
        title:
          type: string
          description: The engagement report's title.
        findings:
          type: array
          description: The prioritizer's ranked findings.
          items:
            $ref: '#/components/schemas/Finding'
        trend:
          type: array
          description: The verifier's exposure trend, optional.
          items:
            $ref: '#/components/schemas/TrendPoint'
        validations:
          type: array
          description: >-
            The current verdict on each scanner finding, optional. Supplying none
            assembles them from what the validator recorded.
          items:
            $ref: '#/components/schemas/BuildReportValidation'
    BuildReportValidation:
      type: object
      description: >-
        One finding's verdict as supplied to a report build. The title travels
        with the verdict because a verdict against an opaque finding id is not
        something a reader can act on.
      required: [finding_id, verdict]
      properties:
        finding_id: { type: string }
        title: { type: string }
        target: { type: string }
        verdict:
          type: string
          enum: [exploitable, exposed, false_positive, benign, inconclusive]
        technique_id: { type: string }
        reason: { type: string }
        evidence_bundle_id: { type: string }
        validated_at:
          type: string
          format: date-time
    StoredReport:
      type: object
      description: >-
        A persisted report and the id it was stored under. The report carries no
        id of its own, so the id the store minted travels alongside it.
      required: [id, report]
      properties:
        id:
          type: string
          description: The stored report's identifier.
        report:
          $ref: '#/components/schemas/Report'
    Report:
      type: object
      description: >-
        The engagement deliverable: an executive summary, a remediation list
        ordered by what was proven, the exposures that could not be stood behind
        kept separate, and a trend. Everything it presents traces to signed
        evidence verified at build time.
      required: [tenant_id, title, generated_at, summary, remediation]
      properties:
        tenant_id:
          type: string
        title:
          type: string
        generated_at:
          type: string
          format: date-time
        summary:
          $ref: '#/components/schemas/ReportSummary'
        remediation:
          type: [array, "null"]
          description: >-
            The proven exposures, ordered by what was demonstrated. Null when the
            engagement proved no reachable exposure.
          items:
            $ref: '#/components/schemas/ReportItem'
        unsupported:
          type: array
          description: >-
            Findings presented as proven upstream whose evidence could not be
            verified here. They are surfaced, never dropped: a finding that fails
            verification is a fact the reader needs. Absent when there are none.
          items:
            $ref: '#/components/schemas/ReportItem'
        unproven:
          type: array
          description: >-
            Exposures with no demonstrated path, carried through from the
            prioritizer's downgrade so a reader sees what was looked at and not
            shown. Absent when there are none.
          items:
            $ref: '#/components/schemas/ReportItem'
        trend:
          type: array
          description: The exposure trend, carried through from verification. Absent when empty.
          items:
            $ref: '#/components/schemas/TrendPoint'
        validation:
          $ref: '#/components/schemas/ReportValidation'
        extensions:
          type: object
          additionalProperties: true
          description: >-
            Optional paid additions keyed by name, such as a compliance-framework
            mapping. A Community report has none. An extension adds a
            cross-reference, never a finding or a count. Absent when there are
            none.
    SAMLSettings:
      type: object
      description: >-
        One organization's SAML 2.0 provider configuration. The service-provider
        private key has no field here in either direction: it is minted server-side,
        sealed through the secrets backend, and never sent or returned.
      properties:
        idp_metadata_xml:
          type: string
          description: >-
            The provider's metadata document. Preferred over the three discrete
            fields when present, because it carries the signing certificate and the
            sign-on URL together and so cannot drift between them.
        idp_sso_url:
          type: string
          description: The provider's single sign-on endpoint.
        idp_entity_id:
          type: string
          description: The provider's entity id. Defaults to the sign-on URL when blank.
        idp_cert_pem:
          type: string
          description: >-
            The provider's signing certificate, PEM or bare base64 DER. This is the
            trust anchor: an assertion is accepted only if signed by this key.
        sp_entity_id:
          type: string
          description: >-
            What this deployment calls itself to the provider. Blank derives it from
            this deployment's own base URL, so the served metadata and the assertion
            consumer cannot disagree.
        acs_url:
          type: string
          description: Where the provider posts assertions. Blank derives it, as above.
        sp_cert_pem:
          type: string
          readOnly: true
          description: This deployment's own public service-provider certificate.
        email_attribute:
          type: string
          description: >-
            Which assertion attribute carries the user's email. Defaults to `email`;
            the SAML 2.0 URN and the common Microsoft claim names are also accepted,
            as is a NameID that is already an email address.
        enabled:
          type: boolean
        tenant_id:
          type: string
          readOnly: true
        created_at: { type: string, format: date-time, readOnly: true }
        updated_at: { type: string, format: date-time, readOnly: true }
        created_by: { type: string, readOnly: true }
    SAMLSettingsResponse:
      type: object
      required: [configured]
      properties:
        configured:
          type: boolean
          description: Whether this organization has a SAML provider stored at all.
        settings:
          $ref: '#/components/schemas/SAMLSettings'
    ActivationStatus:
      type: object
      description: >-
        The license check-in state. Advisory only: nothing here gates a feature or
        a guardrail, and an installation that never checks in is fully supported.
      required: [configured, periodic_running, healthy]
      properties:
        configured:
          type: boolean
          description: >-
            A check-in endpoint is set. It does NOT mean checks are happening --
            see `periodic_running`.
        periodic_running:
          type: boolean
          description: >-
            The periodic loop is enabled. Separate from `configured` deliberately:
            publishing one under the other's name would tell an operator checks
            are happening when none are.
        healthy:
          type: boolean
          description: >-
            The LAST check-in succeeded. This is the question a console is actually
            asking. There is deliberately no monotonic "ever activated" field: a
            flag that never returns to false cannot express a broken instance, and
            a green light beside a months-old timestamp tells an operator the
            opposite of the truth.
        last_check_in:
          type: string
          format: date-time
          description: When the last SUCCESSFUL check-in happened. Absent if none ever has.
        last_failure:
          type: string
          enum: [unreachable, rejected, unexpected_reply]
          description: >-
            Why the last attempt failed, in this product's own vocabulary rather
            than the licensing SDK's internal tokens. `unreachable` covers every
            way the vendor could not be reached; `rejected` means it answered and
            refused; `unexpected_reply` means it answered with something that was
            not a check-in response, which usually indicates a proxy or captive
            portal in the path. Absent when the last attempt succeeded.
        sharing_flagged:
          type: boolean
          description: >-
            The vendor reports this license active on more instances than it
            licenses. Advisory: it gates nothing.
        instance_count:
          type: integer
          description: How many distinct instances the vendor has seen for this license.
        latest_version:
          type: string
          description: The vendor's current build version, when it reported one.
    LicenseCheckInRequest:
      type: object
      description: >-
        A license check-in, as a customer's installation sends it. License state
        only: there is deliberately no field here for a finding, an asset, an
        engagement, a scan result, a host name or an address. The shape is the
        suite's shared wire contract, so the sending client and this receiver
        cannot drift.
      required: [license_id]
      properties:
        license_id:
          type: string
          description: >-
            The license being checked in for. It must match the id inside
            `license_blob`; a mismatch is refused rather than resolved in one
            direction.
        instance_id:
          type: string
          description: >-
            An opaque, stable per-installation identifier, minted by the install
            itself. It carries nothing about the environment -- no host name, no
            address, no tenant name -- and its only meaning is "the same install
            as last time", which is what makes a license-sharing count possible at
            all. Absent is supported; the check-in then gets a verdict and no
            sighting is recorded.
        product:
          type: string
          description: Which suite product is calling, so one receiver can serve several.
        version:
          type: string
          description: >-
            The caller's build version, for the update-check half of the reply.
        license_blob:
          type: string
          description: >-
            The signed license JSON, base64. This is the credential: its Ed25519
            signature is what authenticates the call. A check-in without it is
            refused with 401.
        nonce:
          type: string
          description: >-
            A per-request value, so an intermediary cannot serve a cached reply as
            a fresh one. The response does not echo it -- the shared wire contract
            has no field for that -- so it makes the REQUEST unique rather than
            binding the response to it.
    LicenseCheckInResponse:
      type: object
      description: >-
        The vendor's verdict for one license. Received only on a successful
        check-in: a client that could not reach the endpoint, or got a non-2xx,
        applies none of this and changes no entitlement.
      required: [ok]
      properties:
        ok:
          type: boolean
          description: The check-in itself was answered. It is not a statement about the license.
        revoked:
          type: boolean
          description: >-
            The vendor has withdrawn this license. The receiving install drops paid
            entitlements to the community tier and nothing else -- every guardrail
            (scope enforcement, safe-mode classification, audit, the kill-switch)
            is unconditional and does not consult a license.
        revoked_reason:
          type: string
          description: Why, for the operator to act on.
        signed_license:
          type: string
          description: >-
            A renewal, base64, sent only when the vendor's copy runs LONGER than
            the one presented. The receiving client verifies its signature against
            its own pinned key and refuses a downgrade or an id switch, so this
            field cannot be used to install a different license.
        latest_version:
          type: string
          description: The vendor's current build version, when it publishes one.
        message:
          type: string
          description: An informational note for the operator. It gates nothing.
        sharing_flagged:
          type: boolean
          description: >-
            This license has been seen on more installations than the vendor's
            configured allowance. Advisory only, and off unless an allowance is
            configured: one number applied to every customer is a poor basis for an
            accusation, since production plus staging plus a standby is three
            honest installs.
        instance_count:
          type: integer
          description: >-
            How many distinct installations have checked in under this license
            recently. Absent or zero also covers "this instance is not counting".
    ReportValidation:
      type: object
      description: >-
        What was checked about the scanner findings themselves, and what it
        concluded. It answers a different question from the ranked remediation
        list -- "which of the scanner's claims hold up" rather than "which
        exposures reach something that matters" -- and it is the section that
        removes work, because a finding that did not reproduce against the live
        target is a ticket to close rather than work. Absent when nothing was
        validated, which is not the same as everything coming back clean.
      required: [counts, headline]
      properties:
        counts:
          $ref: '#/components/schemas/ReportValidationCounts'
        headline:
          type: string
          description: >-
            The result in one plain sentence. It always states the unsettled
            count separately and says what it means, because "we checked it and
            the scanner was wrong" and "nobody could check it" are different
            statements and only the first is good news.
        items:
          type: array
          description: >-
            The individual verdicts, ordered so the actionable ones come first.
            Capped; `truncated` says when it is a prefix. The counts above stay
            complete regardless.
          items:
            $ref: '#/components/schemas/ReportValidationItem'
        truncated:
          type: boolean
          description: >-
            The item list is a prefix of what was validated. The counts are
            complete either way.
    ReportValidationCounts:
      type: object
      description: >-
        How many findings landed in each verdict. Cleared and unsettled are
        counted separately and never merged: an unsettled finding is unchecked,
        not cleared.
      required:
        [total, exploitable, exposed, false_positive, benign, inconclusive]
      properties:
        total:
          type: integer
          description: Every finding that carries a verdict.
        exploitable:
          type: integer
          description: A technique replicated the condition and produced evidence.
        exposed:
          type: integer
          description: >-
            Reachability proven and the exploitable precondition asserted from an
            observed version, never by exploiting it.
        false_positive:
          type: integer
          description: >-
            The technique ran and could not replicate the condition. This is the
            count that removes work.
        benign:
          type: integer
          description: The condition may exist but nothing reachable carries it.
        inconclusive:
          type: integer
          description: >-
            Assay could not settle it: no technique covers the class, or the
            dispatch was refused. Not a clearance, and never counted as one.
    ReportValidationItem:
      type: object
      description: One finding's current verdict, rendered for the report.
      required: [finding_id, verdict, reason, validated_at]
      properties:
        finding_id:
          type: string
        title:
          type: string
          description: >-
            The finding's own title, carried so a verdict is presented next to
            the claim it settles rather than against an opaque id.
        target:
          type: string
        verdict:
          type: string
          enum: [exploitable, exposed, false_positive, benign, inconclusive]
        provenance:
          type: string
          enum: [fired, asserted-by-tool, asserted-by-operator]
          description: >-
            The evidence tier the verdict rests on -- what distinguishes an exploit
            Assay demonstrated (`fired`) from one inferred from a version
            (`asserted-by-tool`) or attested by an operator
            (`asserted-by-operator`). A verdict is never presented stronger than
            its tier. Absent for a verdict resting on no evidence tier
            (inconclusive).
        confirmed:
          type: boolean
          description: >-
            True only for an exploitable verdict a technique actually fired. It is
            the server's computed gate; render "confirmed" from this field, never
            from `verdict == exploitable` alone, so an asserted-exploitable finding
            is never shown as confirmed.
        technique_id:
          type: string
          description: >-
            What settled it, so a reader can judge the verdict by what was
            actually run rather than taking it on trust.
        reason:
          type: string
        evidence_bundle_id:
          type: string
          description: The signed evidence, where the technique proved something.
        validated_at:
          type: string
          format: date-time
    ReportSummary:
      type: object
      description: The executive view, the counts a reader can act on in one glance.
      required:
        [p0, p1, p2, unproven, unsupported, proven_reachable_exposures,
         crown_jewels_reached, headline]
      properties:
        p0:
          type: integer
          description: Proven exposures rated P0.
        p1:
          type: integer
          description: Proven exposures rated P1.
        p2:
          type: integer
          description: Proven exposures rated P2.
        unproven:
          type: integer
          description: Exposures carried in the unproven list.
        unsupported:
          type: integer
          description: Findings whose evidence could not be verified.
        proven_reachable_exposures:
          type: integer
          description: Exposures with at least one fully verified proven chain.
        crown_jewels_reached:
          type: integer
          description: Distinct crown jewels a proven chain reached.
        headline:
          type: string
          description: >-
            One sentence stating the engagement's result. It reports what was
            proven and flags separately what could not be verified; it never
            overstates.
    ReportItem:
      type: object
      description: One exposure in the report.
      required: [origin, priority, score, rationale]
      properties:
        origin:
          type: string
          description: The asset the chains start from.
        priority:
          $ref: '#/components/schemas/Priority'
        score:
          type: integer
        rationale:
          type: [array, "null"]
          description: Why the item scored as it did, in plain sentences.
          items:
            type: string
        chains:
          type: array
          description: >-
            The proof chains, each hop's evidence cited and marked verified.
            Absent on an unproven item, which has no chain to show.
          items:
            $ref: '#/components/schemas/ReportProofChain'
        note:
          type: string
          description: >-
            Why an item is in the unsupported or unproven list rather than the
            main one. Absent on a remediation item.
    ReportProofChain:
      type: object
      description: >-
        A proof chain rendered for the report, with each hop's evidence citation
        and whether that evidence verified.
      required: [target, target_label, criticality, hops, keys, highest_class, evidence]
      properties:
        target:
          type: string
        target_label:
          type: string
        criticality:
          type: integer
        hops:
          type: integer
        keys:
          type: [array, "null"]
          description: The assets the chain passes through, in order.
          items:
            type: string
        highest_class:
          type: string
          enum: [passive, active-safe]
          description: >-
            The most invasive safety class used along the chain.
            `active-intrusive` never appears in this product.
        evidence:
          type: [array, "null"]
          description: The evidence behind each hop, each cited and marked verified.
          items:
            $ref: '#/components/schemas/EvidenceRef'
    EvidenceRef:
      type: object
      description: >-
        A citation of one evidence bundle. It carries the bundle id and its
        digest, not its contents: the report points at the proof and the bundle is
        exported alongside for a reader who wants to re-run it.
      required: [bundle_id, digest, conclusion, verified]
      properties:
        bundle_id:
          type: string
        digest:
          type: string
          description: The bundle's content digest. Empty when the bundle did not verify.
        conclusion:
          type: string
          description: What the bundle proves. Empty when the bundle did not verify.
        verified:
          type: boolean
          description: >-
            Always true for a ref that reaches the remediation list: a bundle that
            did not verify moves its whole finding to the unsupported list.
    StoredReportSummary:
      type: object
      description: >-
        One entry of the stored-report list: enough to identify a report and show
        its headline counts without loading the whole document.
      required: [id, tenant_id, title, generated_at, summary]
      properties:
        id:
          type: string
        tenant_id:
          type: string
        title:
          type: string
        generated_at:
          type: string
          format: date-time
        summary:
          $ref: '#/components/schemas/ReportSummary'
    ReportList:
      type: object
      required: [reports, limit]
      properties:
        reports:
          type: array
          items:
            $ref: '#/components/schemas/StoredReportSummary'
        limit:
          type: integer
          description: >-
            The cap that was applied, echoed so a caller can tell a short page
            from an exhausted one.

    ExportDestination:
      type: object
      required: [id, name, url, format, enabled, has_token, created_at, updated_at, created_by]
      properties:
        id:
          type: string
        name:
          type: string
          description: The operator-chosen label shown in the console. 1-100 characters.
        url:
          type: string
        format:
          type: string
          enum: [ecs, cef, webhook]
        enabled:
          type: boolean
        has_token:
          type: boolean
          description: Whether a bearer token is configured — the token itself is never returned.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        created_by:
          type: string
    ExportDestinationList:
      type: object
      required: [destinations]
      properties:
        destinations:
          type: array
          items:
            $ref: '#/components/schemas/ExportDestination'
    ExportDestinationSaveRequest:
      type: object
      required: [name, url, format]
      properties:
        name:
          type: string
          description: 1-100 characters, required.
        url:
          type: string
          description: https to any host, or http to a loopback address only.
        format:
          type: string
          enum: [ecs, cef, webhook]
        token:
          type: string
          format: password
          description: >-
            Optional bearer credential. Always resupplied on an update too —
            an update replaces the whole destination, so an omitted token
            clears it rather than leaving the stored one unchanged.
        enabled:
          type: boolean

    PlanProposal:
      type: object
      required: [technique_id, target, rationale]
      properties:
        technique_id:
          type: string
        target:
          type: string
        params:
          type: object
          additionalProperties:
            type: string
        rationale:
          type: string
        expected_relation:
          type: string
          description: What the model thinks a success would demonstrate — a claim to be checked, never a substitute for the engine actually proving it.

    RefusedPlanProposal:
      type: object
      required: [proposal, reason]
      properties:
        proposal:
          $ref: '#/components/schemas/PlanProposal'
        reason:
          type: string

    Plan:
      type: object
      required: [proposals, replay_id]
      properties:
        proposals:
          type: array
          items:
            $ref: '#/components/schemas/PlanProposal'
        replay_id:
          type: string
          description: Identifies the stored record of this cycle — the model, the prompt, the raw response and what was parsed out of it.
        refused:
          type: array
          items:
            $ref: '#/components/schemas/RefusedPlanProposal'
          description: Proposals the model made that were not passed on, with why — reported rather than dropped.

    PlanRecord:
      type: object
      required: [id, tenant_id, model, at, prompt, response, proposals]
      properties:
        id:
          type: string
        tenant_id:
          type: string
        model:
          type: string
          description: The model identifier that answered, as name@version.
        at:
          type: string
          format: date-time
        prompt:
          type: string
          description: What was sent — the full rendered prompt, the record of exactly what left the authorization boundary.
        response:
          type: string
          description: What the model answered, before parsing.
        proposals:
          type: array
          items:
            $ref: '#/components/schemas/PlanProposal'
        refused:
          type: array
          items:
            $ref: '#/components/schemas/RefusedPlanProposal'
        proposed_by:
          type: string
          description: The principal that asked for this cycle — the operator's own subject, or an engagement's authorizer for an autonomous cycle. Absent when no proposer was recorded (a cycle produced before this was tracked).

    PlanRecordList:
      type: object
      required: [records, limit]
      properties:
        records:
          type: array
          items:
            $ref: '#/components/schemas/PlanRecord'
        limit:
          type: integer
          description: >-
            The cap that was applied, echoed so a caller can tell a short page
            from an exhausted one.
