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

# Create or Update Memory

> Upsert a memory entry by key. If the key exists, the value is updated.



## OpenAPI

````yaml POST /api/chat/memory
openapi: 3.0.3
info:
  title: Sontairo API
  description: REST API for the Sontairo AI agent orchestration platform
  version: 1.0.0
servers:
  - url: https://www.sontairo.com
security:
  - bearerAuth: []
  - cookieAuth: []
paths:
  /api/chat/memory:
    post:
      tags:
        - Memory
      summary: Create or update memory
      description: Upsert a memory entry by key. If the key exists, the value is updated.
      operationId: upsertMemory
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - workspaceId
                - key
                - value
              properties:
                workspaceId:
                  type: string
                projectId:
                  type: string
                  nullable: true
                key:
                  type: string
                  minLength: 1
                  maxLength: 255
                  description: Unique key for the memory entry
                value:
                  type: string
                  minLength: 1
                  description: Memory content
                category:
                  type: string
                  default: general
                  description: Category for organizing memory
      responses:
        '201':
          description: Memory created or updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/Memory'
components:
  schemas:
    Memory:
      type: object
      properties:
        id:
          type: string
        workspaceId:
          type: string
        projectId:
          type: string
          nullable: true
        key:
          type: string
        value:
          type: string
        category:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Session token issued by the desktop/native auth exchange, sent as
        Authorization: Bearer <token>.
    cookieAuth:
      type: apiKey
      in: cookie
      name: session
      description: Browser session cookie set by the web sign-in flow.

````