openapi: 3.0.3
info:
  title: Groundnetic API
  version: "1.0"
  description: |
    Evidence and claims API, v1 (DETAILED_DESIGN.md §D3.2). Errors are
    RFC 9457 problem documents with a stable `code` (§A4.4). Lists use
    opaque cursors; `limit` defaults to 100, maximum 1,000 (§A4.5).
servers:
  - url: /
security:
  - apiKey: []
tags:
  - name: evidence
  - name: claims
  - name: access
  - name: configuration
  - name: beliefs
  - name: why
  - name: contracts
  - name: events
  - name: decisions
  - name: derivation
  - name: dev
  - name: guard
  - name: identity
  - name: federation
  - name: tasks
  - name: discovery
  - name: sdk
paths:
  /v1/evidence:
    post:
      tags: [evidence]
      operationId: submitEvidence
      summary: Submit one evidence item
      parameters:
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/Submission"}
      responses:
        "201": {$ref: "#/components/responses/Submitted"}
        "200": {$ref: "#/components/responses/Submitted"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
        "413": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
        "429": {$ref: "#/components/responses/Problem"}
    get:
      tags: [evidence]
      operationId: searchEvidence
      summary: Search evidence metadata
      parameters:
        - {name: claim, in: query, schema: {type: string, pattern: "^cl_"}}
        - {name: source, in: query, schema: {type: string}}
        - {name: class, in: query, schema: {$ref: "#/components/schemas/EvidenceClass"}}
        - {name: valid_from, in: query, schema: {type: string, format: date-time}}
        - {name: valid_to, in: query, schema: {type: string, format: date-time}}
        - {name: tx_from, in: query, schema: {type: string, format: date-time}}
        - {name: tx_to, in: query, schema: {type: string, format: date-time}}
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: A page of evidence
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items: {type: array, items: {$ref: "#/components/schemas/EvidenceRecord"}}
                  next_cursor: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "429": {$ref: "#/components/responses/Problem"}
  /v1/evidence:batch:
    post:
      tags: [evidence]
      operationId: submitEvidenceBatch
      summary: Submit up to 500 items; per-item results in request order
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [items]
              additionalProperties: false
              properties:
                items:
                  type: array
                  minItems: 1
                  maxItems: 500
                  items: {$ref: "#/components/schemas/Submission"}
      responses:
        "200":
          description: Per-item results
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      required: [index]
                      properties:
                        index: {type: integer}
                        result: {$ref: "#/components/schemas/SubmitResult"}
                        error:
                          type: object
                          required: [code, detail]
                          properties:
                            code: {type: string}
                            detail: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "413": {$ref: "#/components/responses/Problem"}
        "429": {$ref: "#/components/responses/Problem"}
  /v1/evidence/{id}:
    get:
      tags: [evidence]
      operationId: getEvidence
      summary: Get evidence metadata, and content if requested and permitted
      parameters:
        - $ref: "#/components/parameters/EvidenceID"
        - {name: include, in: query, schema: {type: string, enum: [content]}}
      responses:
        "200":
          description: Evidence
          content:
            application/json:
              schema: {$ref: "#/components/schemas/EvidenceRecord"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/evidence/{id}/lineage:
    get:
      tags: [evidence]
      operationId: getLineage
      summary: Provenance traversal up (parents) or down (children), with broken-chain detection
      parameters:
        - $ref: "#/components/parameters/EvidenceID"
        - {name: direction, in: query, schema: {type: string, enum: [up, down], default: up}}
        - {name: depth, in: query, schema: {type: integer, minimum: 1, maximum: 10, default: 1}}
        - {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 1000, default: 1000}}
      responses:
        "200":
          description: Lineage graph
          content:
            application/json:
              schema:
                type: object
                required: [root, direction, depth, nodes, edges, truncated, broken, breaks]
                properties:
                  root: {type: string}
                  direction: {type: string}
                  depth: {type: integer}
                  truncated: {type: boolean}
                  broken: {type: boolean}
                  breaks:
                    type: array
                    items:
                      type: object
                      required: [evidence_id, status]
                      properties:
                        evidence_id: {type: string}
                        status: {type: string}
                  nodes:
                    type: array
                    items:
                      type: object
                      required: [evidence_id, claim_id, class, source_id, observed_at, status, depth]
                      properties:
                        evidence_id: {type: string}
                        claim_id: {type: string}
                        class: {$ref: "#/components/schemas/EvidenceClass"}
                        source_id: {type: string}
                        observed_at: {type: string, format: date-time}
                        status: {type: string, enum: [ACTIVE, REVOKED, QUARANTINED, CONTENT_ERASED]}
                        depth: {type: integer}
                  edges:
                    type: array
                    items:
                      type: object
                      required: [child, parent, relation]
                      properties:
                        child: {type: string}
                        parent: {type: string}
                        relation: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/evidence/{id}/provenance:
    get:
      tags: [evidence]
      operationId: getProvenance
      summary: The lineage as W3C PROV - PROV-JSON, or PROV-O in JSON-LD (DETAILED_DESIGN.md §C9.1 mapping)
      parameters:
        - $ref: "#/components/parameters/EvidenceID"
        - {name: format, in: query, schema: {type: string, enum: [prov-json, prov-o], default: prov-json}}
        - {name: direction, in: query, schema: {type: string, enum: [up, down], default: up}}
        - {name: depth, in: query, schema: {type: integer, minimum: 1, maximum: 10, default: 1}}
        - {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 1000, default: 1000}}
      responses:
        "200":
          description: PROV document
          content:
            application/json: {schema: {type: object, required: [prefix], properties: {prefix: {type: object}}}}
            application/ld+json: {schema: {type: object, required: ["@context", "@graph"]}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/evidence/{id}:supersede:
    post:
      tags: [evidence]
      operationId: supersedeEvidence
      summary: Correct evidence by superseding it (same claim and source)
      parameters:
        - $ref: "#/components/parameters/EvidenceID"
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/Submission"}
      responses:
        "201": {$ref: "#/components/responses/Submitted"}
        "200": {$ref: "#/components/responses/Submitted"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
  /v1/evidence/{id}:revoke:
    post:
      tags: [evidence]
      operationId: revokeEvidence
      summary: Revoke evidence (writer, or a human administrator)
      parameters:
        - $ref: "#/components/parameters/EvidenceID"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [reason]
              additionalProperties: false
              properties:
                reason: {type: string, minLength: 1}
      responses:
        "200":
          description: Revoked
          content:
            application/json:
              schema:
                type: object
                required: [evidence_id, status]
                properties:
                  evidence_id: {type: string}
                  status: {type: string, enum: [REVOKED]}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/overrides:
    post:
      tags: [evidence]
      operationId: assertOverride
      summary: A person overrides a claim's value until an expiry, saying why (DETAILED_DESIGN.md C3.6)
      description: >-
        Recorded as HUMAN_ASSERTED evidence and audited (belief.override). The caller must be a person with the
        override:assert or admin scope, the write scope and a source binding in the claim's namespace; agents and
        services cannot override, and the workspace's access policies (action overrides:write) can narrow who may.
        The override sets the belief's value (overridden = true) until expires_at, at most 30 days after it is
        asserted; the claim's time to live does not end it earlier (BR-5.06). Disagreeing evidence still counts
        as opposition. Withdraw it with POST /v1/evidence/{id}:revoke.
      parameters:
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [claim, value, reason, expires_at]
              additionalProperties: false
              properties:
                claim: {$ref: "#/components/schemas/ClaimRef"}
                value: {$ref: "#/components/schemas/Value"}
                reason: {type: string, minLength: 1, maxLength: 1000}
                valid_from: {type: string, format: date-time, description: "default now"}
                expires_at: {type: string, format: date-time}
                source_id: {type: string, description: "when the person is bound to several sources"}
                idempotency_key: {type: string}
      responses:
        "201": {$ref: "#/components/responses/OverrideAsserted"}
        "200": {$ref: "#/components/responses/OverrideAsserted"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
        "429": {$ref: "#/components/responses/Problem"}
  /v1/claims:canonicalize:
    post:
      tags: [claims]
      operationId: canonicalizeClaim
      summary: Turn a claim URI or structured claim into its canonical ID
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/ClaimRef"}
      responses:
        "200":
          description: Canonical claim
          content:
            application/json:
              schema:
                type: object
                required: [claim_id, uri, canonical, claim_type, claim_type_version]
                properties:
                  claim_id: {type: string}
                  uri: {type: string}
                  canonical: {type: string}
                  claim_type: {type: string}
                  claim_type_version: {type: integer}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/claims:
    get:
      tags: [claims]
      operationId: listClaims
      summary: List recorded claims
      parameters:
        - {name: namespace, in: query, schema: {type: string}}
        - {name: entity_type, in: query, schema: {type: string}}
        - {name: entity, in: query, schema: {type: string}}
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: A page of claims
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items: {type: array, items: {$ref: "#/components/schemas/Claim"}}
                  next_cursor: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/search:
    get:
      tags: [claims]
      operationId: search
      summary: Find claims, their current beliefs or their evidence metadata by text in the claim's identity (claim ID, URI, claim type, namespace, entity, attribute, scope); every term must match; never evidence content
      parameters:
        - {name: q, in: query, required: true, schema: {type: string, maxLength: 200}, description: "1 to 8 terms of 2 to 64 characters, matched as substrings, case-insensitive"}
        - {name: type, in: query, schema: {type: string, enum: [claims, beliefs, evidence], default: claims}}
        - {name: status, in: query, schema: {type: string, enum: [UNKNOWN, SUPPORTED, CONFLICTED, UNRESOLVED]}, description: "type=beliefs only"}
        - {name: class, in: query, schema: {type: string}, description: "type=evidence only"}
        - {name: source, in: query, schema: {type: string}, description: "type=evidence only (src_...)"}
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: "A page of claims (with belief for type=beliefs) in claim ID order, or of evidence records (metadata only) in evidence ID order"
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items: {type: array, items: {type: object}}
                  next_cursor: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/claims/{claim}:
    get:
      tags: [claims]
      operationId: getClaim
      summary: Look up a claim by ID (or URL-encoded gn:// URI)
      parameters:
        - {name: claim, in: path, required: true, schema: {type: string}}
      responses:
        "200":
          description: Claim
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Claim"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/claim-types:
    get:
      tags: [claims]
      operationId: listClaimTypes
      summary: The latest version of each claim type, by name (read; at most 1000)
      parameters:
        - {name: namespace, in: query, schema: {type: string}, description: Only this namespace}
      responses:
        "200":
          description: Claim types
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      required: [name, version, namespace, entity_type, attribute, value_type, updated_at]
                      properties:
                        name: {type: string}
                        version: {type: integer}
                        namespace: {type: string}
                        entity_type: {type: string}
                        attribute: {type: string}
                        value_type: {type: string}
                        unit: {type: string}
                        fresh_for: {type: string}
                        updated_at: {type: string, format: date-time}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/claim-types/{name}:
    put:
      tags: [claims]
      operationId: publishClaimType
      summary: Publish a new claim-type version (admin; identical specs return the latest version)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/ClaimTypeDocument"}
          application/yaml:
            schema: {type: object}
      responses:
        "200":
          description: Stored version
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ClaimTypeVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/claim-types/{name}/versions/{version}:
    get:
      tags: [claims]
      operationId: getClaimType
      summary: Get a claim-type version (a number or "latest")
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: version, in: path, required: true, schema: {type: string, pattern: "^([1-9][0-9]*|latest)$"}}
      responses:
        "200":
          description: Claim-type version
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ClaimTypeVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/claim-aliases:
    post:
      tags: [claims]
      operationId: addClaimAlias
      summary: Map an external entity ID to its canonical ID (one hop; admin)
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/Alias"}
      responses:
        "201":
          description: Alias created
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Alias"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/names:
    get:
      tags: [access]
      operationId: listNames
      summary: Names of the workspace's people, agents and sources (anyone who reads)
      description: >-
        For showing names instead of IDs (FPS-25.19): each principal (principal_id: prn_ or agt_) and source (source_id)
        with its kind and name; no email, scope or status.
      responses:
        "200":
          description: List
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      required: [kind, name]
                      properties:
                        principal_id: {type: string, description: "prn_… or agt_… (people, services, connectors, agents)"}
                        source_id: {type: string, description: "src_… (sources)"}
                        kind: {type: string, description: "The principal's kind (human, service, connector, agent, …) or source"}
                        name: {type: string}
                        pickable: {type: boolean, description: "May be chosen in a picker: active, and for a person a member of the workspace"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/principals:
    get:
      tags: [access]
      operationId: listPrincipals
      summary: Principals (administrators)
      responses:
        "200": {description: List, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [access]
      operationId: createPrincipal
      summary: Create a principal (admin; agents need a human owner)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [kind, name]
              additionalProperties: false
              properties:
                kind: {type: string, enum: [human, service, agent, connector, peer, derivation, edge_device]}
                name: {type: string, minLength: 1}
                owner_id: {type: string}
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                type: object
                required: [principal_id, kind, name]
                properties:
                  principal_id: {type: string}
                  kind: {type: string}
                  name: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/principals/{id}:disable:
    post:
      tags: [access]
      operationId: disablePrincipal
      summary: Disable a principal (admin). Its API keys are revoked, its sessions end, its bindings accept no evidence and it no longer counts toward the plan's limits; its history stays. Not the owner, yourself or the last administrator.
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}, description: "prn_... or agt_..."}
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                reason: {type: string, maxLength: 2000, description: Recorded in the audit trail}
      responses:
        "200":
          description: Disabled
          content:
            application/json:
              schema:
                type: object
                required: [principal_id, kind, name, status]
                properties:
                  principal_id: {type: string}
                  kind: {type: string}
                  name: {type: string}
                  status: {type: string, enum: [active, disabled]}
                  keys_revoked: {type: integer, description: API keys revoked by disabling it}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/principals/{id}:enable:
    post:
      tags: [access]
      operationId: enablePrincipal
      summary: Enable a disabled principal again (admin), within the plan's limits; its revoked keys stay revoked
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}, description: "prn_... or agt_..."}
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                reason: {type: string, maxLength: 2000, description: Recorded in the audit trail}
      responses:
        "200":
          description: Enabled
          content:
            application/json:
              schema:
                type: object
                required: [principal_id, kind, name, status]
                properties:
                  principal_id: {type: string}
                  kind: {type: string}
                  name: {type: string}
                  status: {type: string, enum: [active, disabled]}
                  keys_revoked: {type: integer, description: API keys revoked by disabling it}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/api-keys:
    get:
      tags: [access]
      operationId: listAPIKeys
      summary: API keys, never their secrets (administrators)
      responses:
        "200": {description: List, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [access]
      operationId: issueApiKey
      summary: Issue an API key (admin). The key is shown only in this response.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [principal_id, scopes]
              additionalProperties: false
              properties:
                principal_id: {type: string}
                scopes: {type: array, minItems: 1, description: "audit:read (the Auditor role) is for people only, with read alone", items: {type: string, enum: [read, write, admin, stop, "security_events:write", "override:assert", "audit:read"]}}
                ttl: {type: string, example: 90d}
      responses:
        "201":
          description: Issued
          content:
            application/json:
              schema:
                type: object
                required: [api_key, principal_id, scopes]
                properties:
                  api_key: {type: string}
                  principal_id: {type: string}
                  scopes: {type: array, items: {type: string}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/client-certificates:
    get:
      tags: [access]
      operationId: listClientCertificates
      summary: Machine principals' registered client certificates (administrators)
      responses:
        "200": {description: List, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/ClientCertificate"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [access]
      operationId: registerClientCertificate
      summary: Register a machine principal's client certificate, pinned by its SHA-256, with scopes like an API key (admin)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [principal_id, certificate, scopes]
              additionalProperties: false
              properties:
                principal_id: {type: string}
                certificate: {type: string, description: PEM}
                scopes: {type: array, minItems: 1, items: {type: string, enum: [read, write, admin, stop, "security_events:write"]}}
      responses:
        "201": {description: Registered, content: {application/json: {schema: {$ref: "#/components/schemas/ClientCertificate"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/client-certificates/{id}:revoke:
    post:
      tags: [access]
      operationId: revokeClientCertificate
      summary: Revoke a client certificate immediately (admin)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "204": {description: Revoked}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/api-keys/{key_id}:revoke:
    post:
      tags: [access]
      operationId: revokeApiKey
      summary: Revoke an API key immediately (admin)
      parameters:
        - {name: key_id, in: path, required: true, schema: {type: string}}
      responses:
        "200":
          description: Revoked
          content:
            application/json:
              schema:
                type: object
                required: [key_id, status]
                properties:
                  key_id: {type: string}
                  status: {type: string, enum: [REVOKED]}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/ingest-keys:
    post:
      tags: [access]
      operationId: createIngestKey
      summary: Issue a signing key for stream ingestion (admin); the secret is shown once
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [principal_id]
              additionalProperties: false
              properties:
                principal_id: {type: string}
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                type: object
                required: [key, secret, tenant]
                properties:
                  key: {$ref: "#/components/schemas/IngestKey"}
                  secret: {type: string, description: "gnik_...: signs records (HMAC-SHA256); not retrievable later"}
                  tenant: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/ingest-keys/{key_id}:revoke:
    post:
      tags: [access]
      operationId: revokeIngestKey
      summary: Revoke an ingest key (admin); records signed with it are rejected within 30 s
      parameters:
        - {name: key_id, in: path, required: true, schema: {type: string, pattern: "^ik_"}}
      responses:
        "200":
          description: Revoked
          content:
            application/json:
              schema: {$ref: "#/components/schemas/IngestKey"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/sources:
    get:
      tags: [access]
      operationId: listSources
      summary: Sources (administrators)
      responses:
        "200": {description: List, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [access]
      operationId: createSource
      summary: Register an evidence source (admin)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [name, kind]
              additionalProperties: false
              properties:
                name: {type: string, minLength: 1}
                kind: {type: string, enum: [system, sensor, agent, human, peer, derivation]}
                owner_id: {type: string}
                require_signature: {type: boolean}
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                type: object
                required: [source_id, name, kind]
                properties:
                  source_id: {type: string}
                  name: {type: string}
                  kind: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/bindings:
    get:
      tags: [access]
      operationId: listBindings
      summary: Bindings (administrators)
      responses:
        "200": {description: List, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    put:
      tags: [access]
      operationId: putBinding
      summary: Create or replace a principal's binding to a source (admin)
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/Binding"}
      responses:
        "200":
          description: Stored binding
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Binding"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/beliefs/{claim}:
    get:
      tags: [beliefs]
      operationId: getBelief
      summary: The belief about a claim at a valid time, as known at a transaction time
      description: |
        `valid_at` defaults to now; `as_of_tx` omitted means current knowledge.
        With `Gn-Min-Consistency`, waits (default 5 s, `wait` up to 30 s) until the
        belief includes that write; otherwise 503 consistency_timeout.
        When nothing is known the status is UNKNOWN.
      parameters:
        - $ref: "#/components/parameters/Claim"
        - {name: valid_at, in: query, schema: {type: string, format: date-time}}
        - {name: as_of_tx, in: query, schema: {type: string, format: date-time}}
        - $ref: "#/components/parameters/Wait"
        - $ref: "#/components/parameters/MinConsistency"
      responses:
        "200":
          description: Belief
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Belief"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "503": {$ref: "#/components/responses/Problem"}
  /v1/beliefs/{claim}/history:
    get:
      tags: [beliefs]
      operationId: getBeliefHistory
      summary: Segments overlapping a valid-time range, as known at a transaction time
      parameters:
        - $ref: "#/components/parameters/Claim"
        - {name: valid_from, in: query, schema: {type: string, format: date-time}}
        - {name: valid_to, in: query, schema: {type: string, format: date-time}}
        - {name: as_of_tx, in: query, schema: {type: string, format: date-time}}
        - $ref: "#/components/parameters/Wait"
        - $ref: "#/components/parameters/MinConsistency"
      responses:
        "200": {$ref: "#/components/responses/Beliefs"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "503": {$ref: "#/components/responses/Problem"}
  /v1/beliefs/{claim}/changes:
    get:
      tags: [beliefs]
      operationId: getBeliefChanges
      summary: Knowledge about a claim recorded after a transaction time
      parameters:
        - $ref: "#/components/parameters/Claim"
        - {name: since_tx, in: query, schema: {type: string, format: date-time}}
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200": {$ref: "#/components/responses/Beliefs"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/beliefs:query:
    post:
      tags: [beliefs]
      operationId: queryBeliefs
      summary: Beliefs about many claims, filtered by status, confidence and staleness
      parameters:
        - $ref: "#/components/parameters/Wait"
        - $ref: "#/components/parameters/MinConsistency"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [claims]
              additionalProperties: false
              properties:
                claims: {type: array, minItems: 1, maxItems: 1000, items: {type: string}}
                valid_at: {type: string, format: date-time}
                as_of_tx: {type: string, format: date-time}
                status: {type: array, items: {$ref: "#/components/schemas/BeliefStatus"}}
                min_confidence: {type: number, minimum: 0, maximum: 1}
                stale: {type: boolean}
      responses:
        "200": {$ref: "#/components/responses/Beliefs"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "503": {$ref: "#/components/responses/Problem"}
  /v1/changes:
    get:
      tags: [beliefs]
      operationId: getChanges
      summary: Knowledge recorded after a transaction time, across claims (optionally one namespace)
      parameters:
        - {name: since_tx, in: query, schema: {type: string, format: date-time}}
        - {name: namespace, in: query, schema: {type: string}}
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200": {$ref: "#/components/responses/Beliefs"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/why/claims/{claim}:
    get:
      tags: [why]
      operationId: whyClaim
      summary: Explain the belief about a claim at a valid time, as known at a transaction time
      parameters:
        - $ref: "#/components/parameters/Claim"
        - {name: valid_at, in: query, schema: {type: string, format: date-time}}
        - {name: as_of_tx, in: query, schema: {type: string, format: date-time}}
        - {name: depth, in: query, schema: {type: integer, minimum: 0, maximum: 5, default: 1}}
        - {name: format, in: query, schema: {type: string, enum: [json, text], default: json}}
        - $ref: "#/components/parameters/Wait"
        - $ref: "#/components/parameters/MinConsistency"
      responses:
        "200": {$ref: "#/components/responses/Why"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "503": {$ref: "#/components/responses/Problem"}
  /v1/why/segments/{id}:
    get:
      tags: [why]
      operationId: whySegment
      summary: Explain one stored belief version
      parameters:
        - {name: id, in: path, required: true, schema: {type: string, pattern: "^bs_"}}
        - {name: depth, in: query, schema: {type: integer, minimum: 0, maximum: 5, default: 1}}
        - {name: format, in: query, schema: {type: string, enum: [json, text], default: json}}
      responses:
        "200": {$ref: "#/components/responses/Why"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/jobs:recompute:
    post:
      tags: [configuration]
      operationId: startRecompute
      summary: Re-resolve claims with the configuration now in force (admin). Runs in the background at a limited rate.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [reason]
              additionalProperties: false
              properties:
                namespace: {type: string}
                from: {type: string, format: date-time}
                reason: {type: string, minLength: 1}
      responses:
        "202":
          description: Job accepted
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Job"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/jobs/{id}:
    get:
      tags: [configuration]
      operationId: getJob
      summary: Progress of a job
      parameters:
        - {name: id, in: path, required: true, schema: {type: string, pattern: "^job_"}}
      responses:
        "200":
          description: Job
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Job"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/contracts/{name}:
    put:
      tags: [contracts]
      operationId: publishContract
      summary: Publish a new Outcome Contract version (admin). Invalid definitions return 422 with every problem.
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/yaml:
            schema: {type: object}
          application/json:
            schema: {type: object}
      responses:
        "200":
          description: Stored version
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ContractVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
  /v1/contract-templates:
    get:
      tags: [contracts]
      operationId: listContractTemplates
      summary: The contract template catalog (playbooks), with parameters and an example each
      responses:
        "200":
          description: Templates
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/ContractTemplate"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/contract-templates/{name}:instantiate:
    post:
      tags: [contracts]
      operationId: instantiateContractTemplate
      summary: Publish the contract a template renders, under the name given (admin); parameters not given take their default
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [name]
              additionalProperties: false
              properties:
                name: {type: string, description: "the contract's name, e.g. sre.checkout-healthy"}
                params: {type: object, additionalProperties: {type: string}}
      responses:
        "201":
          description: Published
          content:
            application/json:
              schema:
                type: object
                required: [contract, template, instance_params]
                properties:
                  contract: {$ref: "#/components/schemas/ContractVersion"}
                  template: {type: string}
                  instance_params: {type: array, items: {type: object}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
  /v1/contracts/{name}/versions/{version}:
    get:
      tags: [contracts]
      operationId: getContract
      summary: Get a contract version (a number or "latest")
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: version, in: path, required: true, schema: {type: string, pattern: "^([1-9][0-9]*|latest)$"}}
      responses:
        "200":
          description: Contract version
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ContractVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/contract-instances:
    get:
      tags: [contracts]
      operationId: listContractInstances
      summary: Top-level instances, newest first
      parameters:
        - {name: status, in: query, schema: {$ref: "#/components/schemas/OutcomeStatus"}}
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: A page of instances
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items: {type: array, items: {$ref: "#/components/schemas/ContractInstance"}}
                  next_cursor: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [contracts]
      operationId: createContractInstance
      summary: Create an instance of a contract (state CREATED, status PENDING)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [contract, params]
              additionalProperties: false
              properties:
                contract: {type: string}
                version: {type: integer, minimum: 1}
                params: {type: object}
                action_ref: {type: string}
                decision_id: {type: string}
                participants: {type: array, items: {type: string}}
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ContractInstance"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/contract-instances/{id}:
    get:
      tags: [contracts]
      operationId: getContractInstance
      summary: Instance status; with wait, long-polls until a newer evaluation exists
      parameters:
        - {name: id, in: path, required: true, schema: {type: string, pattern: "^oci_"}}
        - {name: wait, in: query, schema: {type: string}}
        - {name: after_version, in: query, schema: {type: integer, minimum: 0}}
      responses:
        "200":
          description: Instance
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ContractInstance"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/contract-instances/{id}/evaluations:
    get:
      tags: [contracts]
      operationId: listContractEvaluations
      summary: Evaluation versions, oldest first (never rewritten)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string, pattern: "^oci_"}}
      responses:
        "200":
          description: Evaluations
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      required: [evaluation_id, instance_id, version, evaluated_at, trigger, status, revised, result]
                      properties:
                        evaluation_id: {type: string}
                        instance_id: {type: string}
                        version: {type: integer}
                        evaluated_at: {type: string, format: date-time}
                        trigger: {type: string}
                        status: {$ref: "#/components/schemas/OutcomeStatus"}
                        grade: {type: string, nullable: true}
                        revised: {type: boolean}
                        result: {type: object}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/contract-instances/{id}:activate:
    post:
      tags: [contracts]
      operationId: activateContractInstance
      summary: Start the observation window (optionally at a given time)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string, pattern: "^oci_"}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                at: {type: string, format: date-time}
      responses:
        "200":
          description: Instance
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ContractInstance"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/contract-instances/{id}:evaluate:
    post:
      tags: [contracts]
      operationId: evaluateContractInstance
      summary: Evaluate now and record a version
      parameters:
        - {name: id, in: path, required: true, schema: {type: string, pattern: "^oci_"}}
      responses:
        "200":
          description: Instance
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ContractInstance"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/contract-instances/{id}:cancel:
    post:
      tags: [contracts]
      operationId: cancelContractInstance
      summary: Stop the instance; it is never evaluated again
      parameters:
        - {name: id, in: path, required: true, schema: {type: string, pattern: "^oci_"}}
      responses:
        "200":
          description: Instance
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ContractInstance"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/why/evaluations/{id}:
    get:
      tags: [why]
      operationId: whyEvaluation
      summary: Explain an outcome evaluation down to the belief segments it used
      parameters:
        - {name: id, in: path, required: true, schema: {type: string, pattern: "^oce_"}}
      responses:
        "200":
          description: Explanation
          content:
            application/json:
              schema:
                type: object
                required: [evaluation, instance, contract]
                properties:
                  evaluation: {type: object}
                  instance: {$ref: "#/components/schemas/ContractInstance"}
                  contract: {type: object}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/why/decisions/{id}:
    get:
      tags: [why, decisions]
      operationId: whyDecision
      summary: Trace a decision to the beliefs it relied on (as of decision time), their evidence, and its outcome
      parameters:
        - {name: id, in: path, required: true, schema: {type: string, pattern: "^dr_"}}
      responses:
        "200":
          description: Explanation
          content:
            application/json:
              schema:
                type: object
                required: [decision, beliefs, outcome, text]
                properties:
                  decision: {$ref: "#/components/schemas/Decision"}
                  beliefs:
                    type: array
                    items:
                      allOf:
                        - $ref: "#/components/schemas/DecisionBelief"
                        - type: object
                          required: [revised, evidence, why]
                          properties:
                            revised: {type: boolean}
                            evidence:
                              type: object
                              nullable: true
                              required: [support, oppose, correlated, ignored]
                              properties:
                                support: {type: array, items: {type: string}}
                                oppose: {type: array, items: {type: string}}
                                correlated: {type: array, items: {type: string}}
                                ignored: {type: array, items: {type: string}}
                            why: {type: string, nullable: true}
                  outcome:
                    type: object
                    nullable: true
                    required: [instance, evaluations]
                    properties:
                      instance: {$ref: "#/components/schemas/DecisionInstance"}
                      evaluations:
                        type: array
                        items:
                          type: object
                          required: [evaluation_id, version, evaluated_at, status, grade, revised, why]
                          properties:
                            evaluation_id: {type: string}
                            version: {type: integer}
                            evaluated_at: {type: string, format: date-time}
                            status: {$ref: "#/components/schemas/OutcomeStatus"}
                            grade: {type: string, nullable: true}
                            revised: {type: boolean}
                            why: {type: string}
                  text: {type: string}
                  explanation: {$ref: "#/components/schemas/GuardExplanation"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/decisions:
    post:
      tags: [decisions]
      operationId: recordDecision
      summary: Record a decision, snapshotting the relied-on beliefs, and create or link the contract that verifies it
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [action, relies_on, agent]
              additionalProperties: false
              properties:
                action:
                  type: object
                  required: [type, target, consequence]
                  additionalProperties: false
                  properties:
                    type: {type: string, maxLength: 100}
                    target: {type: string, maxLength: 1000}
                    consequence: {type: string, enum: [low, medium, high, critical]}
                    description: {type: string, maxLength: 4000}
                relies_on:
                  type: array
                  maxItems: 100
                  items:
                    type: object
                    required: [claim]
                    additionalProperties: false
                    properties:
                      claim: {type: string}
                      expect: {$ref: "#/components/schemas/Expectation"}
                alternatives: {type: array, maxItems: 20, items: {type: object}}
                contract:
                  type: object
                  required: [name, params]
                  additionalProperties: false
                  properties:
                    name: {type: string}
                    version: {type: integer, minimum: 1}
                    params: {type: object}
                contract_instance_id: {type: string}
                action_ref: {type: string, maxLength: 500}
                agent: {$ref: "#/components/schemas/DecisionAgent"}
                trace_id: {type: string, maxLength: 200}
      responses:
        "201":
          description: Recorded
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Decision"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
    get:
      tags: [decisions]
      operationId: listDecisions
      summary: Decisions, newest first
      parameters:
        - {name: agent, in: query, schema: {type: string}}
        - {name: from, in: query, schema: {type: string, format: date-time}}
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: A page of decisions
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items: {type: array, items: {$ref: "#/components/schemas/Decision"}}
                  next_cursor: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/decisions/{id}:
    get:
      tags: [decisions]
      operationId: getDecision
      summary: A decision record with its transitions, reported actions and linked contract instance
      parameters:
        - {name: id, in: path, required: true, schema: {type: string, pattern: "^dr_"}}
      responses:
        "200":
          description: The decision
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Decision"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/decisions/{id}/actions:
    post:
      tags: [decisions]
      operationId: reportAction
      summary: Report an action state; completed activates the linked contract instance at the completion time
      parameters:
        - {name: id, in: path, required: true, schema: {type: string, pattern: "^dr_"}}
        - $ref: "#/components/parameters/IdempotencyKey"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [state]
              additionalProperties: false
              properties:
                state: {type: string, enum: [started, completed, failed]}
                at: {type: string, format: date-time}
                action_ref: {type: string, maxLength: 500}
                result: {}
      responses:
        "201":
          description: Reported
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Decision"}
        "200":
          description: Already reported with this idempotency key
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Decision"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/derivation-rules:
    get:
      tags: [derivation]
      operationId: listDerivationRules
      summary: Active derivation rules
      responses:
        "200":
          description: Active rules
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items: {type: array, items: {$ref: "#/components/schemas/RuleVersion"}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/derivation-rules:preview:
    post:
      tags: [derivation]
      operationId: previewDerivationRule
      summary: What a rule (published or not) would derive for one entity and scope; writes nothing
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [rule, entity]
              additionalProperties: false
              properties:
                rule: {type: string, description: The DerivationRule document (YAML or JSON)}
                entity: {type: string}
                scope: {type: object, additionalProperties: {type: string}}
      responses:
        "200":
          description: Preview
          content:
            application/json:
              schema:
                type: object
                required: [output_claim, applies, inputs]
                properties:
                  output_claim: {type: string}
                  applies: {type: boolean}
                  value: {type: object}
                  confidence: {type: string}
                  skipped: {type: string}
                  error: {type: string}
                  inputs: {type: object}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
  /v1/derivation-rules/{name}:
    put:
      tags: [derivation]
      operationId: publishDerivationRule
      summary: Publish a new rule version, active at once (admin). Invalid rules and cycles return 422 with every problem.
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/yaml:
            schema: {type: object}
          application/json:
            schema: {type: object}
      responses:
        "200":
          description: Stored version
          content:
            application/json:
              schema: {$ref: "#/components/schemas/RuleVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
    get:
      tags: [derivation]
      operationId: getDerivationRule
      summary: A rule version (default the latest)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: version, in: query, schema: {type: integer, minimum: 1}}
      responses:
        "200":
          description: Rule version
          content:
            application/json:
              schema: {$ref: "#/components/schemas/RuleVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/derivation-rules/{name}/runs:
    get:
      tags: [derivation]
      operationId: derivationRuleRuns
      summary: The rule's run log, newest first (derived, duplicate, skipped with a reason, errors)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - $ref: "#/components/parameters/Limit"
      responses:
        "200":
          description: Runs
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      required: [run_id, rule, rule_version, output_claim, outcome, reason, evidence_id, input_segments, at]
                      properties:
                        run_id: {type: integer}
                        rule: {type: string}
                        rule_version: {type: integer}
                        output_claim: {type: string}
                        outcome: {type: string, enum: [DERIVED, DUPLICATE, SKIPPED, ERROR]}
                        reason: {type: string, nullable: true}
                        evidence_id: {type: string, nullable: true}
                        input_segments: {type: array, items: {type: string}}
                        at: {type: string, format: date-time}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/derivation-rules/{name}:retire:
    post:
      tags: [derivation]
      operationId: retireDerivationRule
      summary: Stop a rule (admin); a retired version is appended
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "200":
          description: The retired version
          content:
            application/json:
              schema: {$ref: "#/components/schemas/RuleVersion"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/dev/clock:
    get:
      tags: [dev]
      operationId: getDevClock
      summary: The emulator's clock (local and test environments only; absent elsewhere)
      responses:
        "200": {description: The clock, content: {application/json: {schema: {$ref: "#/components/schemas/DevClock"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [dev]
      operationId: setDevClock
      summary: Freeze, jump or advance the emulator's clock (admin; local and test only)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                mode: {type: string, enum: [manual, real]}
                at: {type: string, format: date-time}
                advance: {type: string, description: "A duration such as 10m"}
                settle: {type: boolean, description: Wait for background work afterwards}
      responses:
        "200": {description: The clock, content: {application/json: {schema: {$ref: "#/components/schemas/DevClock"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "503": {$ref: "#/components/responses/Problem"}
  /v1/dev/settle:
    post:
      tags: [dev]
      operationId: devSettle
      summary: Wait until background work has caught up (admin; local and test only)
      responses:
        "200":
          description: Settled
          content:
            application/json:
              schema:
                type: object
                required: [settled, waited_ms]
                properties:
                  settled: {type: boolean}
                  waited_ms: {type: integer}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "503": {$ref: "#/components/responses/Problem"}
  /v1/dev/tenants:
    post:
      tags: [dev]
      operationId: createDevTenant
      summary: Create a throwaway tenant with an admin key (admin; local and test only)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [name]
              additionalProperties: false
              properties:
                name: {type: string}
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                type: object
                required: [tenant_id, api_key]
                properties:
                  tenant_id: {type: string}
                  api_key: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/agents:
    get:
      tags: [guard]
      operationId: listAgents
      summary: Registered agents with their mandate version and autonomy lease
      responses:
        "200":
          description: Agents
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items: {type: array, items: {$ref: "#/components/schemas/Agent"}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [guard]
      operationId: createAgent
      summary: Register an agent with an accountable human owner (humans with the admin scope only)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [name, owner_id]
              additionalProperties: false
              properties:
                name: {type: string}
                owner_id: {type: string}
                groups: {type: array, items: {type: string}}
      responses:
        "201": {description: Registered, content: {application/json: {schema: {$ref: "#/components/schemas/Agent"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}:
    get:
      tags: [guard]
      operationId: getAgent
      summary: An agent
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: The agent, content: {application/json: {schema: {$ref: "#/components/schemas/Agent"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}:retire:
    post:
      tags: [guard]
      operationId: retireAgent
      summary: Retire an agent (a person with the admin scope). The gate denies it, its permits are revoked, its lease ends and it no longer counts toward the plan's agents and principals limits; its mandates and history stay.
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                reason: {type: string, maxLength: 2000, description: Recorded in the audit trail}
      responses:
        "200": {description: Retired, content: {application/json: {schema: {$ref: "#/components/schemas/Agent"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}:reinstate:
    post:
      tags: [guard]
      operationId: reinstateAgent
      summary: Reinstate a retired agent (a person with the admin scope), within the plan's agents limit; a renewer then renews its lease
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                reason: {type: string, maxLength: 2000, description: Recorded in the audit trail}
      responses:
        "200": {description: Reinstated, content: {application/json: {schema: {$ref: "#/components/schemas/Agent"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/mandates:
    post:
      tags: [guard]
      operationId: publishMandate
      summary: Publish a new mandate version (humans only); starts a new autonomy lease. Invalid mandates return 422 with every problem.
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/yaml:
            schema: {type: object}
          application/json:
            schema: {type: object}
      responses:
        "201": {description: Stored, content: {application/json: {schema: {$ref: "#/components/schemas/MandateVersion"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/mandates/{version}:
    get:
      tags: [guard]
      operationId: getMandate
      summary: A mandate version (a number or latest)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
        - {name: version, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: The mandate, content: {application/json: {schema: {$ref: "#/components/schemas/MandateVersion"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/me/mandate:
    get:
      tags: [guard]
      operationId: getOwnMandate
      summary: The calling agent's own mandate, lease expiry and remaining budgets (AG-2.10)
      responses:
        "200":
          description: The agent's mandate and budgets
          content:
            application/json:
              schema:
                type: object
                required: [agent, mandate, lease_expires_at, budgets]
                properties:
                  agent: {$ref: "#/components/schemas/Agent"}
                  mandate:
                    nullable: true
                    allOf: [{$ref: "#/components/schemas/MandateVersion"}]
                  lease_expires_at: {type: string, format: date-time, nullable: true}
                  budgets:
                    type: array
                    items:
                      type: object
                      required: [budget, window, used]
                      properties:
                        budget: {type: string, enum: [actions_per_hour, blast_radius, irreversible_per_day, spend_per_day_usd]}
                        window: {type: string}
                        limit: {type: string, description: "empty: no limit"}
                        used: {type: string}
                        remaining: {type: string}
                        allowed: {type: boolean, description: "false when the mandate allows none (irreversible actions without irreversible_per_day); absent otherwise. limit and remaining then stay 0"}
                        message: {type: string, description: "with allowed false: not allowed: this mandate allows no irreversible actions"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/lease:renew:
    post:
      tags: [guard]
      operationId: renewLease
      summary: Renew the agent's autonomy lease (only a human named as a renewer in the mandate)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: The new lease, content: {application/json: {schema: {$ref: "#/components/schemas/Lease"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/unguarded-actions:
    post:
      tags: [guard]
      operationId: reportUnguardedActions
      summary: Report actions let through while Groundnetic was unreachable (enforcement points; fail-open-with-audit mandates)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [items]
              additionalProperties: false
              properties:
                items:
                  type: array
                  minItems: 1
                  maxItems: 1000
                  items:
                    type: object
                    required: [action_type, target, reason, occurred_at]
                    additionalProperties: false
                    properties:
                      id: {type: string, format: uuid}
                      action_type: {type: string}
                      target: {type: string}
                      param_hash: {type: string}
                      audience: {type: string}
                      reason: {type: string, maxLength: 500}
                      jti: {type: string, format: uuid}
                      occurred_at: {type: string, format: date-time}
      responses:
        "200":
          description: Recorded (retries with the same id are not recorded twice)
          content:
            application/json:
              schema:
                type: object
                required: [recorded]
                properties:
                  recorded: {type: integer}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents:renew-leases:
    post:
      tags: [guard]
      operationId: renewGroupLeases
      summary: Renew the lease of every agent in a group for which you are a named renewer (humans only)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [group]
              additionalProperties: false
              properties:
                group: {type: string, maxLength: 200}
      responses:
        "200":
          description: Renewed and skipped agents
          content:
            application/json:
              schema:
                type: object
                required: [group, renewed, skipped]
                properties:
                  group: {type: string}
                  renewed:
                    type: array
                    items:
                      type: object
                      required: [agent_id, lease]
                      properties:
                        agent_id: {type: string}
                        lease: {type: object}
                  skipped:
                    type: array
                    items:
                      type: object
                      required: [agent_id, reason]
                      properties:
                        agent_id: {type: string}
                        reason: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/timeline:
    get:
      tags: [guard]
      operationId: agentTimeline
      summary: Flight recorder — every event for an agent, in time order
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
        - {name: from, in: query, schema: {type: string, format: date-time}}
        - {name: to, in: query, schema: {type: string, format: date-time}}
        - {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 10000}}
      responses:
        "200":
          description: The timeline
          content:
            application/json:
              schema:
                type: object
                required: [agent_id, items, more]
                properties:
                  agent_id: {type: string}
                  more: {type: boolean}
                  items:
                    type: array
                    items:
                      type: object
                      required: [at, type, ref, summary]
                      properties:
                        at: {type: string, format: date-time}
                        type: {type: string}
                        ref: {type: string}
                        decision_id: {type: string}
                        by: {type: string}
                        summary: {type: string}
                        detail: {type: object}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/incident-export:
    post:
      tags: [guard]
      operationId: incidentExport
      summary: A signed incident bundle for investigators (admin scope; not agents)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [reason]
              additionalProperties: false
              properties:
                from: {type: string, format: date-time}
                to: {type: string, format: date-time}
                reason: {type: string, maxLength: 2000}
      responses:
        "200":
          description: The export; verify with the cell's keys (history=true)
          content:
            application/json:
              schema:
                type: object
                required: [bundle, digest, signature, kid]
                properties:
                  bundle: {type: object}
                  digest: {type: string}
                  signature: {type: string}
                  kid: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/tool-catalog:
    get:
      tags: [guard]
      operationId: listToolCatalog
      summary: The tool catalog (latest entry per action type)
      parameters:
        - {name: action_type, in: query, schema: {type: string}}
      responses:
        "200":
          description: Entries
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items: {type: array, items: {$ref: "#/components/schemas/CatalogEntry"}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/tool-catalog/{type}:
    put:
      tags: [guard]
      operationId: putToolCatalog
      summary: Publish a catalog entry for an action type (humans with the admin scope; safety-floor classes cannot be removed)
      parameters:
        - {name: type, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [consequence]
              additionalProperties: false
              properties:
                action_type: {type: string}
                consequence: {type: string, enum: [low, medium, high, critical]}
                safety_class: {type: string, nullable: true}
                irreversible: {type: boolean}
                read_only: {type: boolean}
                target_param: {type: string}
                description: {type: string}
                agent_seconds: {type: integer, minimum: 1, description: "Nominal time for an agent to do it, for task estimates"}
                person_seconds: {type: integer, minimum: 1, description: "Nominal time for a person to do it"}
                egress_param: {type: string, description: "JSON pointer to the destination when the action sends data out (URL, host or e-mail); the mandate's egress list governs it"}
                verifies_params: {type: boolean, description: "the tool verifies the permit's parameter hash before acting (guardproxy, enforcement library), so a mandate may redact its parameters (AG-17.09)"}
                taints:
                  type: array
                  description: What an allowed action marks its session with
                  items: {type: string, enum: [untrusted_content, private_data, outbound_channel]}
      responses:
        "200": {description: Stored, content: {application/json: {schema: {$ref: "#/components/schemas/CatalogEntry"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/gate/decisions:
    post:
      tags: [guard]
      operationId: gateDecide
      summary: Propose an action to the action gate. Every proposal is recorded; ALLOW returns a signed permit
      description: >-
        Runs the Agent Guard pipeline (registered agent, lease, mandate, budgets, human-authority rules,
        grounding, consequence policy, approvals) and records the decision. Only the proposing agent sees the
        permit token.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [action]
              additionalProperties: false
              properties:
                action:
                  type: object
                  required: [type]
                  additionalProperties: false
                  properties:
                    type: {type: string, maxLength: 100}
                    target: {type: string, maxLength: 1000, description: "Taken from params by the catalog's target rule when omitted"}
                    consequence: {type: string, enum: [low, medium, high, critical], description: "Raised to the catalog's and mandate's level"}
                    description: {type: string, maxLength: 4000}
                    params: {type: object, description: "Action parameters; the permit binds sha256 of their JCS form"}
                    cost_usd: {type: string, description: "Decimal; counts against the spend budget"}
                relies_on:
                  type: array
                  maxItems: 100
                  items:
                    type: object
                    required: [claim]
                    additionalProperties: false
                    properties:
                      claim: {type: string}
                      expect: {$ref: "#/components/schemas/Expectation"}
                alternatives: {type: array, maxItems: 20, items: {type: object}}
                contract:
                  type: object
                  required: [name, params]
                  additionalProperties: false
                  properties:
                    name: {type: string}
                    version: {type: integer, minimum: 1}
                    params: {type: object}
                contract_instance_id: {type: string}
                action_ref: {type: string, maxLength: 500}
                agent:
                  type: object
                  additionalProperties: false
                  properties:
                    agent_id: {type: string, description: "Ignored: the agent is the caller"}
                    agent_version: {type: string}
                    model: {type: string}
                trace_id: {type: string, maxLength: 200}
                audience: {type: string, maxLength: 200, description: "Enforcement point allowed to accept the permit (default gn:any)"}
                ttl: {type: string, description: "Permit lifetime, default 5m, at most 15m"}
                task_id: {type: string, description: "The task (tsk_...) this action is a step of: rights granted for the task apply only then (AG-13.08)"}
                session_id: {type: string, maxLength: 200, description: "The agent's session (conversation or run): what it has touched governs this action (AG-4.04)"}
                delegated_by: {type: string, description: "The permit (its jti) of the agent that asked this one to act: this action cannot exceed that agent's mandate or outlive its permit (AG-3.11)"}
                configuration: {type: object, required: [model, system_prompt_sha256, tools], additionalProperties: false, properties: {model: {type: string}, system_prompt_sha256: {type: string, pattern: "^[0-9a-fA-F]{64}$"}, tools: {type: array, items: {type: string}}, skills: {type: array, maxItems: 100, description: "Skills the agent has loaded; each must be approved in the skills registry (AG-5.25)", items: {$ref: "#/components/schemas/SkillRef"}}}}
      responses:
        "201":
          description: Decided and recorded
          content:
            application/json:
              schema: {$ref: "#/components/schemas/GateDecision"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/gate/decisions/{id}:
    get:
      tags: [guard]
      operationId: getGateDecision
      summary: A gated decision's state; with wait, long-polls while it awaits approval
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
        - {name: wait, in: query, schema: {type: string}, description: "Up to 30s"}
      responses:
        "200":
          description: The decision
          content:
            application/json:
              schema: {$ref: "#/components/schemas/GateDecision"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/approvals:
    post:
      tags: [guard]
      operationId: approve
      summary: Approve or reject an escalated decision (human principals only)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [decision_id, verdict, param_hash]
              additionalProperties: false
              properties:
                decision_id: {type: string}
                verdict: {type: string, enum: [approve, reject]}
                param_hash: {type: string, description: "Binds the verdict to the parameters reviewed"}
                comment: {type: string, maxLength: 2000}
      responses:
        "200":
          description: Recorded; the decision's state
          content:
            application/json:
              schema: {$ref: "#/components/schemas/GateDecision"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/permits/{jti}:use:
    post:
      tags: [guard]
      operationId: usePermit
      summary: Record the first use of a permit (enforcement points; a second use is refused)
      parameters:
        - {name: jti, in: path, required: true, schema: {type: string, format: uuid}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                audience: {type: string, maxLength: 200}
                detail: {type: object}
      responses:
        "200": {description: Recorded, content: {application/json: {schema: {$ref: "#/components/schemas/PermitUse"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/permits/{jti}:report:
    post:
      tags: [guard]
      operationId: reportPermit
      summary: Report how the permitted action ended (the enforcement point that used the permit)
      parameters:
        - {name: jti, in: path, required: true, schema: {type: string, format: uuid}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [result]
              additionalProperties: false
              properties:
                result: {type: string, enum: [completed, failed]}
                detail: {type: object}
      responses:
        "200": {description: Recorded, content: {application/json: {schema: {$ref: "#/components/schemas/PermitUse"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/permits/{jti}:revoke:
    post:
      tags: [guard]
      operationId: revokePermit
      summary: Revoke one unexpired permit (human principals only); returns the revocation list
      parameters:
        - {name: jti, in: path, required: true, schema: {type: string, format: uuid}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [reason]
              additionalProperties: false
              properties:
                reason: {type: string, maxLength: 2000}
      responses:
        "200": {description: Revoked, content: {application/json: {schema: {$ref: "#/components/schemas/Revocations"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/suspensions:
    post:
      tags: [guard]
      operationId: suspend
      summary: Kill switch — suspend one agent, a group, or every agent of the tenant (human principals only)
      description: Also served on the independent guard-control listener.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [scope, reason]
              additionalProperties: false
              properties:
                scope: {type: string, enum: [agent, group, tenant]}
                agent_id: {type: string}
                group: {type: string, maxLength: 200}
                reason: {type: string, maxLength: 2000}
      responses:
        "201": {description: Suspended, content: {application/json: {schema: {$ref: "#/components/schemas/Suspension"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    get:
      tags: [guard]
      operationId: listSuspensions
      summary: Suspensions, newest first
      parameters:
        - {name: active, in: query, schema: {type: string, enum: ["true", "false"]}}
      responses:
        "200":
          description: Suspensions
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items: {type: array, items: {$ref: "#/components/schemas/Suspension"}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/suspensions/{id}:
    get:
      tags: [guard]
      operationId: getSuspension
      summary: A suspension
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: The suspension, content: {application/json: {schema: {$ref: "#/components/schemas/Suspension"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/suspensions/{id}:resume:
    post:
      tags: [guard]
      operationId: resume
      summary: Lift a suspension (human principals only; audited)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [reason]
              additionalProperties: false
              properties:
                reason: {type: string, maxLength: 2000}
      responses:
        "200": {description: Resumed, content: {application/json: {schema: {$ref: "#/components/schemas/Suspension"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/revocations:
    get:
      tags: [guard]
      operationId: revocations
      summary: The revocation list (suspended agents, revoked unexpired permits), for enforcement points polling every 2 s
      responses:
        "200": {description: The list, content: {application/json: {schema: {$ref: "#/components/schemas/Revocations"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/revocations/stream:
    get:
      tags: [guard]
      operationId: revocationStream
      summary: Server-sent events — a `revocations` snapshot now and on every change, a `heartbeat` every second
      responses:
        "200": {description: Event stream, content: {text/event-stream: {schema: {type: string}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /.well-known/gn-permit-keys.json:
    get:
      tags: [guard]
      operationId: permitKeys
      summary: Permit verification keys (JWKS, Ed25519), unauthenticated
      security: []
      parameters:
        - {name: history, in: query, schema: {type: string, enum: ["true"]}, description: "Every key ever used (to verify old incident exports)"}
      responses:
        "200":
          description: Keys signing now and in the last 48 hours
          content:
            application/json:
              schema:
                type: object
                required: [keys]
                properties:
                  keys:
                    type: array
                    items:
                      type: object
                      required: [kty, crv, x, kid, alg]
                      properties:
                        kty: {type: string, enum: [OKP]}
                        crv: {type: string, enum: [Ed25519]}
                        x: {type: string}
                        kid: {type: string}
                        alg: {type: string, enum: [EdDSA]}
                        use: {type: string}
  /v1/usage:
    get:
      tags: [access]
      operationId: usage
      summary: This month's usage against the tenant's plan (managed service)
      responses:
        "200":
          description: Usage
          content:
            application/json:
              schema:
                type: object
                required: [tenant_id, period_start, period_end, plan, usage]
                properties:
                  tenant_id: {type: string}
                  period_start: {type: string, format: date-time}
                  period_end: {type: string, format: date-time}
                  since: {type: string, format: date-time, description: "What the numbers cover: the period's start, or the workspace's creation when it was created during the period"}
                  unbilled_gate_callers: {type: integer, description: "Principals that proposed to the gate this period without being billed as active agents: not registered as agents, or retired at the time. The gate denied them; their proposals still count as gate.decisions"}
                  plan:
                    type: object
                    nullable: true
                    description: Null when the cell enforces no plan (unlimited)
                    properties:
                      plan: {type: string}
                      version: {type: integer}
                      set_at: {type: string, format: date-time}
                      limits:
                        type: object
                        properties:
                          evidence_per_month: {type: integer}
                          gate_decisions_per_month: {type: integer}
                          agents: {type: integer}
                          principals: {type: integer}
                          people: {type: integer, description: human principals (members and people signed in through single sign-on)}
                          requests_per_second: {type: number}
                          burst: {type: integer}
                  usage:
                    type: object
                    additionalProperties: {type: integer}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/auth/login:
    get:
      tags: [identity]
      operationId: login
      summary: "Start a sign-in through KnownVault, the only place people sign in (ADR-0069): OIDC authorization code with PKCE S256, state, nonce and tenant_hint (the workspace's slug); with from=product, prompt=none first, falling back to an interactive sign-in"
      security: []
      parameters:
        - {name: tenant, in: query, schema: {type: string}, description: "tn_...; on the managed service the hostname names the tenant"}
        - {name: return_to, in: query, schema: {type: string}}
        - {name: from, in: query, schema: {type: string, enum: [product]}, description: "product: the person comes from another product and may have a KnownVault session (prompt=none first)"}
        - {name: reauth, in: query, schema: {type: string, enum: ["1"]}, description: "1: ask KnownVault for a fresh authentication (prompt=login, max_age=0)"}
        - {name: login_hint, in: query, schema: {type: string}}
        - {name: notice_accepted, in: query, schema: {type: string, enum: ["1"]}}
      responses:
        "200": {description: The system use notification to accept first (HTML)}
        "302": {description: To KnownVault's authorization endpoint}
        "400": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "429": {$ref: "#/components/responses/Problem"}
  /login:
    get:
      tags: [identity]
      operationId: initiateLogin
      summary: "The workspace's start URL (OIDC third-party initiated login, initiate_login_uri): starts a normal sign-in; iss must be KnownVault's issuer exactly; a target_link_uri off this workspace's origin is ignored"
      security: []
      parameters:
        - {name: iss, in: query, required: true, schema: {type: string}}
        - {name: target_link_uri, in: query, schema: {type: string}}
        - {name: login_hint, in: query, schema: {type: string}}
      responses:
        "302": {description: To /v1/auth/login}
        "400": {description: Not KnownVault's issuer (HTML)}
        "404": {description: No KnownVault configured}
  /v1/auth/callback:
    get:
      tags: [identity]
      operationId: authCallback
      summary: "KnownVault's redirect: the code exchanged (private_key_jwt), the ID token verified (iss, aud, ES256, nonce, tenant, tenant_host, MFA); opens a console session (HttpOnly cookie), or approves a device"
      security: []
      parameters:
        - {name: state, in: query, schema: {type: string}}
        - {name: code, in: query, schema: {type: string}}
        - {name: iss, in: query, schema: {type: string}}
        - {name: error, in: query, schema: {type: string}}
        - {name: error_description, in: query, schema: {type: string}}
      responses:
        "200": {description: Signed in (HTML)}
        "302": {description: A silent sign-in KnownVault could not complete; the interactive one}
        "403": {description: Sign-in refused (HTML)}
  /v1/auth/logout:
    post:
      tags: [identity]
      operationId: logout
      summary: "End the console session (CSRF token required) or revoke a refresh token; the browser then goes to KnownVault's end-session (end_session; a form post is redirected there)"
      security: []
      responses:
        "200": {description: "Signed out here: navigate to end_session", content: {application/json: {schema: {type: object, required: [end_session], properties: {end_session: {type: string}}}}}}
        "204": {description: Signed out}
        "303": {description: To KnownVault's end-session}
        "401": {$ref: "#/components/responses/Problem"}
  /v1/auth/signed-out:
    get:
      tags: [identity]
      operationId: signedOut
      summary: Where KnownVault returns the browser after its end-session
      security: []
      responses:
        "200": {description: Signed out (HTML)}
  /v1/auth/backchannel-logout:
    post:
      tags: [identity]
      operationId: backchannelLogout
      summary: "KnownVault's back-channel logout (OpenID Connect Back-Channel Logout 1.0): the logout token verified, every session of its sid ended"
      security: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema: {type: object, required: [logout_token], properties: {logout_token: {type: string}}}
      responses:
        "200": {description: Ended, content: {application/json: {schema: {type: object, properties: {sessions_ended: {type: integer}}}}}}
        "400": {description: Refused, content: {application/json: {schema: {type: object, required: [error], properties: {error: {type: string}, error_description: {type: string}}}}}}
  /v1/auth/client-jwks.json:
    get:
      tags: [identity]
      operationId: clientJWKS
      summary: The cell's KnownVault client key (ES256), which KnownVault verifies the workspaces' private_key_jwt with
      security: []
      responses:
        "200": {description: The key set, content: {application/json: {schema: {type: object, required: [keys], properties: {keys: {type: array, items: {type: object}}}}}}}
        "404": {description: No KnownVault configured}
  /v1/sign-in-policy:
    get:
      tags: [identity]
      operationId: getSignInPolicy
      summary: "What the workspace decides about sign-in (people sign in through KnownVault, where the company's identity provider is set up): a second factor required, people's API keys, the console idle timeout"
      responses:
        "200": {description: The policy, content: {application/json: {schema: {$ref: "#/components/schemas/SignInPolicy"}}}}
        "401": {$ref: "#/components/responses/Problem"}
    put:
      tags: [identity]
      operationId: putSignInPolicy
      summary: Change the sign-in policy (human administrators, after a recent sign-in)
      requestBody:
        required: true
        content: {application/json: {schema: {type: object, additionalProperties: false, properties: {require_mfa: {type: boolean}, api_key: {type: boolean}, idle_timeout_minutes: {type: integer}}}}}
      responses:
        "200": {description: The policy, content: {application/json: {schema: {$ref: "#/components/schemas/SignInPolicy"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/auth/device:
    post:
      tags: [identity]
      operationId: deviceAuthorization
      summary: Start a device sign-in for the CLI (RFC 8628)
      security: []
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema: {type: object, properties: {tenant: {type: string}}}
      responses:
        "200":
          description: Device and user codes
          content:
            application/json:
              schema:
                type: object
                required: [device_code, user_code, verification_uri, expires_in, interval]
                properties:
                  device_code: {type: string}
                  user_code: {type: string}
                  verification_uri: {type: string}
                  verification_uri_complete: {type: string}
                  expires_in: {type: integer}
                  interval: {type: integer}
        "400": {description: OAuth error}
  /v1/auth/device/verify:
    get:
      tags: [identity]
      operationId: deviceVerify
      summary: Where the person opens the device sign-in; shows the code and asks them to confirm it (RFC 8628 §5.4)
      security: []
      parameters:
        - {name: user_code, in: query, schema: {type: string}}
      responses:
        "200": {description: The confirmation page (HTML)}
        "400": {description: No code (HTML)}
        "403": {description: Unknown or expired code (HTML)}
        "429": {$ref: "#/components/responses/Problem"}
    post:
      tags: [identity]
      operationId: deviceConfirm
      summary: The confirmation, from the page itself (a post from another site is refused); redirects to the identity provider, which signs the person in again
      security: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema: {type: object, required: [user_code], properties: {user_code: {type: string}}}
      responses:
        "303": {description: To the identity provider}
        "400": {description: No code (HTML)}
        "403": {description: "Unknown or expired code, or not posted from the confirmation page (HTML)"}
        "429": {$ref: "#/components/responses/Problem"}
  /.well-known/oauth-protected-resource:
    get:
      tags: [identity]
      operationId: protectedResource
      summary: OAuth protected resource metadata of the MCP endpoint (RFC 9728)
      security: []
      responses:
        "200": {description: Metadata, content: {application/json: {schema: {type: object}}}}
  /.well-known/oauth-protected-resource/mcp:
    get:
      tags: [identity]
      operationId: protectedResourceMCP
      summary: OAuth protected resource metadata of /mcp (RFC 9728), named in its WWW-Authenticate
      security: []
      responses:
        "200": {description: Metadata, content: {application/json: {schema: {type: object}}}}
  /.well-known/oauth-authorization-server:
    get:
      tags: [identity]
      operationId: authorizationServer
      summary: OAuth authorization server metadata for MCP clients (RFC 8414)
      security: []
      responses:
        "200": {description: Metadata, content: {application/json: {schema: {type: object}}}}
  /v1/oauth/authorize:
    get:
      tags: [identity]
      operationId: authorizeMCP
      summary: Authorization endpoint for MCP clients (code with PKCE S256); asks the person signed in to the workspace (HTML)
      security: []
      responses:
        "200": {description: The consent or sign-in page, content: {text/html: {schema: {type: string}}}}
        "303": {description: Back to the client with an error}
        "400": {description: Not a valid request of a known client, content: {text/html: {schema: {type: string}}}}
    post:
      tags: [identity]
      operationId: approveMCP
      summary: The person's answer from the consent page (same-site form)
      security: []
      responses:
        "303": {description: Back to the client with a code or an error}
        "403": {description: Refused, content: {text/html: {schema: {type: string}}}}
  /v1/me/mcp-grants:
    get:
      tags: [identity]
      operationId: listMCPGrants
      summary: MCP clients the caller let act for them, live
      responses:
        "200": {description: Grants, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
  /v1/mcp-clients:
    get:
      tags: [identity]
      operationId: listMCPClients
      summary: MCP clients pre-registered by the workspace's administrators, with people's live grants to each (admin)
      responses:
        "200": {description: List, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/MCPClient"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [identity]
      operationId: registerMCPClient
      summary: >-
        Register a public MCP client for MCP clients that cannot serve a client ID metadata document (admin). The answer's
        client_id (mcc_...) is what the client sends to /v1/oauth/authorize and /v1/auth/token; there is no client secret
        (PKCE S256). Redirect URIs are matched exactly (on a loopback address, any port). There is no open dynamic registration.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [client_name, redirect_uris]
              additionalProperties: false
              properties:
                client_name: {type: string, description: "Shown to people on the consent page; unique in the workspace, 100 characters at most"}
                redirect_uris: {type: array, items: {type: string}, description: "1 to 10; https, or http on a loopback address (127.0.0.1, [::1], localhost); no fragment"}
                client_uri: {type: string, description: "The client's homepage (https), optional"}
                logo_uri: {type: string, description: "The client's logo (https), optional; kept for reference, not loaded by the console or the consent page"}
      responses:
        "201": {description: Registered, content: {application/json: {schema: {$ref: "#/components/schemas/MCPClient"}}}}
        "400": {description: "Not saved: every field at fault is named in fields", content: {application/problem+json: {schema: {$ref: "#/components/schemas/Problem"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/mcp-clients/{id}:
    delete:
      tags: [identity]
      operationId: deleteMCPClient
      summary: Delete a registered MCP client and revoke every grant people gave it (refresh tokens at once, access tokens within 5 minutes) (admin)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200":
          description: Deleted
          content:
            application/json:
              schema:
                type: object
                required: [client_id, deleted, grants_revoked]
                properties:
                  client_id: {type: string}
                  deleted: {type: boolean}
                  grants_revoked: {type: integer, description: People's grants to the client that were revoked}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/mcp-clients/{id}:disable:
    post:
      tags: [identity]
      operationId: disableMCPClient
      summary: >-
        Disable a registered MCP client (admin): it cannot start a sign-in, redeem a code or refresh a token; people's grants
        are kept and work again once it is enabled
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Disabled, content: {application/json: {schema: {$ref: "#/components/schemas/MCPClient"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/mcp-clients/{id}:enable:
    post:
      tags: [identity]
      operationId: enableMCPClient
      summary: Enable a disabled MCP client again (admin)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Enabled, content: {application/json: {schema: {$ref: "#/components/schemas/MCPClient"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/me/mcp-grants/{id}:
    delete:
      tags: [identity]
      operationId: revokeMCPGrant
      summary: Revoke an MCP client's grant (refresh tokens at once, access tokens within 5 minutes)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "204": {description: Revoked}
        "401": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/auth/token:
    post:
      tags: [identity]
      operationId: token
      summary: OAuth 2.0 token endpoint — device code, refresh token (rotated), RFC 8693 token exchange for workloads, and authorization code with PKCE for MCP clients
      security: []
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              required: [grant_type]
              properties:
                grant_type: {type: string}
                device_code: {type: string}
                refresh_token: {type: string}
                code: {type: string, description: "authorization_code: the code from /v1/oauth/authorize"}
                code_verifier: {type: string}
                redirect_uri: {type: string}
                client_id: {type: string, description: "MCP clients: the client ID metadata document URL, or the client_id (mcc_...) of a client registered by the workspace"}
                resource: {type: string, description: "MCP clients: this workspace's /mcp URL (RFC 8707)"}
                subject_token: {type: string}
                subject_token_type: {type: string}
                purpose: {type: string, description: "token exchange: bind a purpose of use"}
                tenant: {type: string}
      responses:
        "200":
          description: Tokens
          content:
            application/json:
              schema:
                type: object
                required: [access_token, token_type, expires_in]
                properties:
                  access_token: {type: string}
                  token_type: {type: string}
                  expires_in: {type: integer}
                  refresh_token: {type: string}
                  scope: {type: string}
                  issued_token_type: {type: string}
        "400":
          description: OAuth error
          content:
            application/json:
              schema: {type: object, required: [error], properties: {error: {type: string}, error_description: {type: string}}}
  /v1/auth/me:
    get:
      tags: [identity]
      operationId: me
      summary: Who the caller is, as authenticated (method, second factor, scopes)
      responses:
        "200":
          description: The caller
          content:
            application/json:
              schema:
                type: object
                required: [tenant_id, principal_id, kind, scopes, method, mfa, phishing_resistant, tenant_name, display_name]
                properties:
                  tenant_id: {type: string}
                  tenant_name: {type: string, description: "the organization's name for this tenant"}
                  display_name: {type: string}
                  email: {type: string, description: email reported by the identity provider at sign-in}
                  environment: {type: string, enum: [production, uat], description: "the workspace's environment, when the cell router names the workspace; uat for a UAT workspace"}
                  tenant_host: {type: string, description: "the workspace's KnownVault home (e.g. acme.knownvault.cloud): https://<tenant_host> is where people manage their company sign-in and products"}
                  principal_id: {type: string}
                  kind: {type: string}
                  scopes: {type: array, items: {type: string}}
                  method: {type: string, enum: [api_key, break_glass, oidc, token_exchange, email_code, passkey, oidc_agent, client_certificate, mcp_oauth, staff_session]}
                  mfa: {type: boolean}
                  phishing_resistant: {type: boolean}
                  purpose: {type: string}
        "401": {$ref: "#/components/responses/Problem"}
  /v1/auth/notice:
    get:
      tags: [identity]
      operationId: signInNotice
      summary: The cell's system use notification, shown on the sign-in page before any method and accepted to sign in (GOV-2.08)
      security: []
      responses:
        "200": {description: The notice (empty when the cell has none), content: {application/json: {schema: {type: object, required: [notice, required], properties: {notice: {type: string}, required: {type: boolean}}}}}}
  /v1/auth/notice:accept:
    post:
      tags: [identity]
      operationId: acceptNotice
      summary: Record in the audit trail that the signed-in caller accepted the system use notification (after single sign-on or with an API key; GOV-2.08)
      responses:
        "200": {description: Recorded (recorded is false when the cell has no notice), content: {application/json: {schema: {type: object, required: [recorded, system_use_notice], properties: {recorded: {type: boolean}, system_use_notice: {type: string, description: "The notice's digest"}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
  /v1/members:
    get:
      tags: [identity]
      operationId: listMembers
      summary: People invited by email (administrators)
      responses:
        "200": {description: Members, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object, required: [principal_id, email, name, status, scopes, invited_at, joined_at, passkeys], properties: {principal_id: {type: string}, email: {type: string}, name: {type: string}, status: {type: string, enum: [active, disabled]}, scopes: {type: array, items: {type: string}}, invited_at: {type: string, format: date-time}, joined_at: {type: string, format: date-time, nullable: true}, key_signed_in_at: {type: string, format: date-time, nullable: true, description: "When the member first used an API key of theirs to sign in (console or gnctl) without having signed in with an email code, a passkey or single sign-on (TA-5.49)"}, passkeys: {type: integer}}}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [identity]
      operationId: inviteMember
      summary: Invite a person by email with their scopes (human administrators); they receive an invitation
      requestBody:
        required: true
        content: {application/json: {schema: {type: object, required: [email], additionalProperties: false, properties: {email: {type: string}, name: {type: string}, scopes: {type: array, description: "Viewer [read], Editor [read, write], Administrator [read, write, admin], Auditor [read, audit:read]", items: {type: string, enum: [read, write, admin, stop, "override:assert", billing, "audit:read"]}}}}}}
      responses:
        "201": {description: Invited, content: {application/json: {schema: {type: object, required: [principal_id, email, name, status, scopes, invited_at, joined_at, passkeys], properties: {principal_id: {type: string}, email: {type: string}, name: {type: string}, status: {type: string, enum: [active, disabled]}, scopes: {type: array, items: {type: string}}, invited_at: {type: string, format: date-time}, joined_at: {type: string, format: date-time, nullable: true}, key_signed_in_at: {type: string, format: date-time, nullable: true, description: "When the member first used an API key of theirs to sign in (console or gnctl) without having signed in with an email code, a passkey or single sign-on (TA-5.49)"}, passkeys: {type: integer}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/members/{id}/scopes:
    put:
      tags: [identity]
      operationId: setMemberScopes
      summary: Change a member's scopes; their sessions end
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content: {application/json: {schema: {type: object, required: [scopes], additionalProperties: false, properties: {scopes: {type: array, description: "Viewer [read], Editor [read, write], Administrator [read, write, admin], Auditor [read, audit:read]", items: {type: string, enum: [read, write, admin, stop, "override:assert", billing, "audit:read"]}}}}}}
      responses:
        "200": {description: Changed, content: {application/json: {schema: {type: object, required: [principal_id, email, name, status, scopes, invited_at, joined_at, passkeys], properties: {principal_id: {type: string}, email: {type: string}, name: {type: string}, status: {type: string, enum: [active, disabled]}, scopes: {type: array, items: {type: string}}, invited_at: {type: string, format: date-time}, joined_at: {type: string, format: date-time, nullable: true}, key_signed_in_at: {type: string, format: date-time, nullable: true, description: "When the member first used an API key of theirs to sign in (console or gnctl) without having signed in with an email code, a passkey or single sign-on (TA-5.49)"}, passkeys: {type: integer}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/members/{id}:
    delete:
      tags: [identity]
      operationId: removeMember
      summary: Remove a member; their sessions, keys and passkeys stop working
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "204": {description: Removed}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/organization:
    get:
      tags: [identity]
      operationId: getOrganization
      summary: The organization profile (members read the workspace; administrators also the company, what is verified, waiting for review or missing)
      responses:
        "200":
          description: The profile
          content:
            application/json:
              schema:
                type: object
                required: [version, workspace]
                properties:
                  version: {type: integer}
                  workspace: {type: object}
                  company: {type: object}
                  verified: {type: object}
                  pending: {type: array, items: {type: object}}
                  changes: {type: array, items: {type: object, required: [id, tenant_id, requested_by, changes, status, detail, created_at], properties: {id: {type: string}, tenant_id: {type: string}, requested_by: {type: string}, changes: {type: object}, status: {type: string, enum: [queued, applied, pending_review, rejected]}, detail: {type: string}, errors: {type: array, items: {type: object, required: [field, label, message], properties: {field: {type: string}, label: {type: string}, value: {type: string}, message: {type: string}}}}, created_at: {type: string, format: date-time}, resolved_at: {type: string, format: date-time, nullable: true}}}}
                  missing: {type: array, items: {type: string}}
        "401": {$ref: "#/components/responses/Problem"}
    patch:
      tags: [identity]
      operationId: changeOrganization
      summary: Ask the control plane to change the organization (human administrators); it applies, sends for review or refuses each change
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                name: {type: string}
                legal_name: {type: string}
                registration_number: {type: string}
                legal_form: {type: string}
                incorporation_country: {type: string}
                incorporation_state: {type: string}
                duns_number: {type: string}
                website: {type: string}
                phone: {type: string}
                company_size: {type: string}
                use_case: {type: string}
                business_address: {type: object}
                billing_address: {type: object}
                tax_ids: {type: array, items: {type: object}}
                contacts: {type: array, items: {type: object}}
      responses:
        "202": {description: Sent to the control plane, content: {application/json: {schema: {type: object, required: [id, tenant_id, requested_by, changes, status, detail, created_at], properties: {id: {type: string}, tenant_id: {type: string}, requested_by: {type: string}, changes: {type: object}, status: {type: string, enum: [queued, applied, pending_review, rejected]}, detail: {type: string}, errors: {type: array, items: {type: object, required: [field, label, message], properties: {field: {type: string}, label: {type: string}, value: {type: string}, message: {type: string}}}}, created_at: {type: string, format: date-time}, resolved_at: {type: string, format: date-time, nullable: true}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/uat-environment:
    get:
      tags: [identity]
      operationId: getUATEnvironment
      summary: The workspace's UAT environment (administrators) and the reactivations asked for
      responses:
        "200":
          description: The UAT environment
          content:
            application/json:
              schema:
                type: object
                required: [state, requests]
                properties:
                  state: {type: object, description: "slug, status, suspend_code, console_url and can_reactivate (true when suspended for being unused)"}
                  requests: {type: array, items: {type: object, required: [id, tenant_id, requested_by, action, status, detail, created_at], properties: {id: {type: string}, tenant_id: {type: string}, requested_by: {type: string}, action: {type: string, enum: [reactivate, copy_sso]}, payload: {type: object}, status: {type: string, enum: [queued, applied, rejected]}, detail: {type: string}, created_at: {type: string, format: date-time}, resolved_at: {type: string, format: date-time, nullable: true}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/uat-environment:reactivate:
    post:
      tags: [identity]
      operationId: reactivateUATEnvironment
      summary: Ask the control plane to reactivate the UAT environment suspended for being unused (human administrators); it applies it within seconds
      responses:
        "202": {description: Sent to the control plane, content: {application/json: {schema: {type: object, required: [id, tenant_id, requested_by, action, status, detail, created_at], properties: {id: {type: string}, tenant_id: {type: string}, requested_by: {type: string}, action: {type: string, enum: [reactivate, copy_sso]}, payload: {type: object}, status: {type: string, enum: [queued, applied, rejected]}, detail: {type: string}, created_at: {type: string, format: date-time}, resolved_at: {type: string, format: date-time, nullable: true}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/billing:
    get:
      tags: [identity]
      operationId: getBilling
      summary: "The Billing page (administrators and billing members): plan, price, next charge, card, invoices with PDFs, billing contact, a payment overdue"
      responses:
        "200":
          description: The workspace's billing, as the control plane sent it
          content:
            application/json:
              schema:
                type: object
                required: [state, requests]
                properties:
                  state: {type: object, description: "billing (card, invoice, partner, marketplace, included), explain, can_change_card, plan, interval, currency, price_micros, subscription {status, anniversary, next_charge_at, ends_at, cancel_at_period_end}, card (the payment method) {type (card or us_bank_account), brand, last4, exp_month, exp_year, wallet, label, bank_name, account_type, holder_type}, bank_offered, verification {label, url, since} (a US bank account waiting for its micro-deposits), billing_contact, invoices [{number, status (open, processing, paid, failed...), total_micros, currency, date, period_start, period_end, pdf_url, hosted_url}], processing {number, amount_micros, currency, since} (a bank debit on its way), overdue {number, amount_micros, currency, since, reason, next_retry_at, read_only_at, suspend_at, confirm_url, bank}, home, account {home, home_url, products [{product, title, plan, price_micros, next_charge_share_micros}], next_charge_at, next_charge_micros, currency} (ADR-0066)"}
                  requests: {type: array, items: {type: object, required: [id, tenant_id, requested_by, action, status, detail, created_at], properties: {id: {type: string}, tenant_id: {type: string}, requested_by: {type: string}, action: {type: string, x-extensible-enum: [change_payment_method, purchase, switch_to_free, keep_plan]}, status: {type: string, enum: [queued, applied, rejected]}, detail: {type: string}, url: {type: string, description: "The Stripe Checkout page (setup mode), or the Billing page, once applied"}, created_at: {type: string, format: date-time}, resolved_at: {type: string, format: date-time, nullable: true}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/products:
    get:
      tags: [identity]
      operationId: getProducts
      summary: "The account's products, in its home (every member): each product's name and status; for administrators and billing members also its plan, price and share of the next charge. Another workspace of the account answers home false and the home's address"
      responses:
        "200":
          description: The account's products, as the control plane sent them with the billing state
          content:
            application/json:
              schema:
                type: object
                required: [home, products, can_bill]
                properties:
                  home: {type: boolean, description: "this workspace is the account's home"}
                  home_url: {type: string, description: "the home's Products page"}
                  products: {type: array, items: {type: object, description: "product (groundnetic, or another of the account's products), title, name, status (active, cancelling), ends_at, console_url; for administrators and billing members also subscription_id, plan, interval, currency, price_micros, next_charge_share_micros"}}
                  next_charge_at: {type: string, format: date-time}
                  next_charge_micros: {type: integer, format: int64, description: "the next charge before discounts and tax: the sum of the products' shares"}
                  currency: {type: string}
                  can_bill: {type: boolean}
        "401": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/account/summary:
    get:
      tags: [identity]
      operationId: getAccountSummary
      summary: "The account summary of the console's Home, for the workspace's administrators only (billing members and other members are refused): company sign-in, Groundnetic's usage this period against its plan, the cost by product a month and a year, the next renewal, billing alerts and what to do next"
      responses:
        "200":
          description: The account summary
          content:
            application/json:
              schema:
                type: object
                required: [home, payment_method, alerts, sign_in, administrators, people, todo]
                properties:
                  home: {type: boolean, description: "this workspace is the account's home; price and next charge are the home's"}
                  home_url: {type: string}
                  price: {type: object, description: "interval, currency, lines (product, title with its descriptor, workspace, subscription_id, plan, scope, amount_micros, state, until), total_micros, monthly_micros, annual_micros, renews_at"}
                  next_charge_at: {type: string, format: date-time}
                  next_charge_micros: {type: integer, format: int64}
                  currency: {type: string}
                  renews_at: {type: string, format: date-time}
                  billing: {type: string, description: "card, invoice, partner, marketplace or included"}
                  payment_method: {type: boolean}
                  alerts: {type: array, items: {type: object, required: [kind, severity], properties: {kind: {type: string, enum: [overdue, card_expired, card_expiring, no_payment_method, verification, processing, ending, suspended, validation]}, severity: {type: string, enum: [critical, warning, info]}, product: {type: string}, number: {type: string}, amount_micros: {type: integer, format: int64}, currency: {type: string}, at: {type: string, format: date-time}, detail: {type: string}}}}
                  sign_in: {type: object, required: [state], properties: {state: {type: string, enum: [connected, not_connected, pending, own_oidc, unavailable]}, mode: {type: string}}}
                  usage: {type: object, description: "Groundnetic's usage this period against its plan, as GET /v1/usage"}
                  administrators: {type: integer}
                  people: {type: integer}
                  todo: {type: array, items: {type: object, required: [kind], properties: {kind: {type: string, enum: [company_sign_in, invite_admin, payment_method]}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/billing/banner:
    get:
      tags: [identity]
      operationId: billingBanner
      summary: "The console header's notice while a payment is overdue (every member): payer (amount, date, Change payment method), member (neutral) or uat (the production workspace's); null when nothing is overdue"
      responses:
        "200": {description: The banner, content: {application/json: {schema: {type: object, required: [banner], properties: {banner: {type: object, nullable: true}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
  /v1/billing:change-payment-method:
    post:
      tags: [identity]
      operationId: changePaymentMethod
      summary: "Payment methods are changed in the company's KnownVault portal (Billing): answered 410 managed_in_knownvault with its link; nothing is queued"
      deprecated: true
      responses:
        "401": {$ref: "#/components/responses/Problem"}
        "410": {$ref: "#/components/responses/Problem"}
  /v1/billing:purchase:
    post:
      tags: [identity]
      operationId: purchasePlan
      summary: "Plans are bought in the company's KnownVault portal (Billing): answered 410 managed_in_knownvault with its link; nothing is queued"
      deprecated: true
      responses:
        "401": {$ref: "#/components/responses/Problem"}
        "410": {$ref: "#/components/responses/Problem"}
  /v1/billing:switch-to-free:
    post:
      tags: [identity]
      operationId: switchToFree
      summary: "Plans are changed in the company's KnownVault portal (Billing): answered 410 managed_in_knownvault with its link; nothing is queued"
      deprecated: true
      responses:
        "401": {$ref: "#/components/responses/Problem"}
        "410": {$ref: "#/components/responses/Problem"}
  /v1/billing:keep-plan:
    post:
      tags: [identity]
      operationId: keepPlan
      summary: "Plans are changed in the company's KnownVault portal (Billing): answered 410 managed_in_knownvault with its link; nothing is queued"
      deprecated: true
      responses:
        "401": {$ref: "#/components/responses/Problem"}
        "410": {$ref: "#/components/responses/Problem"}
  /v1/billing/requests/{id}:
    get:
      tags: [identity]
      operationId: billingRequest
      summary: One of the caller's payment method requests, to follow it to its Checkout page
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: The request, content: {application/json: {schema: {type: object, required: [id, tenant_id, requested_by, action, status, detail, created_at], properties: {id: {type: string}, tenant_id: {type: string}, requested_by: {type: string}, action: {type: string, x-extensible-enum: [change_payment_method, purchase, switch_to_free, keep_plan]}, status: {type: string, enum: [queued, applied, rejected]}, detail: {type: string}, url: {type: string, description: "The Stripe Checkout page (setup mode), or the Billing page, once applied"}, created_at: {type: string, format: date-time}, resolved_at: {type: string, format: date-time, nullable: true}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/uat-places:
    get:
      tags: [identity]
      operationId: uatPlaces
      summary: "A UAT workspace's places: 1 administrator + (people limit - 1), and who holds them (administrators)"
      responses:
        "200":
          description: Places
          content:
            application/json:
              schema:
                type: object
                required: [uat, places, used, admin_places, non_admin_places, non_admin_used, people, summary]
                properties:
                  uat: {type: boolean}
                  places: {type: integer, description: "the people limit; 0: unlimited"}
                  used: {type: integer}
                  admin_places: {type: integer}
                  non_admin_places: {type: integer}
                  non_admin_used: {type: integer}
                  people: {type: array, items: {type: object, required: [principal_id, name, admin], properties: {principal_id: {type: string}, name: {type: string}, email: {type: string}, admin: {type: boolean}}}}
                  summary: {type: string}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /.well-known/jwks.json:
    get:
      tags: [identity]
      operationId: jwks
      summary: Access-token verification keys (Ed25519)
      security: []
      responses:
        "200": {description: JWKS, content: {application/json: {schema: {type: object, required: [keys], properties: {keys: {type: array, items: {type: object}}}}}}}
  /v1/workload-trusts:
    get:
      tags: [identity]
      operationId: listWorkloadTrusts
      summary: Workloads allowed to exchange their identity tokens (administrators)
      responses:
        "200":
          description: Trusts
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/WorkloadTrust"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/workload-trusts/{name}:
    put:
      tags: [identity]
      operationId: putWorkloadTrust
      summary: Let a workload (Kubernetes service account, CI, SPIFFE) act as a service, agent or connector principal
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [issuer, subject, principal_id, scopes]
              additionalProperties: false
              properties:
                name: {type: string}
                issuer: {type: string}
                jwks_uri: {type: string}
                audience: {type: string}
                subject: {type: string}
                principal_id: {type: string}
                scopes: {type: array, items: {type: string, enum: [read, write, admin, "override:assert"]}}
      responses:
        "200": {description: Stored, content: {application/json: {schema: {$ref: "#/components/schemas/WorkloadTrust"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [identity]
      operationId: deleteWorkloadTrust
      summary: Remove a workload trust
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agent-identity-providers:
    get:
      tags: [identity]
      operationId: listAgentIdentityProviders
      summary: Identity providers whose tokens sign agents in (Entra Agent ID, Okta, OIDC; administrators, AG-1.04)
      responses:
        "200":
          description: Providers
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/AgentIdentityProvider"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/agent-identity-providers/{name}:
    put:
      tags: [identity]
      operationId: putAgentIdentityProvider
      summary: Let agents call Groundnetic with short-lived tokens from this issuer instead of API keys (people with the admin scope)
      description: >-
        A token is accepted as agent X when X's identities include {system: kind, subject: "<issuer>|<value of agent_claim>"}
        (PUT /v1/agents/{id}/identities). Presets by kind: entra (agent_claim azp, required claim idtyp = app, RS256; issuer
        https://login.microsoftonline.com/<directory ID>/v2.0), okta (agent_claim sub, RS256; issuer https://<org>.okta.com/oauth2/<server>),
        oidc (agent_claim sub, RS256 and ES256). Give required_claim "-" to turn a preset's required claim off.
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [issuer, audiences]
              additionalProperties: false
              properties:
                name: {type: string}
                kind: {type: string, enum: [entra, okta, oidc]}
                issuer: {type: string}
                jwks_uri: {type: string}
                audiences: {type: array, items: {type: string}}
                algorithms: {type: array, items: {type: string, enum: [RS256, RS384, RS512, PS256, PS384, PS512, ES256, ES384, ES512]}}
                agent_claim: {type: string}
                required_claim: {type: string}
                required_value: {type: string}
                max_token_lifetime_seconds: {type: integer, minimum: 300, maximum: 86400}
      responses:
        "200": {description: Stored, content: {application/json: {schema: {$ref: "#/components/schemas/AgentIdentityProvider"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [identity]
      operationId: deleteAgentIdentityProvider
      summary: Stop accepting agents' tokens from this provider
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/support-access:
    get:
      tags: [identity]
      operationId: listSupportAccess
      summary: Support access requests from the service operator (administrators)
      description: The operator's support asks for time-boxed, read-only access to metadata or configuration; administrators approve, deny or revoke it (TENANT_ADMIN.md TA-12.02). Break-glass access arrives approved by two operators.
      responses:
        "200":
          description: Requests, newest first
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      required: [request_id, operator, scope, hours, reason, consented, status, requested_at]
                      properties:
                        request_id: {type: string}
                        operator: {type: string}
                        scope: {type: string, enum: [metadata, configuration]}
                        hours: {type: integer}
                        reason: {type: string}
                        consented: {type: boolean}
                        status: {type: string, enum: [requested, approved, denied, revoked, expired]}
                        requested_at: {type: string, format: date-time}
                        decided_at: {type: string, format: date-time, nullable: true}
                        expires_at: {type: string, format: date-time, nullable: true}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/support-access/{id}:approve:
    post:
      tags: [identity]
      operationId: approveSupportAccess
      summary: Approve a support access request (administrators)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "204": {description: Done}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/support-access/{id}:deny:
    post:
      tags: [identity]
      operationId: denySupportAccess
      summary: Deny a support access request (administrators)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "204": {description: Done}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/support-access/{id}:revoke:
    post:
      tags: [identity]
      operationId: revokeSupportAccess
      summary: Revoke a support access request (administrators)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "204": {description: Done}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/console/banner:
    get:
      tags: [identity]
      operationId: consoleBanner
      summary: The operator's announcement banner for this tenant's console, if one is showing
      responses:
        "200":
          description: The banner
          content:
            application/json:
              schema:
                type: object
                required: [kind, title, body, ends_at]
                properties:
                  kind: {type: string, enum: [maintenance, incident, notice]}
                  title: {type: string}
                  body: {type: string}
                  ends_at: {type: string, format: date-time}
        "204": {description: No banner}
        "401": {$ref: "#/components/responses/Problem"}
  /v1/support-settings:
    get:
      tags: [identity]
      operationId: getSupportSettings
      summary: Whether Groundnetic staff may act as this workspace, and the staff session running now (owners and administrators; ADR-0071)
      description: >-
        "Allow staff impersonation" is off by default. While it is on, Groundnetic support may start one session at a time, at most
        60 minutes, that acts with the workspace's authority (never changing this setting, the owners and administrators or their
        sign-in, the identity provider, never seeing a secret or private key, never approving). It turns itself off when a session ends.
      responses:
        "200": {description: The setting, content: {application/json: {schema: {$ref: "#/components/schemas/SupportSettings"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    put:
      tags: [identity]
      operationId: putSupportSettings
      summary: >-
        Turn Allow staff impersonation on or off (owners and administrators, people only). Turning it on is the consent: it is done
        signed in to the console, with a sign-in of the last 15 minutes (else 403 reauthentication_required). Turning it off ends a
        running staff session at once. Every change is in the audit trail; a staff session cannot change it.
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [allow_staff_impersonation], additionalProperties: false, properties: {allow_staff_impersonation: {type: boolean}}}
      responses:
        "200": {description: The setting, content: {application/json: {schema: {$ref: "#/components/schemas/SupportSettings"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/staff-session:
    get:
      tags: [identity]
      operationId: getStaffSession
      summary: The Groundnetic staff session acting as this workspace now, for the console's banner (every member, and the staff session itself)
      responses:
        "200": {description: The running session, content: {application/json: {schema: {$ref: "#/components/schemas/StaffSession"}}}}
        "404": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/staff-session:end:
    post:
      tags: [identity]
      operationId: endStaffSession
      summary: >-
        End the running staff session now (End now in the banner): the workspace's owners and administrators (ended_by_customer), or
        the staff session itself (ended_by_staff). Allow staff impersonation turns itself off. Nothing running: 204 as well.
      responses:
        "204": {description: "Ended, or none was running"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/subscriptions:
    post:
      tags: [events]
      operationId: createSubscription
      summary: >-
        Create a subscription (admin), delivered through a channel: a signed webhook (the signing secret is shown only in
        this response), email to members, Slack (an incoming-webhook URL) or PagerDuty (Events API v2, a routing key).
        Slack URLs and routing keys are stored encrypted and never shown again. Conditions filter on the event's data.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [event_types]
              additionalProperties: false
              properties:
                channel: {type: string, enum: [webhook, email, slack, pagerduty], default: webhook}
                url: {type: string, description: "webhook: the receiver; slack: the incoming-webhook URL; pagerduty: the Events API endpoint (optional)"}
                routing_key: {type: string, description: "pagerduty: the integration's routing key"}
                recipients: {type: array, maxItems: 20, items: {type: string}, description: "email: members' addresses"}
                event_types: {type: array, minItems: 1, items: {type: string}}
                namespace: {type: string}
                conditions: {type: array, maxItems: 10, items: {$ref: "#/components/schemas/SubscriptionCondition"}}
                description: {type: string}
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                type: object
                required: [subscription, secret]
                properties:
                  subscription: {$ref: "#/components/schemas/Subscription"}
                  secret: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    get:
      tags: [events]
      operationId: listSubscriptions
      summary: List subscriptions (admin)
      responses:
        "200":
          description: Subscriptions
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items: {type: array, items: {$ref: "#/components/schemas/Subscription"}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/subscriptions/{id}:
    get:
      tags: [events]
      operationId: getSubscription
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200":
          description: Subscription
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Subscription"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/subscriptions/{id}/deliveries:
    get:
      tags: [events]
      operationId: listDeliveries
      summary: Deliveries, newest first; state=DEAD lists the dead-letter list
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
        - {name: state, in: query, schema: {type: string, enum: [PENDING, DELIVERED, DEAD]}}
        - $ref: "#/components/parameters/Limit"
      responses:
        "200":
          description: Deliveries
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      required: [delivery_id, event_id, event_type, state, attempts, next_attempt_at, created_at]
                      properties:
                        delivery_id: {type: integer}
                        event_id: {type: string}
                        event_type: {type: string}
                        state: {type: string}
                        attempts: {type: integer}
                        next_attempt_at: {type: string, format: date-time}
                        last_status: {type: integer}
                        last_error: {type: string}
                        created_at: {type: string, format: date-time}
                        delivered_at: {type: string, format: date-time}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/subscriptions/{id}:enable:
    post:
      tags: [events]
      operationId: enableSubscription
      summary: Resume deliveries
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200":
          description: Done
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Subscription"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/subscriptions/{id}:disable:
    post:
      tags: [events]
      operationId: disableSubscription
      summary: Stop deliveries
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200":
          description: Done
          content:
            application/json:
              schema: {$ref: "#/components/schemas/Subscription"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/subscriptions/{id}:replay:
    post:
      tags: [events]
      operationId: replaySubscription
      summary: Put dead deliveries (all, or delivery_ids) back in the queue
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                delivery_ids: {type: array, items: {type: integer}}
      responses:
        "200":
          description: Done
          content:
            application/json:
              schema:
                type: object
                required: [replayed]
                properties:
                  replayed: {type: integer}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/stream:
    get:
      tags: [events]
      operationId: stream
      summary: Server-sent events of the tenant (CloudEvents as data); resume with Last-Event-ID
      parameters:
        - {name: types, in: query, description: "comma-separated type patterns, e.g. dev.groundnetic.belief.*", schema: {type: string}}
        - {name: subject, in: query, description: claim or instance ID, schema: {type: string}}
        - {name: Last-Event-ID, in: header, schema: {type: string}}
      responses:
        "200":
          description: Event stream
          content:
            text/event-stream:
              schema: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/stream/ws:
    get:
      tags: [events]
      operationId: streamWebSocket
      summary: The event stream over a WebSocket - one text message per event ({id, type, data} with the CloudEvent as data) or notice ({type - notice, detail}); resume with last_event_id
      description: >-
        Same authentication, read scope, filters and tenant as GET /v1/stream. Browsers connect from the
        console's own origin only. The server pings every 15 seconds and closes with 1013 (try again later)
        when the client does not keep up for 10 seconds; reconnect with the last id received. Turned off for
        a workspace when its websocket_stream feature flag is off (403, naming the flag).
      parameters:
        - {name: types, in: query, description: "comma-separated type patterns, e.g. dev.groundnetic.belief.*", schema: {type: string}}
        - {name: subject, in: query, description: claim or instance ID, schema: {type: string}}
        - {name: last_event_id, in: query, description: the id of the last event received, schema: {type: string}}
      responses:
        "101": {description: Switching to the WebSocket protocol}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "426": {$ref: "#/components/responses/Problem"}
  /v1/watches:
    get:
      tags: [events]
      operationId: listWatches
      summary: The watch list (claims, namespaces and contracts with their drift rules)
      responses:
        "200":
          description: Watches
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/Watch"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [events]
      operationId: putWatch
      summary: Watch a claim (ID or URI), a namespace (or pattern) or a contract, replacing its watch; no rules gives the defaults
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [target_kind, target]
              additionalProperties: false
              properties:
                target_kind: {type: string, enum: [claim, namespace, contract]}
                target: {type: string}
                critical: {type: boolean}
                rules: {type: array, items: {$ref: "#/components/schemas/DriftRule"}}
                note: {type: string}
      responses:
        "200": {description: Watch, content: {application/json: {schema: {$ref: "#/components/schemas/Watch"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/watches/{id}:
    delete:
      tags: [events]
      operationId: deleteWatch
      summary: Stop watching (the watch's alerts go with it)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/drift-alerts:
    get:
      tags: [events]
      operationId: listDriftAlerts
      summary: Drift alerts, newest first
      parameters:
        - {name: state, in: query, schema: {type: string, description: "OPEN, ACKNOWLEDGED, RESOLVED, active (not resolved) or all (default)"}}
        - {name: subject, in: query, schema: {type: string, description: claim or instance ID}}
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200":
          description: Alerts
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/DriftAlert"}}, next_cursor: {type: string}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/drift-alerts/{id}:
    get:
      tags: [events]
      operationId: getDriftAlert
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Alert, content: {application/json: {schema: {$ref: "#/components/schemas/DriftAlert"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/drift-alerts/{id}:acknowledge:
    post:
      tags: [events]
      operationId: acknowledgeDriftAlert
      summary: Acknowledge an open alert (people only)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {note: {type: string}}}
      responses:
        "200": {description: Alert, content: {application/json: {schema: {$ref: "#/components/schemas/DriftAlert"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/drift-alerts/{id}:resolve:
    post:
      tags: [events]
      operationId: resolveDriftAlert
      summary: Resolve an alert (people only); its rule may alert again about the subject
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {note: {type: string}}}
      responses:
        "200": {description: Alert, content: {application/json: {schema: {$ref: "#/components/schemas/DriftAlert"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/configuration/active:
    get:
      tags: [configuration]
      operationId: getActiveConfiguration
      summary: Policy and authority versions in force now (or at a past time)
      parameters:
        - {name: at, in: query, schema: {type: string, format: date-time}}
      responses:
        "200":
          description: Versions in force
          content:
            application/json:
              schema:
                type: object
                required: [policy, authority]
                properties:
                  policy: {$ref: "#/components/schemas/ConfigVersion"}
                  authority: {$ref: "#/components/schemas/ConfigVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/policies/{name}:
    put:
      tags: [configuration]
      operationId: publishPolicy
      summary: Publish a new ResolutionPolicy version (admin; humans only). Identical specs return the latest version.
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/yaml:
            schema: {type: object}
          application/json:
            schema: {type: object}
      responses:
        "200":
          description: Stored version (not yet active)
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ConfigVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/policies/{name}/versions/{version}:
    get:
      tags: [configuration]
      operationId: getPolicy
      summary: Get a ResolutionPolicy version (a number or "latest")
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: version, in: path, required: true, schema: {type: string, pattern: "^([1-9][0-9]*|latest)$"}}
      responses:
        "200":
          description: Version
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ConfigVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/policies/{name}/versions/{version}:activate:
    post:
      tags: [configuration]
      operationId: activatePolicy
      summary: Put a ResolutionPolicy version in force from now on (admin; humans only)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: version, in: path, required: true, schema: {type: string, pattern: "^[1-9][0-9]*$"}}
      responses:
        "200":
          description: Activated version
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ConfigVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/authority/{name}:
    put:
      tags: [configuration]
      operationId: publishAuthority
      summary: Publish a new AuthorityProfile version (admin; humans only). Identical specs return the latest version.
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/yaml:
            schema: {type: object}
          application/json:
            schema: {type: object}
      responses:
        "200":
          description: Stored version (not yet active)
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ConfigVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/authority/{name}/versions/{version}:
    get:
      tags: [configuration]
      operationId: getAuthority
      summary: Get a AuthorityProfile version (a number or "latest")
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: version, in: path, required: true, schema: {type: string, pattern: "^([1-9][0-9]*|latest)$"}}
      responses:
        "200":
          description: Version
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ConfigVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/authority/{name}/versions/{version}:activate:
    post:
      tags: [configuration]
      operationId: activateAuthority
      summary: Put a AuthorityProfile version in force from now on (admin; humans only)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: version, in: path, required: true, schema: {type: string, pattern: "^[1-9][0-9]*$"}}
      responses:
        "200":
          description: Activated version
          content:
            application/json:
              schema: {$ref: "#/components/schemas/ConfigVersion"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/access-policies:
    get:
      tags: [access]
      operationId: listAccessPolicies
      summary: The tenant's Cedar access policies in force (administrators and auditors)
      responses:
        "200":
          description: Policies
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/AccessPolicy"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/access-policies:schema:
    get:
      tags: [access]
      operationId: accessPolicySchema
      summary: The Cedar schema access policies are checked against, and every action name (administrators and auditors)
      responses:
        "200":
          description: Schema
          content:
            application/json:
              schema:
                type: object
                required: [schema, actions]
                properties:
                  schema: {type: string}
                  actions: {type: array, items: {type: string}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/access-policies:check:
    post:
      tags: [access]
      operationId: checkAccess
      summary: Dry run - would this principal be allowed this action, with the policies in force or a draft? Nothing is changed or recorded (administrators and auditors)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [principal, action]
              additionalProperties: false
              properties:
                principal:
                  type: object
                  required: [id]
                  additionalProperties: false
                  properties:
                    id: {type: string}
                    scopes: {type: array, items: {type: string}}
                    method: {type: string}
                    mfa: {type: boolean}
                    phishing_resistant: {type: boolean}
                action: {type: string, description: "a route action (evidence:write), evidence:read_content or gate:decide"}
                route: {type: string, description: "e.g. POST /v1/principals"}
                purpose: {type: string}
                at: {type: string, format: date-time}
                resource: {type: object, description: "type, id and attributes (Evidence: classification, namespace, ...)"}
                context: {type: object, description: "gate: action_type, target, consequence, min_confidence_observed (ppm), ..."}
                draft:
                  type: object
                  required: [name]
                  additionalProperties: false
                  properties:
                    name: {type: string}
                    policy: {type: string, description: "empty: as if the policy were deleted"}
      responses:
        "200":
          description: Decision
          content:
            application/json:
              schema:
                type: object
                required: [decision, policies]
                properties:
                  decision: {type: string, enum: [allow, deny, escalate]}
                  policies: {type: array, items: {type: string}}
                  reason: {type: string}
                  shadow: {type: array, items: {type: string}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/access-policies/{name}:
    put:
      tags: [access]
      operationId: putAccessPolicy
      summary: Add a version of a Cedar access policy document; forbid policies narrow access, @outcome("escalate") asks a human at the gate
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [policy]
              additionalProperties: false
              properties:
                policy: {type: string, description: Cedar policies}
                description: {type: string}
                reason: {type: string, description: "why the policy changes (at most 1000 characters); kept with the new version of the workspace's access policies (FPS-25.21)"}
      responses:
        "200": {description: Stored, content: {application/json: {schema: {$ref: "#/components/schemas/AccessPolicy"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [access]
      operationId: deleteAccessPolicy
      summary: Remove an access policy (a new, empty version)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: reason, in: query, required: false, schema: {type: string}, description: "why (at most 1000 characters); kept with the new version of the workspace's access policies"}
      responses:
        "204": {description: Removed}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/access-policy-versions:
    get:
      tags: [access]
      operationId: listAccessPolicyVersions
      summary: The history of the workspace's access policies as a whole, newest first - each change's version, who made it, when and why, and the policies in force after it (administrators and auditors; FPS-25.21, FPS-25.24)
      parameters:
        - {name: limit, in: query, required: false, schema: {type: integer, minimum: 1, maximum: 200, default: 50}}
        - {name: before, in: query, required: false, schema: {type: integer, minimum: 1}, description: "versions older than this one (the last version of the previous page)"}
      responses:
        "200":
          description: Versions
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/AccessPolicyVersion"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/access-policy-versions/{version}:
    get:
      tags: [access]
      operationId: getAccessPolicyVersion
      summary: One version of the workspace's access policies, with the text of each policy in force (administrators and auditors); replay and policy diff name it access-policies@N
      parameters:
        - {name: version, in: path, required: true, schema: {type: integer, minimum: 1}}
      responses:
        "200": {description: Version, content: {application/json: {schema: {$ref: "#/components/schemas/AccessPolicyVersion"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/grants:
    get:
      tags: [access]
      operationId: listGrants
      summary: Time-limited grants in force (administrators and auditors)
      responses:
        "200":
          description: Grants
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/Grant"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [access]
      operationId: createGrant
      summary: Let a principal read restricted or personal content in a namespace until a deadline (at most 30 days; not to oneself)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [principal_id, namespace, reason]
              additionalProperties: false
              properties:
                principal_id: {type: string}
                action: {type: string, enum: ["evidence:read_content"]}
                namespace: {type: string, description: "a namespace, or a pattern with *"}
                classification: {type: string, enum: [confidential, restricted, personal]}
                purpose: {type: string}
                reason: {type: string}
                expires_at: {type: string, format: date-time}
                duration: {type: string, description: "e.g. 8h"}
      responses:
        "201": {description: Granted, content: {application/json: {schema: {$ref: "#/components/schemas/Grant"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/grants/{id}:revoke:
    post:
      tags: [access]
      operationId: revokeGrant
      summary: End a grant now
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "204": {description: Revoked}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/review-queues:
    get:
      tags: [guard]
      operationId: listReviewQueues
      summary: Review queues in routing order
      responses:
        "200":
          description: Queues
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/ReviewQueue"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/review-queues/{name}:
    put:
      tags: [guard]
      operationId: putReviewQueue
      summary: Create or replace a review queue and its routing rule (kinds, namespaces, consequences; first match by priority)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                name: {type: string}
                description: {type: string}
                priority: {type: integer}
                kinds: {type: array, items: {type: string}}
                namespaces: {type: array, items: {type: string}}
                consequences: {type: array, items: {type: string, enum: [low, medium, high, critical]}}
                members: {type: array, items: {type: string}, description: "people who decide; empty: any person with write"}
                timeout: {type: string, description: "deadline for gate escalations, e.g. 2h (default 30m)"}
      responses:
        "200": {description: Stored, content: {application/json: {schema: {$ref: "#/components/schemas/ReviewQueue"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [guard]
      operationId: deleteReviewQueue
      summary: Remove a queue; its open items move to the default queue
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/reviews:
    get:
      tags: [guard]
      operationId: listReviews
      summary: Review items, oldest first (open by default)
      parameters:
        - {name: queue, in: query, schema: {type: string}}
        - {name: status, in: query, schema: {type: string, description: "OPEN (default), APPROVED, REJECTED, EXPIRED, CANCELLED or all"}}
        - {name: kind, in: query, schema: {type: string}}
        - {name: overdue, in: query, schema: {type: boolean, description: "true: only open items past their due time (FPS-44.12)"}}
        - {name: limit, in: query, schema: {type: integer}}
      responses:
        "200":
          description: Items
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/ReviewItem"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/scope-grants:
    get:
      tags: [access]
      operationId: listScopeGrants
      summary: Just-in-time scope grants and requests, newest first (agents and workloads see their own) (AG-18)
      parameters:
        - {name: state, in: query, schema: {type: string, enum: [requested, active, rejected, cancelled, request_expired, expired, revoked]}}
        - {name: principal_id, in: query, schema: {type: string}}
        - {name: limit, in: query, schema: {type: integer}}
      responses:
        "200":
          description: Grants
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/ScopeGrant"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [access]
      operationId: askScopeGrant
      summary: Ask for a scope you lack, for a bounded time; a person approves it in the review queues (AG-18.01)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [scope, reason]
              additionalProperties: false
              properties:
                scope: {type: string, enum: [read, write, admin], description: "admin for people only"}
                duration: {type: string, description: "5m to 8h; default 1h, counted from the approval"}
                reason: {type: string, maxLength: 500}
      responses:
        "201": {description: The request, content: {application/json: {schema: {$ref: "#/components/schemas/ScopeGrant"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/scope-grants/{id}:
    get:
      tags: [access]
      operationId: getScopeGrant
      summary: A scope grant or request
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: The grant, content: {application/json: {schema: {$ref: "#/components/schemas/ScopeGrant"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/scope-grants/{id}:approve:
    post:
      tags: [access]
      operationId: approveScopeGrant
      summary: Approve a request (a person with the admin scope, never the requester); the grant starts now
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {comment: {type: string}}}
      responses:
        "200": {description: The grant, content: {application/json: {schema: {$ref: "#/components/schemas/ScopeGrant"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/scope-grants/{id}:reject:
    post:
      tags: [access]
      operationId: rejectScopeGrant
      summary: Reject a request (a person with the admin scope)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {comment: {type: string}}}
      responses:
        "200": {description: The request, content: {application/json: {schema: {$ref: "#/components/schemas/ScopeGrant"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/scope-grants/{id}:revoke:
    post:
      tags: [access]
      operationId: revokeScopeGrant
      summary: End an active grant now, or cancel a pending request (the grantee, or an administrator)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {reason: {type: string, maxLength: 500}}}
      responses:
        "200": {description: The grant, content: {application/json: {schema: {$ref: "#/components/schemas/ScopeGrant"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/review-slas:
    get:
      tags: [guard]
      operationId: getReviewSLAs
      summary: When reviews are due, when reminders go out and where overdue reviews escalate (FPS-44.10)
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/ReviewSLASettings"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putReviewSLAs
      summary: Replace the review SLA rules (administrators; people only); open reviews keep their due times
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [rules]
              additionalProperties: false
              properties:
                rules: {type: array, items: {$ref: "#/components/schemas/ReviewSLARule"}}
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/ReviewSLASettings"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/reviews/{id}:
    get:
      tags: [guard]
      operationId: getReview
      summary: A review item with its subject (the gate decision with its checks, ...)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Item, content: {application/json: {schema: {$ref: "#/components/schemas/ReviewItem"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/reviews/{id}:approve:
    post:
      tags: [guard]
      operationId: approveReview
      summary: "Approve (gate decisions: bound to param_hash; the usual approval rules apply)"
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                param_hash: {type: string}
                comment: {type: string}
      responses:
        "200": {description: Item, content: {application/json: {schema: {$ref: "#/components/schemas/ReviewItem"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/reviews/{id}:reject:
    post:
      tags: [guard]
      operationId: rejectReview
      summary: Reject
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                param_hash: {type: string}
                comment: {type: string}
      responses:
        "200": {description: Item, content: {application/json: {schema: {$ref: "#/components/schemas/ReviewItem"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/reviews/{id}:reassign:
    post:
      tags: [guard]
      operationId: reassignReview
      summary: Move an open item to another queue or person
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                queue: {type: string}
                assignee: {type: string}
      responses:
        "200": {description: Item, content: {application/json: {schema: {$ref: "#/components/schemas/ReviewItem"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/reviews/{id}:accept:
    post:
      tags: [guard]
      operationId: acceptReview
      summary: "Escalations (outcome_escalation, belief_low_confidence, belief_conflicted): accept the result as it is"
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                comment: {type: string}
      responses:
        "200": {description: Item, content: {application/json: {schema: {$ref: "#/components/schemas/ReviewItem"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/reviews/{id}:override:
    post:
      tags: [guard]
      operationId: overrideReview
      summary: >-
        Escalations: hold the result to be wrong, with a reason, naming the status (outcomes) or value (beliefs) held to be
        right. Recorded and announced, not applied: beliefs and outcomes are not rewritten.
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [reason]
              additionalProperties: false
              properties:
                reason: {type: string}
                status: {type: string, enum: [VERIFIED, FAILED, INCONCLUSIVE]}
                value: {}
      responses:
        "200": {description: Item, content: {application/json: {schema: {$ref: "#/components/schemas/ReviewItem"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/reviews/{id}:request-evidence:
    post:
      tags: [guard]
      operationId: requestReviewEvidence
      summary: "Escalations: ask for more evidence; the review stays open and the request is announced (review.evidence_requested)"
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [comment]
              additionalProperties: false
              properties:
                comment: {type: string, description: what evidence is needed}
      responses:
        "200": {description: Item, content: {application/json: {schema: {$ref: "#/components/schemas/ReviewItem"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/escalation-settings:
    get:
      tags: [guard]
      operationId: getEscalationSettings
      summary: What is escalated to review, by namespace (defaults until saved)
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/EscalationSettings"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putEscalationSettings
      summary: Replace the escalation rules (administrators; people only)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [rules]
              additionalProperties: false
              properties:
                rules: {type: array, items: {type: object}}
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/EscalationSettings"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/policy-packs:
    get:
      tags: [access]
      operationId: listPolicyPacks
      summary: Built-in consequence policy packs (gate policies that only make the gate stricter)
      responses:
        "200":
          description: Packs
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      required: [name, description, policy]
                      properties:
                        name: {type: string}
                        description: {type: string}
                        policy: {type: string}
        "401": {$ref: "#/components/responses/Problem"}
  /v1/policy-packs/{name}:install:
    post:
      tags: [access]
      operationId: installPolicyPack
      summary: Install a pack as the access policy pack-<name> (then edit or delete it like any access policy)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Installed, content: {application/json: {schema: {$ref: "#/components/schemas/AccessPolicy"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/sources/{id}/signing:
    get:
      tags: [access]
      operationId: getSourceSigning
      summary: A source's signing keys, trusted issuers and signature failures (administrators)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Signing, content: {application/json: {schema: {$ref: "#/components/schemas/SourceSigning"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [access]
      operationId: putSourceSigning
      summary: Register a source's public keys (JWKS, Ed25519 or P-256) and trusted DID issuers; require signed evidence
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                require_signature: {type: boolean}
                keys: {type: object, description: "public JWKS"}
                trusted_issuers: {type: array, items: {type: string}, description: "did:key, did:jwk or did:web"}
                keys_rotate_by: {type: string, format: date-time, description: "when the keys are due for rotation; reminders go out 30, 7 and 1 days before"}
      responses:
        "200": {description: Stored, content: {application/json: {schema: {$ref: "#/components/schemas/SourceSigning"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/evidence/{id}:quarantine:
    post:
      tags: [evidence]
      operationId: quarantineEvidence
      summary: Quarantine evidence (people with admin) - the claim is re-resolved without it and a review item decides
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [reason]
              additionalProperties: false
              properties:
                reason: {type: string}
      responses:
        "200":
          description: Quarantined
          content:
            application/json:
              schema: {type: object, required: [evidence_id, status], properties: {evidence_id: {type: string}, status: {type: string}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/source-health:
    get:
      tags: [access]
      operationId: listSourceHealth
      summary: Every source's health (HEALTHY, DEGRADED, STALE, SILENT) and metrics, from the daily trust run
      responses:
        "200":
          description: Health
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/SourceHealth"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/sources/{id}/health:
    get:
      tags: [access]
      operationId: getSourceHealth
      summary: One source's health and metrics
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Health, content: {application/json: {schema: {$ref: "#/components/schemas/SourceHealth"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/authority-proposals:
    get:
      tags: [access]
      operationId: listAuthorityProposals
      summary: Authority changes proposed by dynamic trust, newest first
      parameters:
        - {name: status, in: query, schema: {type: string, description: "PENDING, APPLIED, AUTO_APPLIED, REJECTED, SUPERSEDED"}}
      responses:
        "200":
          description: Proposals
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/AuthorityProposal"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/trust:run:
    post:
      tags: [access]
      operationId: runTrust
      summary: Run dynamic trust and source health now (administrators; the trust role runs it daily)
      responses:
        "200":
          description: Summary
          content:
            application/json:
              schema:
                type: object
                properties:
                  sources: {type: integer}
                  comparisons: {type: integer}
                  proposals: {type: integer}
                  auto_applied: {type: integer}
                  health_transitions: {type: integer}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/trust:detect:
    post:
      tags: [access]
      operationId: runDetectors
      summary: Run the anomaly detectors now (administrators; the trust role runs them every 5 minutes)
      responses:
        "200":
          description: Summary
          content:
            application/json:
              schema: {type: object, properties: {flags: {type: integer}, quarantined: {type: integer}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/anomaly-flags:
    get:
      tags: [access]
      operationId: listAnomalyFlags
      summary: What the anomaly detectors flagged, newest first
      parameters:
        - {name: detector, in: query, schema: {type: string}}
      responses:
        "200":
          description: Flags
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      required: [flag_id, detector, subject_kind, subject, action, detail, created_at]
                      properties:
                        flag_id: {type: string}
                        detector: {type: string}
                        subject_kind: {type: string, enum: [source, evidence, principal]}
                        subject: {type: string}
                        action: {type: string, enum: [flag, review, quarantine]}
                        detail: {type: object}
                        created_at: {type: string, format: date-time}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/sources/{id}:quarantine:
    post:
      tags: [access]
      operationId: quarantineSource
      summary: Quarantine a source (people with admin) - its claims are re-resolved without it and a review decides
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [reason]
              additionalProperties: false
              properties:
                reason: {type: string}
      responses:
        "200":
          description: Quarantined
          content:
            application/json:
              schema: {type: object, required: [source_id, status], properties: {source_id: {type: string}, status: {type: string}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/governance-settings:
    get:
      tags: [configuration]
      operationId: getGovernanceSettings
      summary: Whether configuration changes need change requests
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/GovernanceSettings"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    put:
      tags: [configuration]
      operationId: putGovernanceSettings
      summary: Require (or not) change requests for every configuration change (people with admin)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              description: A field left out keeps its current value.
              properties:
                config_approval: {type: string, enum: [optional, required]}
                max_delegation_depth:
                  type: integer
                  description: Longest chain of agents acting at other agents' requests, 1 to 10 (default 3); beyond depth 1 a person approves each action (AG-3.12).
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/GovernanceSettings"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/config-changes:
    post:
      tags: [configuration]
      operationId: createConfigChange
      summary: Propose a configuration document (draft) with its impact on recent beliefs and contracts
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [document]
              additionalProperties: false
              properties:
                document: {type: string, description: "YAML or JSON: ClaimType, ResolutionPolicy, AuthorityProfile, OutcomeContract, DerivationRule, AccessPolicy"}
                description: {type: string}
                impact_window: {type: string, description: "e.g. 168h (default 7 days)"}
                submit: {type: boolean, description: "send to review at once"}
                external_approvals:
                  type: array
                  items: {type: object, required: [reviewer], properties: {reviewer: {type: string}, url: {type: string}}}
      responses:
        "201": {description: Draft, content: {application/json: {schema: {$ref: "#/components/schemas/ConfigChange"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    get:
      tags: [configuration]
      operationId: listConfigChanges
      summary: Change requests, newest first
      parameters:
        - {name: status, in: query, schema: {type: string}}
      responses:
        "200":
          description: Changes
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/ConfigChange"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/config-changes/{id}:
    get:
      tags: [configuration]
      operationId: getConfigChange
      summary: A change request with its impact and approvals
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Change, content: {application/json: {schema: {$ref: "#/components/schemas/ConfigChange"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/config-changes/{id}:submit:
    post:
      tags: [configuration]
      operationId: submitConfigChange
      summary: Send a draft to review (the author)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Change, content: {application/json: {schema: {$ref: "#/components/schemas/ConfigChange"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/config-changes/{id}:publish:
    post:
      tags: [configuration]
      operationId: publishConfigChange
      summary: Publish an approved change (and activate policies and authority)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Change, content: {application/json: {schema: {$ref: "#/components/schemas/ConfigChange"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/config-changes/{id}:withdraw:
    post:
      tags: [configuration]
      operationId: withdrawConfigChange
      summary: Abandon a draft or a change in review (the author)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Change, content: {application/json: {schema: {$ref: "#/components/schemas/ConfigChange"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/config:validate:
    post:
      tags: [configuration]
      operationId: validateConfig
      summary: "Validate a configuration document (CI: gnctl config validate)"
      parameters:
        - {name: window, in: query, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/yaml:
            schema: {type: object}
          application/json:
            schema: {type: object}
      responses:
        "200": {description: Result, content: {application/json: {schema: {type: object, properties: {valid: {type: boolean}, kind: {type: string}, name: {type: string}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/config:regress:
    post:
      tags: [configuration]
      operationId: regressConfig
      summary: "Regress a candidate policy or authority profile against recent history (CI: gnctl config regress)"
      parameters:
        - {name: window, in: query, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/yaml:
            schema: {type: object}
          application/json:
            schema: {type: object}
      responses:
        "200": {description: Result, content: {application/json: {schema: {type: object}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/replay:decision:
    post:
      tags: [configuration]
      operationId: replayDecision
      summary: "Replay a past decision at its own time from recorded evidence and configuration versions, optionally under a candidate (admin or auditor; agents refused; read-only: gnctl replay decision)"
      description: |
        Rebuilds the beliefs the decision rested on as they were known when it was made, from the recorded
        evidence and the policy and authority versions each belief recorded, re-runs the gate's pipeline with
        the mandate version and catalog entry in force then, and says whether the outcome reproduces and what
        differs if not. Inputs the record keeps only as their result (agent state, lease, budget use, the
        envelope, sensitive data, tenant access policies, delegation) are carried and listed in carried.
        With a candidate (a resolution policy, authority profile or mandate version or document) it also shows
        what the outcome would have been. It runs in a read-only transaction: it never issues, revalidates,
        revokes or re-decides a permit and never reaches the gate or an enforcement point (FPS-25.13, FPS-25.15).
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/ReplayDecisionRequest"}
      responses:
        "200": {description: The replay, content: {application/json: {schema: {$ref: "#/components/schemas/DecisionReplay"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/replay:belief:
    post:
      tags: [configuration]
      operationId: replayBelief
      summary: "Replay a past belief resolution at its own transaction time, optionally under a candidate (admin or auditor; agents refused; read-only: gnctl replay belief)"
      description: |
        Recomputes a stored belief segment (or the one that covered a claim at an instant, as known then)
        from the evidence known when it was written and the configuration versions it recorded, and compares
        status, value, confidence, staleness, boundary and input digest (FPS-25.13, FPS-25.15).
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/ReplayBeliefRequest"}
      responses:
        "200": {description: The replay, content: {application/json: {schema: {$ref: "#/components/schemas/SegmentReplay"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/config:diff:
    post:
      tags: [configuration]
      operationId: configDiff
      summary: "Compare two configuration versions, or a candidate, over past decisions and beliefs: which decisions flip, which beliefs change (admin or auditor; agents refused; read-only: gnctl config diff)"
      description: |
        Re-runs a bounded, paged set of past gate decisions and belief segments (a window of at most 31 days,
        by claim or agent, at most limit of each per page) under from (default: the versions each item
        recorded) and to, writing nothing, and lists the decisions whose outcome flips and the beliefs whose
        value, confidence, status or boundary changes (FPS-25.14, FPS-25.15).
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/ConfigDiffRequest"}
      responses:
        "200": {description: One page of the diff, content: {application/json: {schema: {$ref: "#/components/schemas/ConfigDiff"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/samples:
    get:
      tags: [configuration]
      operationId: getSamples
      summary: The samples installed with the workspace (the SRE scenario's claim types and contract, two review policy packs)
      responses:
        "200": {description: Samples, content: {application/json: {schema: {$ref: "#/components/schemas/Samples"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [configuration]
      operationId: removeSamples
      summary: Remove the samples (admin); what the workspace has used or edited is kept and listed in kept, with the reason
      responses:
        "200": {description: Samples after removal, content: {application/json: {schema: {$ref: "#/components/schemas/Samples"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/retention-policy:
    get:
      tags: [configuration]
      operationId: getRetentionPolicy
      summary: The retention policy in force
      responses:
        "200": {description: Policy, content: {application/json: {schema: {type: object}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [configuration]
      operationId: putRetentionPolicy
      summary: Publish a RetentionPolicy version (content past its retention is erased daily)
      requestBody:
        required: true
        content:
          application/yaml:
            schema: {type: object}
          application/json:
            schema: {type: object}
      responses:
        "200": {description: Published, content: {application/json: {schema: {type: object}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/connector-mappings:
    get:
      tags: [configuration]
      operationId: listConnectorMappings
      summary: The latest version of each connector mapping published in the workspace (FPS-27.08)
      responses:
        "200":
          description: Mappings
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/ConnectorMappingVersion"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/plugin-modules:
    post:
      tags: [configuration]
      operationId: uploadPluginModule
      summary: Upload a WebAssembly resolution-plugin module (ABI gn.plugin.v1, at most 32 MiB); it is checked, stored by its SHA-256 and changes nothing until a ResolutionPlugin version names it. Administrators; agents are refused
      requestBody:
        required: true
        content:
          application/wasm:
            schema: {type: string, format: binary}
          application/octet-stream:
            schema: {type: string, format: binary}
      responses:
        "201": {description: Stored (or already stored), content: {application/json: {schema: {$ref: "#/components/schemas/PluginModule"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "413": {$ref: "#/components/responses/Problem"}
  /v1/resolution-plugins:
    get:
      tags: [configuration]
      operationId: listResolutionPlugins
      summary: Every published resolution-plugin version, by name, newest first
      responses:
        "200":
          description: Versions
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/ResolutionPluginVersion"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/resolution-plugins/{name}:
    put:
      tags: [configuration]
      operationId: putResolutionPlugin
      summary: Publish a ResolutionPlugin version naming an uploaded module and its limits (409 change_request_required when the workspace requires change requests; a ResolutionPlugin change request needs two approvers)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/yaml:
            schema: {type: object}
          application/json:
            schema: {type: object}
      responses:
        "200": {description: Published, content: {application/json: {schema: {$ref: "#/components/schemas/ResolutionPluginVersion"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/connector-mappings/{name}:
    get:
      tags: [configuration]
      operationId: getConnectorMapping
      summary: A connector mapping, the latest version or ?version=n; the connect role runs it by name (mapping_name)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: version, in: query, schema: {type: integer, minimum: 1}}
      responses:
        "200": {description: The mapping, content: {application/json: {schema: {$ref: "#/components/schemas/ConnectorMappingVersion"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [configuration]
      operationId: putConnectorMapping
      summary: Publish a ConnectorMapping version (409 change_request_required when the workspace requires change requests; then POST /v1/config-changes)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/yaml:
            schema: {type: object}
          application/json:
            schema: {type: object}
      responses:
        "200": {description: Published, content: {application/json: {schema: {$ref: "#/components/schemas/ConnectorMappingVersion"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/connector-mappings/{name}/versions:
    get:
      tags: [configuration]
      operationId: listConnectorMappingVersions
      summary: Every version of a connector mapping, newest first
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "200":
          description: Versions
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/ConnectorMappingVersion"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/privacy/deletions:
    post:
      tags: [evidence]
      operationId: requestDeletion
      summary: Request erasure of a data subject's, listed or filtered evidence content; another person approves it in review
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [reason, legal_basis]
              additionalProperties: false
              properties:
                subject_ref: {type: string}
                evidence_ids: {type: array, items: {type: string}}
                filter:
                  type: object
                  additionalProperties: false
                  properties:
                    claim_id: {type: string}
                    source_id: {type: string}
                    namespace: {type: string}
                    before: {type: string, format: date-time}
                reason: {type: string}
                legal_basis: {type: string}
      responses:
        "201": {description: Requested, content: {application/json: {schema: {$ref: "#/components/schemas/Deletion"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    get:
      tags: [evidence]
      operationId: listDeletions
      summary: Deletion requests, newest first (administrators)
      responses:
        "200":
          description: Deletions
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/Deletion"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/privacy/deletions/{id}:
    get:
      tags: [evidence]
      operationId: getDeletion
      summary: A deletion request with its report
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Deletion, content: {application/json: {schema: {$ref: "#/components/schemas/Deletion"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /.well-known/gn-anchor-keys.json:
    get:
      tags: [access]
      operationId: anchorKeys
      summary: Public keys that sign audit anchors and compliance export manifests (JWKS)
      security: []
      responses:
        "200": {description: JWKS, content: {application/json: {schema: {type: object}}}}
  /v1/audit/log:
    get:
      tags: [access]
      operationId: auditLog
      summary: Audit records with their chain hashes (administrators and auditors; 1000 per page)
      parameters:
        - {name: from_seq, in: query, schema: {type: integer}}
        - {name: to_seq, in: query, schema: {type: integer}}
      responses:
        "200": {description: Records, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/audit/anchors:
    get:
      tags: [access]
      operationId: listAnchors
      summary: Signed Merkle anchors over the audit trail and evidence, newest first (administrators and auditors)
      responses:
        "200": {description: Anchors, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/audit/timestamps:
    get:
      tags: [access]
      operationId: listAnchorTimestamps
      summary: Daily RFC 3161 time-stamps of the audit anchors (one per UTC day, on its last anchor), newest first (administrators and auditors)
      responses:
        "200": {description: Time-stamps, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/audit/archives:
    get:
      tags: [access]
      operationId: listAuditArchives
      summary: Yearly audit archives in the write-once bucket (chain segment, anchors, evidence leaves, time-stamps, signed manifest), oldest first (administrators and auditors)
      responses:
        "200": {description: Archives, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/audit/anchors/{n}:
    get:
      tags: [access]
      operationId: getAnchor
      summary: One anchor (administrators and auditors)
      parameters:
        - {name: n, in: path, required: true, schema: {type: integer}}
      responses:
        "200": {description: Anchor, content: {application/json: {schema: {type: object}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/audit/anchors/{n}/evidence:
    get:
      tags: [access]
      operationId: anchorEvidence
      summary: The evidence leaves an anchor covers (to recompute its root; administrators and auditors)
      parameters:
        - {name: n, in: path, required: true, schema: {type: integer}}
      responses:
        "200": {description: Leaves, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/audit:anchor:
    post:
      tags: [access]
      operationId: anchorNow
      summary: Anchor what is new now (administrators; the privacy role anchors every 10 minutes)
      responses:
        "200": {description: Result, content: {application/json: {schema: {type: object}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/compliance/exports:
    post:
      tags: [access]
      operationId: createExport
      summary: "Build a compliance export (JSON Lines and a signed manifest; administrators and auditors, subject_access administrators only)"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [report]
              additionalProperties: false
              properties:
                report: {type: string, enum: [audit, access, configuration_history, decision_reconstruction, outcomes, agent_oversight, transparency, guardrail_stress_test, subject_access]}
                from: {type: string, format: date-time}
                to: {type: string, format: date-time}
                from_seq: {type: integer}
                to_seq: {type: integer}
                decision_id: {type: string}
                run_id: {type: string, description: "guardrail_stress_test: the run (srn_…)"}
                principal: {type: string, description: "subject_access: the person (prn_…) or their email; the export holds everything the workspace keeps about them (GDPR Art. 15) and a readable summary.md"}
      responses:
        "201": {description: Export, content: {application/json: {schema: {type: object, required: [manifest, manifest_jws], properties: {manifest: {type: object}, manifest_jws: {type: string}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    get:
      tags: [access]
      operationId: listExports
      summary: Compliance exports, newest first (administrators; auditors see all but subject access exports)
      responses:
        "200": {description: Exports, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/compliance/exports/{id}:
    get:
      tags: [access]
      operationId: getExport
      summary: An export's manifest and signature (administrators and auditors; subject access administrators only)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Export, content: {application/json: {schema: {type: object}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/compliance/exports/{id}/files/{name}:
    get:
      tags: [access]
      operationId: exportFile
      summary: Download one file of an export (JSON Lines; administrators and auditors; subject access administrators only)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: File, content: {application/x-ndjson: {schema: {type: string}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/compliance/exports/{id}:link:
    post:
      tags: [access]
      operationId: exportLink
      summary: A download link for one file, valid 15 minutes, that needs no credentials (administrators and auditors; subject access administrators only)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [file], additionalProperties: false, properties: {file: {type: string}}}
      responses:
        "200": {description: Link, content: {application/json: {schema: {type: object, properties: {url: {type: string}, expires_at: {type: string, format: date-time}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/compliance/downloads/{token}:
    get:
      tags: [access]
      operationId: download
      summary: Download through a time-limited link
      security: []
      parameters:
        - {name: token, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: File, content: {application/x-ndjson: {schema: {type: string}}}}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/connectors:
    get:
      tags: [access]
      operationId: listConnectors
      summary: The connector registry - built-in connectors, the vendor APIs they read and their certification
      responses:
        "200": {description: Connectors, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /.well-known/gn-federation-keys.json:
    get:
      tags: [federation]
      operationId: federationKeys
      summary: Public keys that sign this cell's evidence bundles and peer agreements (JWKS), with the issuer they sign as (`issuer`, an extra member)
      security: []
      responses:
        "200": {description: JWKS, content: {application/json: {schema: {type: object}}}}
  /.well-known/did.json:
    get:
      tags: [federation]
      operationId: federationDID
      summary: This cell's did:web document listing its federation keys, when it presents itself by a DID (federation.did)
      security: []
      responses:
        "200": {description: DID document, content: {application/did+json: {schema: {type: object}}}}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/federation/peers:
    get:
      tags: [federation]
      operationId: listPeers
      summary: Federation peers
      responses:
        "200": {description: Peers, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/Peer"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    post:
      tags: [federation]
      operationId: createPeer
      summary: Register a peer (another instance's tenant) with its pinned bundle-signing keys
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [name, issuer, remote_tenant, region]
              additionalProperties: false
              properties:
                name: {type: string, pattern: "^[a-z0-9][a-z0-9-]{0,62}$"}
                issuer: {type: string, description: "the peer cell's issuer: gn://..., or its DID (did:web, did:key, did:jwk)"}
                remote_tenant: {type: string}
                region: {type: string}
                endpoint: {type: string, description: "base URL of the peer API, for pushes"}
                keys: {type: object, description: "the peer's JWKS (/.well-known/gn-federation-keys.json); optional when the issuer is a DID, whose keys are then resolved and pinned"}
      responses:
        "201": {description: Peer, content: {application/json: {schema: {$ref: "#/components/schemas/Peer"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/federation/peers/{id}:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    get:
      tags: [federation]
      operationId: getPeer
      summary: A peer
      responses:
        "200": {description: Peer, content: {application/json: {schema: {$ref: "#/components/schemas/Peer"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/federation/peers/{id}/credential:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    put:
      tags: [federation]
      operationId: setPeerCredential
      summary: Store the API key the peer issued to this tenant (sealed), for pushing bundles
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [api_key], additionalProperties: false, properties: {api_key: {type: string}}}
      responses:
        "200": {description: Peer, content: {application/json: {schema: {$ref: "#/components/schemas/Peer"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/federation/peers/{id}/agreements:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    get:
      tags: [federation]
      operationId: listAgreements
      summary: A peer's agreement versions, newest first
      responses:
        "200": {description: Agreements, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/Agreement"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    post:
      tags: [federation]
      operationId: proposeAgreement
      summary: Propose an agreement version (draft until both parties sign), optionally with the peer's signature
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [document]
              additionalProperties: false
              properties:
                document: {$ref: "#/components/schemas/AgreementDocument"}
                peer_signature: {type: string}
      responses:
        "201": {description: Agreement, content: {application/json: {schema: {$ref: "#/components/schemas/Agreement"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/federation/peers/{id}/agreements/{action}:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
      - {name: action, in: path, required: true, description: "{version}:sign or {version}:countersign", schema: {type: string, pattern: "^[0-9]+:(sign|countersign)$"}}
    post:
      tags: [federation]
      operationId: signAgreement
      summary: "Sign an agreement version with this cell's federation key (:sign), or add the peer's signature (:countersign, body {signature}); active once both verify"
      requestBody:
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {signature: {type: string}}}
      responses:
        "200": {description: Agreement, content: {application/json: {schema: {$ref: "#/components/schemas/Agreement"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/federation/peers/{id}/bundles:export:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    post:
      tags: [federation]
      operationId: exportBundle
      summary: Build a signed evidence bundle for the peer (tar - manifest.json, evidence.jsonl, manifest.jws - or a W3C Verifiable Presentation); the agreement and its allowed regions bound it
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                claim_ids: {type: array, items: {type: string}}
                since: {type: string, format: date-time}
                until: {type: string, format: date-time}
                limit: {type: integer, minimum: 1, maximum: 10000}
                format: {type: string, enum: [tar, vp], description: "tar (default) or vp - a W3C Verifiable Presentation of evidence credentials (vp+jwt)"}
      responses:
        "200": {description: Bundle, content: {application/x-tar: {schema: {type: string, format: binary}}, application/vp+jwt: {schema: {type: string}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/federation/peers/{id}/bundles:push:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    post:
      tags: [federation]
      operationId: pushBundle
      summary: Export a bundle and send it to the peer's endpoint; returns the peer's import summary
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                claim_ids: {type: array, items: {type: string}}
                since: {type: string, format: date-time}
                until: {type: string, format: date-time}
                limit: {type: integer, minimum: 1, maximum: 10000}
                format: {type: string, enum: [tar, vp], description: "tar (default) or vp - a W3C Verifiable Presentation of evidence credentials (vp+jwt)"}
      responses:
        "200": {description: Pushed, content: {application/json: {schema: {type: object, required: [export], properties: {export: {type: object}, peer_result: {type: object}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/federation/bundles:
    post:
      tags: [federation]
      operationId: importBundle
      summary: Import a bundle - as the peer's principal, or as an administrator with ?peer=; tampered bundles are rejected whole (422 provenance_tamper)
      parameters:
        - {name: peer, in: query, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/x-tar:
            schema: {type: string, format: binary}
          application/vp+jwt:
            schema: {type: string}
      responses:
        "200": {description: Import summary, content: {application/json: {schema: {$ref: "#/components/schemas/ImportResult"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
    get:
      tags: [federation]
      operationId: listBundles
      summary: Bundles sent and received, newest first (the export record proves where data went)
      parameters:
        - {name: direction, in: query, schema: {type: string, enum: [in, out]}}
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200": {description: Bundles, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}, next_cursor: {type: string}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/federation/claim-mappings:
    get:
      tags: [federation]
      operationId: listClaimMappings
      summary: Claim mappings of the active agreements
      responses:
        "200": {description: Mappings, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /.well-known/agent-card.json:
    get:
      tags: [federation]
      operationId: agentCard
      summary: A2A agent card - skills evidence.request, evidence.challenge, belief.query, bundle.exchange
      security: []
      responses:
        "200": {description: Agent card, content: {application/json: {schema: {type: object}}}}
  /v1/a2a:
    post:
      tags: [federation]
      operationId: a2a
      summary: A2A JSON-RPC 2.0 endpoint for peers (message/send with one JSON data part, tasks/get)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [jsonrpc, method]
              properties:
                jsonrpc: {type: string}
                id: {}
                method: {type: string}
                params: {type: object}
      responses:
        "200": {description: JSON-RPC response, content: {application/json: {schema: {type: object, required: [jsonrpc], properties: {jsonrpc: {type: string}, result: {type: object}, error: {type: object}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/federation/peers/{id}/evidence:request:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    post:
      tags: [federation]
      operationId: requestPeerEvidence
      summary: Ask a peer (A2A evidence.request) for evidence about a claim and import the signed bundle it returns
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [claim]
              additionalProperties: false
              properties:
                claim: {type: object, description: "uri, or namespace/entity/attribute/scope - in either party's vocabulary"}
                valid_at: {type: string, format: date-time}
      responses:
        "200": {description: Imported, content: {application/json: {schema: {type: object, required: [task_id, import], properties: {task_id: {type: string}, import: {$ref: "#/components/schemas/ImportResult"}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
  /v1/federation/peers/{id}/beliefs:query:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    post:
      tags: [federation]
      operationId: queryPeerBelief
      summary: Ask a peer (A2A belief.query) for its belief about a claim; the signed answer is verified
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [claim]
              additionalProperties: false
              properties:
                claim: {type: object, description: "uri, or namespace/entity/attribute/scope - in either party's vocabulary"}
                valid_at: {type: string, format: date-time}
      responses:
        "200": {description: The peer's belief, content: {application/json: {schema: {type: object, required: [iss, claim_id, status, confidence], properties: {iss: {type: string}, claim_id: {type: string}, status: {type: string}, confidence: {type: number}, value: {type: object}, stale: {type: boolean}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
  /v1/federation/challenges:
    post:
      tags: [federation]
      operationId: challengeEvidence
      summary: Challenge imported evidence at its origin (A2A evidence.challenge) - the signed provenance chain, or a revocation notice that revokes the local copy
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [evidence_id, reason]
              additionalProperties: false
              properties:
                evidence_id: {type: string}
                reason: {type: string}
      responses:
        "201": {description: Challenge, content: {application/json: {schema: {$ref: "#/components/schemas/Challenge"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
    get:
      tags: [federation]
      operationId: listChallenges
      summary: Challenges sent and answered, newest first
      responses:
        "200": {description: Challenges, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/Challenge"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/agent-detections:
    get:
      tags: [guard]
      operationId: listDetections
      summary: Behavior monitor findings (rate spikes, denial retries, no evidence basis, divergence, ...), newest first
      parameters:
        - {name: agent_id, in: query, schema: {type: string}}
        - {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 500}}
      responses:
        "200": {description: Detections, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object, required: [detection_id, agent_id, detector, action, detail, created_at], properties: {detection_id: {type: string}, agent_id: {type: string}, detector: {type: string}, action: {type: string, enum: [flag, review, breaker]}, detail: {type: object}, suspension_id: {type: string}, created_at: {type: string, format: date-time}}}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/guard:monitor:
    post:
      tags: [guard]
      operationId: runMonitor
      summary: Run the behavior monitor for this tenant now (administrators); breakers suspend agents whose thresholds are exceeded
      responses:
        "200": {description: Summary, content: {application/json: {schema: {type: object, required: [agents, flags, breakers, learned], properties: {agents: {type: integer}, flags: {type: integer}, breakers: {type: integer}, learned: {type: integer}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/mandates:learn:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    post:
      tags: [guard]
      operationId: learnMandate
      summary: Propose a minimal mandate from what a learn-mode agent did (shadow mode) and open its owner's review
      responses:
        "200": {description: Learned mandate, content: {application/json: {schema: {type: object, required: [agent_id, from_version, proposals, actions, mandate], properties: {agent_id: {type: string}, from_version: {type: integer}, since: {type: string, format: date-time}, proposals: {type: integer}, actions: {type: array, items: {type: object}}, mandate: {type: string}, review_id: {type: string}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/mandates/{version}:enforce:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
      - {name: version, in: path, required: true, schema: {type: integer}}
    post:
      tags: [guard]
      operationId: enforceMandate
      summary: Publish a shadow-mode mandate version again in enforce mode
      responses:
        "201": {description: The new version, content: {application/json: {schema: {type: object}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/credential-providers:
    get:
      tags: [guard]
      operationId: listCredentialProviders
      summary: Credential broker providers (secrets are never returned)
      responses:
        "200": {description: Providers, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/CredentialProvider"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/credential-providers/{name}:
    parameters:
      - {name: name, in: path, required: true, schema: {type: string}}
    get:
      tags: [guard]
      operationId: getCredentialProvider
      summary: A credential provider
      responses:
        "200": {description: Provider, content: {application/json: {schema: {$ref: "#/components/schemas/CredentialProvider"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putCredentialProvider
      summary: Create or replace a credential provider (AWS STS, Kubernetes TokenRequest, GitHub App, Vault) and its grants (people only)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [kind, grants]
              additionalProperties: false
              properties:
                kind: {type: string, enum: [aws, kubernetes, github, vault]}
                config: {type: object}
                grants: {type: array, items: {type: object}}
                secret: {type: string, description: "write-only: AWS key pair id:secret, Kubernetes token, GitHub App private key (PEM) or Vault token"}
      responses:
        "200": {description: Provider, content: {application/json: {schema: {$ref: "#/components/schemas/CredentialProvider"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [guard]
      operationId: deleteCredentialProvider
      summary: Remove a credential provider
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/credentials:
    post:
      tags: [guard]
      operationId: exchangeCredentials
      summary: An agent exchanges its permit for short-lived credentials limited to the permitted target (the permit is consumed)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [permit, provider], additionalProperties: false, properties: {permit: {type: string}, provider: {type: string}}}
      responses:
        "201": {description: Credentials, content: {application/json: {schema: {type: object, required: [issuance_id, provider, kind, expires_at, credentials, scope], properties: {issuance_id: {type: string}, provider: {type: string}, kind: {type: string}, expires_at: {type: string, format: date-time}, credentials: {type: object, additionalProperties: {type: string}}, scope: {type: object}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
        "502": {$ref: "#/components/responses/Problem"}
  /v1/credential-issuances:
    get:
      tags: [guard]
      operationId: listCredentialIssuances
      summary: Credentials issued by the broker, newest first (no secret values)
      parameters:
        - {name: agent_id, in: query, schema: {type: string}}
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200": {description: Issuances, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}, next_cursor: {type: string}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/identities:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    get:
      tags: [guard]
      operationId: getAgentIdentities
      summary: The agent's identities in other systems (AWS, Kubernetes, GitHub), for the bypass report; entra, okta and oidc identities (<issuer>|<claim value>) also sign the agent in (AG-1.04)
      responses:
        "200": {description: Identities, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object, required: [system, subject], properties: {system: {type: string, enum: [aws, azure, gcp, kubernetes, argocd, github, copilot-studio, agentforce, entra, okta, oidc, m365-app, google-app, salesforce-app, aws-bedrock-agent, azure-foundry-agent, vertex-agent, mcp-server, upn, entra-object, zscaler-user, cloudflare-user, cloudflare-device, host, ip, other]}, subject: {type: string}, standing: {type: boolean}, note: {type: string}}}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putAgentIdentities
      summary: Replace the agent's identities in other systems (people only)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [items], additionalProperties: false, properties: {items: {type: array, items: {type: object, required: [system, subject], properties: {system: {type: string, enum: [aws, azure, gcp, kubernetes, argocd, github, copilot-studio, agentforce, entra, okta, oidc, m365-app, google-app, salesforce-app, aws-bedrock-agent, azure-foundry-agent, vertex-agent, mcp-server, upn, entra-object, zscaler-user, cloudflare-user, cloudflare-device, host, ip, other]}, subject: {type: string}, standing: {type: boolean}, note: {type: string}}}}}}
      responses:
        "200": {description: Identities, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object, required: [system, subject], properties: {system: {type: string, enum: [aws, azure, gcp, kubernetes, argocd, github, copilot-studio, agentforce, entra, okta, oidc, m365-app, google-app, salesforce-app, aws-bedrock-agent, azure-foundry-agent, vertex-agent, mcp-server, upn, entra-object, zscaler-user, cloudflare-user, cloudflare-device, host, ip, other]}, subject: {type: string}, standing: {type: boolean}, note: {type: string}}}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/disabled-credentials:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    get:
      tags: [guard]
      operationId: getAgentDisabledCredentials
      summary: The agent's standing identities disabled at the source after a bypass (on_bypass.disable_credentials), enabled again when it is resumed, or to disable by hand (AG-5.08)
      responses:
        "200": {description: Disabled credentials, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object, required: [disable_id, agent_id, suspension_id, system, subject, state, attempts, updated_at], properties: {disable_id: {type: string}, agent_id: {type: string}, suspension_id: {type: string}, system: {type: string}, subject: {type: string}, state: {type: string, enum: [pending, disabled, enabled, manual, cancelled]}, connection: {type: string}, detail: {type: string}, last_error: {type: string}, attempts: {type: integer}, updated_at: {type: string, format: date-time}}}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/configuration:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    get:
      tags: [guard]
      operationId: getAgentConfiguration
      summary: The configuration a person approved for the agent (model, system prompt digest, tools) and whether it has drifted (AG-2.06)
      responses:
        "200": {description: Approved configuration, content: {application/json: {schema: {type: object, required: [agent_id, configuration, digest, approved_by, approved_at, drifted], properties: {agent_id: {type: string}, configuration: {type: object}, digest: {type: string}, approved_by: {type: string}, approved_at: {type: string, format: date-time}, drifted: {type: boolean}, drifted_at: {type: string, format: date-time}, drift: {type: object}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putAgentConfiguration
      summary: Approve the agent's configuration (people only); ends any drift
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [model, system_prompt_sha256, tools], additionalProperties: false, properties: {model: {type: string}, system_prompt_sha256: {type: string, pattern: "^[0-9a-fA-F]{64}$"}, tools: {type: array, items: {type: string}}, skills: {type: array, maxItems: 100, description: "Skills the agent has loaded; each must be approved in the skills registry (AG-5.25)", items: {$ref: "#/components/schemas/SkillRef"}}}}
      responses:
        "200": {description: Approved configuration, content: {application/json: {schema: {type: object, required: [agent_id, configuration, digest, approved_by, approved_at, drifted], properties: {agent_id: {type: string}, configuration: {type: object}, digest: {type: string}, approved_by: {type: string}, approved_at: {type: string, format: date-time}, drifted: {type: boolean}, drifted_at: {type: string, format: date-time}, drift: {type: object}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/configuration:observe:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    post:
      tags: [guard]
      operationId: observeAgentConfiguration
      summary: Report the configuration the agent's runtime sees; a difference from the approved one pauses the agent and revokes its permits until a person approves again
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [model, system_prompt_sha256, tools], additionalProperties: false, properties: {model: {type: string}, system_prompt_sha256: {type: string, pattern: "^[0-9a-fA-F]{64}$"}, tools: {type: array, items: {type: string}}, skills: {type: array, maxItems: 100, description: "Skills the agent has loaded; each must be approved in the skills registry (AG-5.25)", items: {$ref: "#/components/schemas/SkillRef"}}}}
      responses:
        "200": {description: Approved configuration and drift, content: {application/json: {schema: {type: object, required: [agent_id, configuration, digest, approved_by, approved_at, drifted], properties: {agent_id: {type: string}, configuration: {type: object}, digest: {type: string}, approved_by: {type: string}, approved_at: {type: string, format: date-time}, drifted: {type: boolean}, drifted_at: {type: string, format: date-time}, drift: {type: object}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /.well-known/authzen-configuration:
    get:
      tags: [guard]
      operationId: authzenConfiguration
      summary: AuthZEN policy decision point metadata (AG-5.18)
      security: []
      responses:
        "200": {description: Metadata, content: {application/json: {schema: {type: object}}}}
  /access/v1/evaluation:
    post:
      tags: [guard]
      operationId: authzenEvaluation
      summary: "AuthZEN access evaluation: a registered decision client asks the action gate on an agent's behalf (subject = agent, action.name = action type, resource.id = target, action.properties = parameters); the decision is recorded and ALLOW carries the permit in context"
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, properties: {subject: {type: object, required: [type, id], properties: {type: {type: string}, id: {type: string}, properties: {type: object}}}, action: {type: object, required: [name], properties: {name: {type: string}, properties: {type: object}}}, resource: {type: object, required: [type, id], properties: {type: {type: string}, id: {type: string}, properties: {type: object}}}, context: {type: object}}}
      responses:
        "200": {description: Decision, content: {application/json: {schema: {type: object, required: [decision], properties: {decision: {type: boolean}, context: {type: object}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /access/v1/evaluations:
    post:
      tags: [guard]
      operationId: authzenEvaluations
      summary: AuthZEN batch evaluation (at most 50; options.evaluations_semantic execute_all, deny_on_first_deny or permit_on_first_permit)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, properties: {subject: {type: object, required: [type, id], properties: {type: {type: string}, id: {type: string}, properties: {type: object}}}, action: {type: object, required: [name], properties: {name: {type: string}, properties: {type: object}}}, resource: {type: object, required: [type, id], properties: {type: {type: string}, id: {type: string}, properties: {type: object}}}, context: {type: object}, evaluations: {type: array, items: {type: object, properties: {subject: {type: object, required: [type, id], properties: {type: {type: string}, id: {type: string}, properties: {type: object}}}, action: {type: object, required: [name], properties: {name: {type: string}, properties: {type: object}}}, resource: {type: object, required: [type, id], properties: {type: {type: string}, id: {type: string}, properties: {type: object}}}, context: {type: object}}}}, options: {type: object}}}
      responses:
        "200": {description: Decisions, content: {application/json: {schema: {type: object, required: [evaluations], properties: {evaluations: {type: array, items: {type: object, required: [decision], properties: {decision: {type: boolean}, context: {type: object}}}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/decision-clients:
    get:
      tags: [guard]
      operationId: listDecisionClients
      summary: Other vendors' enforcement points allowed to ask the gate through AuthZEN
      responses:
        "200": {description: Clients, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object, required: [principal_id, name, agents, created_by, created_at], properties: {principal_id: {type: string}, name: {type: string}, agents: {type: array, items: {type: string}}, created_by: {type: string}, created_at: {type: string, format: date-time}}}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
  /v1/decision-clients/{principal}:
    parameters:
      - {name: principal, in: path, required: true, schema: {type: string}}
    put:
      tags: [guard]
      operationId: putDecisionClient
      summary: Register a service principal as a decision client (people with the admin scope); agents limits which agents it may decide for
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [name], additionalProperties: false, properties: {name: {type: string}, agents: {type: array, items: {type: string}}}}
      responses:
        "200": {description: Client, content: {application/json: {schema: {type: object, required: [principal_id, name, agents, created_by, created_at], properties: {principal_id: {type: string}, name: {type: string}, agents: {type: array, items: {type: string}}, created_by: {type: string}, created_at: {type: string, format: date-time}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [guard]
      operationId: deleteDecisionClient
      summary: Remove a decision client
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/mcp-servers:
    get:
      tags: [guard]
      operationId: listMCPServers
      summary: The approved MCP-server registry (AG-5.21); secrets are never returned (has_secret)
      responses:
        "200": {description: Servers, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/MCPServer"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/mcp-servers/{name}:
    parameters:
      - {name: name, in: path, required: true, schema: {type: string}}
    get:
      tags: [guard]
      operationId: getMCPServer
      summary: One registered MCP server, without its secret
      responses:
        "200": {description: Server, content: {application/json: {schema: {$ref: "#/components/schemas/MCPServer"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putMCPServer
      summary: "Register, change or approve an upstream MCP server (people with the admin scope): its URL, a write-only secret sent in auth_header, and the tools agents may call, each mapped to a gate action type; unlisted tools are refused"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [url]
              additionalProperties: false
              properties:
                url: {type: string}
                auth_header: {type: string}
                secret: {type: string, writeOnly: true}
                approved: {type: boolean}
                default_deny: {type: boolean, description: "Always true: tools not listed are refused"}
                tools: {type: array, items: {$ref: "#/components/schemas/MCPTool"}}
      responses:
        "200": {description: Server, content: {application/json: {schema: {$ref: "#/components/schemas/MCPServer"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [guard]
      operationId: deleteMCPServer
      summary: Remove a server from the registry; its hosted endpoint stops at once
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/skills:
    get:
      tags: [guard]
      operationId: listSkills
      summary: The approved skills registry (AG-5.25)
      responses:
        "200": {description: Skills, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/Skill"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/skills/{name}:
    parameters:
      - {name: name, in: path, required: true, schema: {type: string}}
    get:
      tags: [guard]
      operationId: getSkill
      summary: One registered skill
      responses:
        "200": {description: Skill, content: {application/json: {schema: {$ref: "#/components/schemas/Skill"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putSkill
      summary: "Register, change or approve a skill (people with the admin scope): its source and each approved version by the SHA-256 of its content; the gate refuses an agent that reports a skill not approved or a version not listed"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                description: {type: string, maxLength: 1000}
                source: {type: string, maxLength: 2000, description: Where the skill comes from (a repository or package URL)}
                approved: {type: boolean}
                versions: {type: array, maxItems: 100, items: {$ref: "#/components/schemas/SkillVersion"}}
      responses:
        "200": {description: Skill, content: {application/json: {schema: {$ref: "#/components/schemas/Skill"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [guard]
      operationId: deleteSkill
      summary: Remove a skill from the registry; agents reporting it are refused from then on
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /mcp/{server}:
    parameters:
      - {name: server, in: path, required: true, schema: {type: string}}
      - {name: Mcp-Session-Id, in: header, required: false, schema: {type: string}}
      - {name: Mcp-Protocol-Version, in: header, required: false, schema: {type: string}}
    post:
      tags: [guard]
      operationId: mcpEndpoint
      summary: "The hosted MCP endpoint of an approved server (Streamable HTTP, JSON responses; AG-5.21), with the agent's own API key: initialize, ping, tools/list (approved tools only) and tools/call, which the action gate decides first; only an allowed call reaches the server, and a refusal is a tool result with isError and the decision ID"
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, description: "One JSON-RPC 2.0 message (no batches)"}
      responses:
        "200": {description: The JSON-RPC response, content: {application/json: {schema: {type: object}}}}
        "202": {description: A notification was accepted}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "413": {$ref: "#/components/responses/Problem"}
        "502": {$ref: "#/components/responses/Problem"}
  /v1/claim-verification:setup:
    post:
      tags: [evidence]
      operationId: setupClaimVerification
      summary: Set up claim verification (admins) - the verifier's principal and source, bound with class DERIVED to the namespaces given (AG-4.07)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [namespaces], additionalProperties: false, properties: {namespaces: {type: array, minItems: 1, items: {type: string}}}}
      responses:
        "200": {description: Verifier, content: {application/json: {schema: {type: object, required: [principal_id, source_id, namespaces], properties: {principal_id: {type: string}, source_id: {type: string}, namespaces: {type: array, items: {type: string}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/claim-verifications:
    post:
      tags: [evidence]
      operationId: verifyClaim
      summary: Check an AI_DERIVED statement against the non-AI evidence it cites (same claim, same value, another source, not revoked); when all hold, DERIVED evidence citing them is recorded (AG-4.07)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [evidence_id, cites], additionalProperties: false, properties: {evidence_id: {type: string}, cites: {type: array, minItems: 1, maxItems: 20, items: {type: string}}}}
      responses:
        "200": {description: Not verified (the problems say why), content: {application/json: {schema: {type: object, required: [statement, cites, verified, problems], properties: {statement: {type: string}, cites: {type: array, items: {type: string}}, verified: {type: boolean}, problems: {type: array, items: {type: string}}, evidence: {type: object}}}}}}
        "201": {description: Verified and recorded, content: {application/json: {schema: {type: object, required: [statement, cites, verified, problems], properties: {statement: {type: string}, cites: {type: array, items: {type: string}}, verified: {type: boolean}, problems: {type: array, items: {type: string}}, evidence: {type: object}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/observed-actions:
    post:
      tags: [guard]
      operationId: observeActions
      summary: Report actions seen in other systems' audit trails (Kubernetes audit, CloudTrail, GitHub audit); each is matched to an agent and to the permit or broker credential that covered it
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [actions]
              additionalProperties: false
              properties:
                actions:
                  type: array
                  maxItems: 5000
                  items: {type: object, required: [system, actor, action, target, ref, occurred_at], properties: {system: {type: string}, actor: {type: string}, action: {type: string}, target: {type: string}, ref: {type: string}, occurred_at: {type: string, format: date-time}}}
      responses:
        "200": {description: Matched, content: {application/json: {schema: {type: object, required: [received, matched_to_agents, covered, bypasses, duplicates], properties: {received: {type: integer}, matched_to_agents: {type: integer}, covered: {type: integer}, bypasses: {type: integer}, duplicates: {type: integer}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/bypass-report:
    get:
      tags: [guard]
      operationId: bypassReport
      summary: Agent credentials and actions not routed through permits, per agent
      parameters:
        - {name: since, in: query, schema: {type: string, format: date-time}}
      responses:
        "200": {description: Report, content: {application/json: {schema: {type: object, required: [since, items], properties: {since: {type: string, format: date-time}, items: {type: array, items: {type: object}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/observed-actions/k8s-audit:
    post:
      tags: [guard]
      operationId: observeK8sAudit
      summary: Kubernetes audit webhook backend (continuous bypass detection and coverage)
      description: Point a Kubernetes API server's audit webhook here (--audit-webhook-config-file) with an enforcement or service key. Successful changes become observed actions.
      parameters:
        - {name: cluster, in: query, required: true, schema: {type: string}}
      requestBody: {required: true, content: {application/json: {schema: {type: object, description: "audit.k8s.io/v1 EventList", properties: {items: {type: array, items: {type: object}}}}}}}
      responses:
        "200": {description: Recorded, content: {application/json: {schema: {type: object}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/observed-actions/k8s-audit/{cluster}:
    post:
      tags: [guard]
      operationId: observeK8sAuditCluster
      summary: Kubernetes audit webhook backend for one cluster (use this form; the webhook client replaces query strings)
      description: Point a Kubernetes API server's audit webhook here over HTTPS (its client sends no credentials over HTTP) with a service key.
      parameters:
        - {name: cluster, in: path, required: true, schema: {type: string}}
      requestBody: {required: true, content: {application/json: {schema: {type: object, description: "audit.k8s.io/v1 EventList", properties: {items: {type: array, items: {type: object}}}}}}}
      responses:
        "200": {description: Recorded, content: {application/json: {schema: {type: object}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/governance/coverage:
    get:
      tags: [guard]
      operationId: governanceCoverage
      summary: Governance coverage, per agent and for the tenant (AG-5.07)
      description: Of the agents' actions observed in the systems they act on, the share a permit or brokered credential stood behind. Agents nothing observes have no coverage figure.
      parameters:
        - {name: since, in: query, schema: {type: string, format: date-time}}
      responses:
        "200": {description: Coverage, content: {application/json: {schema: {type: object, required: [since, agents, observed, covered, bypasses, coverage, items], properties: {since: {type: string, format: date-time}, agents: {type: integer}, agents_observed: {type: integer}, agents_governed: {type: integer}, agents_with_gaps: {type: integer}, observed: {type: integer}, covered: {type: integer}, bypasses: {type: integer}, coverage: {type: number, nullable: true}, enforced_uses: {type: integer}, brokered_credentials: {type: integer}, agents_with_standing_credentials: {type: integer}, unknown_agents: {type: integer}, items: {type: array, items: {type: object}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/findings:
    post:
      tags: [evidence]
      operationId: submitFindings
      summary: Security findings become evidence about their targets (AG-4.03)
      description: Findings from a security tool, in its own format (generic, AWS Security Hub ASFF, or SARIF), as the calling connector. Each becomes evidence for gn://sec/target/<target>/<kind> (exposed, sensitive_data, critical_vulnerability, under_attack), true while active and false once resolved. The gate raises the consequence of actions on a target these beliefs mark as dangerous.
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [format, document], properties: {format: {type: string, enum: [generic, asff, sarif]}, document: {}, target: {type: string, description: "sarif: the target the scan is about"}, source_id: {type: string}}}
      responses:
        "200": {description: What became evidence, content: {application/json: {schema: {type: object, required: [findings, submitted, errors, items], properties: {findings: {type: integer}, submitted: {type: integer}, errors: {type: array, items: {type: string}}, items: {type: array, items: {type: object}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/findings:setup:
    post:
      tags: [evidence]
      operationId: setupFindings
      summary: Publish the claim types security findings feed (admins, AG-4.03)
      responses:
        "200": {description: Published, content: {application/json: {schema: {type: object, required: [claim_types], properties: {claim_types: {type: array, items: {type: string}}, next: {type: string}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/graph:
    get:
      tags: [guard]
      operationId: agentGraph
      summary: An agent's authority graph and reach (AG-5.11)
      description: Nodes and edges from what people allowed the agent (mandate rules, broker providers, task grants, identities) to what it relied on and did (its recent decisions, the beliefs they relied on, permits, credentials bought, observed actions, outcomes); and its reach, every target pattern it can touch and through what, routes without a permit (standing credentials) first.
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
        - {name: since, in: query, schema: {type: string, format: date-time}}
      responses:
        "200": {description: Graph, content: {application/json: {schema: {type: object, required: [agent_id, nodes, edges, reach, summary], properties: {agent_id: {type: string}, since: {type: string, format: date-time}, summary: {type: string}, nodes: {type: array, items: {type: object, required: [id, kind, label], properties: {id: {type: string}, kind: {type: string}, label: {type: string}, detail: {type: object}}}}, edges: {type: array, items: {type: object, required: [from, to, kind], properties: {from: {type: string}, to: {type: string}, kind: {type: string}}}}, reach: {type: array, items: {type: object, required: [target, actions, via, gated], properties: {target: {type: string}, actions: {type: array, items: {type: string}}, via: {type: array, items: {type: string}}, consequence: {type: string}, gated: {type: boolean}, note: {type: string}}}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/governance/first-report:
    get:
      tags: [guard]
      operationId: firstReport
      summary: The observe-first report (AG-5.15)
      description: Needs only read-only audit streams and shadow-mode mandates, and changes nothing. The onboarding steps and whether each is done; what the agents did and the governed share; likely unknown agents; the riskiest agents; and what the gate would have refused or escalated in shadow mode, grouped by reason with examples; in plain words. Default period, the last 7 days.
      parameters:
        - {name: since, in: query, schema: {type: string, format: date-time}}
      responses:
        "200": {description: Report, content: {application/json: {schema: {type: object, required: [since, steps, agents, observed, coverage, unknown_agents, top_risks, shadow_decisions, would_refuse, summary], properties: {since: {type: string, format: date-time}, steps: {type: array, items: {type: object, required: [step, done, detail, how], properties: {step: {type: string}, done: {type: boolean}, detail: {type: string}, how: {type: string}}}}, agents: {type: integer}, observed: {type: integer}, coverage: {type: number, nullable: true}, unknown_agents: {type: array, items: {type: object}}, top_risks: {type: array, items: {type: object}}, shadow_decisions: {type: integer}, would_refuse: {type: array, items: {type: object, required: [outcome, reason, count, examples], properties: {outcome: {type: string}, reason: {type: string}, count: {type: integer}, examples: {type: array, items: {type: string}}}}}, summary: {type: array, items: {type: string}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/governance/trend:
    get:
      tags: [guard]
      operationId: governanceTrend
      summary: The governed share of agents' actions over time (AG-5.12)
      parameters:
        - {name: days, in: query, schema: {type: integer, minimum: 1, maximum: 366}}
      responses:
        "200": {description: Trend, content: {application/json: {schema: {type: object, required: [days, coverage, summary], properties: {days: {type: array, items: {type: object, required: [day, observed, covered, bypasses, coverage, decisions], properties: {day: {type: string}, observed: {type: integer}, covered: {type: integer}, bypasses: {type: integer}, coverage: {type: number, nullable: true}, decisions: {type: integer}, allowed: {type: integer}, denied: {type: integer}, escalated: {type: integer}}}}, coverage: {type: number, nullable: true}, change: {type: number, nullable: true}, summary: {type: string}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/governance/posture:
    get:
      tags: [guard]
      operationId: governancePosture
      summary: Risky settings in how agents are governed (standing credentials, broad targets, fail-open, the lethal trifecta without sessions…), mapped to the OWASP Top 10 for LLM Applications (AG-5.19)
      parameters:
        - {name: agent, in: query, schema: {type: string}}
      responses:
        "200": {description: Posture, content: {application/json: {schema: {type: object, required: [items, owasp, summary], properties: {items: {type: array, items: {type: object, required: [agent_id, agent, rule, severity, owasp, detail, fix], properties: {agent_id: {type: string}, agent: {type: string}, rule: {type: string}, severity: {type: string, enum: [high, medium, low]}, owasp: {type: array, items: {type: string}}, detail: {type: string}, fix: {type: string}}}}, owasp: {type: object}, summary: {type: string}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/risk-posture:
    get:
      tags: [guard]
      operationId: riskPosture
      summary: The workspace's AI-governance risk posture, area by area, with counts, 7- and 30-day trends, what they mean and where to fix them (people only) (AG-19.01)
      description: "Read-only, from records that already exist. Each area has a state (attention, ok, no_data) decided by the rule shown with it (attention_when); the overall indicator is only how many areas need attention, not a score (rule). Agents are refused."
      responses:
        "200":
          description: The risk posture
          content:
            application/json:
              schema:
                type: object
                required: [generated_at, attention, no_data, total, summary, rule, areas]
                properties:
                  generated_at: {type: string, format: date-time}
                  attention: {type: integer}
                  no_data: {type: integer}
                  total: {type: integer}
                  summary: {type: string}
                  rule: {type: string}
                  areas:
                    type: array
                    items:
                      type: object
                      required: [id, title, state, headline, counts, trend, means, todo, attention_when, links, requirements]
                      properties:
                        id: {type: string, enum: [agents, discovery, stress, drift, reviews, bypass, feeds, credentials, data]}
                        title: {type: string}
                        state: {type: string, enum: [attention, ok, no_data]}
                        headline: {type: string}
                        counts: {type: array, items: {type: object, required: [key, label, value], properties: {key: {type: string}, label: {type: string}, value: {type: integer}}}}
                        trend: {type: array, items: {type: object, required: [key, label, last_7_days, previous_7_days, last_30_days], properties: {key: {type: string}, label: {type: string}, last_7_days: {type: integer}, previous_7_days: {type: integer}, last_30_days: {type: integer}}}}
                        means: {type: string}
                        todo: {type: string}
                        attention_when: {type: string}
                        links: {type: array, items: {type: object, required: [label, page, api], properties: {label: {type: string}, page: {type: string}, api: {type: string}}}}
                        requirements: {type: array, items: {type: string}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/risk-posture/agents:
    get:
      tags: [guard]
      operationId: riskPostureAgents
      summary: The risk posture per agent, by name, a page at a time (people only) (AG-19.03)
      parameters:
        - {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 100, default: 25}}
        - {name: cursor, in: query, schema: {type: string}}
      responses:
        "200":
          description: A page of agents
          content:
            application/json:
              schema:
                type: object
                required: [items]
                properties:
                  next_cursor: {type: string}
                  items:
                    type: array
                    items:
                      type: object
                      required: [agent_id, name, mandate, adoption_done, adoption_total, standing_credentials, bypasses_30_days, data_refusals_30_days, attention]
                      properties:
                        agent_id: {type: string}
                        name: {type: string}
                        mandate: {type: string}
                        adoption_done: {type: integer}
                        adoption_total: {type: integer}
                        next: {type: string}
                        stress: {type: object, required: [run_id, finished_at, held, through], properties: {run_id: {type: string}, finished_at: {type: string, format: date-time}, held: {type: integer}, through: {type: integer}}}
                        standing_credentials: {type: integer}
                        bypasses_30_days: {type: integer}
                        data_refusals_30_days: {type: integer}
                        attention: {type: array, items: {type: string}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/hijack-simulations:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    post:
      tags: [guard]
      operationId: simulateHijack
      summary: "If this agent were hijacked, what could it do? Adversarial plans built from its mandate replayed through the gate's what-if path; nothing is recorded (AG-5.20)"
      responses:
        "200": {description: Report, content: {application/json: {schema: {type: object, required: [agent_id, attempts, gets_through, summary], properties: {agent_id: {type: string}, attempts: {type: array, items: {type: object, required: [attack, what, outcome, reasons, gets_through, severity], properties: {attack: {type: string}, what: {type: string}, action: {type: string}, target: {type: string}, outcome: {type: string}, reasons: {type: array, items: {type: string}}, detail: {type: string}, gets_through: {type: boolean}, severity: {type: string}}}}, gets_through: {type: integer}, summary: {type: string}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/stress-tests:
    post:
      tags: [guard]
      operationId: startStressTest
      summary: "Run the guardrail stress test: the library's adversarial attempts against the workspace's own configuration, through the gate's what-if path only; nothing is executed, recorded, approved or spent (people with the admin scope; agents are refused) (AG-15.01, AG-15.02)"
      requestBody:
        required: false
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {agent_id: {type: string, description: "Run one agent's cases (agt_…); absent: every agent"}}}
      responses:
        "202": {description: The run started, content: {application/json: {schema: {$ref: "#/components/schemas/StressRun"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
    get:
      tags: [guard]
      operationId: listStressTests
      summary: Stress test runs, newest first (people only) (AG-15.04)
      parameters:
        - {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 100}}
      responses:
        "200": {description: Runs, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/StressRun"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/stress-tests/settings:
    get:
      tags: [guard]
      operationId: getStressSettings
      summary: "The stress test's schedule (off, daily, weekly; weekly by default) and whether it re-runs 10 minutes after a mandate or access-policy change (on by default)"
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/StressSettings"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putStressSettings
      summary: Change the stress test's schedule (people with the admin scope)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [schedule, on_change], properties: {schedule: {type: string, enum: ["off", daily, weekly]}, on_change: {type: boolean}}}
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/StressSettings"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/stress-tests/library:
    get:
      tags: [guard]
      operationId: stressLibrary
      summary: The built-in case library (gn-stress-1.0, cannot be disabled) and the workspace's own cases, with their versions (AG-15.03, AG-15.04, AG-15.05)
      responses:
        "200": {description: Library, content: {application/json: {schema: {type: object, required: [library_version, tenant_cases_version, built_in, workspace], properties: {library_version: {type: string}, tenant_cases_version: {type: integer}, built_in: {type: array, items: {type: object}}, workspace: {type: array, items: {type: object}}, generators: {type: array, items: {type: string}}, categories: {type: array, items: {type: string}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/stress-tests/cases/{id}:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    put:
      tags: [guard]
      operationId: putStressCase
      summary: "Add or replace a workspace case: a StressCase document (YAML or JSON) for one of the fixed generators, with synthetic targets and destinations; no code. Built-in cases cannot be changed or disabled. Invalid cases return 400 naming the field (AG-15.05)"
      requestBody:
        required: true
        content:
          application/yaml:
            schema: {type: object}
          application/json:
            schema: {type: object}
      responses:
        "200": {description: Stored, content: {application/json: {schema: {type: object}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "413": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [guard]
      operationId: deleteStressCase
      summary: Remove a workspace case (built-in cases cannot be removed)
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/stress-tests/{id}:
    get:
      tags: [guard]
      operationId: getStressTest
      summary: "A run with its result: regressions since the previous run first, then what got through by severity with why and the fix, and the report in words (format=md for Markdown) (AG-15.06)"
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
        - {name: format, in: query, schema: {type: string, enum: [json, md]}}
      responses:
        "200": {description: Run, content: {application/json: {schema: {$ref: "#/components/schemas/StressRun"}}, text/plain: {schema: {type: string}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/mandate-templates:
    get:
      tags: [guard]
      operationId: mandateTemplates
      summary: Built-in mandate templates (deploy-bot, read-only-analyst, support-assistant, coding-agent, infra-operator) with an example of each (AG-2.07)
      responses:
        "200": {description: Templates, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
  /v1/agents:from-template:
    post:
      tags: [guard]
      operationId: agentFromTemplate
      summary: Create an agent and its mandate from a template in one step (people only)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [name, owner_id, template, targets], additionalProperties: false, properties: {name: {type: string}, owner_id: {type: string}, groups: {type: array, items: {type: string}}, template: {type: string}, targets: {type: array, minItems: 1, items: {type: string}}, egress: {type: array, items: {type: string}}}}
      responses:
        "201": {description: Created, content: {application/json: {schema: {type: object, required: [agent, mandate, next], properties: {agent: {type: object}, mandate: {type: object}, next: {type: string}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
  /v1/target-owners:
    get:
      tags: [guard]
      operationId: listTargetOwners
      summary: Who owns which targets; an escalated action on an owned target needs one of its owners among the approvers (AG-6.04)
      responses:
        "200": {description: Owners, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object, required: [name, pattern, owners, updated_at], properties: {name: {type: string}, pattern: {type: string}, owners: {type: array, items: {type: string}}, updated_at: {type: string, format: date-time}}}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
  /v1/target-owners/{name}:
    parameters:
      - {name: name, in: path, required: true, schema: {type: string}}
    put:
      tags: [guard]
      operationId: putTargetOwners
      summary: Set the owners of the targets matching a pattern (people with the admin scope)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [pattern, owners], additionalProperties: false, properties: {name: {type: string}, pattern: {type: string}, owners: {type: array, minItems: 1, maxItems: 20, items: {type: string}}}}
      responses:
        "200": {description: Owners, content: {application/json: {schema: {type: object, required: [name, pattern, owners, updated_at], properties: {name: {type: string}, pattern: {type: string}, owners: {type: array, items: {type: string}}, updated_at: {type: string, format: date-time}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [guard]
      operationId: deleteTargetOwners
      summary: Remove an ownership
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/consent-ceilings/{principal}:
    parameters:
      - {name: principal, in: path, required: true, schema: {type: string}}
    get:
      tags: [guard]
      operationId: getConsentCeiling
      summary: How far a person may delegate to their own agents without an administrator (AG-2.08)
      responses:
        "200": {description: Ceiling, content: {application/json: {schema: {type: object, required: [principal_id, consequence_max, actions, targets, egress, updated_at], properties: {principal_id: {type: string}, consequence_max: {type: string}, actions: {type: array, items: {type: string}}, targets: {type: array, items: {type: string}}, egress: {type: array, items: {type: string}}, updated_at: {type: string, format: date-time}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putConsentCeiling
      summary: Set a person's consent ceiling (people with the admin scope)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [consequence_max, actions, targets], additionalProperties: false, properties: {principal_id: {type: string}, consequence_max: {type: string, enum: [low, medium, high, critical]}, actions: {type: array, items: {type: string}}, targets: {type: array, items: {type: string}}, egress: {type: array, items: {type: string}}}}
      responses:
        "200": {description: Ceiling, content: {application/json: {schema: {type: object, required: [principal_id, consequence_max, actions, targets, egress, updated_at], properties: {principal_id: {type: string}, consequence_max: {type: string}, actions: {type: array, items: {type: string}}, targets: {type: array, items: {type: string}}, egress: {type: array, items: {type: string}}, updated_at: {type: string, format: date-time}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/consent:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    post:
      tags: [guard]
      operationId: consentMandate
      summary: The agent's owner grants it a mandate within their consent ceiling, without an administrator (AG-2.08)
      requestBody:
        required: true
        content:
          application/yaml:
            schema: {type: object}
          application/json:
            schema: {type: object}
      responses:
        "201": {description: Stored, content: {application/json: {schema: {$ref: "#/components/schemas/MandateVersion"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "422": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/consent:withdraw:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    post:
      tags: [guard]
      operationId: withdrawConsent
      summary: The owner withdraws the consent the agent's mandate rests on; the agent has no mandate and its permits are revoked
      responses:
        "200": {description: Withdrawn, content: {application/json: {schema: {type: object, required: [withdrawn, meaning], properties: {withdrawn: {type: boolean}, meaning: {type: string}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/governance/frameworks/{id}:
    get:
      tags: [guard]
      operationId: governanceFramework
      summary: The tenant's records mapped to an AI governance framework (AG-5.12)
      description: For eu-ai-act, iso-42001 or nist-ai-rmf, each requirement with what Groundnetic does toward it and live counts of the tenant's evidence. It supports evidence; it does not establish compliance.
      parameters:
        - {name: id, in: path, required: true, schema: {type: string, enum: [eu-ai-act, iso-42001, nist-ai-rmf]}}
      responses:
        "200": {description: Mapping, content: {application/json: {schema: {type: object, required: [id, name, note, controls], properties: {id: {type: string}, name: {type: string}, note: {type: string}, controls: {type: array, items: {type: object, required: [ref, title, how, evidence, status], properties: {ref: {type: string}, title: {type: string}, how: {type: string}, status: {type: string, enum: [evidenced, partial, none]}, evidence: {type: array, items: {type: object, properties: {kind: {type: string}, count: {type: integer}, where: {type: string}}}}}}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/fixes:
    get:
      tags: [guard]
      operationId: agentFixes
      summary: Changes Groundnetic proposes for an agent, as files (AG-5.13)
      description: The mandate learn mode proposes (or the current one, for version control), credential-provider grants that replace standing credentials, and the Kubernetes admission webhook for the clusters the mandate covers.
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Fixes, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object, required: [id, kind, title, why, files], properties: {id: {type: string}, kind: {type: string, enum: [mandate, broker_route, enforcement_point]}, title: {type: string}, why: {type: string}, files: {type: array, items: {type: object, required: [path, content], properties: {path: {type: string}, content: {type: string}}}}}}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/adoption:
    get:
      tags: [guard]
      operationId: agentAdoption
      summary: How far the agent is brought under Agent Guard, for its page (people only) (AG-14.16)
      description: "Each step with whether it is done and, if not, the fix: registered, a mandate, it asks the gate, permits in use, an enforcement point verifies its permits, no standing credentials, a current lease, the mandate enforced. Next is the first step not done. Assets are the discovered assets linked to it, with their own remaining steps (AG-14.11)."
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200":
          description: The agent's progress
          content:
            application/json:
              schema:
                type: object
                required: [agent_id, name, done, total, summary, steps, assets]
                properties:
                  agent_id: {type: string}
                  name: {type: string}
                  done: {type: integer}
                  total: {type: integer}
                  summary: {type: string}
                  next: {$ref: "#/components/schemas/AdoptStep"}
                  steps: {type: array, items: {$ref: "#/components/schemas/AdoptStep"}}
                  assets:
                    type: array
                    items:
                      type: object
                      required: [asset_id, name, kind, status_why, steps]
                      properties:
                        asset_id: {type: string}
                        name: {type: string}
                        kind: {type: string}
                        status: {type: string}
                        status_why: {type: string}
                        steps: {type: array, items: {$ref: "#/components/schemas/AdoptStep"}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agents/{id}/fixes/{fix}:pull-request:
    post:
      tags: [guard]
      operationId: fixPullRequest
      summary: Open a pull request with one fix in the fix repository (AG-5.13)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
        - {name: fix, in: path, required: true, schema: {type: string}}
      responses:
        "201": {description: Opened, content: {application/json: {schema: {type: object, required: [url, number, branch, files], properties: {url: {type: string}, number: {type: integer}, branch: {type: string}, files: {type: integer}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
        "502": {$ref: "#/components/responses/Problem"}
  /v1/integrations:
    get:
      tags: [admin]
      operationId: integrations
      summary: The integration catalogue (AG-5.14)
      description: Evidence connectors, evidence formats, enforcement points, credential providers, cloud connections, edge integrations, agent discovery and Shared Signals, each with its certification (conformance, protocol, vendor, or live, proven against the real system), where its set-up is, and whether this tenant has it configured where Groundnetic can tell.
      responses:
        "200": {description: Catalogue, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object, required: [id, name, category, description, certification, setup, configured], properties: {id: {type: string}, name: {type: string}, category: {type: string}, description: {type: string}, certification: {type: string}, setup: {type: string}, configured: {type: boolean, nullable: true}, count: {type: integer}}}}, systems: {type: array, items: {type: object, required: [system, coverage, enforced_by, detected_by, configured, note], properties: {system: {type: string}, coverage: {type: string, enum: [enforced, detected, none]}, enforced_by: {type: array, items: {type: string}}, detected_by: {type: array, items: {type: string}}, configured: {type: boolean, nullable: true}, note: {type: string}}}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
  /v1/fix-repository:
    get:
      tags: [guard]
      operationId: getFixRepository
      summary: The repository fixes go to as pull requests (AG-5.13)
      responses:
        "200": {description: Repository, content: {application/json: {schema: {$ref: "#/components/schemas/FixRepository"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putFixRepository
      summary: Set the repository fixes go to (human admins; the token is write-only)
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/FixRepository"}
      responses:
        "200": {description: Set, content: {application/json: {schema: {$ref: "#/components/schemas/FixRepository"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/governance/unknown-agents:
    get:
      tags: [guard]
      operationId: unknownAgents
      summary: Identities that act like agents but no agent declares (AG-5.10)
      description: From actions the audit streams reported for undeclared identities. An identity is a likely agent when its actions correlate with Groundnetic's own records (targets mandates govern, actions shortly after gate decisions on the same target, actions after a refusal or escalation), its actor looks like a machine, or it acts in machine-like volume. Each item names the signals, the registered agent it most follows, examples and what to do. Agents that agent platforms (Copilot Studio, Agentforce) list and no registered agent declares as an identity are included with the signal platform_agent, their platform connection, name and state (AG-5.17).
      parameters:
        - {name: since, in: query, schema: {type: string, format: date-time}}
      responses:
        "200": {description: Unknown agents, content: {application/json: {schema: {type: object, required: [since, likely, items], properties: {since: {type: string, format: date-time}, likely: {type: integer}, items: {type: array, items: {type: object, required: [system, actor, actions, score, likely_agent, signals, summary, fix], properties: {system: {type: string}, actor: {type: string}, platform: {type: string}, name: {type: string}, state: {type: string}, actions: {type: integer}, first_seen: {type: string, format: date-time}, last_seen: {type: string, format: date-time}, score: {type: integer}, likely_agent: {type: boolean}, related_agent_id: {type: string}, related_agent_name: {type: string}, summary: {type: string}, fix: {type: string}, signals: {type: array, items: {type: object, properties: {signal: {type: string}, weight: {type: integer}, detail: {type: string}}}}, examples: {type: array, items: {type: object}}}}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/security-feed-profiles:
    get:
      tags: [guard]
      operationId: listSecurityFeedProfiles
      summary: The built-in security-event mapping profiles (secprofiles), with their certification and what is still to confirm on a vendor tenant (AG-17.03)
      responses:
        "200":
          description: Profiles
          content:
            application/json:
              schema:
                type: object
                required: [version, ai_destinations, items]
                properties:
                  version: {type: string}
                  ai_destinations: {type: string, description: "the AI destination list's version"}
                  items:
                    type: array
                    items:
                      type: object
                      required: [name, version, vendor, product, certification, inputs, format, docs, to_confirm]
                      properties:
                        name: {type: string}
                        version: {type: string}
                        vendor: {type: string}
                        product: {type: string}
                        description: {type: string}
                        certification: {type: string, enum: [conformance, vendor]}
                        inputs: {type: array, items: {type: string}}
                        format: {type: string}
                        docs: {type: array, items: {type: string}}
                        to_confirm: {type: array, items: {type: string}}
                        feed_format: {type: string, description: "the feed template to configure in the tool (Zscaler NSS)"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/security-feeds:
    get:
      tags: [guard]
      operationId: listSecurityFeeds
      summary: Security tool feeds (network, secure web gateway, DLP) with their counts (AG-17.01; people and services; secrets are never returned)
      responses:
        "200": {description: Feeds, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/SecurityFeed"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/security-feeds/{name}:
    parameters:
      - {name: name, in: path, required: true, schema: {type: string}}
    get:
      tags: [guard]
      operationId: getSecurityFeed
      summary: A security feed, its counts per day (30 days) and its last error with the fix
      responses:
        "200": {description: Feed, content: {application/json: {schema: {$ref: "#/components/schemas/SecurityFeed"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putSecurityFeed
      summary: Create or change a security feed (people with the admin scope)
      description: "input push (HTTPS push to /v1/security-feeds/{name}/events with a key from {name}:key), object (S3, GCS or Blob locations read with config.connection's discovery identity), otlp (OTLP/HTTP logs to /v1/security-feeds/{name}/v1/logs), syslog (through the collector you run: gnd connect with a security-events mapping; config.collector names it) or office365 (the Office 365 Management Activity API, DLP.All, with config.tenant_id, config.client_id and the app's secret). profile is a built-in profile (GET /v1/security-feed-profiles) or your own SecurityEventProfile in profile_document."
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [input]
              additionalProperties: false
              properties:
                input: {type: string, enum: [push, object, otlp, syslog, office365]}
                profile: {type: string}
                profile_document: {type: string, description: "your own SecurityEventProfile (YAML or JSON), validated when saved"}
                config:
                  type: object
                  additionalProperties: false
                  properties:
                    connection: {type: string}
                    locations: {type: array, maxItems: 20, items: {type: string}}
                    collector: {type: string}
                    tenant_id: {type: string}
                    client_id: {type: string}
                secret: {type: string, description: "write-only: office365's client secret"}
      responses:
        "200": {description: Feed, content: {application/json: {schema: {$ref: "#/components/schemas/SecurityFeed"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [guard]
      operationId: deleteSecurityFeed
      summary: Remove a feed and revoke its keys; what it reported stays (people with the admin scope)
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/security-feeds/{name}:key:
    post:
      tags: [guard]
      operationId: issueSecurityFeedKey
      summary: Issue a push key for the feed, shown once; its only scope is security_events:write and it pushes to this feed only
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {ttl: {type: string, description: "e.g. 90d; default: no expiry"}}}
      responses:
        "201":
          description: Key
          content:
            application/json:
              schema:
                type: object
                required: [feed, api_key, scope, push_path]
                properties:
                  feed: {type: string}
                  api_key: {type: string}
                  scope: {type: string}
                  push_path: {type: string}
                  note: {type: string}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/security-feeds/{name}:test:
    post:
      tags: [guard]
      operationId: testSecurityFeed
      summary: Map a sample with the feed's profile and show the normalized events; nothing is stored
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/x-ndjson: {schema: {type: string}}
          application/json: {schema: {}}
          text/plain: {schema: {type: string}}
      responses:
        "200": {description: Mapped, content: {application/json: {schema: {$ref: "#/components/schemas/SecurityFeedMapping"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/security-feeds/{name}:pull:
    post:
      tags: [guard]
      operationId: pullSecurityFeed
      summary: Pull an object or office365 feed now (people with the admin scope)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Pulled, content: {application/json: {schema: {$ref: "#/components/schemas/SecurityFeedIngest"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "503": {$ref: "#/components/responses/Problem"}
  /v1/security-feeds/{name}/events:
    post:
      tags: [guard]
      operationId: pushSecurityEvents
      summary: Push security tool events to a feed (JSON lines, a JSON array or CEF lines, optionally gzipped, at most 10 MiB, 600 requests a minute), with a key of the feed (AG-17.01)
      description: "Only events about a registered agent's identities, calls to AI services, and data-classification hits are kept, as observed actions and findings; the rest are counted. URL paths, query strings, request bodies and matched content are never stored (AG-17.06)."
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/x-ndjson: {schema: {type: string}}
          application/json: {schema: {}}
          text/plain: {schema: {type: string}}
          application/octet-stream: {schema: {type: string, format: binary}}
      responses:
        "200": {description: Recorded, content: {application/json: {schema: {$ref: "#/components/schemas/SecurityFeedIngest"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "413": {$ref: "#/components/responses/Problem"}
        "429": {$ref: "#/components/responses/Problem"}
  /v1/security-feeds/{name}/v1/logs:
    post:
      tags: [guard]
      operationId: pushSecurityOTLPLogs
      summary: OpenTelemetry logs (OTLP/HTTP, protobuf or JSON) for a feed with input otlp, with a key of the feed
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/x-protobuf: {schema: {type: string, format: binary}}
          application/json: {schema: {type: object}}
      responses:
        "200": {description: Recorded, content: {application/json: {schema: {$ref: "#/components/schemas/SecurityFeedIngest"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "413": {$ref: "#/components/responses/Problem"}
  /v1/agents/self/egress:
    get:
      tags: [guard]
      operationId: getSelfEgress
      summary: The calling agent's egress list, for the guardproxy's outbound proxy (AG-17.07); empty with the reason when it may connect nowhere
      responses:
        "200":
          description: Egress list
          content:
            application/json:
              schema:
                type: object
                required: [agent_id, egress, cache_seconds]
                properties:
                  agent_id: {type: string}
                  egress: {type: array, items: {type: string}}
                  mandate_version: {type: integer}
                  reason: {type: string}
                  cache_seconds: {type: integer}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/egress/observations:
    post:
      tags: [guard]
      operationId: observeEgress
      summary: The guardproxy's outbound proxy reports the connections it allowed and refused, as observed actions of the agents (host, port, verdict, bytes; never a path)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [proxy, items]
              additionalProperties: false
              properties:
                proxy: {type: string}
                items:
                  type: array
                  maxItems: 5000
                  items:
                    type: object
                    required: [id, agent_id, host, port, verdict, occurred_at]
                    additionalProperties: false
                    properties:
                      id: {type: string}
                      agent_id: {type: string}
                      host: {type: string}
                      port: {type: integer}
                      verdict: {type: string, enum: [allow, refuse]}
                      reason: {type: string}
                      bytes_out: {type: integer}
                      occurred_at: {type: string, format: date-time}
      responses:
        "200": {description: Recorded, content: {application/json: {schema: {type: object, required: [received, matched_to_agents, covered, bypasses, duplicates], properties: {received: {type: integer}, matched_to_agents: {type: integer}, covered: {type: integer}, bypasses: {type: integer}, duplicates: {type: integer}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/sensitive-data/patterns:
    get:
      tags: [guard]
      operationId: getSensitivePatterns
      summary: The workspace's own named sensitive-data patterns, applied with the personal-data rule of mandates' data blocks (AG-17.08), and the built-in detectors
      responses:
        "200":
          description: Patterns
          content:
            application/json:
              schema:
                type: object
                required: [items, detectors]
                properties:
                  items: {type: array, items: {$ref: "#/components/schemas/SensitivePattern"}}
                  detectors: {type: object}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putSensitivePatterns
      summary: Replace the workspace's named sensitive-data patterns (people with the admin scope)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [items]
              additionalProperties: false
              properties:
                items: {type: array, maxItems: 100, items: {$ref: "#/components/schemas/SensitivePattern"}}
      responses:
        "200":
          description: Stored
          content:
            application/json:
              schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/SensitivePattern"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/agent-platforms:
    get:
      tags: [guard]
      operationId: listAgentPlatforms
      summary: Read-only connections to agent platforms (Copilot Studio, Agentforce) and OAuth grant sources (Microsoft 365, Google Workspace, Salesforce) (AG-5.17, AG-5.23; secrets are never returned)
      responses:
        "200": {description: Connections, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/AgentPlatform"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/agent-platforms/{name}:
    parameters:
      - {name: name, in: path, required: true, schema: {type: string}}
    get:
      tags: [guard]
      operationId: getAgentPlatform
      summary: An agent-platform connection (people and services; not agents)
      responses:
        "200": {description: Connection, content: {application/json: {schema: {$ref: "#/components/schemas/AgentPlatform"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putAgentPlatform
      summary: Create or replace a read-only connection to an agent platform or an OAuth grant source (people with the admin scope)
      description: "copilot_studio config: environment_url (the Dataverse URL), tenant_id and client_id of an Entra ID app registration with a Dataverse application user; agentforce and salesforce_grants config: instance_url (My Domain) and client_id of a connected app with the client credentials flow; m365_grants config: tenant_id and client_id of an Entra ID app registration with Directory.Read.All and Application.Read.All (application permissions), optional max_apps (default 500) and graph_url; google_grants config: admin_email (the administrator a service account with domain-wide delegation impersonates), optional customer (default my_customer), max_users (default 2000) and directory_url. token_url overrides the token endpoint; Salesforce kinds also take api_version (default v61.0). The secret is the OAuth client secret, or for google_grants the service account's JSON key file: write-only, required when the connection is created, kept when left out. docs/agent-platforms.md has the set-up."
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [kind, config]
              additionalProperties: false
              properties:
                kind: {type: string, enum: [copilot_studio, agentforce, m365_grants, google_grants, salesforce_grants]}
                config: {type: object}
                secret: {type: string, description: "write-only: the OAuth client secret (google_grants: the service account's JSON key file)"}
                poll_minutes: {type: integer, minimum: 5, maximum: 1440, description: "how often it is polled (default 15)"}
      responses:
        "200": {description: Connection, content: {application/json: {schema: {$ref: "#/components/schemas/AgentPlatform"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [guard]
      operationId: deleteAgentPlatform
      summary: Remove a connection and the agents it found (people with the admin scope)
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agent-platforms/{name}:poll:
    post:
      tags: [guard]
      operationId: pollAgentPlatform
      summary: Read the platform's agents or OAuth grants now (people)
      description: Lists the platform's agents, or the apps holding OAuth grants (read-only), and records them. A failure says what the platform refused and what to fix, and is kept on the connection as last_error; note says what a bound (max_users, max_apps) left unread.
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Polled, content: {application/json: {schema: {type: object, required: [platform, polled_at, agents, grants, new, removed, unregistered], properties: {platform: {type: string}, polled_at: {type: string, format: date-time}, agents: {type: integer}, grants: {type: integer, description: "apps holding OAuth grants (grant connections)"}, new: {type: integer}, removed: {type: integer}, unregistered: {type: integer}, note: {type: string, description: "what a bound left unread"}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "502": {$ref: "#/components/responses/Problem"}
  /v1/agent-platforms/{name}/agents:
    get:
      tags: [guard]
      operationId: agentPlatformAgents
      summary: The agents a platform lists, with the registered agent each is linked to
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: removed, in: query, schema: {type: boolean}, description: "include agents the platform no longer lists"}
      responses:
        "200": {description: Agents, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/PlatformAgent"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agent-platforms/{name}/agents/{agent}:
    put:
      tags: [guard]
      operationId: putAgentPlatformAgent
      summary: Ignore a platform agent, or stop ignoring it (people with the admin scope)
      description: An ignored agent is not reported as unknown. To register it instead, create the agent and declare the identity this agent's `identity` names.
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: agent, in: path, required: true, schema: {type: string}, description: "the platform's ID of the agent (external_id)"}
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [ignored], additionalProperties: false, properties: {ignored: {type: boolean}, note: {type: string, maxLength: 500}}}
      responses:
        "200": {description: Agent, content: {application/json: {schema: {$ref: "#/components/schemas/PlatformAgent"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agent-platforms/{name}/grants:
    get:
      tags: [guard]
      operationId: agentPlatformGrants
      summary: The apps a grant connection found holding OAuth grants, with their scopes and the registered agent each is linked to (AG-5.23)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: removed, in: query, schema: {type: boolean}, description: "include apps no longer listed"}
      responses:
        "200": {description: Grants, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/PlatformGrant"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/agent-platforms/{name}/grants/{app}:
    put:
      tags: [guard]
      operationId: putAgentPlatformGrant
      summary: Ignore an app holding OAuth grants (it is not an agent), or stop ignoring it, with a note (people with the admin scope)
      description: An ignored app is not reported as an unknown agent. To link it to an agent instead, declare the identity this grant's `identity` names on the agent; the grant then counts as that agent's standing credential.
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
        - {name: app, in: path, required: true, schema: {type: string}, description: "the app's ID (app_id)"}
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [ignored], additionalProperties: false, properties: {ignored: {type: boolean}, note: {type: string, maxLength: 500}}}
      responses:
        "200": {description: Grant, content: {application/json: {schema: {$ref: "#/components/schemas/PlatformGrant"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /.well-known/ssf-configuration:
    get:
      tags: [guard]
      operationId: ssfConfiguration
      summary: Shared Signals transmitter configuration metadata (SSF 1.0; AG-5.22)
      description: "issuer (this address), jwks_uri (the keys that sign Groundnetic's SETs), delivery_methods_supported (push, RFC 8935) and events_supported; the groundnetic member says what Groundnetic receives, and where."
      security: []
      responses:
        "200": {description: Metadata, content: {application/json: {schema: {type: object, required: [issuer, jwks_uri, delivery_methods_supported], properties: {spec_version: {type: string}, issuer: {type: string}, jwks_uri: {type: string}, delivery_methods_supported: {type: array, items: {type: string}}, events_supported: {type: array, items: {type: string}}}}}}}
  /.well-known/gn-ssf-keys.json:
    get:
      tags: [guard]
      operationId: ssfKeys
      summary: The JWKS that verifies Groundnetic's Shared Signals SETs (Ed25519, EdDSA; AG-5.22)
      security: []
      responses:
        "200": {description: JWKS, content: {application/json: {schema: {type: object, required: [keys], properties: {keys: {type: array, items: {type: object}}}}}}}
  /ssf/receive/{tenant}/{stream}:
    post:
      tags: [guard]
      operationId: ssfReceive
      summary: An identity provider pushes a Security Event Token (RFC 8935; AG-5.22)
      description: "The SET must be signed with a key from the stream's jwks_uri, with the stream's issuer and audience. Session-revoked and credential-change (CAEP), account-disabled, sessions-revoked and credential-compromise (RISC) events whose subject is an identity an agent declares with system oidc revoke that agent's outstanding permits (cause idp_signal). Each jti is acted on once. 202 on accept; 400 with err and description otherwise."
      security: []
      parameters:
        - {name: tenant, in: path, required: true, schema: {type: string}, description: "the workspace (tn_...)"}
        - {name: stream, in: path, required: true, schema: {type: string}, description: "the transmitter's name"}
      requestBody:
        required: true
        content:
          application/secevent+jwt:
            schema: {type: string}
      responses:
        "202": {description: Accepted}
        "400": {description: Refused, content: {application/json: {schema: {$ref: "#/components/schemas/SETError"}}}}
  /v1/ssf/receivers:
    get:
      tags: [guard]
      operationId: listSSFReceivers
      summary: Where Groundnetic pushes its Shared Signals events (AG-5.22; people and services, not agents; secrets are never returned)
      responses:
        "200": {description: Receivers, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/SSFReceiver"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/ssf/receivers/{name}:
    parameters:
      - {name: name, in: path, required: true, schema: {type: string}}
    get:
      tags: [guard]
      operationId: getSSFReceiver
      summary: A Shared Signals receiver, with its delivery counts
      responses:
        "200": {description: Receiver, content: {application/json: {schema: {$ref: "#/components/schemas/SSFReceiver"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putSSFReceiver
      summary: Create or replace a Shared Signals receiver (people with the admin scope)
      description: "Groundnetic pushes each permit revocation and agent suspension it is subscribed to as a SET (CAEP session-revoked; subject {format: opaque, id: the permit's jti or the agent's ID}; the groundnetic claim has agent_id, cause and reason), signed with the keys at /.well-known/gn-ssf-keys.json, to endpoint_url, and retries with backoff until it answers 202. issuer defaults to this address. secret is write-only: sent as Authorization: Bearer."
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [endpoint_url, audience]
              additionalProperties: false
              properties:
                endpoint_url: {type: string}
                audience: {type: string, maxLength: 500}
                issuer: {type: string, maxLength: 500}
                events: {type: array, items: {type: string, enum: [permit-revoked, agent-suspended]}}
                secret: {type: string, description: "write-only: the bearer token the receiver expects"}
                clear_secret: {type: boolean}
      responses:
        "200": {description: Receiver, content: {application/json: {schema: {$ref: "#/components/schemas/SSFReceiver"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [guard]
      operationId: deleteSSFReceiver
      summary: Remove a receiver and its undelivered SETs (people with the admin scope)
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/ssf/receivers/{name}:verify:
    post:
      tags: [guard]
      operationId: verifySSFReceiver
      summary: Send the receiver an SSF verification event, to check it accepts Groundnetic's SETs (people with the admin scope)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "202": {description: Queued, content: {application/json: {schema: {$ref: "#/components/schemas/SSFDelivery"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/ssf/receivers/{name}/deliveries:
    get:
      tags: [guard]
      operationId: listSSFDeliveries
      summary: The SETs sent, or to send, to a receiver, newest first, with their delivery status
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Deliveries, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/SSFDelivery"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/ssf/transmitters:
    get:
      tags: [guard]
      operationId: listSSFTransmitters
      summary: Identity providers that push Shared Signals events to Groundnetic (AG-5.22; people and services, not agents)
      responses:
        "200": {description: Transmitters, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/SSFTransmitter"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/ssf/transmitters/{name}:
    parameters:
      - {name: name, in: path, required: true, schema: {type: string}}
    get:
      tags: [guard]
      operationId: getSSFTransmitter
      summary: An identity provider's stream, with the push URL to give it
      responses:
        "200": {description: Transmitter, content: {application/json: {schema: {$ref: "#/components/schemas/SSFTransmitter"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [guard]
      operationId: putSSFTransmitter
      summary: Create or replace an identity provider's stream (people with the admin scope)
      description: "issuer and jwks_uri come from the identity provider's /.well-known/ssf-configuration; audience is what it puts in aud (default: the push URL). Give the identity provider push_url as the stream's push endpoint."
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [issuer, jwks_uri]
              additionalProperties: false
              properties:
                issuer: {type: string, maxLength: 500}
                jwks_uri: {type: string}
                audience: {type: string, maxLength: 500}
      responses:
        "200": {description: Transmitter, content: {application/json: {schema: {$ref: "#/components/schemas/SSFTransmitter"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [guard]
      operationId: deleteSSFTransmitter
      summary: Remove an identity provider's stream and what it sent (people with the admin scope)
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/ssf/transmitters/{name}/signals:
    get:
      tags: [guard]
      operationId: listSSFSignals
      summary: The SETs an identity provider sent, newest first, with the agents they named and the permits revoked
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Signals, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/SSFSignal"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/governance/agent-risks:
    get:
      tags: [guard]
      operationId: agentRisks
      summary: Agents ranked by combinations of weaknesses (AG-5.09)
      description: Every agent, riskiest first. Each item lists its weaknesses (bypasses, standing credentials, low or unknown coverage, a high-consequence mandate, reliance on AI-derived evidence, an expiring lease, detections, fail-open actions), what to do about each, and a plain-language summary. Suspended agents are listed as contained.
      parameters:
        - {name: since, in: query, schema: {type: string, format: date-time}}
      responses:
        "200": {description: Ranking, content: {application/json: {schema: {type: object, required: [since, high, items], properties: {since: {type: string, format: date-time}, high: {type: integer}, items: {type: array, items: {type: object, required: [agent_id, name, level, score, factors, summary], properties: {agent_id: {type: string}, name: {type: string}, level: {type: string, enum: [high, medium, low, contained]}, score: {type: integer}, consequence_max: {type: string}, summary: {type: string}, factors: {type: array, items: {type: object, required: [factor, weight, detail, fix], properties: {factor: {type: string}, weight: {type: integer}, detail: {type: string}, fix: {type: string}}}}}}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/tasks:
    post:
      tags: [tasks]
      operationId: createTask
      summary: Record a task for an agent or a person (AG-13.01)
      description: A goal, a plan of steps (an action type, a target and parameters), an assignee and a deadline. People, services and agents (through MCP) may create tasks.
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/TaskInput"}
      responses:
        "201": {description: Created, content: {application/json: {schema: {$ref: "#/components/schemas/Task"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    get:
      tags: [tasks]
      operationId: listTasks
      summary: Tasks, newest first
      parameters:
        - {name: state, in: query, schema: {type: string, enum: [draft, analysed, granted, running, done, cancelled, expired]}}
        - {name: assignee, in: query, schema: {type: string}}
        - {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 500}}
      responses:
        "200": {description: Tasks, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/Task"}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/tasks/{id}:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    get:
      tags: [tasks]
      operationId: getTask
      summary: A task with its steps' state, grants, grant requests and an explanation
      responses:
        "200": {description: Task, content: {application/json: {schema: {$ref: "#/components/schemas/Task"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [tasks]
      operationId: updateTask
      summary: Replace a draft or analysed task's goal, plan, assignee and deadline (it becomes a draft again)
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/TaskInput"}
      responses:
        "200": {description: Task, content: {application/json: {schema: {$ref: "#/components/schemas/Task"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/tasks/{id}:analyse:
    post:
      tags: [tasks]
      operationId: analyseTask
      summary: What the task will take an assignee (AG-13.02–AG-13.04), changing nothing
      description: >-
        Per step, the rights needed (mandate rules, access, each cloud permission with its resource), which the
        assignee holds, the approvals the gate would require, the conditions it would check, consequence and
        reversibility; for the task, the rights missing, the highest consequence and the time it will take
        (median and 90th percentile, for an agent or a person). compare analyses other candidates too.
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              properties:
                assignee: {$ref: "#/components/schemas/PrincipalRef"}
                compare: {type: array, maxItems: 5, items: {$ref: "#/components/schemas/PrincipalRef"}}
      responses:
        "200":
          description: Analysis
          content:
            application/json:
              schema:
                type: object
                required: [analysis, compared]
                properties:
                  analysis: {$ref: "#/components/schemas/TaskAnalysis"}
                  compared: {type: array, items: {$ref: "#/components/schemas/TaskAnalysis"}}
                  comparison: {$ref: "#/components/schemas/PlainExplanation"}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/tasks/{id}:grant:
    post:
      tags: [tasks]
      operationId: grantTask
      summary: Grant the assignee exactly the missing rights, for this task only (AG-13.05–AG-13.07)
      description: Granted at once when the caller may approve (the requester up to medium consequence, a workspace administrator with a second factor above); otherwise a person is asked through the review queues. Rights above a connection's ceiling are refused, naming them.
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema: {$ref: "#/components/schemas/GrantInput"}
      responses:
        "201": {description: Grant request, content: {application/json: {schema: {$ref: "#/components/schemas/TaskGrantRequest"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/tasks/{id}:request-more:
    post:
      tags: [tasks]
      operationId: requestMoreForTask
      summary: Ask for more rights during a task, optionally adding steps; analysed and approved like the first grant (AG-13.09)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema: {$ref: "#/components/schemas/GrantInput"}
      responses:
        "201": {description: Grant request, content: {application/json: {schema: {$ref: "#/components/schemas/TaskGrantRequest"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/tasks/{id}:start:
    post:
      tags: [tasks]
      operationId: startTask
      summary: Start a task (for a person, the first step's clock starts)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Task, content: {application/json: {schema: {$ref: "#/components/schemas/Task"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/tasks/{id}:complete-step:
    post:
      tags: [tasks]
      operationId: completeTaskStep
      summary: Record a step as done or failed; when every step is done the task is done and its grants are revoked
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [step], additionalProperties: false, properties: {step: {type: integer, minimum: 1}, outcome: {type: string, enum: [done, failed]}, note: {type: string, maxLength: 2000}}}
      responses:
        "200": {description: Task, content: {application/json: {schema: {$ref: "#/components/schemas/Task"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/tasks/{id}:cancel:
    post:
      tags: [tasks]
      operationId: cancelTask
      summary: Cancel a task; everything granted for it is revoked
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {reason: {type: string, maxLength: 2000}}}
      responses:
        "200": {description: Task, content: {application/json: {schema: {$ref: "#/components/schemas/Task"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/tasks/{id}:done:
    post:
      tags: [tasks]
      operationId: finishTask
      summary: Mark a task done; everything granted for it is revoked
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {reason: {type: string, maxLength: 2000}}}
      responses:
        "200": {description: Task, content: {application/json: {schema: {$ref: "#/components/schemas/Task"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/task-grant-requests/{id}:
    get:
      tags: [tasks]
      operationId: getTaskGrantRequest
      summary: A grant request and what it granted
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Grant request, content: {application/json: {schema: {$ref: "#/components/schemas/TaskGrantRequest"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/task-grant-requests/{id}:approve:
    post:
      tags: [tasks]
      operationId: approveTaskGrant
      summary: Approve a grant request (people only; AG-13.07)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {comment: {type: string, maxLength: 2000}}}
      responses:
        "200": {description: Grant request, content: {application/json: {schema: {$ref: "#/components/schemas/TaskGrantRequest"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/task-grant-requests/{id}:reject:
    post:
      tags: [tasks]
      operationId: rejectTaskGrant
      summary: Reject a grant request (people only)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {comment: {type: string, maxLength: 2000}}}
      responses:
        "200": {description: Grant request, content: {application/json: {schema: {$ref: "#/components/schemas/TaskGrantRequest"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/cloud-connections:
    get:
      tags: [tasks]
      operationId: listCloudConnections
      summary: Connections to AWS accounts, Azure subscriptions and Google Cloud projects (secrets are never returned)
      responses:
        "200": {description: Connections, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/CloudConnection"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/cloud-connections/{name}:
    parameters:
      - {name: name, in: path, required: true, schema: {type: string}}
    get:
      tags: [tasks]
      operationId: getCloudConnection
      summary: A connection, with the issuer, subject and audience its cloud must trust
      responses:
        "200": {description: Connection, content: {application/json: {schema: {$ref: "#/components/schemas/CloudConnection"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [tasks]
      operationId: putCloudConnection
      summary: Create or replace a connection made from a cloud template (people with the admin scope; AG-13.06, AG-13.11)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [cloud, config]
              additionalProperties: false
              properties:
                cloud: {type: string, enum: [aws, azure, gcp]}
                config: {type: object, description: "What the cloud's template printed (role ARN, tenant and subscription, project and service accounts)"}
                ceiling: {type: object, description: "The customer's ceiling, as the template set it"}
                targets: {type: array, maxItems: 100, items: {type: string}, description: "Target patterns it serves, e.g. aws://123456789012/**; empty: every target of its cloud"}
                secret: {type: string, description: "write-only; only where the cloud cannot federate"}
                observe: {type: object, additionalProperties: false, properties: {push_service_account: {type: string}, push_audience: {type: string}}}
      responses:
        "200": {description: Connection, content: {application/json: {schema: {$ref: "#/components/schemas/CloudConnection"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [tasks]
      operationId: deleteCloudConnection
      summary: Remove a connection (refused while task grants through it are in force)
      responses:
        "204": {description: Removed}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/cloud-connections/{name}:test:
    post:
      tags: [discovery]
      operationId: testCloudConnection
      summary: Test a connection's read-only discovery identity, one cheap call per service (people with the admin scope; AG-14.13)
      description: Assumes the connection's discovery identity (never the broker) and reports each service as allowed, denied (with the missing permission and the template parameter that adds it) or not checked. A test that reaches the cloud starts the connection's first discovery run when it has none.
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Tested, content: {application/json: {schema: {$ref: "#/components/schemas/ConnectionTest"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/cloud-templates:
    get:
      tags: [discovery]
      operationId: listCloudTemplates
      summary: The cloud connection templates to download and run in your own account (people)
      responses:
        "200": {description: Templates, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object, required: [name, cloud, format, description, path], properties: {name: {type: string}, cloud: {type: string}, format: {type: string}, description: {type: string}, path: {type: string}}}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/cloud-templates/{name}:
    get:
      tags: [discovery]
      operationId: getCloudTemplate
      summary: Download one connection template (CloudFormation YAML, or a zip of a Terraform or Bicep module)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "200":
          description: The template
          content:
            application/yaml: {schema: {description: "the CloudFormation template"}}
            application/zip: {schema: {type: string, format: binary}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/sdk-downloads:
    get:
      tags: [sdk]
      operationId: listSDKDownloads
      summary: The SDK packages (Python wheel, TypeScript package) built into this cell, to download and install from the file (people; FPS-25.09)
      responses:
        "200": {description: Packages, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object, required: [name, language, version, size, sha256, install, description, media_type, path], properties: {name: {type: string}, language: {type: string, enum: [python, typescript]}, version: {type: string}, size: {type: integer}, sha256: {type: string}, install: {type: string, description: "the command that installs the downloaded file"}, description: {type: string}, media_type: {type: string}, path: {type: string}}}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/sdk-downloads/{name}:
    get:
      tags: [sdk]
      operationId: getSDKDownload
      summary: Download one SDK package (pip install ./<file>, npm install ./<file>)
      parameters:
        - {name: name, in: path, required: true, schema: {type: string}}
      responses:
        "200":
          description: The package
          content:
            application/zip: {schema: {type: string, format: binary}}
            application/gzip: {schema: {type: string, format: binary}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/discovery/assets:
    get:
      tags: [discovery]
      operationId: listDiscoveredAssets
      summary: The inventory of AI assets, whatever found them (people with the read scope; AG-14)
      parameters:
        - {name: status, in: query, schema: {type: string, enum: [governed, ungoverned, unknown, none]}}
        - {name: kind, in: query, schema: {type: string}}
        - {name: provider, in: query, schema: {type: string}}
        - {name: source, in: query, schema: {type: string, enum: [cloud, gateway, proxy, gate, observed, platform, grant, device, security_feed]}}
        - {name: connection, in: query, schema: {type: string}, description: "a cloud connection, or local for the in-cell sources"}
        - {name: changed_since, in: query, schema: {type: string, format: date-time}}
        - {name: include_ignored, in: query, schema: {type: boolean}}
        - {name: include_disappeared, in: query, schema: {type: boolean}}
        - {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 1000, default: 500}}
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200": {description: Assets, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/DiscoveredAsset"}}, next_cursor: {type: string}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/discovery/assets/{id}:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    get:
      tags: [discovery]
      operationId: getDiscoveredAsset
      summary: One asset with its evidence, what it uses and what uses it, and the steps left once it is linked
      responses:
        "200": {description: Asset, content: {application/json: {schema: {$ref: "#/components/schemas/DiscoveredAsset"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [discovery]
      operationId: putDiscoveredAsset
      summary: Ignore an asset with a note, or stop ignoring it (people with the admin scope)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [ignored], additionalProperties: false, properties: {ignored: {type: boolean}, note: {type: string, maxLength: 500}}}
      responses:
        "200": {description: Asset, content: {application/json: {schema: {$ref: "#/components/schemas/DiscoveredAsset"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/discovery/assets/{id}:adopt:
    post:
      tags: [discovery]
      operationId: adoptDiscoveredAsset
      summary: "Bring an asset under Agent Guard: register an agent from a mandate template, in shadow mode by default, declaring the asset's identity (admin; AG-14.11)"
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [owner_id]
              additionalProperties: false
              properties:
                name: {type: string}
                owner_id: {type: string, description: "the accountable person (prn_…)"}
                template: {type: string, description: "a mandate template; default the suggested one"}
                targets: {type: array, items: {type: string}}
                egress: {type: array, items: {type: string}}
                groups: {type: array, items: {type: string}}
                mode: {type: string, enum: [shadow, enforce]}
      responses:
        "201": {description: Adopted, content: {application/json: {schema: {$ref: "#/components/schemas/AdoptResult"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/discovery/assets/{id}:link:
    post:
      tags: [discovery]
      operationId: linkDiscoveredAsset
      summary: Link an asset to an existing agent, declaring its identity on it (admin)
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [agent_id], additionalProperties: false, properties: {agent_id: {type: string}}}
      responses:
        "200": {description: Linked, content: {application/json: {schema: {$ref: "#/components/schemas/DiscoveredAsset"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/discovery:run:
    post:
      tags: [discovery]
      operationId: runDiscovery
      summary: Start a discovery run now of a connection, or of the in-cell sources (local) (admin; refused with the running run's ID if one is going)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [connection], additionalProperties: false, properties: {connection: {type: string, description: "a cloud connection's name, or local"}}}
      responses:
        "202": {description: Started, content: {application/json: {schema: {$ref: "#/components/schemas/DiscoveryRun"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
        "409": {$ref: "#/components/responses/Problem"}
  /v1/discovery/runs:
    get:
      tags: [discovery]
      operationId: listDiscoveryRuns
      summary: Recent discovery runs, newest first
      parameters:
        - {name: connection, in: query, schema: {type: string}}
        - $ref: "#/components/parameters/Limit"
        - $ref: "#/components/parameters/Cursor"
      responses:
        "200": {description: Runs, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/DiscoveryRun"}}, next_cursor: {type: string}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/discovery/runs/{id}:
    get:
      tags: [discovery]
      operationId: getDiscoveryRun
      summary: A run with its progress per service and region
      parameters:
        - {name: id, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Run, content: {application/json: {schema: {$ref: "#/components/schemas/DiscoveryRun"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/discovery/summary:
    get:
      tags: [discovery]
      operationId: getDiscoverySummary
      summary: Counts by status and the newest changes (Home)
      responses:
        "200": {description: Summary, content: {application/json: {schema: {$ref: "#/components/schemas/DiscoverySummary"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/discovery/settings:
    get:
      tags: [discovery]
      operationId: getDiscoverySettings
      summary: The workspace's discovery settings (the local run, the administrators' daily digest, accepting developer machine reports)
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/DiscoverySettings"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    put:
      tags: [discovery]
      operationId: putDiscoverySettings
      summary: Change the workspace's discovery settings (admin)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, additionalProperties: false, properties: {local_enabled: {type: boolean}, digest: {type: boolean}, accept_device_reports: {type: boolean, description: "take reports from developer machines (gnctl scan --report; off by default: employee-monitoring rules)"}}}
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/DiscoverySettings"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/discovery/observations:
    post:
      tags: [discovery]
      operationId: reportDiscoveryObservations
      summary: A guardproxy reports its upstream MCP servers (its own key with the write scope; not agents)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [source, servers]
              additionalProperties: false
              properties:
                source: {type: string, enum: [proxy]}
                reporter: {type: string}
                servers: {type: array, minItems: 1, maxItems: 200, items: {type: object, required: [name, url], additionalProperties: false, properties: {name: {type: string}, url: {type: string}, tools: {type: array, items: {type: string}}}}}
      responses:
        "200": {description: Recorded, content: {application/json: {schema: {type: object, required: [received, new], properties: {received: {type: integer}, new: {type: integer}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/discovery/device-reports:
    post:
      tags: [discovery]
      operationId: reportDevice
      summary: "A person reports their own machine's AI coding tools and MCP servers (gnctl scan --report; AG-16): their own credential, never an agent's; refused while the workspace does not accept device reports; one per device per minute"
      description: The report holds no secret value, MCP argument, environment value, header or query string; the server runs the secret check again and drops anything that matches. It is kept 90 days per device as discovery evidence and projected into the inventory as coding_tool and mcp_server assets.
      requestBody:
        required: true
        content:
          application/json:
            schema: {$ref: "#/components/schemas/DeviceReport"}
      responses:
        "200": {description: Recorded, content: {application/json: {schema: {$ref: "#/components/schemas/DeviceReportResult"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "413": {$ref: "#/components/responses/Problem"}
        "429": {$ref: "#/components/responses/Problem"}
  /v1/discovery/devices:
    get:
      tags: [discovery]
      operationId: listDevices
      summary: The developer machines that reported, with hook coverage per tool (administrators see every machine; anyone else their own)
      responses:
        "200": {description: Devices, content: {application/json: {schema: {$ref: "#/components/schemas/DeviceList"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/discovery/devices/{id}:
    parameters:
      - {name: id, in: path, required: true, schema: {type: string}}
    get:
      tags: [discovery]
      operationId: getDevice
      summary: One machine with its latest report and the reports kept (your own, or any for administrators)
      responses:
        "200": {description: Device, content: {application/json: {schema: {$ref: "#/components/schemas/Device"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [discovery]
      operationId: deleteDevice
      summary: Delete a machine's reports and its evidence in the inventory (your own, or any for administrators; AG-16.04)
      responses:
        "200": {description: Deleted, content: {application/json: {schema: {type: object, required: [device_id, reports_deleted, assets_deleted, text], properties: {device_id: {type: string}, reports_deleted: {type: integer}, assets_deleted: {type: integer}, text: {type: string}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/cloud-federation:
    get:
      tags: [tasks]
      operationId: getCloudFederation
      summary: The workspace's OIDC issuer for cloud federation, its keys and the subject and audiences clouds trust (AG-13.11)
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/FederationSettings"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
    put:
      tags: [tasks]
      operationId: putCloudFederation
      summary: Set the issuer URL (https://<workspace host>/federation; people with the admin scope)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [issuer], additionalProperties: false, properties: {issuer: {type: string}}}
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/FederationSettings"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/cloud-federation:rotate-key:
    post:
      tags: [tasks]
      operationId: rotateCloudFederationKey
      summary: Start a new signing key now; the old one stays published for 24 hours
      responses:
        "200": {description: Settings, content: {application/json: {schema: {$ref: "#/components/schemas/FederationSettings"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/cloud-identities:
    get:
      tags: [tasks]
      operationId: listCloudIdentities
      summary: People's and agents' identities on connected clouds
      parameters:
        - {name: principal_id, in: query, schema: {type: string}}
      responses:
        "200": {description: Identities, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/CloudIdentity"}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/cloud-identities/{principal}/{connection}:
    parameters:
      - {name: principal, in: path, required: true, schema: {type: string}}
      - {name: connection, in: path, required: true, schema: {type: string}}
    put:
      tags: [tasks]
      operationId: putCloudIdentity
      summary: Record who a person or agent is on a connection (an ARN or Identity Center user ID, an Entra object ID, a Google member)
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [subject], additionalProperties: false, properties: {subject: {type: string, maxLength: 500}}}
      responses:
        "200": {description: Identity, content: {application/json: {schema: {$ref: "#/components/schemas/CloudIdentity"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    delete:
      tags: [tasks]
      operationId: deleteCloudIdentity
      summary: Forget a cloud identity
      responses:
        "204": {description: Removed}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/work-schedules:
    get:
      tags: [tasks]
      operationId: listWorkSchedules
      summary: Working hours, time zones and teams for estimates (AG-13.04)
      responses:
        "200": {description: Schedules, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {$ref: "#/components/schemas/WorkSchedule"}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/work-schedules/{principal}:
    put:
      tags: [tasks]
      operationId: putWorkSchedule
      summary: Set a person's working hours and team (their own, or anyone's with the admin scope), or the workspace's ("default")
      parameters:
        - {name: principal, in: path, required: true, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema: {type: object, required: [time_zone, days, from, to], additionalProperties: false, properties: {principal_id: {type: string}, time_zone: {type: string}, days: {type: array, items: {type: string, enum: [mon, tue, wed, thu, fri, sat, sun]}}, from: {type: string}, to: {type: string}, team: {type: string}}}
      responses:
        "200": {description: Schedule, content: {application/json: {schema: {$ref: "#/components/schemas/WorkSchedule"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/observed-actions/cloud/{connection}:
    post:
      tags: [tasks]
      operationId: observeCloudAuditLog
      summary: Cloud audit-log records as observed actions; they confirm task steps and flag actions on task resources taken outside them (AG-13.10)
      description: >-
        Send what the cloud's forwarder produces: CloudTrail events as EventBridge sends them (an API destination with
        Authorization: Bearer <service key>), Azure Activity Log records or Event Hub batches (with a service key), or
        Google Cloud audit log entries as Pub/Sub push (authenticated by the Google-signed token of the connection's
        observe.push_service_account and observe.push_audience; the workspace is its address or ?tenant=tn_...).
      parameters:
        - {name: connection, in: path, required: true, schema: {type: string}}
        - {name: tenant, in: query, schema: {type: string}}
      requestBody:
        required: true
        content:
          application/json:
            schema: {}
      responses:
        "200": {description: Recorded, content: {application/json: {schema: {$ref: "#/components/schemas/CloudObserveResult"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /federation/.well-known/openid-configuration:
    get:
      tags: [tasks]
      operationId: federationDiscovery
      security: []
      summary: The workspace's OpenID configuration as a federation issuer (served on the workspace's host)
      responses:
        "200": {description: OpenID configuration, content: {application/json: {schema: {type: object, required: [issuer, jwks_uri], properties: {issuer: {type: string}, jwks_uri: {type: string}}}}}}
        "404": {$ref: "#/components/responses/Problem"}
  /federation/jwks.json:
    get:
      tags: [tasks]
      operationId: federationJWKS
      security: []
      summary: The federation issuer's public keys (RS256)
      responses:
        "200": {description: Keys, content: {application/json: {schema: {type: object, required: [keys], properties: {keys: {type: array, items: {type: object}}}}}}}
        "404": {$ref: "#/components/responses/Problem"}
  /federation/t/{tenant}/.well-known/openid-configuration:
    get:
      tags: [tasks]
      operationId: federationDiscoveryByTenant
      security: []
      summary: The same, addressed by workspace ID (cells reached without the router)
      parameters:
        - {name: tenant, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: OpenID configuration, content: {application/json: {schema: {type: object, required: [issuer, jwks_uri], properties: {issuer: {type: string}, jwks_uri: {type: string}}}}}}
        "404": {$ref: "#/components/responses/Problem"}
  /federation/t/{tenant}/jwks.json:
    get:
      tags: [tasks]
      operationId: federationJWKSByTenant
      security: []
      summary: The same keys, addressed by workspace ID
      parameters:
        - {name: tenant, in: path, required: true, schema: {type: string}}
      responses:
        "200": {description: Keys, content: {application/json: {schema: {type: object, required: [keys], properties: {keys: {type: array, items: {type: object}}}}}}}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/world/entities:
    get:
      tags: [beliefs]
      operationId: worldEntities
      summary: Entities seen in claims (world state)
      parameters:
        - {name: type, in: query, schema: {type: string}}
        - {name: prefix, in: query, schema: {type: string}}
        - {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 1000}}
      responses:
        "200": {description: Entities, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/world/entities/{type}/{id}:
    parameters:
      - {name: type, in: path, required: true, schema: {type: string}}
      - {name: id, in: path, required: true, schema: {type: string}}
    get:
      tags: [beliefs]
      operationId: worldEntity
      summary: An entity's state at a valid time, as known at a transaction time - every fact and relationship with its belief segment (explain with WHY)
      parameters:
        - {name: valid_at, in: query, schema: {type: string, format: date-time}}
        - {name: as_of_tx, in: query, schema: {type: string, format: date-time}}
      responses:
        "200": {description: Entity state, content: {application/json: {schema: {type: object, required: [entity_type, entity_id, valid_at, facts, relations_out, relations_in], properties: {entity_type: {type: string}, entity_id: {type: string}, valid_at: {type: string, format: date-time}, facts: {type: array, items: {type: object, required: [claim_id, attribute, status, segment_id], properties: {claim_id: {type: string}, attribute: {type: string}, status: {type: string}, segment_id: {type: string}}}}, relations_out: {type: array, items: {type: object}}, relations_in: {type: array, items: {type: object}}, position: {type: object}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/world/topology:
    get:
      tags: [beliefs]
      operationId: worldTopology
      summary: The relationship graph around an entity (depth up to 6)
      parameters:
        - {name: entity_type, in: query, required: true, schema: {type: string}}
        - {name: entity_id, in: query, required: true, schema: {type: string}}
        - {name: depth, in: query, schema: {type: integer, minimum: 1, maximum: 6}}
        - {name: direction, in: query, schema: {type: string, enum: [out, in, both]}}
        - {name: valid_at, in: query, schema: {type: string, format: date-time}}
        - {name: as_of_tx, in: query, schema: {type: string, format: date-time}}
      responses:
        "200": {description: Topology, content: {application/json: {schema: {type: object, required: [root, depth, nodes, edges], properties: {root: {type: string}, depth: {type: integer}, nodes: {type: array, items: {type: string}}, edges: {type: array, items: {type: object}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/world/diff:
    get:
      tags: [beliefs]
      operationId: worldDiff
      summary: Belief segments recorded or superseded between two transaction times, within a namespace or entity type
      parameters:
        - {name: from_tx, in: query, required: true, schema: {type: string, format: date-time}}
        - {name: to_tx, in: query, schema: {type: string, format: date-time}}
        - {name: namespace, in: query, schema: {type: string}}
        - {name: entity_type, in: query, schema: {type: string}}
        - {name: limit, in: query, schema: {type: integer, minimum: 1, maximum: 5000}}
      responses:
        "200": {description: Changes, content: {application/json: {schema: {type: object, required: [from_tx, to_tx, items], properties: {from_tx: {type: string, format: date-time}, to_tx: {type: string, format: date-time}, items: {type: array, items: {type: object}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/world/near:
    get:
      tags: [beliefs]
      operationId: worldNear
      summary: Located entities within a radius of a point, nearest first
      parameters:
        - {name: lat, in: query, required: true, schema: {type: number}}
        - {name: lon, in: query, required: true, schema: {type: number}}
        - {name: radius_m, in: query, required: true, schema: {type: number}}
        - {name: entity_type, in: query, schema: {type: string}}
        - {name: valid_at, in: query, schema: {type: string, format: date-time}}
        - {name: as_of_tx, in: query, schema: {type: string, format: date-time}}
      responses:
        "200": {description: Positions, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/world/within:
    get:
      tags: [beliefs]
      operationId: worldWithin
      summary: Located entities inside a bounding box
      parameters:
        - {name: min_lat, in: query, required: true, schema: {type: number}}
        - {name: min_lon, in: query, required: true, schema: {type: number}}
        - {name: max_lat, in: query, required: true, schema: {type: number}}
        - {name: max_lon, in: query, required: true, schema: {type: number}}
        - {name: entity_type, in: query, schema: {type: string}}
        - {name: valid_at, in: query, schema: {type: string, format: date-time}}
        - {name: as_of_tx, in: query, schema: {type: string, format: date-time}}
      responses:
        "200": {description: Positions, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/world/polygon:
    post:
      tags: [beliefs]
      operationId: worldPolygon
      summary: Located entities inside a polygon, a page at a time (FPS-36.03)
      description: >-
        The polygon is a list of 3 to 1,000 [lat, lon] points (a closing point equal to the first is
        optional); edges are straight in latitude and longitude, and points on an edge count as
        inside. A polygon may not cross the antimeridian: split it in two. Results are ordered by
        entity type, entity ID and segment; pass next_cursor as cursor for the next page.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [polygon]
              additionalProperties: false
              properties:
                polygon:
                  type: array
                  minItems: 3
                  maxItems: 1001
                  items: {type: array, minItems: 2, maxItems: 2, items: {type: number}}
                entity_type: {type: string}
                valid_at: {type: string, format: date-time}
                as_of_tx: {type: string, format: date-time}
                limit: {type: integer, minimum: 1, maximum: 1000, default: 100}
                cursor: {type: string}
      responses:
        "200": {description: Positions, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}, next_cursor: {type: string}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/world/twins:
    get:
      tags: [beliefs]
      operationId: worldTwins
      summary: Digital-twin projection definitions
      responses:
        "200": {description: Twins, content: {application/json: {schema: {type: object, required: [items], properties: {items: {type: array, items: {type: object}}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/world/twins/{name}:
    parameters:
      - {name: name, in: path, required: true, schema: {type: string}}
    get:
      tags: [beliefs]
      operationId: worldTwin
      summary: A digital twin with its rows (each value with its segment)
      responses:
        "200": {description: Twin, content: {application/json: {schema: {$ref: "#/components/schemas/Twin"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
    put:
      tags: [beliefs]
      operationId: putTwin
      summary: Define a digital-twin projection (an entity type, attributes, relations) and materialize it from beliefs
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [entity_type]
              additionalProperties: false
              properties:
                entity_type: {type: string}
                attributes: {type: array, items: {type: string}}
                relations: {type: array, items: {type: string}}
                namespace: {type: string}
      responses:
        "200": {description: Twin, content: {application/json: {schema: {$ref: "#/components/schemas/Twin"}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/world/twins/{name}:refresh:
    parameters:
      - {name: name, in: path, required: true, schema: {type: string}}
    post:
      tags: [beliefs]
      operationId: refreshTwin
      summary: Rebuild a twin's rows from the current beliefs
      responses:
        "200": {description: Twin, content: {application/json: {schema: {$ref: "#/components/schemas/Twin"}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
  /v1/world:rebuild:
    post:
      tags: [beliefs]
      operationId: worldRebuild
      summary: Rebuild the world-state projection from belief segments (administrators)
      responses:
        "200": {description: Rebuilt, content: {application/json: {schema: {type: object, required: [claims], properties: {claims: {type: integer}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/world:query:
    post:
      tags: [beliefs]
      operationId: worldQuery
      summary: World-state query - entities chosen by key, type or area and filtered by what is believed about them, each with its state at a valid time as known at a transaction time; every fact and relationship carries its belief segment (explain with WHY)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              additionalProperties: false
              description: Exactly one of entities, entity_type, near or within selects the entities; every where condition must hold.
              properties:
                entities: {type: array, maxItems: 100, items: {type: object, required: [type, id], additionalProperties: false, properties: {type: {type: string}, id: {type: string}}}}
                entity_type: {type: string}
                prefix: {type: string, description: "Entity ID prefix, with entity_type"}
                near: {type: object, required: [lat, lon, radius_m], additionalProperties: false, properties: {lat: {type: number}, lon: {type: number}, radius_m: {type: number, minimum: 0, exclusiveMinimum: true, maximum: 20000000}}}
                within: {type: object, required: [min_lat, min_lon, max_lat, max_lon], additionalProperties: false, properties: {min_lat: {type: number}, min_lon: {type: number}, max_lat: {type: number}, max_lon: {type: number}}}
                where:
                  type: array
                  maxItems: 20
                  items:
                    type: object
                    required: [attribute]
                    additionalProperties: false
                    properties:
                      attribute: {type: string}
                      op: {type: string, enum: [eq, ne, in, exists, absent], default: eq}
                      value: {description: "For eq and ne: a string, number or boolean compared with the belief's value"}
                      values: {type: array, items: {}, description: For in}
                      status: {type: array, items: {type: string}, description: Only beliefs with these statuses count}
                      min_confidence: {type: number, minimum: 0, maximum: 1}
                valid_at: {type: string, format: date-time}
                as_of_tx: {type: string, format: date-time}
                limit: {type: integer, minimum: 1, maximum: 1000, default: 100}
                cursor: {type: string, description: "The previous page's next_cursor, with the same query"}
      responses:
        "200":
          description: A page of entity states; a selective query may return fewer items than limit (at most 5000 entities are examined per call) with a next_cursor to continue
          content:
            application/json:
              schema:
                type: object
                required: [valid_at, items, scanned, next_cursor]
                properties:
                  valid_at: {type: string, format: date-time}
                  as_of_tx: {type: string, format: date-time, nullable: true}
                  items: {type: array, items: {type: object, required: [entity_type, entity_id, valid_at, facts, relations_out, relations_in], properties: {entity_type: {type: string}, entity_id: {type: string}, facts: {type: array, items: {type: object}}, relations_out: {type: array, items: {type: object}}, relations_in: {type: array, items: {type: object}}, position: {type: object}}}}
                  missing: {type: array, items: {type: object}, description: Named entities nothing is known about}
                  scanned: {type: integer}
                  next_cursor: {type: string, nullable: true}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/edge/config:
    get:
      tags: [evidence]
      operationId: edgeConfig
      summary: The signed configuration an edge runtime mirrors (claim types, active policy and authority, contracts, its sources) - edge devices only
      responses:
        "200": {description: Signed configuration, content: {application/json: {schema: {type: object, required: [config, jws], properties: {config: {type: object}, jws: {type: string}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/edge/evidence:
    post:
      tags: [evidence]
      operationId: edgeEvidence
      summary: An edge runtime sends local evidence up (up to 500 items; idempotent per item); clock offsets over 2 s are flagged
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required: [items]
              properties:
                sent_at: {type: string, format: date-time}
                items: {type: array, maxItems: 500, items: {type: object, required: [local_id, recorded_at, evidence], properties: {local_id: {type: string}, recorded_at: {type: string, format: date-time}, evidence: {type: object}}}}
      responses:
        "200": {description: Acknowledged, content: {application/json: {schema: {type: object, required: [items, clock_offset_ms, time_anomaly], properties: {items: {type: array, items: {type: object}}, clock_offset_ms: {type: integer}, time_anomaly: {type: boolean}}}}}}
        "400": {$ref: "#/components/responses/Problem"}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
  /v1/branding:
    get:
      tags: [access]
      operationId: getBranding
      summary: The tenant's branding (a partner's product name, logo, color and support link), applied by the console; empty for direct tenants
      responses:
        "200": {description: Branding, content: {application/json: {schema: {type: object, additionalProperties: false, properties: {product_name: {type: string}, logo: {type: string, description: "data: URI"}, primary_color: {type: string}, support_url: {type: string}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
  /v1/edge/status:
    get:
      tags: [evidence]
      operationId: edgeStatus
      summary: On an edge runtime - sync state, pending evidence and the offline buffer
      responses:
        "200": {description: Status, content: {application/json: {schema: {type: object, required: [online, pending_items, pending_bytes, quota_bytes, pressure], properties: {online: {type: boolean}, pending_items: {type: integer}, pending_bytes: {type: integer}, quota_bytes: {type: integer}, pressure: {type: number}}}}}}
        "401": {$ref: "#/components/responses/Problem"}
        "403": {$ref: "#/components/responses/Problem"}
        "404": {$ref: "#/components/responses/Problem"}
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
      description: "API key: gn_<env>_<key id>_<secret>; or a Groundnetic access token; or, for agents, a token from an agent identity provider (AG-1.04), with the header Gn-Tenant: tn_... when more than one workspace trusts its issuer"
  parameters:
    IdempotencyKey:
      name: Idempotency-Key
      in: header
      schema: {type: string, maxLength: 255}
    EvidenceID:
      name: id
      in: path
      required: true
      schema: {type: string, pattern: "^ev_"}
    Limit:
      name: limit
      in: query
      schema: {type: integer, minimum: 1, maximum: 1000, default: 100}
    Cursor:
      name: cursor
      in: query
      schema: {type: string}
    Claim:
      name: claim
      in: path
      required: true
      description: Claim ID (cl_...) or URL-encoded gn:// URI
      schema: {type: string}
    Wait:
      name: wait
      in: query
      description: Longest read-your-writes wait, e.g. 10s (max 30s)
      schema: {type: string}
    MinConsistency:
      name: Gn-Min-Consistency
      in: header
      description: Consistency token from a write; the read waits until it is included
      schema: {type: string}
  headers:
    RequestID:
      schema: {type: string}
    ConsistencyToken:
      description: Read-your-writes token for the write just made
      schema: {type: string}
  responses:
    Submitted:
      description: Stored (201) or recognised as a duplicate (200)
      headers:
        Gn-Consistency-Token: {$ref: "#/components/headers/ConsistencyToken"}
        Gn-Request-Id: {$ref: "#/components/headers/RequestID"}
      content:
        application/json:
          schema: {$ref: "#/components/schemas/SubmitResult"}
    OverrideAsserted:
      description: Override recorded (201) or recognised as a duplicate (200)
      headers:
        Gn-Consistency-Token: {$ref: "#/components/headers/ConsistencyToken"}
        Gn-Request-Id: {$ref: "#/components/headers/RequestID"}
      content:
        application/json:
          schema: {$ref: "#/components/schemas/OverrideResult"}
    Beliefs:
      description: Belief segments
      content:
        application/json:
          schema:
            type: object
            required: [items]
            properties:
              items: {type: array, items: {$ref: "#/components/schemas/Belief"}}
              next_cursor: {type: string}
    Why:
      description: Explanation (DETAILED_DESIGN.md §C6.3)
      content:
        application/json:
          schema: {$ref: "#/components/schemas/Explanation"}
    Problem:
      description: RFC 9457 problem
      headers:
        Gn-Request-Id: {$ref: "#/components/headers/RequestID"}
      content:
        application/problem+json:
          schema: {$ref: "#/components/schemas/Problem"}
  schemas:
    SignInPolicy:
      type: object
      required: [require_mfa, api_key, idle_timeout_minutes]
      properties:
        require_mfa: {type: boolean, description: "refuse a sign-in whose ID token asserts no second factor (amr)"}
        api_key: {type: boolean, description: "people may use API keys of their own (never for a console session)"}
        idle_timeout_minutes: {type: integer, description: "Console sessions end after this many minutes without the person's activity: 0 (off) or 15 to 480 (SP-12.13)"}
        idle_timeout_fixed: {type: string, description: "Why the idle timeout cannot be changed here (us-gov cells: 15 minutes, GOV-2.09)"}
        updated_at: {type: string, format: date-time, nullable: true}
    MCPTool:
      type: object
      required: [name, action_type]
      additionalProperties: false
      properties:
        name: {type: string, description: The tool's MCP name}
        action_type: {type: string, description: The gate action type a call is decided as}
        target: {type: string, description: "Target template; ${arg} is a tool argument; default mcp://<server>/<tool>"}
        target_param: {type: string, description: "JSON pointer to the argument that is the target, e.g. /path"}
        read_only: {type: boolean}
        description: {type: string}
    MCPServer:
      type: object
      required: [name, url, auth_header, has_secret, approved, tools, default_deny, endpoint, created_by, created_at, updated_by, updated_at]
      properties:
        name: {type: string}
        url: {type: string}
        auth_header: {type: string}
        has_secret: {type: boolean}
        approved: {type: boolean}
        tools: {type: array, items: {$ref: "#/components/schemas/MCPTool"}}
        default_deny: {type: boolean}
        endpoint: {type: string, description: The hosted endpoint path agents point their MCP client at}
        created_by: {type: string}
        created_at: {type: string, format: date-time}
        updated_by: {type: string}
        updated_at: {type: string, format: date-time}
    SkillRef:
      type: object
      required: [name, sha256]
      additionalProperties: false
      properties:
        name: {type: string, pattern: "^[a-z0-9][a-z0-9-]{0,63}$"}
        sha256: {type: string, pattern: "^[0-9a-fA-F]{64}$", description: The SHA-256 of the skill's content}
    SkillVersion:
      type: object
      required: [sha256]
      additionalProperties: false
      properties:
        sha256: {type: string, pattern: "^[0-9a-fA-F]{64}$"}
        note: {type: string, maxLength: 200}
    Skill:
      type: object
      required: [name, description, source, versions, approved, created_by, created_at, updated_by, updated_at]
      properties:
        name: {type: string}
        description: {type: string}
        source: {type: string}
        versions: {type: array, items: {$ref: "#/components/schemas/SkillVersion"}}
        approved: {type: boolean}
        created_by: {type: string}
        created_at: {type: string, format: date-time}
        updated_by: {type: string}
        updated_at: {type: string, format: date-time}
    FixRepository:
      type: object
      properties:
        provider: {type: string, enum: [github]}
        repository: {type: string, description: owner/name}
        base: {type: string}
        api: {type: string}
        directory: {type: string}
        token: {type: string, writeOnly: true}
        has_token: {type: boolean, readOnly: true}
        updated_at: {type: string, format: date-time, readOnly: true}
    Peer:
      type: object
      required: [peer_id, name, issuer, remote_tenant, region, keys, principal_id, status, has_credential, created_at]
      properties:
        peer_id: {type: string}
        name: {type: string}
        issuer: {type: string}
        remote_tenant: {type: string}
        region: {type: string}
        endpoint: {type: string}
        keys: {type: object}
        principal_id: {type: string}
        status: {type: string, enum: [active, suspended]}
        has_credential: {type: boolean}
        active_agreement: {type: integer}
        created_at: {type: string, format: date-time}
    AgreementDocument:
      type: object
      required: [agreement_id, version, parties, flows, allowed_regions]
      properties:
        agreement_id: {type: string}
        version: {type: integer, minimum: 1}
        parties:
          type: array
          minItems: 2
          maxItems: 2
          items: {type: object, required: [issuer, tenant, region], properties: {issuer: {type: string}, tenant: {type: string}, region: {type: string}}}
        flows:
          type: array
          items:
            type: object
            required: [from, to, namespaces, classes, max_classification]
            properties:
              from: {type: integer}
              to: {type: integer}
              namespaces: {type: array, items: {type: string}}
              classes: {type: array, items: {$ref: "#/components/schemas/EvidenceClass"}}
              max_classification: {type: string}
              authority_caps: {type: object, additionalProperties: {type: number}}
              mappings:
                type: array
                items:
                  type: object
                  required: [from, to]
                  properties:
                    from: {type: object, properties: {namespace: {type: string}, entity_type: {type: string}, attribute: {type: string}}}
                    to: {type: object, properties: {namespace: {type: string}, entity_type: {type: string}, attribute: {type: string}}}
        allowed_regions: {type: array, items: {type: string}}
        delegated_trust: {type: boolean, description: "peers declare their sources' authority; the receiver uses min(declared, cap)"}
    Agreement:
      type: object
      required: [peer_id, version, document, digest, status, created_at]
      properties:
        peer_id: {type: string}
        version: {type: integer}
        document: {$ref: "#/components/schemas/AgreementDocument"}
        digest: {type: string}
        local_signature: {type: string}
        peer_signature: {type: string}
        status: {type: string, enum: [draft, active, superseded]}
        created_at: {type: string, format: date-time}
        activated_at: {type: string, format: date-time}
    Twin:
      type: object
      required: [name, definition, updated_at]
      properties:
        name: {type: string}
        definition: {type: object}
        updated_at: {type: string, format: date-time}
        refreshed_at: {type: string, format: date-time}
        rows: {type: array, items: {type: object}}
    DiscoveryHint:
      type: object
      required: [code, text]
      properties:
        code: {type: string}
        severity: {type: string}
        text: {type: string}
        fix: {type: string}
        value: {type: string}
    DiscoveryEvidence:
      type: object
      required: [source, method, ref, observed_at]
      properties:
        source: {type: string}
        method: {type: string}
        ref: {type: string}
        observed_at: {type: string, format: date-time}
    DiscoveredAssetRef:
      type: object
      required: [asset_id, kind, name, key]
      properties:
        asset_id: {type: string}
        kind: {type: string}
        name: {type: string}
        key: {type: string}
    AdoptStep:
      type: object
      required: [step, text, done]
      properties:
        step: {type: string}
        text: {type: string}
        done: {type: boolean}
        fix: {type: string}
    DiscoveredAsset:
      type: object
      required: [asset_id, provider, kind, key, name, sources, attributes, status_why, can_act, weak, calls_models, uses, ignored, owner_hints, risk_hints, first_seen, last_seen, missed_runs, changed_fields]
      properties:
        asset_id: {type: string}
        provider: {type: string}
        kind: {type: string}
        key: {type: string, description: "the ARN, lower-cased Azure resource ID, Google full resource name, mcp:<host><path>, or <system>:<subject>"}
        name: {type: string}
        connection: {type: string}
        region: {type: string}
        service: {type: string}
        sources: {type: array, items: {type: string}}
        attributes: {type: object, description: "what matters about it, never content (no prompts, inputs, outputs or secret values)"}
        status: {type: string, enum: [governed, ungoverned, unknown], description: "empty for read-only assets"}
        status_why: {type: string}
        identity_system: {type: string}
        identity: {type: string}
        role: {type: string}
        can_act: {type: boolean}
        weak: {type: boolean}
        calls_models: {type: boolean}
        uses: {type: array, items: {type: string}}
        agent_id: {type: string}
        agent_name: {type: string}
        ignored: {type: boolean}
        note: {type: string}
        owner_hints: {type: array, items: {$ref: "#/components/schemas/DiscoveryHint"}}
        risk_hints: {type: array, items: {$ref: "#/components/schemas/DiscoveryHint"}}
        first_seen: {type: string, format: date-time}
        last_seen: {type: string, format: date-time}
        missed_runs: {type: integer}
        disappeared_at: {type: string, format: date-time}
        disappeared_why: {type: string}
        changed_at: {type: string, format: date-time}
        changed_fields: {type: array, items: {type: string}}
        evidence: {type: array, items: {$ref: "#/components/schemas/DiscoveryEvidence"}}
        used_by: {type: array, items: {$ref: "#/components/schemas/DiscoveredAssetRef"}}
        uses_assets: {type: array, items: {$ref: "#/components/schemas/DiscoveredAssetRef"}}
        next_steps: {type: array, items: {$ref: "#/components/schemas/AdoptStep"}}
        suggested:
          type: object
          required: [targets, egress, name, why]
          properties:
            template: {type: string}
            targets: {type: array, items: {type: string}}
            egress: {type: array, items: {type: string}}
            name: {type: string}
            why: {type: string}
            mcp_registration: {type: object, required: [name, url, tools], properties: {name: {type: string}, url: {type: string}, tools: {type: array, items: {type: string}}}}
    DiscoveryServiceProgress:
      type: object
      required: [service, state, count]
      properties:
        service: {type: string}
        region: {type: string}
        state: {type: string, enum: [running, done, denied, failed, skipped, bounded]}
        count: {type: integer}
        error: {type: string}
        fix: {type: string}
        note: {type: string}
    DiscoveryRun:
      type: object
      required: [run_id, connection, trigger, state, first, services, found, new, changed, disappeared, unchanged, bounded, summary, started_at, heartbeat_at]
      properties:
        run_id: {type: string}
        connection: {type: string, description: "a cloud connection, or local"}
        trigger: {type: string, enum: [schedule, manual, connection_test]}
        state: {type: string, enum: [running, done, partial, failed]}
        first: {type: boolean, description: "the connection's first run: it alerts nobody"}
        services: {type: array, items: {$ref: "#/components/schemas/DiscoveryServiceProgress"}}
        found: {type: integer}
        new: {type: integer}
        changed: {type: integer}
        disappeared: {type: integer}
        unchanged: {type: integer}
        bounded: {type: array, items: {type: string}}
        error: {type: string}
        fix: {type: string}
        summary: {type: string}
        started_by: {type: string}
        started_at: {type: string, format: date-time}
        heartbeat_at: {type: string, format: date-time}
        finished_at: {type: string, format: date-time}
    DiscoverySummary:
      type: object
      required: [governed, ungoverned, unknown, read_only, ignored, disappeared, cloud_connections, connections_with_discovery, changes]
      properties:
        governed: {type: integer}
        ungoverned: {type: integer}
        unknown: {type: integer}
        read_only: {type: integer}
        ignored: {type: integer}
        disappeared: {type: integer}
        cloud_connections: {type: integer}
        connections_with_discovery: {type: integer}
        last_run: {$ref: "#/components/schemas/DiscoveryRun"}
        changes: {type: array, items: {$ref: "#/components/schemas/DiscoveredAsset"}}
    DiscoverySettings:
      type: object
      required: [local_enabled, digest]
      properties:
        local_enabled: {type: boolean}
        digest: {type: boolean, description: "a daily email to the administrators of the new ungoverned assets"}
        accept_device_reports: {type: boolean, description: "the workspace takes reports from developer machines (gnctl scan --report; AG-16); off by default"}
        last_digest_at: {type: string, format: date-time}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
    DeviceTool:
      type: object
      required: [id, name, found, hook]
      properties:
        id: {type: string, description: "the catalog's ID: claude-code, cursor, vscode-ext:github.copilot, cli:aider, ..."}
        name: {type: string}
        version: {type: string}
        found: {type: array, items: {type: string}, description: "how it was found, paths with ~ for the home directory"}
        hook: {type: object, required: [status], properties: {status: {type: string, enum: [installed, missing, not_supported]}, where: {type: array, items: {type: string}}}}
    DeviceMCPServer:
      type: object
      required: [name, tool, config, transport]
      properties:
        name: {type: string}
        tool: {type: string}
        config: {type: string}
        transport: {type: string, enum: [stdio, http, sse]}
        command: {type: string, description: "the command's base name"}
        package: {type: string, description: "the npx or uvx package, or the docker image"}
        host: {type: string}
        path: {type: string}
        via_gateway: {type: boolean}
        disabled: {type: boolean}
    DeviceReport:
      type: object
      required: [schema, device_id, os, arch, gnctl_version, catalog_version, scanned_at, tools, mcp_servers, credentials]
      properties:
        schema: {type: string, enum: [groundnetic.device-report/v1]}
        device_id: {type: string, description: "dvc_…, random, made by gnctl on the first report"}
        os: {type: string, enum: [darwin, linux, windows]}
        arch: {type: string}
        hostname: {type: string, description: "only with gnctl scan --include-hostname"}
        gnctl_version: {type: string}
        catalog_version: {type: string}
        scanned_at: {type: string, format: date-time}
        tools: {type: array, maxItems: 64, items: {$ref: "#/components/schemas/DeviceTool"}}
        mcp_servers: {type: array, maxItems: 256, items: {$ref: "#/components/schemas/DeviceMCPServer"}}
        credentials: {type: object, additionalProperties: {type: boolean}, description: "credential presence by environment-variable name or file path; never a value"}
    DeviceReportResult:
      type: object
      required: [device_id, received_at, tools, mcp_servers, new, changed, disappeared, dropped]
      properties:
        device_id: {type: string}
        received_at: {type: string, format: date-time}
        tools: {type: integer}
        mcp_servers: {type: integer}
        new: {type: integer}
        changed: {type: integer}
        disappeared: {type: integer}
        dropped: {type: integer, description: "strings the server's secret check removed"}
    Device:
      type: object
      required: [device_id, principal_id, person_name, os, arch, gnctl_version, catalog_version, first_seen, last_report_at, reports, tools, mcp_servers, credentials_present, mine]
      properties:
        device_id: {type: string}
        principal_id: {type: string}
        person_name: {type: string}
        os: {type: string}
        arch: {type: string}
        hostname: {type: string}
        gnctl_version: {type: string}
        catalog_version: {type: string}
        first_seen: {type: string, format: date-time}
        last_report_at: {type: string, format: date-time}
        reports: {type: integer}
        tools: {type: array, items: {$ref: "#/components/schemas/DeviceTool"}}
        mcp_servers: {type: array, items: {$ref: "#/components/schemas/DeviceMCPServer"}}
        credentials_present: {type: array, items: {type: string}}
        mine: {type: boolean}
        latest_report: {$ref: "#/components/schemas/DeviceReport"}
        history: {type: array, items: {type: object, required: [received_at, tools, mcp_servers], properties: {received_at: {type: string, format: date-time}, tools: {type: integer}, mcp_servers: {type: integer}}}}
    DeviceList:
      type: object
      required: [items, hook_coverage, accept_device_reports, all]
      properties:
        items: {type: array, items: {$ref: "#/components/schemas/Device"}}
        hook_coverage: {type: array, items: {type: object, required: [tool, name, machines, installed, text], properties: {tool: {type: string}, name: {type: string}, machines: {type: integer}, installed: {type: integer}, text: {type: string}}}}
        accept_device_reports: {type: boolean}
        all: {type: boolean, description: "every machine (an administrator), or only the caller's"}
    ConnectionTest:
      type: object
      required: [connection, cloud, identity, passed, checks, summary]
      properties:
        connection: {type: string}
        cloud: {type: string}
        identity: {type: string}
        passed: {type: boolean}
        checks: {type: array, items: {type: object, required: [service, permission, state, reason], properties: {service: {type: string}, permission: {type: string}, state: {type: string, enum: [allowed, denied, not_checked]}, reason: {type: string}, fix: {type: string}}}}
        summary: {type: string}
        run_id: {type: string}
    AdoptResult:
      type: object
      required: [asset, agent, mandate_version, mode, next_steps]
      properties:
        asset: {$ref: "#/components/schemas/DiscoveredAsset"}
        agent: {type: object}
        mandate_version: {type: integer}
        mode: {type: string}
        next_steps: {type: array, items: {$ref: "#/components/schemas/AdoptStep"}}
    SensitivePattern:
      type: object
      required: [name, pattern]
      additionalProperties: false
      properties:
        name: {type: string, pattern: "^[a-z0-9][a-z0-9-]{0,40}$"}
        pattern: {type: string, maxLength: 500, description: "RE2"}
        outcome: {type: string, enum: ["", allow, deny, escalate, redact], description: "default: the mandate's personal outcome"}
    SensitiveRecord:
      type: object
      required: [rules, outcome, hits]
      description: "What a mandate's sensitive-data rule found in the parameters: rule, path and count, never the value (AG-17.08)"
      properties:
        rules: {type: array, items: {type: string}}
        outcome: {type: string, enum: [allow, deny, escalate, redact]}
        hits:
          type: array
          items:
            type: object
            required: [rule, class, path, count, outcome]
            properties:
              rule: {type: string}
              class: {type: string, enum: [secret, personal, pattern]}
              path: {type: string}
              count: {type: integer}
              outcome: {type: string}
        too_large: {type: boolean}
        redacted: {type: boolean}
    FeedCounters:
      type: object
      required: [received, kept, dropped, failed]
      properties:
        received: {type: integer}
        kept: {type: integer}
        dropped: {type: integer}
        failed: {type: integer}
        duplicates: {type: integer}
    SecurityFeed:
      type: object
      required: [name, input, profile, profile_version, vendor, product, certification, to_confirm, config, has_secret, principal_id, today, last_30_days, days, sample_errors, updated_at, updated_by]
      properties:
        name: {type: string}
        input: {type: string, enum: [push, object, otlp, syslog, office365]}
        profile: {type: string}
        profile_version: {type: string}
        vendor: {type: string}
        product: {type: string}
        certification: {type: string}
        to_confirm: {type: array, items: {type: string}}
        feed_format: {type: string}
        config: {type: object}
        has_secret: {type: boolean}
        push_path: {type: string}
        principal_id: {type: string}
        today: {$ref: "#/components/schemas/FeedCounters"}
        last_30_days: {$ref: "#/components/schemas/FeedCounters"}
        days: {type: object, additionalProperties: {$ref: "#/components/schemas/FeedCounters"}}
        sample_errors: {type: array, items: {type: string}}
        last_received_at: {type: string, format: date-time}
        last_pulled_at: {type: string, format: date-time}
        last_error: {type: string}
        last_fix: {type: string}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
    SecurityFeedIngest:
      type: object
      required: [received, kept, dropped, failed, duplicates, matched_to_agents, bypasses, unknown_ai_calls, findings, errors]
      properties:
        received: {type: integer}
        kept: {type: integer}
        dropped: {type: integer}
        failed: {type: integer}
        duplicates: {type: integer}
        matched_to_agents: {type: integer}
        bypasses: {type: integer}
        unknown_ai_calls: {type: integer}
        findings: {type: integer}
        errors: {type: array, items: {type: string}}
    SecurityFeedMapping:
      type: object
      required: [received, mapped, filtered, failed, errors]
      properties:
        received: {type: integer}
        mapped: {type: integer}
        filtered: {type: integer}
        failed: {type: integer}
        errors: {type: array, items: {type: string}}
        events: {type: array, items: {type: object}}
    AgentPlatform:
      type: object
      required: [name, kind, config, has_secret, poll_minutes, identity_system, agents, grants, unregistered, updated_at, updated_by]
      properties:
        name: {type: string}
        kind: {type: string, enum: [copilot_studio, agentforce, m365_grants, google_grants, salesforce_grants]}
        config: {type: object}
        has_secret: {type: boolean}
        poll_minutes: {type: integer}
        identity_system: {type: string, description: "the agent-identity system that links a registered agent to one of its agents"}
        last_polled_at: {type: string, format: date-time}
        last_success_at: {type: string, format: date-time}
        last_error: {type: string}
        last_note: {type: string, description: "what the last successful poll left unread (a bound reached)"}
        agents: {type: integer}
        grants: {type: integer, description: "apps holding OAuth grants (grant connections)"}
        unregistered: {type: integer, description: "agents, and apps that can write or send, neither registered nor ignored"}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
    PlatformGrant:
      type: object
      required: [app_id, name, users, all_users, scopes, writes, write_scopes, app_only, platform, identity, first_seen, last_seen, ignored]
      properties:
        app_id: {type: string, description: "Entra appId, Google OAuth client ID, or Salesforce app name"}
        alt_id: {type: string, description: "Entra service principal ID, or Salesforce connected app ID; also links"}
        name: {type: string}
        users: {type: integer, description: "users who granted it"}
        all_users: {type: boolean, description: "an administrator consented for every user"}
        scopes: {type: array, items: {type: string}}
        writes: {type: boolean, description: "some scope can write or send"}
        write_scopes: {type: array, items: {type: string}}
        app_only: {type: boolean, description: "application permissions: it acts without a user"}
        last_used_at: {type: string, format: date-time}
        platform: {type: string}
        identity: {type: string, description: "system:app ID, as a registered agent declares it"}
        registered_agent_id: {type: string}
        first_seen: {type: string, format: date-time}
        last_seen: {type: string, format: date-time}
        removed_at: {type: string, format: date-time}
        ignored: {type: boolean}
        note: {type: string}
    SETError:
      type: object
      required: [err, description]
      properties:
        err: {type: string, enum: [invalid_request, invalid_key, invalid_issuer, invalid_audience, authentication_failed, access_denied]}
        description: {type: string}
    SSFReceiver:
      type: object
      required: [name, endpoint_url, audience, issuer, events, has_secret, pending, delivered, failed, updated_at, updated_by]
      properties:
        name: {type: string}
        endpoint_url: {type: string}
        audience: {type: string}
        issuer: {type: string}
        events: {type: array, items: {type: string, enum: [permit-revoked, agent-suspended]}}
        has_secret: {type: boolean}
        pending: {type: integer}
        delivered: {type: integer}
        failed: {type: integer}
        last_delivered_at: {type: string, format: date-time}
        last_error: {type: string, description: "the newest undelivered SET's error, with what to fix"}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
    SSFDelivery:
      type: object
      required: [set_id, event, subject, state, attempts, created_at, token]
      properties:
        set_id: {type: string}
        event: {type: string, enum: [permit-revoked, agent-suspended, verification]}
        subject: {type: string}
        state: {type: string, enum: [pending, delivered, failed]}
        attempts: {type: integer}
        last_status: {type: integer}
        last_error: {type: string}
        next_attempt_at: {type: string, format: date-time}
        created_at: {type: string, format: date-time}
        delivered_at: {type: string, format: date-time}
        token: {type: string, description: "the signed SET"}
    SSFTransmitter:
      type: object
      required: [name, issuer, jwks_uri, audience, push_path, received, updated_at, updated_by]
      properties:
        name: {type: string}
        issuer: {type: string}
        jwks_uri: {type: string}
        audience: {type: string}
        push_path: {type: string}
        push_url: {type: string, description: "the push endpoint to give the identity provider"}
        received: {type: integer}
        last_received_at: {type: string, format: date-time}
        last_error: {type: string, description: "why the last refused SET was refused"}
        last_error_at: {type: string, format: date-time}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
    SSFSignal:
      type: object
      required: [set_id, events, subjects, agents, permits_revoked, summary, received_at]
      properties:
        set_id: {type: string}
        events: {type: array, items: {type: string}}
        subjects: {type: array, items: {type: string}}
        agents: {type: array, items: {type: string}}
        permits_revoked: {type: integer}
        summary: {type: string}
        received_at: {type: string, format: date-time}
    PlatformAgent:
      type: object
      required: [external_id, name, platform, identity, first_seen, last_seen, ignored]
      properties:
        external_id: {type: string}
        name: {type: string}
        api_name: {type: string}
        kind: {type: string}
        state: {type: string}
        owner: {type: string}
        published_at: {type: string, format: date-time}
        modified_at: {type: string, format: date-time}
        platform: {type: string}
        identity: {type: string, description: "system:subject, as a registered agent declares it"}
        registered_agent_id: {type: string}
        first_seen: {type: string, format: date-time}
        last_seen: {type: string, format: date-time}
        removed_at: {type: string, format: date-time}
        ignored: {type: boolean}
        ignored_note: {type: string}
    CredentialProvider:
      type: object
      required: [name, kind, config, grants, has_secret, updated_at, updated_by]
      properties:
        name: {type: string}
        kind: {type: string, enum: [aws, kubernetes, github, vault]}
        config: {type: object}
        grants: {type: array, items: {type: object}}
        has_secret: {type: boolean}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
    Challenge:
      type: object
      required: [challenge_id, peer_id, direction, reason, outcome, response, created_at]
      properties:
        challenge_id: {type: string}
        peer_id: {type: string}
        direction: {type: string, enum: [in, out]}
        evidence_id: {type: string}
        remote_id: {type: string}
        reason: {type: string}
        outcome: {type: string, enum: [upheld, broken, revoked, unknown, failed]}
        response: {type: object}
        created_at: {type: string, format: date-time}
    ImportResult:
      type: object
      required: [bundle_id, peer_id, status, entries, accepted, rejected, items]
      properties:
        bundle_id: {type: string}
        peer_id: {type: string}
        status: {type: string, enum: [accepted, partial, rejected]}
        entries: {type: integer}
        accepted: {type: integer}
        rejected: {type: integer}
        items:
          type: array
          items:
            type: object
            required: [remote_id]
            properties:
              remote_id: {type: string}
              evidence_id: {type: string}
              duplicate: {type: boolean}
              code: {type: string}
              detail: {type: string}
    SupportSettings:
      type: object
      required: [allow_staff_impersonation, changed_by, changed_at, active_session, last_session]
      properties:
        allow_staff_impersonation: {type: boolean}
        changed_by: {type: string, nullable: true, description: "who last changed it: a person's email, or system when it turned itself off after a session"}
        changed_at: {type: string, format: date-time, nullable: true}
        active_session:
          allOf: [{$ref: "#/components/schemas/StaffSession"}]
          nullable: true
        last_session:
          type: object
          nullable: true
          description: the most recent ended staff session, for the ended notice
          required: [session_id, operator_name, operator_email, ended_at, end_reason]
          properties:
            session_id: {type: string}
            operator_name: {type: string}
            operator_email: {type: string}
            ended_at: {type: string, format: date-time}
            end_reason: {type: string, enum: [expired, ended_by_customer, ended_by_staff, setting_off, staff_signed_out, revoked]}
    StaffSession:
      type: object
      required: [session_id, operator_name, operator_email, reason, started_at, expires_at, you]
      properties:
        session_id: {type: string}
        operator_name: {type: string}
        operator_email: {type: string}
        reason: {type: string}
        started_at: {type: string, format: date-time}
        expires_at: {type: string, format: date-time}
        you: {type: boolean, description: "true when the caller is this staff session"}
    Problem:
      type: object
      required: [type, title, status, code]
      properties:
        type: {type: string}
        title: {type: string}
        status: {type: integer}
        code:
          type: string
          enum: [validation_failed, schema_version_unsupported, claim_type_unknown, canonicalization_failed,
                 timestamp_out_of_range, binding_violation, forbidden, not_found, idempotency_conflict,
                 precondition_failed, payload_too_large, secret_detected, signature_invalid, contract_invalid, rule_invalid, mandate_invalid, governance_forbidden, permit_replayed, permit_revoked, quota_exceeded,
                 rate_limited, consistency_timeout, unauthenticated, method_not_allowed, internal,
                 provenance_tamper, region_not_allowed, wrong_region, provider_unavailable, above_ceiling, change_request_required]
        detail:
          type: string
          description: What failed, the value at fault and what to do next, in plain words.
        instance:
          type: string
          description: The request's reference (as in Gn-Request-Id); give it to support.
        errors: {type: array, items: {type: string}}
        fields:
          type: array
          description: The request fields at fault, for showing each problem next to its field.
          items:
            type: object
            required: [field, message]
            properties:
              field: {type: string}
              message: {type: string}
              value: {type: string}
    EvidenceClass:
      type: string
      enum: [PRIMARY, DERIVED, AI_DERIVED, HUMAN_ASSERTED]
    ClaimRef:
      type: object
      additionalProperties: false
      description: Either `uri` or the structured form.
      properties:
        uri: {type: string, example: "gn://sre/service/checkout/deployed_version?env=prod"}
        namespace: {type: string}
        entity:
          type: object
          required: [type, id]
          additionalProperties: false
          properties:
            type: {type: string}
            id: {type: string}
        attribute: {type: string}
        scope: {type: object, additionalProperties: {type: string}}
    Value:
      type: object
      required: [type]
      description: Typed value (DETAILED_DESIGN.md §B1.3). Numbers are strings.
      properties:
        type:
          type: string
          description: The value type. New types may be added within /v1 (docs/compatibility.md); clients should show values of a type they do not know as JSON.
          x-extensible-enum: [boolean, categorical, integer, decimal, text, windowed_aggregate, interval, structured, geo_point, entity_ref]
        value: {}
        unit: {type: string}
        low: {type: string, description: "interval: lower bound (inclusive)"}
        high: {type: string, description: "interval: upper bound (inclusive)"}
        fields:
          type: object
          description: "structured: each declared field's value (boolean, or a string as for its scalar type)"
          additionalProperties: {}
        lat: {type: string, description: "geo_point: latitude in degrees, -90 to 90"}
        lon: {type: string, description: "geo_point: longitude in degrees, -180 to 180"}
        alt: {type: string, description: "geo_point: altitude in metres (optional)"}
        accuracy_m: {type: string, description: "geo_point: the reading's accuracy in metres (± m); a fix coarser than the claim's tolerance_m weighs less (BR-1.06)"}
        accuracy: {type: string, description: "integer and decimal: the reading's accuracy, ± in the value's unit (e.g. a sensor tolerance); coarser than the claim's tolerance weighs less (BR-1.06)"}
        ref:
          type: object
          description: "entity_ref: the entity referred to"
          properties:
            type: {type: string}
            id: {type: string}
        window_start: {type: string, format: date-time}
        window_end: {type: string, format: date-time}
        count: {}
        min: {type: string}
        max: {type: string}
        mean: {type: string}
        p50: {type: string}
        p95: {type: string}
        p99: {type: string}
    Submission:
      type: object
      required: [schema_version, claim, value, observed_at]
      additionalProperties: false
      properties:
        schema_version: {type: string, enum: ["gn.evidence/1.0"]}
        claim: {$ref: "#/components/schemas/ClaimRef"}
        source_id: {type: string}
        class: {$ref: "#/components/schemas/EvidenceClass"}
        value: {$ref: "#/components/schemas/Value"}
        observed_at: {type: string, format: date-time}
        valid_from: {type: string, format: date-time}
        valid_to: {type: string, format: date-time}
        confidence: {type: number, minimum: 0, maximum: 1}
        parents:
          type: array
          items:
            type: object
            required: [evidence_id, relation]
            additionalProperties: false
            properties:
              evidence_id: {type: string}
              relation: {type: string, enum: [DERIVED_FROM, INTERPRETS, SUMMARIZES, COPIED_FROM, ATTESTS]}
        payload_ref: {$ref: "#/components/schemas/PayloadRef"}
        subject_ref: {type: string}
        classification: {type: string, enum: [public, internal, confidential, restricted, personal]}
        ai: {$ref: "#/components/schemas/AIInfo"}
        sensor:
          type: object
          required: [device_id]
          properties:
            device_id: {type: string}
            calibration: {type: object, additionalProperties: {type: string}}
        signature: {type: string}
        trace: {type: string}
        metadata: {type: object, maxProperties: 32, additionalProperties: {type: string, maxLength: 256}}
        idempotency_key: {type: string, maxLength: 255}
    PayloadRef:
      type: object
      required: [uri]
      properties:
        uri: {type: string}
        sha256: {type: string}
        media_type: {type: string}
        size: {type: integer}
    AIInfo:
      type: object
      required: [model]
      properties:
        model: {type: string}
        model_version: {type: string}
        agent_id: {type: string}
        agent_version: {type: string}
        tool_calls: {type: array, items: {}}
        prompt_sha256: {type: string}
    SubmitResult:
      type: object
      required: [evidence_id, claim_id, claim_uri, recorded_at, commit_seq, class, duplicate, consistency_token]
      properties:
        evidence_id: {type: string}
        claim_id: {type: string}
        claim_uri: {type: string}
        recorded_at: {type: string, format: date-time}
        commit_seq: {type: integer}
        class: {$ref: "#/components/schemas/EvidenceClass"}
        duplicate: {type: boolean}
        duplicate_rule: {type: string, enum: [idempotency_key, fingerprint]}
        consistency_token: {type: string}
    EvidenceRecord:
      type: object
      required: [evidence_id, claim_id, commit_seq, recorded_at, schema_version, claim_type, claim_type_version,
                 source_id, principal_id, class, value_type, observed_at, valid_from, confidence_origin,
                 classification, provenance_roots, ai_hops, content_state]
      properties:
        trace: {type: string, description: "the producer's W3C traceparent"}
        evidence_id: {type: string}
        claim_id: {type: string}
        commit_seq: {type: integer}
        recorded_at: {type: string, format: date-time}
        schema_version: {type: string}
        claim_type: {type: string}
        claim_type_version: {type: integer}
        source_id: {type: string}
        principal_id: {type: string}
        class: {$ref: "#/components/schemas/EvidenceClass"}
        value_type: {type: string}
        observed_at: {type: string, format: date-time}
        valid_from: {type: string, format: date-time}
        valid_to: {type: string, format: date-time}
        confidence: {type: number}
        confidence_origin: {type: string}
        classification: {type: string}
        supersedes: {type: string}
        provenance_roots: {type: array, items: {type: string}}
        ai_hops: {type: integer}
        parents:
          type: array
          items:
            type: object
            properties:
              evidence_id: {type: string}
              relation: {type: string}
        statuses: {type: array, items: {type: string}}
        content_state: {type: string, enum: [PRESENT, ERASED, WITHHELD, DENIED, UNAVAILABLE]}
        integrity: {type: object, description: "signature status (valid, absent, not_verified), key_id, alg, issuer"}
        content_reason: {type: string, description: "why content is DENIED: access policy, purpose"}
        content_erased_at: {type: string, format: date-time}
        value: {$ref: "#/components/schemas/Value"}
        metadata: {type: object, additionalProperties: {type: string}}
        ai: {$ref: "#/components/schemas/AIInfo"}
        sensor: {type: object}
        payload_ref: {$ref: "#/components/schemas/PayloadRef"}
        origin: {type: object, description: "federated evidence - peer, remote evidence and source IDs, remote recorded_at, chain"}
        override: {$ref: "#/components/schemas/Override"}
        archived_at: {type: string, format: date-time, description: "set when the item is in the archive tier (older than the hot window); it reads the same, more slowly"}
    Override:
      type: object
      description: a person's override (C3.6) - why, who (a principal ID) and when it ends
      required: [reason, by, expires_at]
      properties:
        reason: {type: string}
        by: {type: string}
        expires_at: {type: string, format: date-time}
    OverrideResult:
      allOf:
        - $ref: "#/components/schemas/SubmitResult"
        - type: object
          required: [reason, by, valid_from, expires_at, effective_until, withdraw]
          properties:
            reason: {type: string}
            by: {type: string}
            valid_from: {type: string, format: date-time}
            expires_at: {type: string, format: date-time}
            effective_until: {type: string, format: date-time, description: "when it stops counting - its expires_at; the claim's TTL does not end it earlier"}
            withdraw: {type: string, description: "the request that withdraws it"}
    Claim:
      type: object
      required: [claim_id, uri, canonical, claim_type, namespace, entity_type, entity_id, attribute, scope, created_at]
      properties:
        claim_id: {type: string}
        uri: {type: string}
        canonical: {type: string}
        claim_type: {type: string}
        namespace: {type: string}
        entity_type: {type: string}
        entity_id: {type: string}
        attribute: {type: string}
        scope: {type: object, additionalProperties: {type: string}}
        created_at: {type: string, format: date-time}
    ClaimTypeDocument:
      type: object
      required: [apiVersion, kind, metadata, spec]
      properties:
        apiVersion: {type: string, enum: [groundnetic.dev/v1]}
        kind: {type: string, enum: [ClaimType]}
        metadata:
          type: object
          required: [name]
          properties:
            name: {type: string}
        spec: {type: object}
    ClaimTypeVersion:
      type: object
      required: [name, version, spec]
      properties:
        name: {type: string}
        version: {type: integer}
        spec:
          type: object
          required: [namespace, entity_type, attribute, value, resolution, freshness, classes_allowed, classification]
          properties:
            namespace: {type: string}
            entity_type: {type: string}
            attribute: {type: string}
            value: {type: object}
            resolution: {type: object}
            freshness: {type: object}
            classes_allowed: {type: array, items: {$ref: "#/components/schemas/EvidenceClass"}}
            classification: {type: string}
            allowed_purposes: {type: array, items: {type: string}}
    WhyItem:
      type: object
      required: [evidence_id, broken_chain]
      properties:
        integrity: {type: object, description: "signature status (valid, absent, not_verified), key_id, alg, issuer"}
        content_erased_at: {type: string, format: date-time}
        content_unavailable:
          type: object
          description: Why the item's value is missing (FPS-15.09); the item still counts as recorded, with its metadata, hashes and provenance
          required: [reason, temporary, detail]
          properties:
            reason: {type: string, enum: [retention, deletion, crypto_erased, erased, key_unavailable]}
            at: {type: string, format: date-time}
            deletion_id: {type: string}
            legal_basis: {type: string}
            policy: {type: string, description: "the retention rule, or plan for the plan's retention"}
            temporary: {type: boolean, description: "true when trying again later may show the content (the key service is down)"}
            detail: {type: string}
        evidence_id: {type: string}
        source_id: {type: string}
        source_name: {type: string, description: "The source's name (FPS-25.19)"}
        override_by_name: {type: string, description: "On an override, the name of the person who set it (FPS-25.19)"}
        authority_default: {type: boolean, description: "The authority profile names no authority for the source on this claim, so the policy's default for its class applies (TA-19.08)"}
        class: {type: string}
        observed_at: {type: string, format: date-time}
        value: {type: object}
        factors:
          type: object
          properties:
            A: {type: number}
            C: {type: number}
            F: {type: number}
            K: {type: number}
        weight: {type: number}
        cluster: {type: string}
        reason: {type: string}
        ai: {type: object}
        broken_chain: {type: boolean}
        redacted: {type: boolean}
        override: {$ref: "#/components/schemas/Override"}
        fresh_until: {type: string, format: date-time, description: "when the item drops to the aging freshness factor (observed_at + fresh_for)"}
        expires_at: {type: string, format: date-time, description: "when the item stops counting: min(valid_to, valid_from + TTL); a human override's valid_to (its expires_at)"}
        earlier_reports:
          type: object
          description: >-
            Set on a source's latest report when the segment counts the source's earlier reports as a number,
            not one item each (segments in input form gn.inputs.v2; QUESTIONS #19): they were valid at the
            segment's start and do not count while this report does (BR-6.04).
          required: [count, reason]
          properties:
            count: {type: integer, description: "how many of the source's earlier reports this one superseded"}
            reason: {type: string, enum: [SUPERSEDED]}
            list:
              type: string
              description: >-
                GET link paging through the source's reports of the claim valid at the segment's start, as
                recorded by then (GET /v1/evidence with claim, source, valid_from, valid_to and tx_to). It lists
                this report too, and reports past the claim's TTL whose stated validity is open. Absent when
                the source cannot be shown.
        explanation:
          type: string
          description: >-
            What this item contributes, in plain words (TA-19.06): whether it agrees or disagrees, its weight
            as the product of its factors with their names, why its freshness is what it is and when it ages
            or expires; or why it is not counted. Computed by fixed rules, without a language model.
          example: "Disagrees: reports 1.4.0. Counts 0.15 = source authority 0.30 × confidence 1.00 × freshness 0.50 × class factor 1.00 (PRIMARY). Freshness 0.50 because it was observed 3h before 2026-10-01T12:00:00Z, past the 1h fresh-for window (it aged at 2026-10-01T10:00:00Z). It stops counting at 2026-10-02T09:00:00Z."
    WhyWords:
      type: object
      description: >-
        The plain-language reading of an explanation (TENANT_ADMIN.md TA-19.06), computed deterministically
        from the same data by fixed rules (no language model): every number in it is one the resolution used.
      required: [headline, meaning, why, freshness, next, method]
      properties:
        headline:
          type: string
          description: what the status means for this claim, with the number and the threshold that decided it
          example: "Supported: value 1.5.0 with confidence 0.68, at or above the 0.50 needed to report a value; opposition 0.15 is below the 0.25 that would make it conflicted."
        meaning: {type: string, description: what the status means for any claim}
        why:
          type: array
          items: {type: string}
          description: how support and opposition were combined into the confidence (noisy-OR, AI cap), and which items were not counted and why
        freshness:
          type: array
          items: {type: string}
          description: the claim's freshness windows, whether the belief is stale, and the next instants when counted items age or expire with what that does to the result
        next:
          type: array
          items: {type: string}
          description: what would change the result (thresholds to cross, evidence that would help) or what happens next
        method: {type: string, description: the rules that wrote the words}
    Explanation:
      type: object
      required: [claim, as_of, belief, supporting, opposing, correlated, ignored, provenance, derived_text, explanation]
      properties:
        explanation: {$ref: "#/components/schemas/WhyWords"}
        claim:
          type: object
          required: [id, uri]
          properties:
            id: {type: string}
            uri: {type: string}
        as_of:
          type: object
          properties:
            valid_at: {type: string, format: date-time}
            tx: {type: string, format: date-time, nullable: true}
        belief:
          type: object
          required: [status, value, confidence, support, opposition, stale, overridden]
          properties:
            segment_id: {type: string}
            status: {$ref: "#/components/schemas/BeliefStatus"}
            value: {type: object, nullable: true}
            leading_value: {type: object}
            confidence: {type: number}
            support: {type: number}
            opposition: {type: number}
            stale: {type: boolean}
            overridden: {type: boolean}
            valid_from: {type: string, format: date-time}
            valid_to: {type: string, format: date-time, nullable: true}
        supporting: {type: array, items: {$ref: "#/components/schemas/WhyItem"}}
        opposing: {type: array, items: {$ref: "#/components/schemas/WhyItem"}}
        correlated: {type: array, items: {$ref: "#/components/schemas/WhyItem"}}
        ignored: {type: array, items: {$ref: "#/components/schemas/WhyItem"}}
        resolution:
          type: object
          properties:
            algorithm: {type: string}
            policy_version: {type: string}
            authority_version: {type: string}
            thresholds: {type: object, additionalProperties: {type: string}}
            input_digest: {type: string}
            covered_commit_seq: {type: integer}
        provenance:
          type: object
          required: [depth, nodes, edges]
          properties:
            depth: {type: integer}
            nodes: {type: array, items: {type: object}}
            edges: {type: array, items: {type: object}}
        derived_text: {type: string, nullable: true}
        reproducible: {type: boolean, description: "false when counted evidence content was erased (retention or deletion)"}
    BeliefStatus:
      type: string
      enum: [UNKNOWN, SUPPORTED, CONFLICTED, UNRESOLVED]
    Belief:
      type: object
      description: A belief segment (DETAILED_DESIGN.md §B1.7). Without segment_id, nothing is known.
      required: [claim_id, claim_uri, status, stale, overridden, value, confidence, support, opposition, covered_commit_seq]
      properties:
        segment_id: {type: string}
        claim_id: {type: string}
        claim_uri: {type: string}
        status: {$ref: "#/components/schemas/BeliefStatus"}
        stale: {type: boolean}
        overridden: {type: boolean}
        value: {nullable: true, allOf: [{$ref: "#/components/schemas/Value"}]}
        leading_value: {$ref: "#/components/schemas/Value"}
        candidates: {type: array, items: {$ref: "#/components/schemas/Value"}}
        spread: {type: string}
        confidence: {type: number, minimum: 0, maximum: 1}
        support: {type: number, minimum: 0, maximum: 1}
        opposition: {type: number, minimum: 0, maximum: 1}
        valid_from: {type: string, format: date-time}
        valid_to: {type: string, format: date-time, nullable: true}
        tx_from: {type: string, format: date-time}
        tx_to: {type: string, format: date-time, nullable: true}
        algorithm: {type: string}
        policy_version: {type: string}
        authority_version: {type: string}
        covered_commit_seq: {type: integer}
        input_digest: {type: string}
        evidence:
          type: object
          required: [support, oppose, correlated, ignored]
          properties:
            support: {type: array, items: {type: string}}
            oppose: {type: array, items: {type: string}}
            correlated: {type: array, items: {type: string}}
            superseded:
              type: integer
              description: >-
                Earlier reports of the listed items' sources, counted as a number and not listed (BR-6.04;
                segments in input form gn.inputs.v2): they do not count. WHY lists them per source.
            ignored:
              type: array
              items:
                type: object
                required: [evidence_id, reason]
                properties:
                  evidence_id: {type: string}
                  reason: {type: string}
    OutcomeStatus:
      type: string
      enum: [PENDING, VERIFIED, FAILED, INCONCLUSIVE, EXPIRED]
    ContractInstance:
      type: object
      required: [instance_id, contract, contract_version, params, state, status, grade, created_at, evaluation_version, participants]
      properties:
        instance_id: {type: string}
        contract: {type: string}
        contract_version: {type: integer}
        params: {type: object, additionalProperties: {type: string}}
        state: {type: string, enum: [CREATED, ACTIVE, TERMINAL, CANCELLED]}
        status: {$ref: "#/components/schemas/OutcomeStatus"}
        grade: {type: string, nullable: true, enum: [FULL, PARTIAL, NONE, null]}
        created_at: {type: string, format: date-time}
        activated_at: {type: string, format: date-time, nullable: true}
        window_start: {type: string, format: date-time, nullable: true}
        window_end: {type: string, format: date-time, nullable: true}
        settle_end: {type: string, format: date-time, nullable: true}
        terminal_at: {type: string, format: date-time, nullable: true}
        evaluation_version: {type: integer}
        parent_instance_id: {type: string}
        decision_id: {type: string}
        action_ref: {type: string}
        participants: {type: array, items: {type: string}}
    Expectation:
      type: object
      required: [op]
      additionalProperties: false
      properties:
        op: {type: string, enum: [eq, ne, gt, gte, lt, lte, exists, pass]}
        value: {}
        field: {type: string}
        min_confidence: {type: number, minimum: 0, maximum: 1}
    DecisionAgent:
      type: object
      required: [agent_id]
      additionalProperties: false
      properties:
        agent_id: {type: string, maxLength: 200}
        agent_version: {type: string}
        model: {type: string}
    DecisionBelief:
      type: object
      required: [claim, claim_id, segment_id, status, stale, confidence, value]
      properties:
        claim: {type: string}
        claim_id: {type: string}
        segment_id: {type: string, nullable: true}
        status: {type: string, enum: [SUPPORTED, CONFLICTED, UNRESOLVED, UNKNOWN]}
        stale: {type: boolean}
        confidence: {type: number}
        value: {nullable: true}
        expect: {$ref: "#/components/schemas/Expectation"}
        result: {type: string, enum: [T, F, U], description: "Three-valued result of the expectation at decision time"}
        support_classes: {type: array, items: {type: string}, description: "Classes of the supporting evidence"}
        required: {type: boolean, description: "A mandate requirement (grounding rule)"}
    PortalLinkRequest:
      type: object
      required: [id, status, created_at]
      properties:
        id: {type: string, format: uuid}
        kind: {type: string, enum: [portal_link, copy_production]}
        status: {type: string, enum: [queued, ready, shown, rejected]}
        detail: {type: string, description: "why it was rejected; for a copy, what was copied"}
        url: {type: string, description: "the portal link, in the one answer that shows it; never stored after"}
        expires_at: {type: string, format: date-time}
        created_at: {type: string, format: date-time}
    Deletion:
      type: object
      required: [deletion_id, selector, reason, legal_basis, status, requested_by, created_at]
      properties:
        deletion_id: {type: string}
        selector: {type: object}
        reason: {type: string}
        legal_basis: {type: string}
        status: {type: string, enum: [PENDING_APPROVAL, APPROVED, EXECUTING, DONE, REJECTED]}
        requested_by: {type: string}
        approved_by: {type: string}
        report: {type: object}
        review_id: {type: string}
        created_at: {type: string, format: date-time}
        approved_at: {type: string, format: date-time}
        done_at: {type: string, format: date-time}
    GovernanceSettings:
      type: object
      required: [config_approval, max_delegation_depth]
      properties:
        config_approval: {type: string, enum: [optional, required]}
        max_delegation_depth: {type: integer, minimum: 1, maximum: 10}
        updated_at: {type: string, format: date-time}
        administrators: {type: integer, minimum: 0, description: "People holding the admin scope (read only). With one, that administrator approves their own configuration changes, recorded as sole_administrator (FPS-25.18)."}
    ConfigChange:
      type: object
      required: [change_id, kind, name, document, status, author, required_approvals, approvals, external_approvals, created_at, updated_at]
      properties:
        change_id: {type: string}
        kind: {type: string}
        name: {type: string}
        document: {type: string}
        description: {type: string}
        status: {type: string, enum: [DRAFT, IN_REVIEW, APPROVED, PUBLISHED, REJECTED, WITHDRAWN]}
        author: {type: string}
        required_approvals: {type: integer}
        approvals: {type: array, items: {type: object}}
        external_approvals: {type: array, items: {type: object}}
        impact: {type: object}
        published_version: {type: string}
        review_id: {type: string}
        created_at: {type: string, format: date-time}
        updated_at: {type: string, format: date-time}
    SourceHealth:
      type: object
      required: [source_id, name, state, metrics, since, computed_at, reliability]
      properties:
        source_id: {type: string}
        name: {type: string}
        state: {type: string, enum: [HEALTHY, DEGRADED, STALE, SILENT]}
        metrics: {type: object}
        since: {type: string, format: date-time}
        computed_at: {type: string, format: date-time}
        reliability:
          description: "The source's measurements and the authority in effect side by side, in words; no new score (BR-11.06)"
          type: object
          required: [agreement, comparisons, completeness, summary]
          properties:
            agreement: {type: number, nullable: true, description: "Agreeing share of the last day's comparisons with the other sources"}
            comparisons: {type: integer}
            completeness: {type: number, nullable: true, description: "Share of the reports its cadence predicts that arrived in 24 hours"}
            authority:
              type: object
              description: "Its entry in the active authority profile; absent: its bindings' class default applies"
              properties:
                default: {type: string}
                domains: {type: array, items: {type: object, properties: {match: {type: string}, authority: {type: string}}}}
                lowered: {type: object, properties: {factor: {type: string}, state: {type: string}, since: {type: string}, reason: {type: string}}}
            authority_version: {type: string}
            summary: {type: string}
    AuthorityProposal:
      type: object
      required: [proposal_id, source_id, domain, current, proposed, agreements, comparisons, period_from, period_to, status, created_at]
      properties:
        proposal_id: {type: string}
        source_id: {type: string}
        domain: {type: string}
        current: {type: string}
        proposed: {type: string}
        agreements: {type: integer}
        comparisons: {type: integer}
        period_from: {type: string, format: date-time}
        period_to: {type: string, format: date-time}
        status: {type: string, enum: [PENDING, APPLIED, AUTO_APPLIED, REJECTED, SUPERSEDED]}
        authority_version: {type: string}
        created_at: {type: string, format: date-time}
        decided_at: {type: string, format: date-time}
        decided_by: {type: string}
        review_id: {type: string}
    SourceSigning:
      type: object
      required: [source_id, require_signature, keys, trusted_issuers, signature_failures]
      properties:
        source_id: {type: string}
        require_signature: {type: boolean}
        keys: {type: object}
        trusted_issuers: {type: array, items: {type: string}}
        signature_failures: {type: integer}
        last_signature_failure: {type: string, format: date-time}
        keys_rotate_by: {type: string, format: date-time}
    ClientCertificate:
      type: object
      required: [certificate_id, principal_id, fingerprint_sha256, subject, issuer, not_before, not_after, scopes, created_at]
      properties:
        certificate_id: {type: string}
        principal_id: {type: string}
        fingerprint_sha256: {type: string}
        subject: {type: string}
        issuer: {type: string}
        not_before: {type: string, format: date-time}
        not_after: {type: string, format: date-time}
        scopes: {type: array, items: {type: string}}
        created_at: {type: string, format: date-time}
        revoked_at: {type: string, format: date-time}
    MCPClient:
      type: object
      description: "An MCP client registered by the workspace's administrators (public, PKCE S256, usable in this workspace only)"
      required: [client_id, client_name, redirect_uris, status, token_endpoint_auth_method, active_grants, created_at, updated_at]
      properties:
        client_id: {type: string, description: "mcc_..., what the client sends as client_id"}
        client_name: {type: string}
        redirect_uris: {type: array, items: {type: string}}
        client_uri: {type: string}
        logo_uri: {type: string}
        status: {type: string, enum: [active, disabled]}
        token_endpoint_auth_method: {type: string, enum: [none]}
        active_grants: {type: integer, description: "People's live grants to the client"}
        created_at: {type: string, format: date-time}
        created_by: {type: string}
        updated_at: {type: string, format: date-time}
    ReviewQueue:
      type: object
      required: [name, priority, kinds, namespaces, consequences, members, updated_at, updated_by]
      properties:
        name: {type: string}
        description: {type: string}
        priority: {type: integer}
        kinds: {type: array, items: {type: string}}
        namespaces: {type: array, items: {type: string}}
        consequences: {type: array, items: {type: string}}
        members: {type: array, items: {type: string}}
        timeout: {type: string}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
    ReviewItem:
      type: object
      required: [review_id, kind, ref, queue, title, status, detail, created_at]
      properties:
        review_id: {type: string}
        kind: {type: string, x-extensible-enum: [gate_decision, authority_proposal, quarantine, source_quarantine, source_flag, config_change, deletion, agent_breaker, mandate_proposal, agent_coordination, task_grant, outcome_escalation, belief_low_confidence, belief_conflicted, scope_grant]}
        ref: {type: string}
        queue: {type: string}
        title: {type: string}
        namespace: {type: string}
        consequence: {type: string}
        status: {type: string, enum: [OPEN, APPROVED, REJECTED, EXPIRED, CANCELLED]}
        assignee: {type: string}
        detail: {type: object}
        created_at: {type: string, format: date-time}
        due_at: {type: string, format: date-time}
        sla:
          type: object
          description: The SLA rule that set the due time and reminders (FPS-44.10)
          properties:
            due: {type: string}
            remind_before: {type: array, items: {type: string}}
            escalate_to: {type: string}
            rule: {type: string, description: "rules[i] or defaults[i]"}
        reminded_at: {type: string, format: date-time}
        reminders: {type: integer, description: reminders sent}
        overdue_at: {type: string, format: date-time, description: when it passed its due time still open}
        resolved_at: {type: string, format: date-time}
        resolved_by: {type: string}
        resolution: {type: object}
        subject: {type: object}
    AccessPolicy:
      type: object
      required: [name, version, policy, updated_at, updated_by]
      properties:
        name: {type: string}
        version: {type: integer}
        policy: {type: string}
        description: {type: string}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
        set_version: {type: integer, description: "the version of the workspace's access policies the change made (on a write only)"}
    AccessPolicyVersion:
      type: object
      required: [version, members, change, reason, created_at]
      properties:
        version: {type: integer}
        members: {type: object, additionalProperties: {type: integer}, description: "each policy in force: name → that policy's version"}
        change: {type: string, enum: [initial, write, delete], description: "initial: the policies in force when versioning began"}
        changed: {type: string, description: the policy written or deleted}
        reason: {type: string}
        created_at: {type: string, format: date-time}
        created_by: {type: string, description: "who made the change; absent for the initial version"}
        policies: {type: array, items: {$ref: "#/components/schemas/AccessPolicy"}, description: "the policies in force (one version only)"}
    Grant:

      type: object
      required: [grant_id, principal_id, action, namespace, reason, expires_at, created_at, created_by]
      properties:
        grant_id: {type: string}
        principal_id: {type: string}
        action: {type: string}
        namespace: {type: string}
        classification: {type: string}
        purpose: {type: string}
        reason: {type: string}
        expires_at: {type: string, format: date-time}
        created_at: {type: string, format: date-time}
        created_by: {type: string}
        revoked_at: {type: string, format: date-time}
    WorkloadTrust:
      type: object
      required: [name, issuer, audience, subject, principal_id, scopes]
      properties:
        name: {type: string}
        issuer: {type: string}
        jwks_uri: {type: string}
        audience: {type: string}
        subject: {type: string}
        principal_id: {type: string}
        scopes: {type: array, items: {type: string}}
        created_at: {type: string, format: date-time}
    AgentIdentityProvider:
      type: object
      required: [name, kind, issuer, audiences, algorithms, agent_claim, max_token_lifetime_seconds, updated_at]
      properties:
        name: {type: string}
        kind: {type: string, enum: [entra, okta, oidc]}
        issuer: {type: string}
        jwks_uri: {type: string}
        audiences: {type: array, items: {type: string}}
        algorithms: {type: array, items: {type: string}}
        agent_claim: {type: string}
        required_claim: {type: string}
        required_value: {type: string}
        max_token_lifetime_seconds: {type: integer}
        updated_at: {type: string, format: date-time}
    Suspension:
      type: object
      required: [suspension_id, scope, agent_id, group, reason, created_at, created_by, active]
      properties:
        suspension_id: {type: string}
        scope: {type: string, enum: [agent, group, tenant]}
        agent_id: {type: string, nullable: true}
        group: {type: string, nullable: true}
        reason: {type: string}
        created_at: {type: string, format: date-time}
        created_by: {type: string, description: "a principal, or system:breaker"}
        detector: {type: string, description: the circuit breaker that suspended the agent}
        active: {type: boolean}
        resumed_at: {type: string, format: date-time}
        resumed_by: {type: string}
        resume_reason: {type: string}
        created_by_name: {type: string, description: the display name of who suspended}
        agent_name: {type: string, description: the suspended agent's display name (scope agent)}
        summary: {type: string, description: "The suspension in plain words (TA-19.06)"}
    Revocations:
      type: object
      required: [version, as_of, agents, permits]
      properties:
        version: {type: integer}
        as_of: {type: string, format: date-time}
        agents: {type: array, items: {type: string}}
        permits: {type: array, items: {type: string}}
    PermitUse:
      type: object
      required: [jti, decision_id, agent_id, action_type, target, expires_at, used_at, used_by, audience, result]
      properties:
        jti: {type: string}
        decision_id: {type: string}
        agent_id: {type: string}
        action_type: {type: string}
        target: {type: string}
        expires_at: {type: string, format: date-time}
        used_at: {type: string, format: date-time}
        used_by: {type: string}
        audience: {type: string}
        result: {type: string, nullable: true, enum: [completed, failed]}
        result_at: {type: string, format: date-time}
    GateDecision:
      type: object
      required: [decision_id, agent_id, outcome, state, reasons, consequence, param_hash, shadow, permit, checks]
      properties:
        decision_id: {type: string}
        agent_id: {type: string}
        on_guard_unavailable: {type: string, enum: [fail_closed, fail_open_audit]}
        outcome: {type: string, enum: [ALLOW, DENY, ESCALATED]}
        state: {type: string, enum: [ALLOWED, DENIED, ESCALATED, APPROVED, REJECTED]}
        reasons: {type: array, items: {type: string}}
        consequence: {type: string, enum: [low, medium, high, critical]}
        param_hash: {type: string}
        shadow: {type: boolean}
        review_id: {type: string, description: "the review item of an escalated decision"}
        explanation: {$ref: "#/components/schemas/GuardExplanation"}
        sensitive_data: {$ref: "#/components/schemas/SensitiveRecord"}
        params: {type: object, description: "the redacted parameters the permit binds, when the mandate's data rule redacted some: carry the call with these (AG-17.09)"}
        permit:
          type: object
          nullable: true
          required: [jti, kid, audience, expires_at, shadow]
          properties:
            token: {type: string, description: "Compact JWS; only for the agent it was issued to"}
            jti: {type: string}
            kid: {type: string}
            audience: {type: string}
            expires_at: {type: string, format: date-time}
            shadow: {type: boolean}
        approval:
          type: object
          required: [needed, verdict, approvals]
          properties:
            needed:
              type: object
              properties:
                approvers: {type: integer}
                mfa: {type: boolean}
                window: {type: integer, description: "Nanoseconds"}
            verdict: {type: string, enum: [APPROVED, PENDING, REJECTED]}
            approvals:
              type: array
              items:
                type: object
                required: [principal, approve, at]
                properties:
                  principal: {type: string}
                  approve: {type: boolean}
                  comment: {type: string}
                  at: {type: string, format: date-time}
            ignored: {type: array, items: {type: string}}
            deadline: {type: string, format: date-time}
        checks:
          type: array
          items:
            type: object
            required: [n, name, pass]
            properties:
              n: {type: integer}
              name: {type: string}
              pass: {type: boolean}
              reason: {type: string}
              detail: {type: string}
    DecisionInstance:
      type: object
      required: [instance_id, contract, contract_version, state, status, grade, evaluation_version]
      properties:
        instance_id: {type: string}
        contract: {type: string}
        contract_version: {type: integer}
        state: {type: string, enum: [CREATED, ACTIVE, TERMINAL, CANCELLED]}
        status: {$ref: "#/components/schemas/OutcomeStatus"}
        grade: {type: string, nullable: true}
        evaluation_version: {type: integer}
    Decision:
      type: object
      required: [decision_id, agent, principal, action, beliefs, alternatives, policy, outcome, state, transitions, actions,
                 contract_instance, decided_at]
      properties:
        decision_id: {type: string}
        agent: {$ref: "#/components/schemas/DecisionAgent"}
        principal: {type: string}
        action:
          type: object
          required: [type, target, consequence]
          properties:
            type: {type: string}
            target: {type: string}
            consequence: {type: string, enum: [low, medium, high, critical]}
            description: {type: string}
        beliefs: {type: array, items: {$ref: "#/components/schemas/DecisionBelief"}}
        alternatives: {type: array, items: {type: object}}
        policy: {type: object}
        outcome: {type: string, nullable: true, enum: [ALLOW, ESCALATED, DENY, null]}
        state:
          type: string
          enum: [PROPOSED, ALLOWED, DENIED, ESCALATED, APPROVED, REJECTED, ACTION_REPORTED, OUTCOME_LINKED]
        transitions:
          type: array
          items:
            type: object
            required: [seq, state, at, detail]
            properties:
              seq: {type: integer}
              state: {type: string}
              at: {type: string, format: date-time}
              by: {type: string}
              detail: {type: object}
        actions:
          type: array
          items:
            type: object
            required: [seq, state, at, reported_at, reported_by]
            properties:
              seq: {type: integer}
              state: {type: string, enum: [started, completed, failed]}
              at: {type: string, format: date-time}
              reported_at: {type: string, format: date-time}
              reported_by: {type: string}
              action_ref: {type: string}
              result: {}
        contract_instance:
          allOf: [{$ref: "#/components/schemas/DecisionInstance"}]
          nullable: true
        action_ref: {type: string}
        trace_id: {type: string}
        decided_at: {type: string, format: date-time}
        explanation: {$ref: "#/components/schemas/GuardExplanation"}
    IngestKey:
      type: object
      required: [key_id, principal_id, created_at, revoked_at]
      properties:
        key_id: {type: string}
        principal_id: {type: string}
        created_at: {type: string, format: date-time}
        revoked_at: {type: string, format: date-time, nullable: true}
    RuleVersion:
      type: object
      required: [rule_id, name, version, retired, input_types, output_type, source_id, principal_id, source, created_at]
      properties:
        rule_id: {type: string}
        name: {type: string}
        version: {type: integer}
        retired: {type: boolean}
        input_types: {type: array, items: {type: string}}
        output_type: {type: string}
        source_id: {type: string}
        principal_id: {type: string}
        source: {type: string}
        created_at: {type: string, format: date-time}
    DevClock:
      type: object
      required: [now, mode]
      properties:
        now: {type: string, format: date-time}
        mode: {type: string, enum: [real, manual]}
        offset: {type: string}
    Lease:
      type: object
      required: [seq, mandate_version, starts_at, expires_at, renewed_by, state]
      properties:
        seq: {type: integer}
        mandate_version: {type: integer}
        starts_at: {type: string, format: date-time}
        expires_at: {type: string, format: date-time}
        renewed_by: {type: string}
        state: {type: string, enum: [ACTIVE, EXPIRED]}
    Agent:
      type: object
      required: [agent_id, name, status, owner, groups, mandate_version, lease, created_at]
      properties:
        agent_id: {type: string}
        name: {type: string}
        status: {type: string}
        owner: {type: string}
        groups: {type: array, items: {type: string}}
        mandate_version: {type: integer, nullable: true}
        lease:
          allOf: [{$ref: "#/components/schemas/Lease"}]
          nullable: true
        created_at: {type: string, format: date-time}
        mandate_mode: {type: string, enum: [enforce, shadow, learn], description: the latest mandate's mode}
        suspension: {$ref: "#/components/schemas/Suspension"}
        retired: {type: boolean, description: "retired: it can do nothing and does not count toward the plan's limits (AG-2.09)"}
        retirement:
          type: object
          properties:
            retirement_id: {type: string}
            retired_at: {type: string, format: date-time}
            retired_by: {type: string}
            reason: {type: string}
        explanation: {$ref: "#/components/schemas/GuardExplanation"}
    StressRun:
      type: object
      description: A guardrail stress test run (AG-15.04, ADR-0061)
      required: [run_id, trigger, library_version, tenant_cases_version, config_digest, state, counts, summary, started_at]
      properties:
        run_id: {type: string}
        trigger: {type: string, enum: [manual, schedule, config_change]}
        agent_id: {type: string}
        library_version: {type: string}
        tenant_cases_version: {type: integer}
        config_digest: {type: string}
        state: {type: string, enum: [running, finished, partial, failed]}
        counts: {type: object, properties: {attempts: {type: integer}, agents: {type: integer}, held: {type: integer}, through: {type: integer}, not_applicable: {type: integer}, errors: {type: integer}}}
        summary: {type: string}
        note: {type: string}
        result_sha256: {type: string}
        started_at: {type: string, format: date-time}
        finished_at: {type: string, format: date-time}
        started_by: {type: string}
        result: {type: object}
        report_md: {type: string}
    StressSettings:
      type: object
      required: [schedule, on_change, cases_version, default]
      properties:
        schedule: {type: string, enum: ["off", daily, weekly]}
        on_change: {type: boolean}
        cases_version: {type: integer}
        default: {type: boolean}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
    MandateVersion:
      type: object
      required: [agent_id, version, spec, source, created_at, created_by]
      properties:
        agent_id: {type: string}
        version: {type: integer}
        spec: {type: object}
        source: {type: string}
        created_at: {type: string, format: date-time}
        created_by: {type: string}
        explanation: {$ref: "#/components/schemas/GuardExplanation"}
    PrincipalRef:
      type: object
      required: [kind, id]
      properties:
        kind: {type: string, description: "agent or person (requesters may also be services)"}
        id: {type: string, description: "agt_... or prn_..."}
        name: {type: string}
    TaskStep:
      type: object
      required: [action, target]
      properties:
        n: {type: integer}
        action: {type: string, description: "Action type, e.g. vm.restart"}
        target: {type: string, description: "aws://<account>/<region>/<service>/<type>/<id>, azure://..., gcp://..., gn://..."}
        params: {type: object}
        description: {type: string}
        state: {type: string, enum: [pending, running, done, failed, cancelled]}
        started_at: {type: string, format: date-time}
        finished_at: {type: string, format: date-time}
    TaskInput:
      type: object
      required: [goal, plan]
      additionalProperties: false
      properties:
        goal: {type: string, maxLength: 2000}
        plan: {type: array, minItems: 1, maxItems: 50, items: {$ref: "#/components/schemas/TaskStep"}}
        assignee: {$ref: "#/components/schemas/PrincipalRef"}
        deadline: {type: string, format: date-time}
        max_duration: {type: string, description: "Longest a grant for it may last, e.g. 4h (default 8h, at most 7d)"}
        origin: {type: string, enum: [api, console, gnctl, mcp, ticket]}
        external_ref: {type: string, maxLength: 500}
    Task:
      type: object
      required: [task_id, goal, plan, assignee, requester, deadline, state, origin, created_at, updated_at, grants, grant_requests]
      properties:
        task_id: {type: string}
        goal: {type: string}
        plan: {type: array, items: {$ref: "#/components/schemas/TaskStep"}}
        assignee: {allOf: [{$ref: "#/components/schemas/PrincipalRef"}], nullable: true}
        requester: {$ref: "#/components/schemas/PrincipalRef"}
        deadline: {type: string, format: date-time, nullable: true}
        max_duration: {type: string}
        state: {type: string, enum: [draft, analysed, granted, running, done, cancelled, expired]}
        origin: {type: string}
        external_ref: {type: string}
        estimate_seconds: {type: integer}
        created_at: {type: string, format: date-time}
        updated_at: {type: string, format: date-time}
        started_at: {type: string, format: date-time}
        ended_at: {type: string, format: date-time}
        end_reason: {type: string}
        grants: {type: array, items: {$ref: "#/components/schemas/TaskGrant"}}
        grant_requests: {type: array, items: {$ref: "#/components/schemas/TaskGrantRequest"}}
        observed:
          type: array
          description: "Cloud audit-log actions on the task's resources, newest first (at most 200): those that confirmed a step, and those taken outside the task (AG-13.10)"
          items:
            type: object
            required: [system, actor, action, target, event_id, at, outside_task, covered]
            properties:
              system: {type: string}
              actor: {type: string}
              action: {type: string}
              target: {type: string}
              event_id: {type: string}
              at: {type: string, format: date-time}
              step: {type: integer}
              outside_task: {type: boolean}
              covered: {type: boolean}
        explanation: {$ref: "#/components/schemas/GuardExplanation"}
    TaskGrant:
      type: object
      required: [grant_id, request_id, kind, steps, summary, expires_at, created_at]
      properties:
        grant_id: {type: string}
        request_id: {type: string}
        kind: {type: string, enum: [mandate_rule, access, cloud]}
        steps: {type: array, items: {type: integer}}
        action: {type: string}
        target: {type: string}
        consequence: {type: string}
        connection: {type: string}
        cloud: {type: string}
        permissions: {type: array, items: {type: object}}
        principal: {type: string}
        access_grant_id: {type: string}
        handle: {type: string}
        summary: {type: string}
        expires_at: {type: string, format: date-time}
        created_at: {type: string, format: date-time}
        revoked_at: {type: string, format: date-time}
        revoke_reason: {type: string}
        cloud_revoked_at: {type: string, format: date-time}
        cloud_note: {type: string}
        applying: {type: boolean}
    TaskGrantRequest:
      type: object
      required: [request_id, task_id, seq, requested_by, consequence, approver, items, ends_at, state, created_at]
      properties:
        request_id: {type: string}
        task_id: {type: string}
        seq: {type: integer}
        requested_by: {type: string}
        reason: {type: string}
        consequence: {type: string}
        approver: {type: string, enum: [requester, admin_step_up]}
        items: {type: array, items: {type: object}}
        ends_at: {type: string, format: date-time}
        state: {type: string, enum: [pending, approved, rejected, cancelled]}
        decided_by: {type: string}
        decided_at: {type: string, format: date-time}
        note: {type: string}
        created_at: {type: string, format: date-time}
        review_id: {type: string}
        grants: {type: array, items: {$ref: "#/components/schemas/TaskGrant"}}
        explanation: {$ref: "#/components/schemas/GuardExplanation"}
    GrantInput:
      type: object
      additionalProperties: false
      properties:
        reason: {type: string, maxLength: 2000}
        max_duration: {type: string}
        steps: {type: array, maxItems: 50, items: {$ref: "#/components/schemas/TaskStep"}}
    TaskAnalysis:
      type: object
      required: [analysis_id, task_id, assignee, at, steps, missing, blockers, not_checked, highest_consequence, irreversible, grant_approver, step_approvals, estimate, explanation]
      properties:
        analysis_id: {type: string}
        task_id: {type: string}
        assignee: {$ref: "#/components/schemas/PrincipalRef"}
        at: {type: string, format: date-time}
        steps: {type: array, items: {type: object, required: [step, action, target, consequence, rights, cloud, approvals, conditions]}}
        missing: {type: array, items: {type: object, required: [kind, what, state, grantable, reason]}}
        blockers: {type: array, items: {type: string}}
        not_checked: {type: integer}
        highest_consequence: {type: string}
        irreversible: {type: boolean}
        grant_approver: {type: string, enum: [requester, admin_step_up, none]}
        step_approvals: {type: integer}
        estimate: {$ref: "#/components/schemas/TaskEstimate"}
        meets_deadline: {type: boolean}
        explanation: {$ref: "#/components/schemas/GuardExplanation"}
    TaskEstimate:
      type: object
      required: [assignee_kind, known, median_seconds, p90_seconds, basis, work, approval_wait, condition_wait, steps, summary]
      properties:
        assignee_kind: {type: string}
        known: {type: boolean}
        median_seconds: {type: integer}
        p90_seconds: {type: integer}
        basis: {type: string, enum: [measured_assignee, measured_group, measured_workspace, nominal, mixed, unknown, none]}
        work: {$ref: "#/components/schemas/TimeRange"}
        approval_wait: {$ref: "#/components/schemas/TimeRange"}
        condition_wait: {$ref: "#/components/schemas/TimeRange"}
        availability: {type: object, description: "People: working hours, time zone and backlog"}
        steps: {type: array, items: {type: object}}
        finish_median: {type: string, format: date-time}
        finish_p90: {type: string, format: date-time}
        summary: {type: string}
    TimeRange:
      type: object
      required: [median_seconds, p90_seconds, basis]
      properties:
        median_seconds: {type: integer}
        p90_seconds: {type: integer}
        basis: {type: string}
    PlainExplanation:
      $ref: "#/components/schemas/GuardExplanation"
    CloudConnection:
      type: object
      required: [name, cloud, config, targets, has_secret, observe, updated_at, updated_by, federation]
      properties:
        name: {type: string}
        cloud: {type: string, enum: [aws, azure, gcp]}
        config: {type: object}
        ceiling: {type: object}
        targets: {type: array, items: {type: string}}
        has_secret: {type: boolean}
        observe: {type: object}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
        federation:
          type: object
          required: [issuer, subject, audience]
          properties:
            issuer: {type: string}
            subject: {type: string}
            audience: {type: string}
            discovery_url: {type: string}
            jwks_url: {type: string}
    FederationSettings:
      type: object
      required: [issuer, subject_format, audiences, algorithm, token_ttl, keys]
      properties:
        issuer: {type: string}
        discovery_url: {type: string}
        jwks_url: {type: string}
        subject_format: {type: string}
        audiences: {type: object, additionalProperties: {type: string}}
        algorithm: {type: string}
        token_ttl: {type: string}
        keys: {type: array, items: {type: string}}
        suggested_issuer: {type: string}
        updated_at: {type: string, format: date-time}
    CloudIdentity:
      type: object
      required: [principal_id, kind, connection, cloud, subject, created_at, created_by]
      properties:
        principal_id: {type: string}
        kind: {type: string, enum: [agent, person]}
        connection: {type: string}
        cloud: {type: string}
        subject: {type: string}
        created_at: {type: string, format: date-time}
        created_by: {type: string}
    WorkSchedule:
      type: object
      required: [principal_id, time_zone, days, from, to, updated_at, updated_by]
      properties:
        principal_id: {type: string}
        time_zone: {type: string}
        days: {type: array, items: {type: string}}
        from: {type: string}
        to: {type: string}
        team: {type: string}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
    CloudObserveResult:
      type: object
      required: [received, recorded, duplicates, steps_done, outside, tasks_done]
      properties:
        received: {type: integer}
        recorded: {type: integer}
        duplicates: {type: integer}
        steps_done: {type: array, items: {type: object}}
        outside: {type: array, items: {type: object}}
        tasks_done: {type: array, items: {type: string}}
    GuardExplanation:
      type: object
      description: >-
        A decision, agent or mandate in plain words (TA-19.06): what it means, why it has this value (the
        inputs and checks with their numbers), and what happens next or would change it. Computed by fixed
        templates from the same data, without a language model.
      required: [headline, points, next]
      properties:
        headline: {type: string, description: "The result and its main reason, in one or two sentences"}
        points: {type: array, items: {type: string}, description: "The inputs and checks behind it, one per line"}
        next: {type: array, items: {type: string}, description: "What happens next, or what would change it"}
    CatalogEntry:
      type: object
      required: [action_type, version, consequence, safety_class, irreversible, read_only, target_param, description, created_at]
      properties:
        action_type: {type: string}
        version: {type: integer}
        consequence: {type: string, enum: [low, medium, high, critical]}
        safety_class: {type: string, nullable: true}
        irreversible: {type: boolean}
        read_only: {type: boolean}
        target_param: {type: string}
        description: {type: string}
        created_at: {type: string, format: date-time}
        agent_seconds: {type: integer}
        person_seconds: {type: integer}
        egress_param: {type: string}
        taints: {type: array, items: {type: string}}
        verifies_params: {type: boolean}
    Subscription:
      type: object
      required: [subscription_id, url, event_types, description, status, created_at]
      properties:
        subscription_id: {type: string}
        url: {type: string}
        channel: {type: string, enum: [webhook, email, slack, pagerduty]}
        recipients: {type: array, items: {type: string}}
        event_types: {type: array, items: {type: string}}
        namespace: {type: string}
        conditions: {type: array, items: {$ref: "#/components/schemas/SubscriptionCondition"}}
        description: {type: string}
        status: {type: string, enum: [ACTIVE, DISABLED]}
        failing_since: {type: string, format: date-time}
        disabled_reason: {type: string}
        created_at: {type: string, format: date-time}
    SubscriptionCondition:
      type: object
      description: "A value condition on the event's data, e.g. {field: confidence, op: lt, value: 0.6} (numbers compare exactly)"
      required: [field, op, value]
      additionalProperties: false
      properties:
        field: {type: string, description: "a field of the event's data, dotted for nested fields"}
        op: {type: string, enum: [eq, ne, lt, lte, gt, gte]}
        value: {oneOf: [{type: number}, {type: string}, {type: boolean}]}
    DriftRule:
      type: object
      required: [kind]
      additionalProperties: false
      properties:
        kind: {type: string, enum: [confidence_below, confidence_drop, flip, stale, outcome_revised]}
        threshold: {type: string, description: "confidence_below: e.g. \"0.6\""}
        drop: {type: string, description: "confidence_drop: e.g. \"0.2\""}
    Watch:
      type: object
      required: [watch_id, target_kind, target, critical, rules, created_at, created_by, updated_at]
      properties:
        watch_id: {type: string}
        target_kind: {type: string, enum: [claim, namespace, contract]}
        target: {type: string}
        target_uri: {type: string}
        critical: {type: boolean}
        rules: {type: array, items: {$ref: "#/components/schemas/DriftRule"}}
        note: {type: string}
        created_at: {type: string, format: date-time}
        created_by: {type: string}
        updated_at: {type: string, format: date-time}
    SampleItem:
      type: object
      required: [kind, name]
      properties:
        kind: {type: string, enum: [claim_type, contract, access_policy]}
        name: {type: string}
        reason: {type: string, description: why it was kept on removal}
    ReplayCandidate:
      type: object
      description: "A configuration to replay under: a stored version (pol_… resolution policy, auv_… authority profile, agt_…@N mandate version N, access-policies@N the access policies at version N) or a document (YAML or JSON ResolutionPolicy, AuthorityProfile or Mandate)."
      properties:
        version: {type: string, example: "pol_01J..."}
        document: {type: string}
    ReplayDecisionRequest:
      type: object
      required: [decision_id]
      properties:
        decision_id: {type: string, example: "dr_01J..."}
        candidate: {$ref: "#/components/schemas/ReplayCandidate"}
    ReplayBeliefRequest:
      type: object
      description: "segment_id, or claim and at."
      properties:
        segment_id: {type: string, example: "bs_01J..."}
        claim: {type: string, example: "gn://sre/service/checkout/deployed_version?env=prod"}
        at: {type: string, format: date-time}
        candidate: {$ref: "#/components/schemas/ReplayCandidate"}
    ReplayBelief:
      type: object
      properties:
        status: {type: string}
        value: {nullable: true}
        confidence: {type: string}
        stale: {type: boolean}
        valid_from: {type: string, format: date-time}
        valid_to: {type: string, format: date-time, nullable: true}
        policy_version: {type: string}
        authority_version: {type: string}
        algorithm: {type: string}
        input_digest: {type: string}
        expectation_result: {type: string}
        support_classes: {type: array, items: {type: string}}
    SegmentReplay:
      type: object
      properties:
        segment_id: {type: string}
        claim_id: {type: string}
        claim_type: {type: string}
        written_at: {type: string, format: date-time}
        recorded: {$ref: "#/components/schemas/ReplayBelief"}
        replayed: {$ref: "#/components/schemas/ReplayBelief"}
        reproduces: {type: boolean}
        same_inputs: {type: boolean}
        differences: {type: array, items: {type: string}}
        candidate:
          type: object
          properties:
            label: {type: string}
            belief: {$ref: "#/components/schemas/ReplayBelief"}
            differences: {type: array, items: {type: string}}
        caveats: {type: array, items: {type: string}}
        summary: {type: string}
    DecisionReplay:
      type: object
      properties:
        decision_id: {type: string}
        decided_at: {type: string, format: date-time}
        agent_id: {type: string}
        action_type: {type: string}
        target: {type: string}
        recorded: {type: object, description: "The gate's recorded outcome, reasons, consequence, shadow, checks and mandate version; absent for decisions recorded without the gate."}
        replayed: {type: object, description: "The re-run: outcome, reasons, consequence, shadow, checks, mandate_version, catalog_version, access_policy_version (the access policies re-evaluated) and carried (the inputs taken from the record)."}
        beliefs:
          type: array
          items:
            type: object
            properties:
              claim: {type: string}
              required: {type: boolean}
              recorded: {$ref: "#/components/schemas/ReplayBelief"}
              replayed: {$ref: "#/components/schemas/ReplayBelief"}
              differences: {type: array, items: {type: string}}
        reproduces: {type: boolean}
        differences: {type: array, items: {type: string}}
        candidate:
          type: object
          properties:
            label: {type: string}
            gate: {type: object}
            flipped: {type: boolean}
            beliefs: {type: array, items: {type: object}}
            differences: {type: array, items: {type: string}}
            indeterminate: {type: string}
        caveats: {type: array, items: {type: string}}
        summary: {type: string}
    ConfigDiffRequest:
      type: object
      required: [to]
      properties:
        from: {$ref: "#/components/schemas/ReplayCandidate"}
        to: {$ref: "#/components/schemas/ReplayCandidate"}
        since: {type: string, format: date-time}
        until: {type: string, format: date-time}
        claim: {type: string}
        agent: {type: string}
        include: {type: string, enum: [decisions, beliefs]}
        limit: {type: integer, minimum: 1, maximum: 200, default: 50}
        cursor: {type: string}
    ConfigDiff:
      type: object
      properties:
        from: {type: string}
        to: {type: string}
        since: {type: string, format: date-time}
        until: {type: string, format: date-time}
        decisions_examined: {type: integer}
        beliefs_examined: {type: integer}
        flips:
          type: array
          items:
            type: object
            properties:
              decision_id: {type: string}
              agent_id: {type: string}
              action_type: {type: string}
              target: {type: string}
              decided_at: {type: string, format: date-time}
              recorded_outcome: {type: string}
              from: {type: object, properties: {outcome: {type: string}, reasons: {type: array, items: {type: string}}}}
              to: {type: object, properties: {outcome: {type: string}, reasons: {type: array, items: {type: string}}}}
              because: {type: array, items: {type: string}}
        belief_changes:
          type: array
          items:
            type: object
            properties:
              segment_id: {type: string}
              claim_id: {type: string}
              written_at: {type: string, format: date-time}
              from: {$ref: "#/components/schemas/ReplayBelief"}
              to: {$ref: "#/components/schemas/ReplayBelief"}
              changes: {type: array, items: {type: string}}
        indeterminate:
          type: array
          items: {type: object, properties: {ref: {type: string}, why: {type: string}}}
        next_cursor: {type: string}
        summary: {type: string}
    Samples:
      type: object
      required: [version, items, installed_at]
      properties:
        version: {type: integer}
        items: {type: array, items: {$ref: "#/components/schemas/SampleItem"}}
        installed_at: {type: string, format: date-time}
        removed_at: {type: string, format: date-time}
        kept: {type: array, items: {$ref: "#/components/schemas/SampleItem"}}
    DriftAlert:
      type: object
      required: [alert_id, watch_id, rule, subject_kind, subject, state, severity, title, text, detail, occurrences, created_at, last_seen_at]
      properties:
        alert_id: {type: string}
        watch_id: {type: string}
        rule: {type: string}
        subject_kind: {type: string, enum: [claim, instance]}
        subject: {type: string}
        namespace: {type: string}
        state: {type: string, enum: [OPEN, ACKNOWLEDGED, RESOLVED]}
        severity: {type: string, enum: [info, warning, critical]}
        title: {type: string}
        text: {type: string, description: "what changed, from what to what, the cause and where to see why, in plain words"}
        detail: {type: object}
        occurrences: {type: integer, description: "times the rule fired while the alert was open"}
        created_at: {type: string, format: date-time}
        last_seen_at: {type: string, format: date-time}
        acknowledged_at: {type: string, format: date-time}
        acknowledged_by: {type: string}
        resolved_at: {type: string, format: date-time}
        resolved_by: {type: string}
        note: {type: string}
    PluginModule:
      type: object
      required: [sha256, size, imports]
      properties:
        sha256: {type: string, description: "hex SHA-256 of the module; name it in a ResolutionPlugin's spec.module_sha256"}
        size: {type: integer}
        imports: {type: array, items: {type: string}, description: "the WASI preview-1 functions it imports (no others are allowed)"}
    ResolutionPluginVersion:
      type: object
      required: [name, version, spec]
      properties:
        name: {type: string}
        version: {type: integer}
        created_at: {type: string, format: date-time, description: when this version was published}
        created_by: {type: string, description: "the principal who published it (prn_…; through a change request, whoever published the approved change)"}
        spec:
          type: object
          required: [module_sha256, abi, limits]
          properties:
            module_sha256: {type: string}
            abi: {type: string, example: gn.plugin.v1}
            description: {type: string}
            limits:
              type: object
              properties:
                memory_pages: {type: integer, description: "64 KiB pages, at most 4096"}
                timeout_ms: {type: integer, description: "at most 2000"}
    ConnectorMappingVersion:
      type: object
      required: [tenant, name, version, connector, document, created_at, created_by]
      properties:
        tenant: {type: string, description: "tn_...: the tenant that published it; the connect role runs it only for a connector entry of this tenant"}
        name: {type: string}
        version: {type: integer}
        connector: {type: string}
        document: {type: string, description: the ConnectorMapping document as published}
        created_at: {type: string, format: date-time}
        created_by: {type: string}
    ScopeGrant:
      type: object
      required: [grant_id, principal_id, principal_kind, scope, duration, reason, state, requested_at, request_expires_at]
      properties:
        grant_id: {type: string}
        principal_id: {type: string}
        principal_kind: {type: string}
        scope: {type: string}
        duration: {type: string}
        reason: {type: string}
        state: {type: string, enum: [requested, active, rejected, cancelled, request_expired, expired, revoked]}
        requested_at: {type: string, format: date-time}
        request_expires_at: {type: string, format: date-time, description: "undecided by then, the request lapses"}
        decided_by: {type: string}
        decided_at: {type: string, format: date-time}
        decision_note: {type: string}
        starts_at: {type: string, format: date-time}
        expires_at: {type: string, format: date-time}
        revoked_by: {type: string}
        revoked_at: {type: string, format: date-time}
        revoke_reason: {type: string}
        review_id: {type: string, description: the open review of a pending request}
    ReviewSLARule:
      type: object
      required: [due]
      additionalProperties: false
      properties:
        kind: {type: string, description: "a review kind or * (default)"}
        consequence: {type: string, description: "low, medium, high, critical, none or * (default)"}
        due: {type: string, description: "after the review opens, 1m to 30d, e.g. 4h"}
        remind_before: {type: array, maxItems: 5, items: {type: string}, description: "before the due time, e.g. [1h, 15m]"}
        escalate_to: {type: string, description: "the queue an overdue review moves to; empty: it stays, announced as overdue"}
    ReviewSLASettings:
      type: object
      required: [rules, defaults]
      properties:
        rules: {type: array, items: {$ref: "#/components/schemas/ReviewSLARule"}, description: "the first match applies"}
        defaults: {type: array, items: {$ref: "#/components/schemas/ReviewSLARule"}, description: "built in; apply after the rules"}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
    EscalationSettings:
      type: object
      required: [rules, default]
      properties:
        rules:
          type: array
          items:
            type: object
            required: [namespace, outcomes, low_confidence, conflicted]
            additionalProperties: false
            properties:
              namespace: {type: string, description: "a namespace or a pattern with *; the first match applies"}
              outcomes: {type: boolean, description: "escalate INCONCLUSIVE and FAILED outcomes"}
              min_consequence: {type: string, enum: [low, medium, high, critical], description: "of the contract's metadata.consequence (default high; contracts without one are medium)"}
              low_confidence: {type: boolean, description: "escalate beliefs below their confidence threshold"}
              conflicted: {type: boolean, description: "escalate CONFLICTED beliefs"}
        default: {type: boolean, description: "no settings saved: these are the defaults"}
        updated_at: {type: string, format: date-time}
        updated_by: {type: string}
    ContractTemplate:
      type: object
      required: [name, title, description, params, instance_params, example]
      properties:
        name: {type: string}
        title: {type: string}
        description: {type: string}
        params:
          type: array
          items:
            type: object
            required: [name, kind, description, default]
            properties:
              name: {type: string}
              kind: {type: string, enum: [claim, duration, probability, consequence]}
              description: {type: string}
              default: {type: string}
        instance_params:
          type: array
          items:
            type: object
            required: [name, type, description, example]
            properties:
              name: {type: string}
              type: {type: string}
              description: {type: string}
              example: {type: string}
        example: {type: string, description: "the contract rendered with the defaults"}
    ContractVersion:
      type: object
      required: [contract_id, name, version, source, created_at]
      properties:
        contract_id: {type: string}
        name: {type: string}
        version: {type: integer}
        source: {type: string}
        created_at: {type: string, format: date-time}
    Job:
      type: object
      required: [job_id, kind, filter, from, reason, state, published, created_at, updated_at]
      properties:
        job_id: {type: string}
        kind: {type: string, enum: [RECOMPUTE]}
        filter: {type: object}
        from: {type: string, format: date-time}
        reason: {type: string}
        state: {type: string, enum: [PENDING, RUNNING, DONE, CANCELLED]}
        published: {type: integer}
        created_at: {type: string, format: date-time}
        updated_at: {type: string, format: date-time}
    ConfigVersion:
      type: object
      required: [version_id, kind, name, version, document, created_at]
      properties:
        version_id: {type: string}
        kind: {type: string, enum: [policy, authority]}
        name: {type: string}
        version: {type: integer}
        document: {type: object}
        created_at: {type: string, format: date-time}
    Alias:
      type: object
      required: [namespace, entity_type, alias, canonical]
      additionalProperties: false
      properties:
        namespace: {type: string}
        entity_type: {type: string}
        alias: {type: string}
        canonical: {type: string}
    Binding:
      type: object
      required: [principal_id, source_id, allowed_classes, namespaces]
      additionalProperties: false
      properties:
        principal_id: {type: string}
        source_id: {type: string}
        allowed_classes: {type: array, minItems: 1, items: {$ref: "#/components/schemas/EvidenceClass"}}
        namespaces: {type: array, minItems: 1, items: {type: string}}
        max_confidence: {type: number, minimum: 0, maximum: 1}
        valid_until: {type: string, format: date-time}
