openapi: 3.1.0
info:
  title: Memory Intelligence API
  description: 'The public REST API for **Memory Intelligence** — turn content into Unified Memory Objects
    (UMOs)

    your agents can capture, recall, and verify.


    ## Authentication

    All endpoints require an API key in the Authorization header:

    `Authorization: Bearer mi_sk_your_key_here`

    Get a key from the developer portal (free during beta).


    ## SDKs

    Typed Python and JavaScript SDKs are coming. Today, use this REST API directly, or the MCP server

    (`pip install memoryintelligence-mcp`) to give an MCP client memory in one command.


    ## Core methods

    | Endpoint | Purpose |

    |---|---|

    | `POST /v1/process` | Capture content → UMO |

    | `POST /v1/memories/query` | Semantic search / ask |

    | `GET /v1/memories` | List UMOs |

    | `GET /v1/memories/{id}/proof` | Provenance verification |

    | `GET /v1/memories/{id}/explain` | UMO introspection |

    | `DELETE /v1/memories/{id}` | Delete with receipt |

    | `POST /v1/batch` | Batch capture |

    | `POST /v1/upload` | Media file capture |


    Aliases (same handlers): `POST /v1/memories` → `/v1/process`; `POST /v1/search` → `/v1/memories/query`.

    '
  version: 1.0.0
servers:
- url: https://api.memoryintelligence.io
  description: Production
paths:
  /health:
    get:
      tags:
      - System
      summary: Health Check
      description: 'Returns the operational status of the API and its core dependencies.


        Use this endpoint to confirm the API is reachable and ready to accept

        requests. Monitor it in your infrastructure health checks and dashboards.


        `status` values:

        - `healthy`  — all systems operational

        - `degraded` — API is reachable but one or more services are impaired

        - `starting` — API is initializing (model pre-warm in progress)


        `services.database` reflects whether the Postgres connection pool is alive.

        `services.embedding` reflects whether the embedding model is loaded and ready.

        A degraded service means captures will still succeed but may fall back to

        reduced functionality (e.g. search falls back to keyword-only if embedding

        is not ready).'
      operationId: health_check_health_get
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
  /v1/process:
    post:
      tags:
      - sdk
      summary: Process Content
      description: 'Capture raw content and convert it into a Unified Memory Object (UMO).


        Input: anything that happened — text, events, decisions, observations.

        Output: a UMO — a discrete, provenance-stamped, semantically-indexed unit

        of memory. Raw content is never stored; only meaning persists.


        Returns UMOCompactResponse by default. Use ?detail=full for the verbose

        MeaningObjectResponse. Add ?include=embedding to append the 384-dim vector.


        Provenance is automatic: actor_type and device_id are inferred from

        the API key, SDK headers, User-Agent, and client IP unless explicitly

        overridden in the request body. Zero-friction attribution.'
      operationId: process_content_v1_process_post
      parameters:
      - name: detail
        in: query
        required: false
        schema:
          type: string
          description: '''compact'' (default) or ''full'''
          default: compact
          title: Detail
        description: '''compact'' (default) or ''full'''
      - name: include
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Comma-separated extras, e.g. 'embedding'
          title: Include
        description: Comma-separated extras, e.g. 'embedding'
      - name: authorization
        in: header
        required: false
        schema:
          type: string
          title: Authorization
      - name: x-mi-source
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Mi-Source
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProcessRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/memories:
    get:
      tags:
      - MI API
      summary: mi.list() — Enumerate the caller's memories
      description: 'List the caller''s Unified Memory Objects with pagination.


        Returns a compact list without embeddings. Use `limit` and `offset` for

        pagination. Filter by `source` (e.g. "api", "slack", "gmail").


        **Auth:** `Authorization: Bearer mi_sk_...` API key, or a signed-in

        portal/console JWT (Bearer or `mi_jwt` cookie) — owner read.'
      operationId: canonical_list_memories_v1_memories_get
      parameters:
      - name: limit
        in: query
        required: false
        schema:
          type: integer
          default: 20
          title: Limit
      - name: offset
        in: query
        required: false
        schema:
          type: integer
          default: 0
          title: Offset
      - name: source
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Source
      - name: redact
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Read-time PII redaction override; None=fail-safe redact unless owner-portal read.
            See finding R11.
          title: Redact
        description: Read-time PII redaction override; None=fail-safe redact unless owner-portal read.
          See finding R11.
      - name: authorization
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Authorization
      - name: x-mi-source
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Mi-Source
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    post:
      tags:
      - MI API
      summary: mi.capture() — Turn raw content into a Unified Memory Object
      description: 'Capture raw content and transform it into a Unified Memory Object (UMO).


        The 7-stage pipeline (CAPTURE → NORMALIZE → EXTRACT → ENRICH → PARSE →

        EMBED → VALIDATE) runs synchronously and returns the UMO on completion.

        Raw content is discarded after processing when `retention_policy` is

        `meaning_only` (the default). Use `?detail=full` for the verbose echo

        (including structured claims) — same contract as `/v1/process`.


        **Auth:** `Authorization: Bearer mi_sk_...`'
      operationId: canonical_capture_v1_memories_post
      parameters:
      - name: detail
        in: query
        required: false
        schema:
          type: string
          description: '''compact'' (default) or ''full'''
          default: compact
          title: Detail
        description: '''compact'' (default) or ''full'''
      - name: include
        in: query
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          description: Comma-separated extras, e.g. 'embedding'
          title: Include
        description: Comma-separated extras, e.g. 'embedding'
      - name: authorization
        in: header
        required: false
        schema:
          type: string
          title: Authorization
      - name: x-mi-source
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Mi-Source
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/memories/query:
    post:
      tags:
      - MI API
      summary: mi.ask() — Retrieve memories by semantic meaning
      description: 'Semantic search over the caller''s UMO corpus.


        Embeds the query, runs pgvector cosine similarity, and reranks by

        keyword overlap and recency. Returns compact UMO summaries by default;

        use `?detail=full` for the verbose SearchResponse with complete UMO

        fields, including structured claims (`svo_triples`) — same contract as

        `/v1/search`.


        **Auth:** `Authorization: Bearer mi_sk_...` API key, or a signed-in

        portal/console JWT (Bearer or `mi_jwt` cookie) — owner read.'
      operationId: canonical_query_v1_memories_query_post
      parameters:
      - name: detail
        in: query
        required: false
        schema:
          type: string
          description: '''compact'' (default) or ''full'''
          default: compact
          title: Detail
        description: '''compact'' (default) or ''full'''
      - name: authorization
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Authorization
      - name: x-mi-source
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Mi-Source
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/search:
    post:
      tags:
      - sdk
      summary: Search Memories
      description: 'Retrieve memories by semantic meaning.


        Returns ranked UMOs whose meaning is closest to the query.

        Results are ordered by: semantic similarity (60%) + keyword overlap (15%)

        + entity overlap (15%) + recency (10%). Use ?detail=full for the verbose

        SearchResponse with full per-result explanations.'
      operationId: search_memories_v1_search_post
      parameters:
      - name: detail
        in: query
        required: false
        schema:
          type: string
          description: '''compact'' (default) or ''full'''
          default: compact
          title: Detail
        description: '''compact'' (default) or ''full'''
      - name: authorization
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Authorization
      - name: x-mi-source
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Mi-Source
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/memories/{id}:
    get:
      tags:
      - MI API
      summary: mi.read() — Retrieve a memory by ID
      description: 'Retrieve a single Unified Memory Object by its UMO ID.


        Returns the full UMO including summary, entities, topics, sentiment,

        provenance hashes, quality score, and timestamps.


        **Tenant isolation:** Identity derived from API key — only returns

        the memory if it belongs to the caller.


        **Auth:** `Authorization: Bearer mi_sk_...`'
      operationId: canonical_read_v1_memories__id__get
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          title: Id
      - name: redact
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Read-time PII redaction override; None=fail-safe redact unless owner-portal read.
            See finding R11.
          title: Redact
        description: Read-time PII redaction override; None=fail-safe redact unless owner-portal read.
          See finding R11.
      - name: authorization
        in: header
        required: false
        schema:
          type: string
          title: Authorization
      - name: x-mi-source
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Mi-Source
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - MI API
      summary: mi.forget() — Delete a memory (soft-delete + grace window) with a deletion receipt.
      description: 'mi.forget(): Delete a Unified Memory Object by ID.


        Soft-deletes the UMO: it is immediately excluded from every read (search,

        list, get) and a deletion receipt is written as cryptographic proof. A

        background purge worker hard-deletes the content after a short grace window

        (recovery safety); after that the content is unrecoverable. The receipt is

        retained as a deletion log entry.


        **Tenant isolation:** Identity derived from API key — only deletes

        the memory if it belongs to the caller.


        Private — this is the ownership guarantee made visible.'
      operationId: canonical_forget_v1_memories__id__delete
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          title: Id
      - name: authorization
        in: header
        required: false
        schema:
          type: string
          title: Authorization
      - name: x-mi-source
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Mi-Source
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/memories/{id}/proof:
    get:
      tags:
      - MI API
      summary: mi.verify() — Confirm a memory is real and receipted
      description: 'Verify cryptographic receipt for a memory. Accepts UMO ID or content hash.


        **Tenant isolation:** Identity derived from the API key or JWT — only

        returns proof if the memory belongs to the caller.


        **Auth:** `Authorization: Bearer mi_sk_...` API key, or a signed-in

        portal/console JWT (Bearer or `mi_jwt` cookie).'
      operationId: canonical_verify_v1_memories__id__proof_get
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          title: Id
      - name: authorization
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Authorization
      - name: x-mi-source
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Mi-Source
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/memories/{id}/explain:
    get:
      tags:
      - MI API
      summary: mi.explain() — Understand what a memory contains
      description: 'Return plain-language explanation of a memory''s contents.


        **Tenant isolation:** Identity derived from the API key or JWT — only

        returns explanation if the memory belongs to the caller.


        **Auth:** `Authorization: Bearer mi_sk_...` API key, or a signed-in

        portal/console JWT (Bearer or `mi_jwt` cookie) — owner read.'
      operationId: canonical_explain_v1_memories__id__explain_get
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
          title: Id
      - name: level
        in: query
        required: false
        schema:
          $ref: '#/components/schemas/ExplainLevelRequest'
          default: full
      - name: redact
        in: query
        required: false
        schema:
          anyOf:
          - type: boolean
          - type: 'null'
          description: Read-time PII redaction override; None=fail-safe redact unless owner-portal read.
            See finding R11.
          title: Redact
        description: Read-time PII redaction override; None=fail-safe redact unless owner-portal read.
          See finding R11.
      - name: authorization
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: Authorization
      - name: x-mi-source
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Mi-Source
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/batch:
    post:
      tags:
      - sdk
      summary: Batch Process Content
      description: 'Batch capture — process up to 50 items concurrently in a single request.


        Each item is independent: one failure does not block the rest.

        Returns per-item results with aggregate success/failure counts,

        wrapped in the standard APIEnvelope.


        Provenance is automatic: actor_type and device_id are inferred from

        the API key, SDK headers, User-Agent, and client IP — same as single

        capture. Per-item overrides are respected.'
      operationId: batch_process_content_v1_batch_post
      parameters:
      - name: authorization
        in: header
        required: false
        schema:
          type: string
          title: Authorization
      - name: x-mi-source
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Mi-Source
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchProcessRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /v1/upload:
    post:
      tags:
      - sdk
      summary: Upload Media
      description: "Upload a media file and convert it into a UMO.\n\nAccepts multipart/form-data. The\
        \ file is routed through the appropriate\nhandler (Whisper for audio/video, OCR for images, pdfplumber\
        \ for PDFs),\nand the extracted text flows through the full intelligence pipeline.\n\nSupported:\n\
        \  Audio: mp3, wav, m4a, flac, ogg, aac, opus, webm   (Whisper transcription)\n  Image: png, jpg,\
        \ jpeg, gif, bmp, tiff, webp, heic   (OCR)\n  Document: pdf                                  \
        \      (pdfplumber → pypdf)\n  Data: csv, tsv, txt, md, json, jsonl, xlsx, docx     (tabular/text\
        \ extraction)\n  Video: mp4, mov, avi, mkv, webm                      (not yet extracted — planned)\n\
        \n**Tenant isolation:** user_ulid is ALWAYS resolved from API key auth context.\nThe form field\
        \ is deprecated and ignored for security."
      operationId: upload_media_v1_upload_post
      parameters:
      - name: authorization
        in: header
        required: false
        schema:
          type: string
          title: Authorization
      - name: x-mi-source
        in: header
        required: false
        schema:
          anyOf:
          - type: string
          - type: 'null'
          title: X-Mi-Source
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/Body_upload_media_v1_upload_post'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    BatchProcessRequest:
      properties:
        items:
          items:
            $ref: '#/components/schemas/BatchItemRequest'
          type: array
          maxItems: 50
          minItems: 1
          title: Items
      type: object
      required:
      - items
      title: BatchProcessRequest
      description: Batch capture — process up to 50 items in one call.
    BatchItemRequest:
      properties:
        content:
          anyOf:
          - type: string
          - $ref: '#/components/schemas/EncryptedContentRequest'
          title: Content
        retention_policy:
          $ref: '#/components/schemas/RetentionPolicyRequest'
          default: meaning_only
        pii_handling:
          $ref: '#/components/schemas/PIIHandlingRequest'
          default: extract_and_redact
        provenance_mode:
          $ref: '#/components/schemas/ProvenanceModeRequest'
          default: standard
        scope:
          $ref: '#/components/schemas/ScopeRequest'
          default: user
        scope_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Scope Id
        source:
          type: string
          title: Source
          default: api
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        tags:
          anyOf:
          - items:
              type: string
            type: array
            maxItems: 50
          - type: 'null'
          title: Tags
          description: Caller-supplied tags merged with pipeline-derived tags on the resulting UMO. Same
            semantics as ProcessRequest.tags.
        org_ulid:
          anyOf:
          - type: string
          - type: 'null'
          title: Org Ulid
        actor_type:
          $ref: '#/components/schemas/ActorTypeRequest'
          description: 'Who/what created this memory: human, agent, or system. Server infers from API
            key and SDK headers if not set.'
          default: human
        device_id:
          anyOf:
          - type: string
            maxLength: 64
          - type: 'null'
          title: Device Id
          description: Persistent device fingerprint. Server infers from caller signals if not set.
      type: object
      required:
      - content
      title: BatchItemRequest
      description: Single item within a batch capture request.
    ProvenanceModeRequest:
      type: string
      enum:
      - standard
      - authorship
      - audit
      title: ProvenanceModeRequest
      description: Provenance tracking level.
    RetentionPolicyRequest:
      type: string
      enum:
      - meaning_only
      - full
      - summary_only
      title: RetentionPolicyRequest
      description: What to retain after processing.
    PIIHandlingRequest:
      type: string
      enum:
      - detect_only
      - extract_and_redact
      - hash
      - reject
      title: PIIHandlingRequest
      description: How to handle PII.
    ActorTypeRequest:
      type: string
      enum:
      - human
      - agent
      - system
      title: ActorTypeRequest
      description: 'WHO created this memory — human, agent, or system.


        This is a provenance-critical field. It distinguishes content authored by

        a real person from content generated by an AI agent or synthesised by

        a system pipeline. The value is recorded in the origin lineage step and

        surfaces in search results, explain, and verify responses.


        Values:

        - `human`   — a real user authored the content (default)

        - `agent`   — an AI agent (e.g. SpaceAgent, LLM summariser) produced it

        - `system`  — an automated pipeline or integration generated it (no human or agent in the loop)'
    ScopeRequest:
      type: string
      enum:
      - user
      - client
      - project
      - team
      - org
      - all
      title: ScopeRequest
      description: Governance scope for memory isolation.
    EncryptedContentRequest:
      properties:
        ciphertext:
          type: string
          title: Ciphertext
        nonce:
          type: string
          title: Nonce
        tag:
          type: string
          title: Tag
        key_id:
          type: string
          title: Key Id
        algorithm:
          type: string
          title: Algorithm
          default: AES-256-GCM
      type: object
      required:
      - ciphertext
      - nonce
      - tag
      - key_id
      title: EncryptedContentRequest
      description: 'AES-256-GCM encrypted content payload sent by the Python SDK.

        The server derives the decryption key from the API key (PBKDF2, fixed salt)

        — same derivation the SDK used, so no explicit key exchange is needed.'
    ExplainLevelRequest:
      type: string
      enum:
      - none
      - human
      - audit
      - full
      title: ExplainLevelRequest
      description: Explanation level.
    Body_upload_media_v1_upload_post:
      properties:
        file:
          type: string
          contentMediaType: application/octet-stream
          title: File
        user_ulid:
          anyOf:
          - type: string
          - type: 'null'
          title: User Ulid
        org_ulid:
          anyOf:
          - type: string
          - type: 'null'
          title: Org Ulid
        scope:
          anyOf:
          - type: string
          - type: 'null'
          title: Scope
          default: user
        actor_type:
          anyOf:
          - type: string
          - type: 'null'
          title: Actor Type
          description: 'Override actor type: ''human'', ''agent'', or ''system''. Inferred from headers
            if omitted.'
        device_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Device Id
          description: Override device ID. Inferred from X-MI-Device-ID header or fingerprinted if omitted.
        capture_trigger:
          anyOf:
          - type: string
          - type: 'null'
          title: Capture Trigger
          description: 'Capture trigger: ''explicit'', ''middleware'', ''decorator'', ''source_sync''.'
          default: explicit
        metadata_json:
          anyOf:
          - type: string
          - type: 'null'
          title: Metadata Json
        claim_granular:
          type: boolean
          title: Claim Granular
          description: Persist the extracted content (OCR / transcript / text) as a parent UMO plus one
            child UMO per claim (#446). Default on for uploads — a whiteboard photo, voice note, or meeting
            recording is the multi-claim case. Structured (spreadsheet) uploads ignore this.
          default: true
        claim_level:
          type: string
          title: Claim Level
          description: 'Claim boundary when claim_granular: ''sentence'' | ''compound'' (recommended)
            | ''assertion''.'
          default: compound
      type: object
      required:
      - file
      title: Body_upload_media_v1_upload_post
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    SearchRequest:
      properties:
        query:
          type: string
          maxLength: 10000
          minLength: 1
          title: Query
        scope:
          $ref: '#/components/schemas/ScopeRequest'
          default: user
        scope_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Scope Id
        explain:
          $ref: '#/components/schemas/ExplainLevelRequest'
          description: 'Explanation level. On the default compact response, any level other than ''none''
            also includes the per-component `scores` breakdown on each result (opt-in since #538; default
            responses carry only the composite `score`).'
          default: none
        limit:
          type: integer
          maximum: 100.0
          minimum: 1.0
          title: Limit
          default: 10
        offset:
          type: integer
          minimum: 0.0
          title: Offset
          default: 0
        date_from:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Date From
        date_to:
          anyOf:
          - type: string
            format: date-time
          - type: 'null'
          title: Date To
        tags:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Tags
          description: Filter results by tag (any-of overlap). Accepted as `tags` (preferred, matches
            the capture-side field) or `topics` (legacy alias). Empty list or omitted = no tag filter.
        entities:
          anyOf:
          - items:
              type: string
            type: array
          - type: 'null'
          title: Entities
        min_score:
          anyOf:
          - type: number
            maximum: 1.0
            minimum: 0.0
          - type: 'null'
          title: Min Score
          description: 'Optional minimum SEMANTIC similarity (cosine, 0.0-1.0) a result must meet to be
            returned. Omitted/None = no floor (legacy behavior: always returns top-K, even for out-of-corpus
            queries). Set this to suppress weak/irrelevant matches — e.g. an auto-recall hook deciding
            whether any memory is relevant enough to inject. NOTE: tune conservatively; with the current
            small embedding model, genuinely relevant matches can score modestly, so an aggressive floor
            may drop real results.'
        source:
          anyOf:
          - type: string
          - type: 'null'
          title: Source
          description: Filter results by capture source (e.g. 'api', 'slack', 'gmail', 'browser'). Only
            returns memories from this source.
        budget_tokens:
          anyOf:
          - type: integer
          - type: 'null'
          title: Budget Tokens
        org_ulid:
          anyOf:
          - type: string
          - type: 'null'
          title: Org Ulid
        redact:
          anyOf:
          - type: boolean
          - type: 'null'
          title: Redact
          description: 'Read-time PII redaction override. Omitted/None = fail-safe default (redact hard
            PII unless the request is a recognised owner-portal read). `false` = return raw values (owner
            viewing their own data); `true` = force redaction. Agent/MCP surfaces (X-MI-Source: mcp) are
            always redacted and ignore this flag. Separate from `pii_handling`, which governs capture-time
            storage. See finding R11.'
      type: object
      required:
      - query
      title: SearchRequest
      description: Semantic search over the caller's UMO corpus.
    ProcessRequest:
      properties:
        content:
          anyOf:
          - type: string
          - $ref: '#/components/schemas/EncryptedContentRequest'
          title: Content
          description: Raw text content or an AES-256-GCM encrypted payload from the Python SDK.
        retention_policy:
          $ref: '#/components/schemas/RetentionPolicyRequest'
          description: Controls what is persisted. `meaning_only` stores semantic derivatives only — raw
            content is never saved.
          default: meaning_only
        pii_handling:
          $ref: '#/components/schemas/PIIHandlingRequest'
          description: How to handle detected PII before storage.
          default: extract_and_redact
        provenance_mode:
          $ref: '#/components/schemas/ProvenanceModeRequest'
          description: Level of provenance tracking. `audit` mode stores a full hash chain verifiable
            via mi.verify().
          default: standard
        scope:
          $ref: '#/components/schemas/ScopeRequest'
          default: user
        scope_id:
          anyOf:
          - type: string
          - type: 'null'
          title: Scope Id
          description: Scoped resource ID (e.g. project ULID when scope=project).
        source:
          type: string
          title: Source
          description: Origin of the content (e.g. 'api', 'slack', 'gmail', 'browser'). Free-form string
            stored in provenance.
          default: api
        capture_trigger:
          $ref: '#/components/schemas/CaptureTriggerRequest'
          description: How this capture was initiated. Use 'explicit' when calling mi.capture() directly.
            The SDK sets 'middleware', 'decorator', or 'source_sync' automatically — you do not need to
            set this manually.
          default: explicit
        actor_type:
          $ref: '#/components/schemas/ActorTypeRequest'
          description: WHO created this content — 'human' (real user), 'agent' (AI-generated), or 'system'
            (automated pipeline). Recorded in the provenance origin step and surfaced in search, explain,
            and verify responses. This is how MI distinguishes real memories from AI-derived or system-synthesised
            content.
          default: human
        device_id:
          anyOf:
          - type: string
            maxLength: 64
          - type: 'null'
          title: Device Id
          description: Persistent device identifier (e.g. iOS identifierForVendor, a self-issued ULID
            stored in Keychain). Ties a capture to a specific physical device for provenance. Optional
            — omit if the source is a server-side integration.
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
          description: Arbitrary key-value pairs stored in the UMO. Useful for application-level tagging.
        tags:
          anyOf:
          - items:
              type: string
            type: array
            maxItems: 50
          - type: 'null'
          title: Tags
          description: Caller-supplied tags merged with pipeline-derived tags on the resulting UMO. Used
            by /v1/memories/query tag filter. Free-form strings; convention encouraged (e.g. 'signal',
            'competitive', '<competitor>'). Up to 50.
        org_ulid:
          anyOf:
          - type: string
          - type: 'null'
          title: Org Ulid
          description: Organisation ULID for multi-tenant deployments.
        enable_chunking:
          type: boolean
          title: Enable Chunking
          description: Enable automatic chunking for large content. Creates a parent UMO with child chunks.
          default: false
        chunk_threshold:
          type: integer
          maximum: 50000.0
          minimum: 500.0
          title: Chunk Threshold
          description: Character threshold for chunking. Content exceeding this triggers chunking.
          default: 3000
        claim_granular:
          type: boolean
          title: Claim Granular
          description: Persist long content as a parent UMO plus one child UMO per claim (lineage-linked).
            Each claim is independently retrievable. Set by mi_capture by default.
          default: false
        claim_level:
          type: string
          title: Claim Level
          description: 'Claim boundary granularity when claim_granular=true: ''sentence'' (one atom per
            sentence), ''compound'' (sentence base, split only genuine multi-assertion sentences — recommended),
            or ''assertion'' (one atom per clause).'
          default: compound
      type: object
      required:
      - content
      title: ProcessRequest
      description: 'Capture raw content and convert it into a Unified Memory Object (UMO).


        The 7-stage pipeline (CAPTURE → NORMALIZE → EXTRACT → ENRICH → PARSE →

        EMBED → VALIDATE) runs synchronously. Raw content is discarded after

        processing when `retention_policy` is `meaning_only` (the default).'
    CaptureTriggerRequest:
      type: string
      enum:
      - explicit
      - middleware
      - decorator
      - source_sync
      title: CaptureTriggerRequest
      description: 'How this capture was initiated.


        Stored in UMO metadata and used for:

        - Search reranking: `explicit` captures rank above ambient ones by default.

        - Observability: breakdown of capture modes in usage metrics.

        - Filtering: developers can exclude middleware captures from certain queries.


        Values:

        - `explicit`    — developer called mi.capture() directly (default)

        - `middleware`  — captured automatically by mi.CaptureMiddleware

        - `decorator`   — captured by the @mi.capture function decorator

        - `source_sync` — captured by a connected source (Slack, Gmail, etc.)'
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer
