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

# Get user memory

> Get memory for a user. With `?role=`, returns a flat key-value map for that role. Without `role`, returns memory grouped by all roles.



## OpenAPI

````yaml GET /v1/memory/{userId}
openapi: 3.1.0
info:
  title: Kairn API
  version: 1.0.0
  description: >-
    The Kairn API. All requests require an `X-API-Key` header with your tenant
    API key.
servers:
  - url: https://api.kairn.sh
    description: Production
security:
  - ApiKey: []
tags:
  - name: Agent
    description: Invoke agents and stream responses.
  - name: Memory
    description: Read and write per-user agent memory.
  - name: Souls
    description: Manage agent identities.
  - name: Skills
    description: Manage custom skills (instructions and webhook tools).
  - name: Mandates
    description: Schedule autonomous agent tasks.
  - name: Invocations
    description: Inspect past agent runs.
  - name: Sessions
    description: Access multi-turn conversation history.
  - name: Audit
    description: Audit log for all agent activity.
paths:
  /v1/memory/{userId}:
    get:
      tags:
        - Memory
      summary: Get user memory
      description: >-
        Get memory for a user. With `?role=`, returns a flat key-value map for
        that role. Without `role`, returns memory grouped by all roles.
      operationId: memory-get
      parameters:
        - name: userId
          in: path
          required: true
          schema:
            type: string
          example: user_123
        - name: role
          in: query
          schema:
            type: string
          description: Filter to a specific role. Omit to get all roles.
      responses:
        '200':
          description: Memory for the user.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/MemoryMap'
                  - $ref: '#/components/schemas/MemorySummary'
components:
  schemas:
    MemoryMap:
      type: object
      additionalProperties:
        type: string
      description: Flat key-value map of memory entries.
      example:
        name: Alex
        plan: pro
        open_tickets: '2'
    MemorySummary:
      type: object
      additionalProperties:
        $ref: '#/components/schemas/MemoryMap'
      description: Memory grouped by role.
      example:
        default:
          name: Alex
        manager:
          team_size: '12'
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: X-API-Key

````

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