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

# Save a memory

> Save a memory through the belief pipeline: exact-duplicate detection, semantic dedup, and
contradiction detection. A contradiction keeps **both** memories active and returns
`outcome: conflict` with a `conflictId` for you to resolve. Nothing is overwritten.

In offline mode (no `OPENROUTER_API_KEY`) dedup is off and every save is `added`.




## OpenAPI

````yaml /openapi.yaml post /memory/save
openapi: 3.1.0
info:
  title: memloom local API
  version: 0.1.0
  description: >
    The HTTP API served by the `memloom serve` daemon on your machine. The CLI,
    the MCP server,

    and the viewer all route through this API. The daemon is the single owner of
    the store, so

    every client shares one consistent view of your memories.


    No authentication: the daemon binds to `127.0.0.1` only and is reachable
    solely from your

    own machine. Browser clients on other localhost ports are allowed via CORS.
servers:
  - url: http://127.0.0.1:4319
    description: Local memloom daemon
security: []
paths:
  /memory/save:
    post:
      summary: Save a memory
      description: >
        Save a memory through the belief pipeline: exact-duplicate detection,
        semantic dedup, and

        contradiction detection. A contradiction keeps **both** memories active
        and returns

        `outcome: conflict` with a `conflictId` for you to resolve. Nothing is
        overwritten.


        In offline mode (no `OPENROUTER_API_KEY`) dedup is off and every save is
        `added`.
      operationId: saveMemory
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SaveInput'
      responses:
        '200':
          description: The save decision.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SaveResult'
        '400':
          $ref: '#/components/responses/ValidationError'
        '503':
          $ref: '#/components/responses/StoreLocked'
components:
  schemas:
    SaveInput:
      type: object
      required:
        - content
      properties:
        content:
          type: string
          description: The memory text to save.
          example: the staging database runs on Postgres 17
        canonical:
          type: string
          description: Optional short canonical form used for exact-duplicate detection.
          example: staging database engine
        memoryType:
          type: string
          enum:
            - fact
            - preference
            - episode
            - procedure
          default: fact
          description: >-
            The kind of memory (defaults to `fact`): `fact` is a stable truth
            about the world or the user; `preference` is how the user likes
            things done; `episode` is a time-bound event or decision;
            `procedure` is reusable how-to steps.
          example: fact
        ownerId:
          type: string
          description: >-
            Owner UUID. Defaults to the fixed single-user sentinel in the
            embedded tier.
    SaveResult:
      type: object
      required:
        - id
        - outcome
      properties:
        id:
          type: string
          description: Id of the saved (or merged-into) memory.
        outcome:
          type: string
          enum:
            - added
            - merged
            - versioned
            - conflict
          description: >-
            What the belief pipeline did. `versioned` means the save restated an
            existing belief and became its new current version.
        conflictId:
          type: string
          description: >-
            Present when `outcome` is `conflict`; resolve it via the conflicts
            endpoints.
        version:
          type: integer
          description: >-
            Present when `outcome` is `versioned`; the new version number (2 or
            higher).
  responses:
    ValidationError:
      description: The request body failed validation. `issues` names each offending field.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: invalid request body
              issues:
                type: array
                items:
                  type: object
                  properties:
                    path:
                      type: string
                      example: query
                    message:
                      type: string
                      example: query must be a non-empty string
    StoreLocked:
      description: >
        The store is held by a connected Postgres wire client (Drizzle Studio,
        psql). PGLite is

        single-connection; disconnect that client and retry. All `/memory/*`
        endpoints can

        return this.
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: >-
                  the store is locked by a connected Postgres wire client
                  (Drizzle Studio, psql, a DB panel). PGLite is
                  single-connection; disconnect that client and retry.

````