> ## Documentation Index
> Fetch the complete documentation index at: https://memos-api.openmem.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Create memories

> Store new memories in a MemCube.



## OpenAPI

````yaml POST /memories
openapi: 3.1.0
info:
  title: MemOS REST APIs
  description: A REST API for managing and searching memories using MemOS.
  version: 1.0.0
servers: []
security: []
paths:
  /memories:
    post:
      summary: Create memories
      description: Store new memories in a MemCube.
      operationId: add_memory_memories_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MemoryCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SimpleResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    MemoryCreate:
      properties:
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
          description: User ID for the request
          example: user123
        messages:
          anyOf:
            - items:
                $ref: '#/components/schemas/Message'
              type: array
            - type: 'null'
          title: Messages
          description: List of messages to store.
          example:
            - content: Hello
              role: user
        mem_cube_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Mem Cube Id
          description: ID of the memory cube
          example: cube123
        memory_content:
          anyOf:
            - type: string
            - type: 'null'
          title: Memory Content
          description: Content to store as memory
          example: This is a memory content
        doc_path:
          anyOf:
            - type: string
            - type: 'null'
          title: Doc Path
          description: Path to document to store
          example: /path/to/document.txt
      type: object
      title: MemoryCreate
    SimpleResponse:
      properties:
        code:
          type: integer
          title: Code
          description: Response status code
          default: 200
          example: 200
        message:
          type: string
          title: Message
          description: Response message
          example: Operation successful
        data:
          type: 'null'
          title: Data
          description: Response data
      type: object
      required:
        - message
      title: SimpleResponse
      description: Simple response model for operations without data return.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    Message:
      properties:
        role:
          type: string
          title: Role
          description: Role of the message (user or assistant).
          example: user
        content:
          type: string
          title: Content
          description: Message content.
          example: Hello, how can I help you?
      type: object
      required:
        - role
        - content
      title: Message
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````