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

# Get ready-to-inject context

> One call for plugins, hooks and chat apps. Returns the open in-progress note, the user's
preferences and the memories relevant to `query`, rendered as a `<memcontext>` block that
fits in `maxTokens`. Each line shows its date, the app it came from and what it replaced.




## OpenAPI

````yaml /openapi.yaml get /api/memories/context
openapi: 3.1.0
info:
  title: MemContext API
  version: 1.1.0
  description: |
    REST API for persistent, evolving AI memory. Save, search, and manage
    memories with automatic deduplication, version chains, and hybrid retrieval.
servers:
  - url: https://api.memcontext.in
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Memories
    description: Save, search, list, update, and delete memories.
  - name: History
    description: Inspect how memories evolve over time.
  - name: Feedback
    description: Rate retrieval quality to improve future results.
  - name: Profiles
    description: Pre-aggregated user context from memory.
  - name: Workspaces
    description: >-
      Company/team account boundaries for billing, members, API keys, and
      vaults.
  - name: API Keys
    description: Workspace-bound API keys for server-side integrations.
  - name: Subscription
    description: Workspace-owned billing and member-memory limits.
  - name: Context Vault
    description: Document ingestion and workspace RAG retrieval.
paths:
  /api/memories/context:
    get:
      tags:
        - Memories
      summary: Get ready-to-inject context
      description: >
        One call for plugins, hooks and chat apps. Returns the open in-progress
        note, the user's

        preferences and the memories relevant to `query`, rendered as a
        `<memcontext>` block that

        fits in `maxTokens`. Each line shows its date, the app it came from and
        what it replaced.
      operationId: getMemoryContext
      parameters:
        - in: query
          name: query
          schema:
            type: string
            maxLength: 1000
          description: The user's message. Omit to get recent memory instead.
        - in: query
          name: project
          schema:
            type: string
          description: Current project or repo. Picks that project's in-progress note.
        - in: query
          name: scope
          schema:
            type: string
            maxLength: 200
        - in: query
          name: maxTokens
          schema:
            type: integer
            minimum: 100
            maximum: 4000
            default: 600
      responses:
        '200':
          description: Context block and the structured pieces it was built from.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemoryContextResponse'
components:
  schemas:
    MemoryContextResponse:
      type: object
      required:
        - text
        - tokens
        - handoff
        - preferences
        - memories
      properties:
        text:
          type: string
          description: Ready-to-inject `<memcontext>` block for a system prompt or hook.
        tokens:
          type: integer
          description: Approximate token count of `text`.
        handoff:
          allOf:
            - $ref: '#/components/schemas/HandoffNote'
          nullable: true
        preferences:
          type: array
          items:
            $ref: '#/components/schemas/SearchMemoryResult'
        memories:
          type: array
          items:
            $ref: '#/components/schemas/SearchMemoryResult'
    HandoffNote:
      type: object
      required:
        - id
        - content
        - createdAt
      properties:
        id:
          type: string
          format: uuid
        content:
          type: string
        project:
          type: string
        scope:
          type: string
        client:
          type: string
        createdAt:
          type: string
          format: date-time
        validUntil:
          type: string
          format: date-time
    SearchMemoryResult:
      type: object
      required:
        - id
        - content
        - relevance
        - createdAt
      properties:
        id:
          type: string
          format: uuid
        content:
          type: string
        category:
          $ref: '#/components/schemas/MemoryCategory'
        scope:
          type: string
          nullable: true
        project:
          type: string
          nullable: true
        relevance:
          type: number
          minimum: 0
          maximum: 1
          description: Relevance score from 0 (least relevant) to 1 (most relevant).
        createdAt:
          type: string
          format: date-time
        client:
          type: string
          description: App that wrote the memory, when known.
        kind:
          type: string
          enum:
            - handoff
          description: Present for the project's in-progress note.
        previous:
          type: array
          description: Older versions this memory replaced, newest first (up to 3).
          items:
            $ref: '#/components/schemas/MemoryVersionSummary'
    MemoryCategory:
      type: string
      enum:
        - preference
        - fact
        - decision
        - context
      description: |
        - `preference` - User likes or dislikes (e.g. "prefers dark mode").
        - `fact` - Objective information (e.g. "uses macOS").
        - `decision` - Choices made (e.g. "chose the new billing provider").
        - `context` - Background information (e.g. "working on e-commerce app").
    MemoryVersionSummary:
      type: object
      required:
        - content
        - createdAt
      properties:
        content:
          type: string
        createdAt:
          type: string
          format: date-time
        client:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >
        API key created from the MemContext dashboard. Keys are prefixed with
        `mc_`, bound to one workspace, and API-key requests cannot override that
        workspace.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.