InsuredAuditDeveloper Portal

OpenAPI 3.1 Specification

The full machine-readable spec. Feed this to any OpenAPI-aware toolchain — code generators, linters, mock servers, your IDE. See Postman / Insomnia collections for the same spec pre-converted.

Download openapi.yaml

openapi: "3.1.0"
info:
  title: CREB / InsuredAudit API
  version: "1.0.0"
  description: "Public REST surface for the CREB® Court Ready Evidentiary Bundle platform, shipping as InsuredAudit. All routes are versioned under `/v1`. See https://docs.insuredaudit.com for guides and examples."
  x-api-version: v1
  contact:
    name: InsuredAudit Developer Support
    email: "[email protected]"
    url: "https://docs.insuredaudit.com"
  license:
    name: Proprietary
    url: "https://insuredaudit.com/legal"
servers:
  - url: "https://api.insuredaudit.com"
    description: Production
  - url: "http://localhost:8080"
    description: Local dev
tags:
  - name: actors
    description: "Actor (user / service account) management. Admin-only."
  - name: advocacy
  - name: "ai-decisions"
    description: "AI provenance ledger for any model-assisted decision (UM, denial, fraud score, etc.)."
  - name: "api-keys"
    description: "Tenant-scoped API key management. Admin-only."
  - name: appointments
  - name: "ava-access"
  - name: bundles
    description: "Court Ready Evidentiary Bundles (CREB). Asynchronous: POST `/v1/bundles` to enqueue a build; poll `/v1/bundles/:id` until `status=SEALED`, then GET `/v1/bundles/:id/download` for the signed ZIP."
  - name: "care-team"
  - name: connectors
    description: Adapter connector instance management (FHIR / HL7v2 / X12 / NCPDP endpoints).
  - name: consent
  - name: custody
    description: "Chain-of-custody log per object (event, document, bundle). Append-only."
  - name: dashboard
    description: Aggregate counters for operator dashboards.
  - name: "data-rights"
  - name: documents
    description: "The document vault. Multipart upload of evidentiary documents. Storage is content-addressed (sha256) inside WORM; metadata is queryable. Quarantine/scan happens inline when `CREB_CONTENT_SCAN_INLINE=true` is set on the server."
  - name: events
    description: "The event ledger. Single or batched event envelopes, immutable on commit, hash-chained per (tenant, source_system) partition. Every accepted envelope is also persisted to the WORM store; see `/concepts/event-envelope` in the docs portal."
  - name: exceptions
    description: "Operator queue of ingest-time and reconciliation-time exceptions. Assign / resolve / mark-known-gap."
  - name: "feature-flags"
  - name: graph
    description: "Event/entity graph queries — neighbors, subgraphs, paths."
  - name: healthz
  - name: ingest
    description: "Raw / batch ingest helpers (multipart, NDJSON streams)."
  - name: leads
  - name: "legal-holds"
    description: Litigation hold management. Holds tombstone matching events/documents so retention sweeps cannot delete them. Release requires a documented authority.
  - name: "legal-matters"
    description: "Long-running matter records that group holds, members, bundles, and exception triage."
  - name: "member-auth"
  - name: members
    description: "Master-patient-index style member directory backed by the IdentityResolver. Use `/v1/members/search` for fuzzy lookup."
  - name: quarantine
    description: "Operator actions on quarantined documents (release after false-positive review)."
  - name: redactions
    description: "Member-facing or court-facing redactions. Two-stage: create draft, then apply."
  - name: roles
    description: "Role catalogue + actor-to-role assignment. Admin-only."
  - name: rules
    description: "Versioned rule corpus (plan benefit rules, network rules, prior-auth rules, jurisdictional regulations). Each ingest snapshots the rule artifact into WORM and creates an immutable revision row."
  - name: search
    description: "Search across the event log, documents, and full-text index."
  - name: "signing-keys"
    description: "Bundle signing key lifecycle (Ed25519). Admin-only."
  - name: "source-feeds"
    description: Source feed monitoring — heartbeats and staleness sweep.
  - name: tenants
    description: "Tenant lifecycle. Admin-only."
  - name: webhooks
    description: "Outbound delivery of platform events to operator-registered HTTPS endpoints. HMAC-signed (rotating secrets); retried with exponential backoff. See `/concepts/webhooks` in the docs portal."
paths:
  "/v1/actors":
    get:
      summary: List actors
      tags:
        - actors
      operationId: getActors
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
    post:
      summary: Create actors
      tags:
        - actors
      operationId: postActors
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/actors/{id}/roles/{role_id}":
    delete:
      summary: "Delete :role id"
      tags:
        - actors
      operationId: deleteActorsIdRolesRoleId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: role_id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
    post:
      summary: "Create :role id"
      tags:
        - actors
      operationId: postActorsIdRolesRoleId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: role_id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/advocacy/explain/{event_id}":
    get:
      summary: "Get :event id"
      tags:
        - advocacy
      operationId: getAdvocacyExplainEventId
      parameters:
        - name: event_id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "events:read"
  "/v1/advocacy/guideline/{event_id}":
    get:
      summary: "Get :event id"
      tags:
        - advocacy
      operationId: getAdvocacyGuidelineEventId
      parameters:
        - name: event_id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "events:read"
  "/v1/advocacy/recode/{event_id}":
    post:
      summary: "Create :event id"
      tags:
        - advocacy
      operationId: postAdvocacyRecodeEventId
      parameters:
        - name: event_id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/ai-decisions":
    get:
      summary: List ai decisions
      tags:
        - "ai-decisions"
      operationId: getAiDecisions
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "ai-provenance:read"
    post:
      summary: Create ai decisions
      tags:
        - "ai-decisions"
      operationId: postAiDecisions
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "ai-provenance:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/ai-decisions/{id}":
    get:
      summary: "Get :id"
      tags:
        - "ai-decisions"
      operationId: getAiDecisionsId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "ai-provenance:read"
  "/v1/ai-decisions/{id}/override":
    post:
      summary: Create override
      tags:
        - "ai-decisions"
      operationId: postAiDecisionsIdOverride
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "ai-provenance:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/ai-decisions/summary":
    get:
      summary: List summary
      tags:
        - "ai-decisions"
      operationId: getAiDecisionsSummary
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "ai-provenance:read"
  "/v1/api-keys":
    get:
      summary: List api keys
      tags:
        - "api-keys"
      operationId: getApiKeys
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
    post:
      summary: Create api keys
      tags:
        - "api-keys"
      operationId: postApiKeys
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/api-keys/{id}":
    delete:
      summary: "Delete :id"
      tags:
        - "api-keys"
      operationId: deleteApiKeysId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
  "/v1/appointments":
    get:
      summary: List appointments
      tags:
        - appointments
      operationId: getAppointments
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "appointments:read"
    post:
      summary: Create appointments
      tags:
        - appointments
      operationId: postAppointments
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "appointments:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/ava-access/request":
    post:
      summary: Create request
      tags:
        - "ava-access"
      operationId: postAvaAccessRequest
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/ava-access/verify":
    post:
      summary: Create verify
      tags:
        - "ava-access"
      operationId: postAvaAccessVerify
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/bundles":
    get:
      summary: List bundles
      tags:
        - bundles
      operationId: getBundles
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "bundles:read"
    post:
      summary: Create bundles
      tags:
        - bundles
      operationId: postBundles
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "bundles:request"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              "$ref": "#/components/schemas/BundleRequest"
      description: "Enqueue a bundle build. Returns `201 Created` immediately with `status: REQUESTED`. The bundle-worker picks up the row, fetches the matching events/documents, signs the manifest, writes a sealed ZIP to WORM, and updates the row to `SEALED` with a `worm_blob_sha256`. Polling: GET `/v1/bundles/:id` until `status=SEALED`. Typical build time: a few seconds for member-scope bundles; minutes for matter-scope."
  "/v1/bundles/{id}":
    get:
      summary: "Get :id"
      tags:
        - bundles
      operationId: getBundlesId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "bundles:read"
  "/v1/bundles/{id}/diff":
    get:
      summary: Get diff
      tags:
        - bundles
      operationId: getBundlesIdDiff
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "bundles:read"
  "/v1/bundles/{id}/download":
    get:
      summary: Get download
      tags:
        - bundles
      operationId: getBundlesIdDownload
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "bundles:export"
      description: "Stream the sealed bundle ZIP. Returns `409 NOT_SEALED` if the bundle isn't ready yet. Custody event `DOWNLOAD_BUNDLE` is recorded automatically."
  "/v1/bundles/{id}/edx":
    get:
      summary: Get edx
      tags:
        - bundles
      operationId: getBundlesIdEdx
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "bundles:export"
  "/v1/bundles/{id}/regenerate":
    post:
      summary: Create regenerate
      tags:
        - bundles
      operationId: postBundlesIdRegenerate
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "bundles:request"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/bundles/{id}/verify-signature":
    post:
      summary: Create verify signature
      tags:
        - bundles
      operationId: postBundlesIdVerifySignature
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "bundles:read"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/care-team":
    get:
      summary: List care team
      tags:
        - "care-team"
      operationId: getCareTeam
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "care-team:read"
    post:
      summary: Create care team
      tags:
        - "care-team"
      operationId: postCareTeam
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "care-team:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/connectors":
    get:
      summary: List connectors
      tags:
        - connectors
      operationId: getConnectors
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "connectors:write"
    post:
      summary: Create connectors
      tags:
        - connectors
      operationId: postConnectors
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "connectors:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/connectors/{id}":
    delete:
      summary: "Delete :id"
      tags:
        - connectors
      operationId: deleteConnectorsId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "connectors:write"
    get:
      summary: "Get :id"
      tags:
        - connectors
      operationId: getConnectorsId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "connectors:write"
    patch:
      summary: "Update :id"
      tags:
        - connectors
      operationId: patchConnectorsId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "connectors:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/consent":
    post:
      summary: Create consent
      tags:
        - consent
      operationId: postConsent
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/custody/{type}/{id}":
    get:
      summary: "Get :id"
      tags:
        - custody
      operationId: getCustodyTypeId
      parameters:
        - name: type
          in: path
          required: true
          schema:
            type: string
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "custody:read"
  "/v1/dashboard/counts":
    get:
      summary: List counts
      tags:
        - dashboard
      operationId: getDashboardCounts
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "events:read"
  "/v1/data-rights/requests/{rid}":
    get:
      summary: "Get :rid"
      tags:
        - "data-rights"
      operationId: getDataRightsRequestsRid
      parameters:
        - name: rid
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "data-rights:read"
  "/v1/data-rights/requests/{rid}/dry-run":
    post:
      summary: Create dry run
      tags:
        - "data-rights"
      operationId: postDataRightsRequestsRidDryRun
      parameters:
        - name: rid
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "data-rights:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/data-rights/requests/{rid}/evaluate":
    post:
      summary: Create evaluate
      tags:
        - "data-rights"
      operationId: postDataRightsRequestsRidEvaluate
      parameters:
        - name: rid
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "data-rights:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/data-rights/requests/{rid}/execute":
    post:
      summary: Create execute
      tags:
        - "data-rights"
      operationId: postDataRightsRequestsRidExecute
      parameters:
        - name: rid
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/documents":
    get:
      summary: List documents
      tags:
        - documents
      operationId: getDocuments
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "documents:read"
    post:
      summary: Create documents
      tags:
        - documents
      operationId: postDocuments
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "documents:write"
      requestBody:
        required: true
        content:
          "multipart/form-data":
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                metadata:
                  type: string
                  description: "JSON-encoded metadata object: tenant_id, member_id, document_type, source_system, source_document_id, retention_until, related_event_ids."
              required:
                - file
                - metadata
      description: |
        Multipart upload of an evidentiary document. The `file` part carries bytes; the `metadata` part carries a JSON object describing tenancy, member linkage, source system, and retention. On ingest the file is sha256-hashed and persisted to WORM as content-addressed storage; the metadata row references the blob.
        
        If `CREB_CONTENT_SCAN_INLINE=true` is set on the server, the scanner runs synchronously and an INFECTED result yields `400 DOCUMENT_INFECTED` (the WORM blob is still kept as evidence per BR-001). Otherwise the document row is left `PENDING` for the async scan worker; subsequent GETs return `451 LEGAL_REASONS` while in quarantine.
  "/v1/documents/{id}":
    get:
      summary: "Get :id"
      tags:
        - documents
      operationId: getDocumentsId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "documents:read"
  "/v1/documents/{id}/metadata":
    get:
      summary: Get metadata
      tags:
        - documents
      operationId: getDocumentsIdMetadata
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "documents:read"
  "/v1/documents/{id}/rescan":
    post:
      summary: Create rescan
      tags:
        - documents
      operationId: postDocumentsIdRescan
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "documents:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/documents/{id}/scan-status":
    get:
      summary: Get scan status
      tags:
        - documents
      operationId: getDocumentsIdScanStatus
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "documents:read"
  "/v1/events":
    post:
      summary: Create events
      tags:
        - events
      operationId: postEvents
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "events:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              oneOf:
                - "$ref": "#/components/schemas/EventEnvelope"
                - "$ref": "#/components/schemas/EventBatch"
      description: |
        Append one event or a batch of events to the ledger. Single-envelope bodies return `201 Created` (or `200` on dedup hit). Batch bodies return `202 Accepted` with a per-row result array; partial failures do not roll back successful rows.
        
        Idempotency: envelope hash is the natural dedup key. Sending the exact same envelope twice returns the same `event_id` with `status: DUPLICATE`. Supply an `Idempotency-Key` header if you'd like a non-content-derived dedup key.
        
        Rate limit: per-tenant, defaults to 600 envelopes / minute. Override via `tenant.rate_limit_overrides_json`.
  "/v1/events/validate":
    post:
      summary: Validate events
      tags:
        - events
      operationId: postEventsValidate
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "events:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              oneOf:
                - "$ref": "#/components/schemas/EventEnvelope"
                - "$ref": "#/components/schemas/EventBatch"
  "/v1/exceptions":
    get:
      summary: List exceptions
      tags:
        - exceptions
      operationId: getExceptions
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
  "/v1/exceptions/{id}/assign":
    post:
      summary: Create assign
      tags:
        - exceptions
      operationId: postExceptionsIdAssign
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "exceptions:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/exceptions/{id}/resolve":
    post:
      summary: Create resolve
      tags:
        - exceptions
      operationId: postExceptionsIdResolve
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "exceptions:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/exceptions/summary":
    get:
      summary: List summary
      tags:
        - exceptions
      operationId: getExceptionsSummary
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "exceptions:read"
  "/v1/feature-flags":
    get:
      summary: List feature flags
      tags:
        - "feature-flags"
      operationId: getFeatureFlags
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
    post:
      summary: Create feature flags
      tags:
        - "feature-flags"
      operationId: postFeatureFlags
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/feature-flags/{flag}/evaluate":
    get:
      summary: Get evaluate
      tags:
        - "feature-flags"
      operationId: getFeatureFlagsFlagEvaluate
      parameters:
        - name: flag
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
  "/v1/feature-flags/{id}":
    delete:
      summary: "Delete :id"
      tags:
        - "feature-flags"
      operationId: deleteFeatureFlagsId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
    get:
      summary: "Get :id"
      tags:
        - "feature-flags"
      operationId: getFeatureFlagsId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
  "/v1/feature-flags/{id}/rules":
    post:
      summary: Create rules
      tags:
        - "feature-flags"
      operationId: postFeatureFlagsIdRules
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/feature-flags/{id}/rules/{ruleId}":
    delete:
      summary: "Delete :ruleId"
      tags:
        - "feature-flags"
      operationId: deleteFeatureFlagsIdRulesRuleId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: ruleId
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
  "/v1/graph/events/{id}/neighbors":
    get:
      summary: Get neighbors
      tags:
        - graph
      operationId: getGraphEventsIdNeighbors
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "graph:read"
  "/v1/graph/members/{id}/relations":
    get:
      summary: Get relations
      tags:
        - graph
      operationId: getGraphMembersIdRelations
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "graph:read"
  "/v1/graph/path":
    get:
      summary: List path
      tags:
        - graph
      operationId: getGraphPath
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "graph:read"
  "/v1/graph/subgraph":
    post:
      summary: Create subgraph
      tags:
        - graph
      operationId: postGraphSubgraph
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "graph:read"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/healthz":
    get:
      summary: Liveness probe
      tags:
        - healthz
      operationId: getHealthz
      parameters: []
      responses:
        "200":
          description: Health summary including db + WORM status.
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      security: []
      description: "Returns a one-shot health snapshot covering the database and WORM store. Never requires authentication so probes and uptime monitors can hit it. Reported `status` is `ok` only when every dependency is `ok`; otherwise `degraded`."
  "/v1/ingest/raw":
    post:
      summary: Create raw
      tags:
        - ingest
      operationId: postIngestRaw
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "events:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/leads":
    post:
      summary: Create leads
      tags:
        - leads
      operationId: postLeads
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/legal-holds":
    get:
      summary: List legal holds
      tags:
        - "legal-holds"
      operationId: getLegalHolds
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "legal-holds:read"
    post:
      summary: Create legal holds
      tags:
        - "legal-holds"
      operationId: postLegalHolds
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "legal-holds:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/legal-holds/{id}":
    delete:
      summary: "Delete :id"
      tags:
        - "legal-holds"
      operationId: deleteLegalHoldsId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "legal-holds:write"
  "/v1/legal-matters":
    get:
      summary: List legal matters
      tags:
        - "legal-matters"
      operationId: getLegalMatters
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "legal-matters:read"
    post:
      summary: Create legal matters
      tags:
        - "legal-matters"
      operationId: postLegalMatters
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "legal-matters:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/legal-matters/{id}":
    get:
      summary: "Get :id"
      tags:
        - "legal-matters"
      operationId: getLegalMattersId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "legal-matters:read"
  "/v1/legal-matters/{id}/members":
    post:
      summary: Create members
      tags:
        - "legal-matters"
      operationId: postLegalMattersIdMembers
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "legal-matters:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/member-auth/complete-login":
    post:
      summary: Create complete login
      tags:
        - "member-auth"
      operationId: postMemberAuthCompleteLogin
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/member-auth/logout":
    post:
      summary: Create logout
      tags:
        - "member-auth"
      operationId: postMemberAuthLogout
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/member-auth/request-login":
    post:
      summary: Create request login
      tags:
        - "member-auth"
      operationId: postMemberAuthRequestLogin
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/member-auth/session":
    get:
      summary: List session
      tags:
        - "member-auth"
      operationId: getMemberAuthSession
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
  "/v1/members/{id}/data-rights/deletion":
    post:
      summary: Create deletion
      tags:
        - members
      operationId: postMembersIdDataRightsDeletion
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "data-rights:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/members/{id}/data-rights/requests":
    get:
      summary: Get requests
      tags:
        - members
      operationId: getMembersIdDataRightsRequests
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "data-rights:read"
  "/v1/members/{id}/export":
    post:
      summary: Create export
      tags:
        - members
      operationId: postMembersIdExport
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "data-rights:read"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/members/{id}/export/download":
    get:
      summary: Get download
      tags:
        - members
      operationId: getMembersIdExportDownload
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
  "/v1/members/{memberId}":
    get:
      summary: "Get :memberId"
      tags:
        - members
      operationId: getMembersMemberId
      parameters:
        - name: memberId
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "events:read"
  "/v1/members/{memberId}/timeline":
    get:
      summary: Get timeline
      tags:
        - members
      operationId: getMembersMemberIdTimeline
      parameters:
        - name: memberId
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "events:read"
      description: "Returns a member's full event timeline, ordered by `event_effective_timestamp`. Time-range filters: `from`, `to`. Page with `limit`."
  "/v1/members/search":
    post:
      summary: Create search
      tags:
        - members
      operationId: postMembersSearch
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "events:read"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/quarantine/{id}/release":
    post:
      summary: Create release
      tags:
        - quarantine
      operationId: postQuarantineIdRelease
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/redactions":
    get:
      summary: List redactions
      tags:
        - redactions
      operationId: getRedactions
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "documents:read"
    post:
      summary: Create redactions
      tags:
        - redactions
      operationId: postRedactions
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "documents:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/redactions/{id}":
    get:
      summary: "Get :id"
      tags:
        - redactions
      operationId: getRedactionsId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "documents:read"
  "/v1/redactions/{id}/apply":
    post:
      summary: Create apply
      tags:
        - redactions
      operationId: postRedactionsIdApply
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "documents:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/roles":
    get:
      summary: List roles
      tags:
        - roles
      operationId: getRoles
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
    post:
      summary: Create roles
      tags:
        - roles
      operationId: postRoles
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/rules":
    get:
      summary: List rules
      tags:
        - rules
      operationId: getRules
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "rules:read"
    post:
      summary: Create rules
      tags:
        - rules
      operationId: postRules
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "rules:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/search":
    post:
      summary: Create search
      tags:
        - search
      operationId: postSearch
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "events:read"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
      description: "Structured search across the event log. Body fields: `tenant_id` (required), `member_id`, `event_family`, `event_type`, `from`, `to`, `limit`, `cursor`. Returns paginated event rows."
  "/v1/search/documents":
    post:
      summary: Create documents
      tags:
        - search
      operationId: postSearchDocuments
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "documents:read"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/search/index":
    post:
      summary: Create index
      tags:
        - search
      operationId: postSearchIndex
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/signing-keys":
    get:
      summary: List signing keys
      tags:
        - "signing-keys"
      operationId: getSigningKeys
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "signing-keys:read"
    post:
      summary: Create signing keys
      tags:
        - "signing-keys"
      operationId: postSigningKeys
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "signing-keys:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/signing-keys/{id}":
    delete:
      summary: "Delete :id"
      tags:
        - "signing-keys"
      operationId: deleteSigningKeysId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "signing-keys:write"
  "/v1/source-feeds":
    get:
      summary: List source feeds
      tags:
        - "source-feeds"
      operationId: getSourceFeeds
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "feeds:read"
  "/v1/source-feeds/heartbeat":
    post:
      summary: Create heartbeat
      tags:
        - "source-feeds"
      operationId: postSourceFeedsHeartbeat
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "feeds:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/source-feeds/summary":
    get:
      summary: List summary
      tags:
        - "source-feeds"
      operationId: getSourceFeedsSummary
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "feeds:read"
  "/v1/source-feeds/sweep":
    post:
      summary: Create sweep
      tags:
        - "source-feeds"
      operationId: postSourceFeedsSweep
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: "feeds:write"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/tenants":
    get:
      summary: List tenants
      tags:
        - tenants
      operationId: getTenants
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
    post:
      summary: Create tenants
      tags:
        - tenants
      operationId: postTenants
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
  "/v1/tenants/{id}":
    delete:
      summary: "Delete :id"
      tags:
        - tenants
      operationId: deleteTenantsId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
    get:
      summary: "Get :id"
      tags:
        - tenants
      operationId: getTenantsId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
  "/v1/webhooks":
    get:
      summary: List webhooks
      tags:
        - webhooks
      operationId: getWebhooks
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
    post:
      summary: Create webhooks
      tags:
        - webhooks
      operationId: postWebhooks
      parameters:
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              "$ref": "#/components/schemas/Webhook"
      description: "Register an outbound webhook. The server generates a rotating HMAC secret returned exactly once in the response. Subsequent rotates (POST `/v1/webhooks/:id/rotate-secret`) replace the secret atomically. Failed deliveries are retried with exponential backoff; see `/v1/webhooks/:id/deliveries` for the audit trail."
  "/v1/webhooks/{id}":
    delete:
      summary: "Delete :id"
      tags:
        - webhooks
      operationId: deleteWebhooksId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
    get:
      summary: "Get :id"
      tags:
        - webhooks
      operationId: getWebhooksId
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
  "/v1/webhooks/{id}/deliveries":
    get:
      summary: Get deliveries
      tags:
        - webhooks
      operationId: getWebhooksIdDeliveries
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
  "/v1/webhooks/{id}/rotate-secret":
    post:
      summary: Create rotate secret
      tags:
        - webhooks
      operationId: postWebhooksIdRotateSecret
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
        - name: tenant_id
          in: query
          required: false
          description: "Tenant identifier. Either pass on the query string, or set the `X-Tenant-Id` header. Required on most routes; admin endpoints derive it from the API key."
          schema:
            type: string
        - name: "Idempotency-Key"
          in: header
          required: false
          description: "Optional ULID supplied by the client to ensure the request is processed at most once. Server-side replay returns the original response."
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            "application/json":
              schema:
                type: object
                additionalProperties: true
        "400":
          description: Validation error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "401":
          description: Missing or invalid API key.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "403":
          description: API key lacks the required scope.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "429":
          description: "Per-tenant rate limit exceeded."
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
        "500":
          description: Unhandled server error.
          content:
            "application/json":
              schema:
                "$ref": "#/components/schemas/Error"
      x-required-scope: admin
      requestBody:
        required: true
        content:
          "application/json":
            schema:
              type: object
              additionalProperties: true
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: "Send the API key as `Authorization: Bearer <api_key>`. Manage keys via the `/v1/api-keys` admin endpoints."
  schemas:
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              example: MISSING_TENANT
            message:
              type: string
              example: tenant_id required
            details:
              type: object
              additionalProperties: true
    EventEnvelope:
      type: object
      required:
        - event_family
        - event_type
        - tenant_id
        - member_id
        - source_system
        - source_record_type
        - source_record_id
        - event_effective_timestamp
        - payload
      additionalProperties: false
      properties:
        event_family:
          type: string
          description: "One of the canonical event families. See @creb/canonical-events families.ts."
        event_type:
          type: string
          maxLength: 128
        event_subtype:
          type: string
          maxLength: 128
        event_version:
          type: integer
          default: 1
          minimum: 1
        schema_version:
          type: string
          default: "1.0"
        tenant_id:
          type: string
          maxLength: 64
        member_id:
          type: string
          minLength: 8
          maxLength: 64
        source_system:
          type: string
          maxLength: 128
        source_record_type:
          type: string
          maxLength: 128
        source_record_id:
          type: string
          maxLength: 256
        source_event_id:
          type: string
          maxLength: 256
        source_event_timestamp:
          type: string
          format: "date-time"
        event_effective_timestamp:
          type: string
          format: "date-time"
        event_observed_timestamp:
          type: string
          format: "date-time"
        actor_id:
          type: string
          maxLength: 128
        actor_type:
          type: string
          maxLength: 64
        organization_id:
          type: string
          maxLength: 128
        correlation_id:
          type: string
          maxLength: 128
        causation_id:
          type: string
          maxLength: 128
        parent_event_id:
          type: string
        related_event_ids:
          type: array
          items:
            type: string
          maxItems: 256
        related_claim_ids:
          type: array
          items:
            type: string
          maxItems: 256
        related_authorization_ids:
          type: array
          items:
            type: string
          maxItems: 256
        related_prescription_ids:
          type: array
          items:
            type: string
          maxItems: 256
        related_dispute_ids:
          type: array
          items:
            type: string
          maxItems: 256
        related_document_ids:
          type: array
          items:
            type: string
          maxItems: 256
        related_rule_ids:
          type: array
          items:
            type: string
          maxItems: 256
        outcome:
          type: string
          maxLength: 64
        outcome_reason:
          type: string
          maxLength: 1024
        data_classification:
          type: string
          maxLength: 64
        legal_hold_status:
          type: string
          maxLength: 64
        retention_policy_id:
          type: string
          maxLength: 64
        payload:
          type: object
          additionalProperties: true
          description: Domain payload; the envelope only requires it be a JSON object.
    EventBatch:
      type: object
      required:
        - events
      additionalProperties: false
      properties:
        batch_id:
          type: string
          maxLength: 128
        source_batch_id:
          type: string
          maxLength: 256
        events:
          type: array
          items:
            "$ref": "#/components/schemas/EventEnvelope"
          minItems: 1
          maxItems: 1000
    IngestResult:
      type: object
      properties:
        event_id:
          type: string
        status:
          type: string
          enum:
            - ACCEPTED
            - DUPLICATE
            - ERROR
        envelope_hash:
          type: string
        prev_event_hash:
          type:
            - string
            - "null"
        worm_blob_sha256:
          type: string
        creb_commit_ts:
          type: string
          format: "date-time"
    BundleRequest:
      type: object
      required:
        - scope
        - bundle_type
      properties:
        scope:
          type: object
          additionalProperties: true
        matter_id:
          type: string
        bundle_type:
          type: string
          enum:
            - MEMBER
            - MATTER
            - INCIDENT
        requested_by:
          type: string
        parent_bundle_id:
          type: string
    Webhook:
      type: object
      properties:
        id:
          type: string
        tenant_id:
          type: string
        url:
          type: string
          format: uri
        event_types:
          type: array
          items:
            type: string
        active:
          type: boolean
        created_at:
          type: string
          format: "date-time"
security:
  - ApiKeyAuth: []