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

# Remember a fact

> Store one fact so the agent can recall it later by meaning. The text is embedded on write; retrieval is semantic, not keyword.

**Scope goes in the body here.** Pass `scope` plus the matching `contactId` / `conversationId`. Omit it for the project scope. Every read endpoint takes the scope as a `?scope=` query parameter instead — see the `scope` parameter on `GET /v1/memory`.

**One fact per call.** A paragraph carrying five unrelated facts is embedded as an average of all five and retrieved well by none of them.



## OpenAPI

````yaml /openapi.json post /v1/memory
openapi: 3.0.3
info:
  title: Zavu Unified Messaging Layer API
  version: 0.2.0
  description: >
    Unified multi-channel messaging API for Zavu.


    Supported channels:

    - **SMS**: Simple text messages

    - **WhatsApp**: Rich messaging with media, buttons, lists, CTA URL buttons,
    location requests, and templates

    - **Telegram**: Bot messaging with text, media, and interactive elements

    - **Email**: Transactional emails via Amazon SES


    Design goals:

    - Simple `send()` entrypoint for developers

    - Project-level authentication via Bearer token

    - Support for all WhatsApp message types (text, image, video, audio,
    document, sticker, location, contact, buttons, list, cta_url,
    location_request, reaction, template)

    - If a non-text message type is sent, WhatsApp channel is used automatically

    - 24-hour WhatsApp conversation window enforcement

    - Universal `to` field accepts phone numbers (E.164), email addresses, or
    numeric chat IDs (Telegram/Instagram/Messenger)
servers:
  - url: https://api.zavu.dev
security:
  - bearerAuth: []
paths:
  /v1/memory:
    post:
      tags:
        - Memory
      summary: Remember a fact
      description: >-
        Store one fact so the agent can recall it later by meaning. The text is
        embedded on write; retrieval is semantic, not keyword.


        **Scope goes in the body here.** Pass `scope` plus the matching
        `contactId` / `conversationId`. Omit it for the project scope. Every
        read endpoint takes the scope as a `?scope=` query parameter instead —
        see the `scope` parameter on `GET /v1/memory`.


        **One fact per call.** A paragraph carrying five unrelated facts is
        embedded as an average of all five and retrieved well by none of them.
      operationId: addMemory
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MemoryAddRequest'
            examples:
              project:
                summary: A fact the whole project shares
                value:
                  text: Orders placed before 2pm ship the same day.
              contact:
                summary: A fact about one person
                value:
                  text: Prefers WhatsApp over email.
                  scope: contact
                  contactId: jd7x2k3m4n5p6q7r8s9t0abc
                  metadata:
                    source: onboarding
              expiring:
                summary: A fact that expires
                value:
                  text: Currently travelling, back on the 14th.
                  scope: contact
                  contactId: jd7x2k3m4n5p6q7r8s9t0abc
                  ttlSeconds: 1209600
      responses:
        '201':
          description: Fact stored.
          content:
            application/json:
              schema:
                type: object
                required:
                  - memory
                properties:
                  memory:
                    $ref: '#/components/schemas/MemoryRecord'
        '400':
          description: Invalid body, oversized text, or a scope without its id.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '429':
          description: >-
            A quota is exhausted. `memory_scope_full` means this scope is at its
            cap (10,000 facts for project, 2,000 per contact, 1,000 per
            conversation); `memory_limit_exceeded` means the plan's monthly unit
            quota is spent. Reads and deletes keep working in both cases.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                scope_full:
                  summary: Scope at capacity
                  value:
                    code: memory_scope_full
                    message: >-
                      This memory scope is full. Delete facts you no longer
                      need, or store them under a narrower scope.
        '503':
          description: Memory is not available for this deployment.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    MemoryAddRequest:
      type: object
      description: >-
        Store one fact. It is embedded on write, so it becomes searchable by
        meaning rather than by keyword.
      required:
        - text
      properties:
        text:
          type: string
          description: >-
            What to remember. Max 8,192 bytes of UTF-8. Write one fact per call:
            a paragraph holding five unrelated facts embeds as an average of all
            five and is retrieved well by none of them.
          example: >-
            Prefers to be contacted in the morning, and by WhatsApp rather than
            email.
        scope:
          $ref: '#/components/schemas/MemoryScope'
        contactId:
          type: string
          description: Required when `scope` is `contact`.
        conversationId:
          type: string
          description: Required when `scope` is `conversation`.
        metadata:
          type: object
          description: >-
            Arbitrary string tags stored alongside the fact and returned with
            it. Keys max 64 chars, values max 512, whole object max 2,048 bytes.
            Not searchable — search matches `text` only.
          additionalProperties:
            type: string
        ttlSeconds:
          type: integer
          description: >-
            Delete the fact after this many seconds. 60 to 63,072,000 (2 years).
            Omit to keep it until deleted.
          minimum: 60
          maximum: 63072000
    MemoryRecord:
      type: object
      description: A stored fact, as returned when it is created.
      required:
        - id
        - scope
        - createdAt
      properties:
        id:
          type: string
          example: m7x2k3m4n5p6q7r8s9t0
        scope:
          $ref: '#/components/schemas/MemoryScope'
        createdAt:
          type: string
          format: date-time
        expiresAt:
          type: string
          format: date-time
          description: >-
            When the fact self-deletes. Present only when it was stored with
            `ttlSeconds`, or when the key is a test-mode key (forced to 30
            days).
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: invalid_request
        message:
          type: string
          example: Phone number is invalid
        details:
          type: object
          additionalProperties: true
    MemoryScope:
      type: string
      description: >-
        Which namespace a memory belongs to. Scopes are isolated: a search in
        one never returns a memory from another.


        - `project`: shared by the whole project. What the agent knows in
        general.

        - `contact`: what the agent knows about one person, across every
        conversation with them.

        - `conversation`: what the agent knows about one inbox thread.


        Defaults to `project` everywhere. `contact` and `conversation` require
        the matching id.
      enum:
        - project
        - contact
        - conversation
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````