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

# Update documents

> Update existing documents by ID with a strongly consistent read followed by a merged replacement. Omitted fields are preserved, nested objects are recursively merged, and arrays are replaced. Indexed fields reject null. A missing ID in the selected branch and partition rejects the whole request with 400 before submission. No document-version precondition is supported; concurrent updates can overwrite each other. The maximum supported payload size is 6MB.



## OpenAPI

````yaml post /collections/{collectionName}/docs/update
openapi: 3.1.1
info:
  title: LambdaDB API
  summary: LambdaDB Open API Spec
  version: 1.1.1
servers:
  - url: https://{projectHost}
    description: LambdaDB API endpoints
    variables:
      projectHost:
        description: The project-scoped URL of the API
        default: api.lambdadb.ai/projects/example-project
security: []
tags:
  - name: collections
    description: Create, describe, configure, list, and delete collections.
  - name: versioning
    description: Manage branches, tags, and aliases within a collection.
  - name: collections.docs
    description: Write, fetch, list, and bulk upload documents.
paths:
  /collections/{collectionName}/docs/update:
    post:
      tags:
        - collections.docs
      summary: Update Documents
      description: >-
        Update existing documents by ID with a strongly consistent read followed
        by a merged replacement. Omitted fields are preserved, nested objects
        are recursively merged, and arrays are replaced. Indexed fields reject
        null. A missing ID in the selected branch and partition rejects the
        whole request with 400 before submission. No document-version
        precondition is supported; concurrent updates can overwrite each other.
        The maximum supported payload size is 6MB.
      operationId: updateDocs
      parameters:
        - $ref: '#/components/parameters/CollectionName'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                docs:
                  type: array
                  items:
                    type: object
                    additionalProperties: true
                    minProperties: 1
                  description: >-
                    Documents to update; each must contain the existing document
                    ID and, for partitioned documents outside __default__, its
                    existing partition-field value. Omitted fields are
                    preserved. Objects merge recursively; arrays and scalars
                    replace existing values. Null is rejected for indexed fields
                    and stored as JSON null for unindexed fields, not as a field
                    deletion. For native embedding fields, an explicitly
                    supplied vector takes precedence. Otherwise equivalent input
                    reuses an existing vector, changed source input regenerates
                    it, and removal of the last source removes an inherited
                    vector. Metadata-only updates preserve direct vectors when
                    raw source fields are unchanged.
                  minItems: 1
                branch:
                  type: string
                  pattern: ^[a-zA-Z0-9_-]{3,52}$
                  description: Write target branch. Defaults to main when omitted.
              required:
                - docs
              additionalProperties: false
            examples:
              example:
                summary: Example request body for documents update
                value:
                  docs:
                    - id: example-id1
                      example-field1: example-value1
                      example-field2:
                        - 0.1
                        - 0.2
                        - 0.3
                    - id: example-id2
                      example-field1: example-value2
                      example-field2:
                        - 0.4
                        - 0.5
                        - 0.6
      responses:
        '202':
          description: Update request accepted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
              examples:
                example:
                  summary: Example response for documents update`
                  value:
                    message: Update request is accepted
        '400':
          description: >-
            Invalid update input, a missing document in the selected branch and
            partition, invalid merged document, or native embedding input
            rejection. These failures occur before the updates are submitted.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequest'
              examples:
                example:
                  summary: Example response for bad request
                  value:
                    message: Invalid request
        '401':
          description: Unauthenticated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Unauthenticated'
              examples:
                example:
                  summary: Example response for authentication failure
                  value:
                    message: Authentication failed
        '403':
          description: Project read, write, storage, or inference quota exceeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MessageResponse'
              example:
                message: Project inference quota exceeded
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResourceNotFound'
              examples:
                example:
                  summary: Example response for resource not found
                  value:
                    message: Resource not found
        '413':
          $ref: '#/components/responses/PayloadTooLarge'
        '429':
          description: Too many requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequests'
              examples:
                example:
                  summary: Example response for too many requests
                  value:
                    message: Too many requests
          headers:
            Retry-After:
              description: >-
                Optional retry delay in seconds. Not present on every 429
                response.
              schema:
                type: string
        '500':
          description: >-
            Internal server error, including native embedding provider,
            response, or transport failures.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerError'
              examples:
                example:
                  summary: Example response for internal server error
                  value:
                    message: Internal server error
        '502':
          $ref: '#/components/responses/BadGateway'
        '503':
          $ref: '#/components/responses/ServiceUnavailable'
        '504':
          $ref: '#/components/responses/GatewayTimeout'
      security:
        - ProjectApiKey: []
components:
  parameters:
    CollectionName:
      in: path
      name: collectionName
      description: Collection name.
      required: true
      schema:
        type: string
  schemas:
    MessageResponse:
      type: object
      properties:
        message:
          type: string
      required:
        - message
    BadRequest:
      title: BadRequest
      type: object
      properties:
        message:
          type: string
    Unauthenticated:
      title: Unauthenticated
      type: object
      properties:
        message:
          type: string
    ResourceNotFound:
      title: ResourceNotFound
      type: object
      properties:
        message:
          type: string
    TooManyRequests:
      title: TooManyRequests
      type: object
      properties:
        message:
          type: string
    InternalServerError:
      title: InternalServerError
      type: object
      properties:
        message:
          type: string
  responses:
    PayloadTooLarge:
      description: >-
        Request exceeds the Gateway transport limit. Reduce the request size or
        use bulk upsert when supported.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MessageResponse'
    BadGateway:
      description: >-
        Unexpected downstream failure. A failed write response may leave its
        outcome uncertain.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MessageResponse'
    ServiceUnavailable:
      description: >-
        Transient catalog or storage dependency failure. Use bounded retries
        where the operation permits.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MessageResponse'
    GatewayTimeout:
      description: >-
        Gateway request deadline exceeded. A write may have been applied; verify
        its outcome before retrying.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/MessageResponse'
  securitySchemes:
    ProjectApiKey:
      type: apiKey
      in: header
      name: x-api-key
      description: Project API Key.
      x-speakeasy-example: <YOUR_PROJECT_API_KEY>

````

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