> ## 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 a memory by ID



## OpenAPI

````yaml /openapi.yaml get /api/memories/{id}
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/{id}:
    get:
      tags:
        - Memories
      summary: Get a memory by ID
      operationId: getMemory
      parameters:
        - $ref: '#/components/parameters/MemoryId'
        - in: query
          name: scope
          schema:
            type: string
            maxLength: 200
          description: >-
            Hard isolation boundary. When provided, the memory must belong to
            this scope.
      responses:
        '200':
          description: Full memory record.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Memory'
        '404':
          description: Memory not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    MemoryId:
      in: path
      name: id
      required: true
      schema:
        type: string
        format: uuid
      description: Memory UUID.
  schemas:
    Memory:
      type: object
      required:
        - id
        - userId
        - content
        - source
        - isCurrent
        - version
        - createdAt
      properties:
        id:
          type: string
          format: uuid
        userId:
          type: string
        content:
          type: string
        category:
          $ref: '#/components/schemas/MemoryCategory'
        scope:
          type: string
          nullable: true
        project:
          type: string
          nullable: true
        source:
          $ref: '#/components/schemas/MemorySource'
        isCurrent:
          type: boolean
          description: Whether this is the current version of this memory.
        supersedesId:
          type: string
          format: uuid
          nullable: true
          description: ID of the memory this version superseded.
        rootId:
          type: string
          format: uuid
          nullable: true
          description: ID of the original memory in the version chain.
        version:
          type: integer
          description: Version number in the chain (starts at 1).
        validFrom:
          type: string
          format: date-time
          nullable: true
        validUntil:
          type: string
          format: date-time
          nullable: true
          description: ISO 8601 datetime after which this memory is considered expired.
        createdAt:
          type: string
          format: date-time
    ErrorResponse:
      type: object
      required:
        - error
      properties:
        error:
          type: string
          description: Human-readable error message.
        code:
          type: string
          description: Machine-readable error code (e.g. `HTTP_404`, `INTERNAL_ERROR`).
        requestId:
          type: string
          description: >-
            Unique request ID for tracing. Also returned in the `X-Request-Id`
            response header.
        errorId:
          type: string
          description: Unique error ID for support reference (format `ERR_XXXXXXXX`).
    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").
    MemorySource:
      type: string
      enum:
        - mcp
        - web
        - api
        - openclaw
      description: |
        Where the memory originated.
        - `mcp` - Saved via MCP tool.
        - `web` - Saved from the dashboard.
        - `api` - Saved via REST API (default).
        - `openclaw` - Saved via OpenClaw integration.
  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.

````