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

# Partially update document file

> Refresh only the file-backed fields you provide. Supplying a file replaces the canonical content; omitted metadata and processing context remain unchanged.



## OpenAPI

````yaml https://api.supermemory.ai/v5/openapi patch /ns/{namespace}/document/file/{id}
openapi: 3.1.0
info:
  title: supermemory API
  description: >-
    The Memory API for the AI era. OpenAPI operations include x-codeSamples for
    the official TypeScript and Python SDKs (Mintlify-compatible).
  version: 5.0.0
servers:
  - description: Production Server
    url: https://api.supermemory.ai
security:
  - bearerAuth: []
tags:
  - name: Ingest
    description: Ingest documents, files, URLs, conversations, and other content
  - name: Recall (Search)
    description: >-
      Semantic recall across your content — supports memories, hybrid, and
      documents modes
  - name: Profiles
    description: Maintained static, dynamic, and custom-bucket profiles scoped by namespace
  - name: Content Management
    description: List, get, update, and delete content and memories
  - name: Namespaces
    description: List and manage isolated namespaces and their settings
  - name: Connectors
    description: >-
      Sync external sources such as Google Drive, Notion and GitHub into a
      namespace
  - name: Organization
    description: Read and update organization-wide settings
paths:
  /ns/{namespace}/document/file/{id}:
    patch:
      tags:
        - Ingest
      summary: Partially update document file
      description: >-
        Refresh only the file-backed fields you provide. Supplying a file
        replaces the canonical content; omitted metadata and processing context
        remain unchanged.
      operationId: patchNsByNamespaceDocumentFileById
      parameters:
        - in: path
          name: namespace
          schema:
            type: string
            maxLength: 100
            pattern: ^[a-zA-Z0-9_:-]+$
            example: user_alex
          required: true
          description: >-
            The isolated namespace. This can be an ID for your user, a project
            ID, or any other identifier you wish to use to scope documents.
        - in: path
          name: id
          schema:
            type: string
            minLength: 1
            maxLength: 255
            example: my-doc-123
          required: true
          description: The public document ID
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  description: File contents to upload
                  format: binary
                  type: string
                supportingContext:
                  description: >-
                    Context used to guide memory extraction within this
                    namespace. Max 1500 characters.
                  example: Focus on product decisions, dates, and owners.
                  type: string
                  maxLength: 1500
                metadata:
                  description: >-
                    JSON-encoded metadata to attach to the document and its
                    derived memories
                  type: string
                group:
                  description: >-
                    JSON-encoded metadata used to keep related context isolated
                    during processing and recall
                  type: string
                date:
                  description: When the source content is from, in ISO 8601 format
                  example: '2026-01-15'
                  type: string
                taskType:
                  description: >-
                    Processing pipeline. "memory" builds durable learned
                    context; "superrag" optimizes the document for retrieval
                    without generating memories.
                  type: string
                  enum:
                    - memory
                    - superrag
                dreaming:
                  description: >-
                    Processing mode. "dynamic" (default) groups related
                    documents so memories form from coherent context. "instant"
                    processes each document independently right away and bills
                    one extra operation per document.
                  type: string
                  enum:
                    - dynamic
                    - instant
                fileType:
                  description: >-
                    Explicit source type used when automatic inference is
                    insufficient
                  type: string
                  enum:
                    - text
                    - pdf
                    - image
                    - video
                    - audio
                mimeType:
                  description: Explicit MIME type used when upload metadata is insufficient
                  type: string
                  pattern: ^[^\s/]+\/[^\s/]+$
              additionalProperties: false
      responses:
        '200':
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    minLength: 1
                    description: Document identifier to poll or retrieve
                  status:
                    type: string
                    enum:
                      - unknown
                      - queued
                      - extracting
                      - chunking
                      - embedding
                      - indexing
                      - done
                      - failed
                    description: >-
                      The document's processing state after this request. queued
                      when new work was queued; otherwise its current state,
                      e.g. done for an unchanged duplicate or failed for a
                      metadata-only update to a failed document.
                required:
                  - id
                  - status
                additionalProperties: false
          description: Update accepted for processing
        '400':
          description: Invalid file request
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/ErrorResponse'
                  - $ref: '#/components/schemas/ValidationErrorResponse'
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unauthorized
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Insufficient balance or document quota
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Write access required for this namespace
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Document not found in this namespace
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Filepath conflict or namespace merge prevents the update
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      x-codeSamples:
        - lang: typescript
          label: TypeScript SDK
          source: >-
            import { Supermemory } from "supermemory";


            const client = new Supermemory(); // reads SUPERMEMORY_API_KEY


            const doc = await client.documents.updateFile("user_123",
            "doc_abc123", {
              metadata: JSON.stringify({ reviewed: true }), // file is optional here
            });

            console.log(doc.status);
        - lang: python
          label: Python SDK
          source: |-
            from supermemory import Supermemory
            import json
            client = Supermemory()  # reads SUPERMEMORY_API_KEY

            doc = client.documents.update_file(
                "user_123",
                "doc_abc123",
                metadata=json.dumps({"reviewed": True}),  # file is optional here
            )
            print(doc.status)
        - lang: bash
          label: cURL
          source: >-
            curl -X PATCH
            "https://api.supermemory.ai/ns/user_123/document/file/doc_abc123" \
              -H "Authorization: Bearer $SUPERMEMORY_API_KEY" \
              -F 'metadata={"reviewed":true}'
components:
  schemas:
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
          description: Error message
          example: Invalid request parameters
        details:
          type: string
          description: Additional error details
          example: Query must be at least 1 character long
      required:
        - error
    ValidationErrorResponse:
      type: object
      description: Body returned when request input fails schema validation
      properties:
        success:
          type: boolean
          enum:
            - false
        error:
          type: array
          description: Validation issues
          items:
            type: object
            properties:
              message:
                type: string
              path:
                type: array
                items:
                  oneOf:
                    - type: string
                    - type: number
            required:
              - message
        data:
          description: The input that failed validation
      required:
        - success
        - error
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http

````

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