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

# Update a memory file

> Update content, purpose, or both. With an API token, namespace, path, and version are required. version is the opaque token from the last read. A stale version returns 409. A malformed version returns 422. Send only the fields you want to change. A JSON null leaves the stored value unchanged and still returns 200. There is no way to clear a field.



## OpenAPI

````yaml /openapi.json put /memory/file
openapi: 3.1.0
info:
  title: cominty/cominty
  description: |

    ### Cominty Meta:

    ```json
    {
      "VERSION_TAG": "eng-997-add-organization-scoped-memory-namespaces.6928eb8",
      "VERSION_AT": "2026-10-07T14:46:28+02:00",
      "DEPLOYED_BY": "github-actions::elfominty",
      "DEPLOYED_AT": "2026-10-07T13:06:50Z",
      "AWS_SECRET_NAME": "cominty-monorepo-dev-python-api",
      "AWS_SECRET_VERSION": "3de071f4-5485-4bf2-a676-0f72bf7aa59f",
      "AWS_SECRET_REGION": "eu-west-3"
    }
    ```
  version: eng-997-add-organization-scoped-memory-namespaces.6928eb8
servers:
  - url: https://ds.cominty.com
security:
  - comintyToken: []
paths:
  /memory/file:
    put:
      tags:
        - memory
      summary: Update a memory file
      description: >-
        Update content, purpose, or both. With an API token, namespace, path,
        and version are required. version is the opaque token from the last
        read. A stale version returns 409. A malformed version returns 422. Send
        only the fields you want to change. A JSON null leaves the stored value
        unchanged and still returns 200. There is no way to clear a field.
      operationId: update_memory_file_memory_file_put
      parameters:
        - name: path
          in: query
          required: true
          schema:
            type: string
            title: Path
          description: >-
            Relative path with at most one folder segment, for example
            notes/todo.md. a/b/todo.md returns 422.
        - name: version
          in: query
          required: true
          schema:
            type: string
            format: date-time
            title: Version
          description: >-
            Opaque token from the last read of this file. A stale value returns
            409. A malformed value returns 422. Send it back unchanged.
        - name: namespace
          in: query
          required: false
          schema:
            anyOf:
              - type: string
                maxLength: 128
              - type: 'null'
            title: Namespace
          description: >-
            Namespace the file belongs to. Required for an API token. Omitting
            it returns 400 Missing namespace. At most 128 characters.
        - name: user_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: User Id
          description: Optional. Does not select the memory namespace.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MemoryFileUpdate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MemoryFileOut'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    MemoryFileUpdate:
      properties:
        content:
          anyOf:
            - type: string
            - type: 'null'
          title: Content
          description: >-
            New body. Omit the field to leave the stored body unchanged. Null
            does not clear it.
        purpose:
          anyOf:
            - type: string
            - type: 'null'
          title: Purpose
          description: >-
            New purpose. Omit the field to leave the stored purpose unchanged.
            Null does not clear it.
      type: object
      title: MemoryFileUpdate
    MemoryFileOut:
      properties:
        path:
          type: string
          title: Path
          description: Path as stored.
        purpose:
          type: string
          title: Purpose
          description: Why the file exists.
        namespace:
          type: string
          title: Namespace
          description: Namespace the file belongs to.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the file was created.
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: When the file was last updated.
        content:
          type: string
          title: Content
          description: File body. May be empty.
        version:
          type: string
          format: date-time
          title: Version
          description: Opaque version identifier; echo back as `version` when updating.
          readOnly: true
      additionalProperties: false
      type: object
      required:
        - path
        - purpose
        - namespace
        - created_at
        - updated_at
        - content
        - version
      title: MemoryFileOut
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    comintyToken:
      type: apiKey
      in: header
      name: x-cominty-token
      description: >-
        A Cominty Platform API secret. A key created now starts with sk-cmt-.
        Send it as is, or as Bearer sk-cmt-..., with at most one Bearer prefix.
        A key created before the prefix existed has no sk-cmt- and still works.

````

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