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

# Update chunk metadata

> Overwrite metadata on chunks in a vector database, targeted by file IDs or chunk IDs. This replaces all existing metadata on the targeted chunks.

Overwrite user-defined metadata on chunks within a vector database. Target the chunks with exactly one of `chunk_ids` or `file_ids`; providing both, or neither, returns an error. This operation is destructive: the supplied `metadata` object replaces all existing metadata on every targeted chunk, so include any fields you want to keep.


## OpenAPI

````yaml patch /v1/flow/vectordb/{database_id}/metadata
openapi: 3.1.0
info:
  title: SeekrFlow API
  description: SeekrFlow API Documentation
  termsOfService: http://www.seekr.com/support
  contact:
    name: Seekr API Support
    url: http://www.seekr.com/contact
    email: contact@seekr.com
  version: 5.99.0
servers:
  - url: https://flow.seekr.com
    description: SeekrBuild server base URL
security: []
paths:
  /v1/flow/vectordb/{database_id}/metadata:
    patch:
      tags:
        - Vector database
      summary: Update chunk metadata
      description: >-
        Overwrite metadata on chunks in a vector database, targeted by file IDs
        or chunk IDs. This replaces all existing metadata on the targeted
        chunks.
      operationId: >-
        update_vector_database_metadata_v1_flow_vectordb__database_id__metadata_patch
      parameters:
        - name: database_id
          in: path
          required: true
          schema:
            type: string
            title: Database Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VectorDatabaseMetadataUpdateRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VectorDatabaseMetadataUpdateResponse'
        '422':
          description: Invalid request parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    VectorDatabaseMetadataUpdateRequest:
      properties:
        file_ids:
          anyOf:
            - items:
                type: string
              type: array
              minItems: 1
            - type: 'null'
          title: File Ids
          description: File IDs whose chunks should have their metadata replaced.
          examples:
            - - file_789
              - file_012
        chunk_ids:
          anyOf:
            - items:
                type: string
              type: array
              minItems: 1
            - type: 'null'
          title: Chunk Ids
          description: Chunk IDs to update metadata on directly.
          examples:
            - - chunk_789
              - chunk_012
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
          description: >-
            Key-value pairs to write onto every targeted chunk. Replaces all
            existing metadata. Constraints: (1) flat object only — no nested
            objects or arrays; (2) values must be string, number, boolean, or
            datetime (null is rejected); (3) maximum 20 fields.
          examples:
            - category: support_doc
              confidence: medium
              source: manual_review
      type: object
      required:
        - metadata
      title: VectorDatabaseMetadataUpdateRequest
      description: >-
        Request body for overwriting chunk metadata within a vector database.


        This operation is **destructive**: the provided `metadata` object
        replaces all

        existing metadata on the targeted chunks. Any previous metadata fields
        not

        included in the new object are permanently removed.


        Provide exactly one of `file_ids` or `chunk_ids` to target chunks.
    VectorDatabaseMetadataUpdateResponse:
      properties:
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
          description: The metadata object that was written to all matching chunks.
      type: object
      required:
        - metadata
      title: VectorDatabaseMetadataUpdateResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      description: >-
        Your Seekr API key, sent in the Authorization header with no 'Bearer'
        prefix.
      in: header
      name: Authorization

````