> ## 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.

# Ingest a file as context

> Extract, chunk, embed, and store a .md/.txt/.pdf file from the daemon's machine.
A document mirrors its file: re-adding an unchanged file is a no-op
(`unchanged`), a changed file replaces its chunks (`updated`). Markdown chunks carry
their heading breadcrumb; PDF chunks keep their page number. Chunks surface in normal
`/memory/query` results with a `source`.




## OpenAPI

````yaml /openapi.yaml post /context/add
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:
  /context/add:
    post:
      summary: Ingest a file as context
      description: >
        Extract, chunk, embed, and store a .md/.txt/.pdf file from the daemon's
        machine.

        A document mirrors its file: re-adding an unchanged file is a no-op

        (`unchanged`), a changed file replaces its chunks (`updated`). Markdown
        chunks carry

        their heading breadcrumb; PDF chunks keep their page number. Chunks
        surface in normal

        `/memory/query` results with a `source`.
      operationId: contextAdd
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - path
              properties:
                path:
                  type: string
                  description: Absolute path to a .md, .txt, or .pdf file on this machine.
                  example: C:\Users\me\notes\setup.md
      responses:
        '200':
          description: What happened to the document.
          content:
            application/json:
              schema:
                type: object
                properties:
                  documentId:
                    type: string
                  outcome:
                    type: string
                    enum:
                      - added
                      - updated
                      - unchanged
                      - converted
                      - exists
                    description: >-
                      `converted` means the path matched an earlier upload
                      snapshot, which was absorbed into this linked document.
                      `exists` means the content is already present as a linked
                      document.
                  title:
                    type: string
                    example: Deploy Guide
                  chunks:
                    type: integer
                    example: 12
        '400':
          $ref: '#/components/responses/ValidationError'
        '503':
          $ref: '#/components/responses/StoreLocked'
components:
  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.

````