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

# Create Memory

> Create a new memory entry



## OpenAPI

````yaml /api-reference/openapi/EvoAI-Knowledge-Service/memory.yaml post /api/v1/memory
openapi: 3.1.0
info:
  title: Evolution Foundation - Knowledge Service - Memory
  description: Knowledge base and memory management
  version: 1.0.0
servers:
  - url: https://api.evoai.app
    description: Production server
  - url: http://localhost:3005
    description: Development server
    variables:
      port:
        default: '3005'
  - url: '{customUrl}'
    description: Custom server
    variables:
      customUrl:
        default: https://your-instance.com
        description: Enter your server URL
security: []
paths:
  /api/v1/memory:
    post:
      summary: Create Memory
      description: Create a new memory entry
      operationId: create_memory_api_v1_memory_post
      parameters:
        - name: x-client-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: X-Client-Id
        - name: x-memory-base-config-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
                format: uuid
              - type: 'null'
            title: X-Memory-Base-Config-Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MemoryCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SuccessResponse_MemoryCreateResponse_'
        '400':
          description: Bad Request (invalid data)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: BAD_REQUEST
                  message: Invalid input data
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/memory
                  method: POST
        '401':
          description: Unauthorized (invalid or missing token)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: UNAUTHORIZED
                  message: Invalid or missing authentication token
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/memory
                  method: POST
        '403':
          description: Forbidden (insufficient permissions)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: FORBIDDEN
                  message: Insufficient permissions to perform this action
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/memory
                  method: POST
        '404':
          description: Not Found (resource not found)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: NOT_FOUND
                  message: Memory base configuration not found
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/memory
                  method: POST
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error (server error)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                success: false
                error:
                  code: INTERNAL_SERVER_ERROR
                  message: An unexpected error occurred
                meta:
                  timestamp: '2024-01-15T10:30:00Z'
                  path: /api/v1/memory
                  method: POST
components:
  schemas:
    MemoryCreate:
      properties:
        app_name:
          type: string
          title: App Name
          description: Application name (usually agent_id)
        user_id:
          type: string
          title: User Id
          description: User ID
        content:
          type: string
          title: Content
          description: Memory content to store
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Optional metadata dictionary
        session_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Id
          description: Optional session ID (will be generated if not provided)
        short_term_max_messages:
          anyOf:
            - type: integer
              maximum: 500
              minimum: 10
            - type: 'null'
          title: Short Term Max Messages
          description: Maximum messages in short-term memory before compression
        compression_interval:
          anyOf:
            - type: integer
              maximum: 100
              minimum: 5
            - type: 'null'
          title: Compression Interval
          description: Compress every N messages to medium-term memory
      type: object
      required:
        - app_name
        - user_id
        - content
      title: MemoryCreate
      description: Schema for creating memory entries
    SuccessResponse_MemoryCreateResponse_:
      properties:
        success:
          type: boolean
          title: Success
          description: Success indicator
          default: true
        data:
          $ref: aeeb921d-5835-49b8-9656-4d39c2a8796b
          description: Response payload
        meta:
          $ref: be7b1a98-fc3c-4438-8cac-b48d3905187c
          description: Metadata
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          description: Optional success message
      type: object
      required:
        - data
        - meta
      title: SuccessResponse[MemoryCreateResponse]
    ErrorResponse:
      properties:
        success:
          type: boolean
          title: Success
          description: Success indicator
          default: false
        error: 3b56b665-e9c0-41b1-a37c-355a53be9c43
        meta:
          $ref: 50f39c23-fe22-4b97-8f84-b0fff72697b7
          description: Metadata
      type: object
      required:
        - error
        - meta
      title: ErrorResponse
      description: |-
        Standard error response schema matching error_response() return format.

        This schema matches the structure returned by error_response() function,
        which always uses ErrorInfo for the error field.
    HTTPValidationError:
      properties:
        detail:
          items: f4eb5d82-0acd-4e49-a748-7e7b04b04962
          type: array
          title: Detail
      type: object
      title: HTTPValidationError

````

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