> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reilabs.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Memory Query



## OpenAPI

````yaml /neuroadapt-openapi.json post /api/v1/memory/query
openapi: 3.0.3
info:
  title: Neuroadapt API
  version: 1.0.0
  description: >-
    Neuroadapt is a local, non-LLM memory and reasoning API exposed through an
    authenticating go-proxy. It stores session-scoped events, retrieves relevant
    evidence, exposes concept-level reasoning signals, and keeps enough state
    for frontend clients to inspect what the system knows.


    ## Authentication


    Send `Authorization: Bearer <secretToken>`. The proxy looks the token up in
    the MongoDB `agents` collection and **forces `session_id = agentId` on every
    request**. Any `session_id` you put in the body (or in the
    `/memz/memories/{session_id}` path) is overwritten by the proxy, so the
    value you send is a placeholder. A missing or invalid token returns `401`.


    The core memory endpoints do not call an LLM; the OpenAI-compatible chat
    route is present only for compatibility.


    ## API prefix


    The versioned API is served under `/api/v1`. Equivalent bowtie-compatible
    prefixes are also available: `/public/rei-ai-bowtie/v4` and
    `/rei-ai-bowtie/v4`.
servers:
  - url: https://rei-neuroadapt-api.reilabs.org
    description: UAT (proxied, authenticated)
security:
  - BearerAuth: []
tags:
  - name: System
    description: >-
      Health and version checks. Public — no auth required (passed through by
      the proxy).
  - name: Memory
    description: Session-scoped, non-LLM memory and reasoning endpoints (/api/v1/memory/*).
  - name: Domains
    description: >-
      Closed-source expansion surface. Declare schemas, rules, events, queries,
      and feedback over HTTP (/api/v1/domains/*).
  - name: Legacy
    description: Low-level memory API (/memz/*).
  - name: Chat
    description: >-
      OpenAI-compatible chat completion route. Use only when you explicitly want
      the chat pipeline.
paths:
  /api/v1/memory/query:
    post:
      tags:
        - Memory
      summary: Memory Query
      operationId: memory_query_api_v1_memory_query_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MemoryQueryRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                additionalProperties: true
                type: object
                title: Response Memory Query Api V1 Memory Query Post
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    MemoryQueryRequest:
      properties:
        session_id:
          type: string
          minLength: 1
          title: Session Id
        user_message:
          type: string
          minLength: 1
          title: User Message
        top_k:
          type: integer
          maximum: 100
          minimum: 1
          title: Top K
          default: 10
        include_reasoning:
          type: boolean
          title: Include Reasoning
          default: false
        metadata_filter:
          title: Metadata Filter
          additionalProperties: true
          type: object
          nullable: true
        update_memory_state:
          type: boolean
          title: Update Memory State
          default: true
      additionalProperties: false
      type: object
      required:
        - session_id
        - user_message
      title: MemoryQueryRequest
    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
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: >-
        Unit API Key mapped to an agent in the `agents` collection. The proxy
        forces `session_id = agentId`.

````