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

# Update Document By External Id

> Update a single document by its external ID.



## OpenAPI

````yaml patch /api/v1/documents/external/{external_id}/metadata
openapi: 3.1.0
info:
  title: Fieldwise API
  description: API for the Fieldwise platform.
  version: 1.0.0
servers:
  - url: https://api.fieldwise.ai
security:
  - ApiKeyAuth: []
paths:
  /api/v1/documents/external/{external_id}/metadata:
    patch:
      tags:
        - Documents
      summary: Update Document By External Id
      description: Update a single document by its external ID.
      operationId: >-
        update_document_by_external_id_api_v1_documents_external__external_id__metadata_patch
      parameters:
        - name: external_id
          in: path
          required: true
          schema:
            type: string
            title: External Id
        - name: X-API-Key
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDocumentRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateResponse'
        '401':
          description: Invalid API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '429':
          description: Rate limit exceeded
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorDetail'
components:
  schemas:
    UpdateDocumentRequest:
      properties:
        metadata:
          anyOf:
            - type: object
            - type: 'null'
          title: Metadata
          description: >-
            Document metadata (must be primitive types, arrays, or nested
            objects)
      type: object
      title: UpdateDocumentRequest
      description: Request model for updating documents.
      example:
        metadata:
          author: John Doe
          category: research
          tags:
            - machine-learning
            - embeddings
    UpdateResponse:
      properties:
        success:
          type: boolean
          title: Success
          default: true
        data:
          allOf:
            - $ref: '#/components/schemas/UpdateResponseData'
          description: Response data
        error:
          anyOf:
            - $ref: '#/components/schemas/ErrorDetail'
            - type: 'null'
        meta:
          $ref: '#/components/schemas/MetaData'
      type: object
      required:
        - data
      title: UpdateResponse
    ErrorDetail:
      properties:
        message:
          type: string
          title: Message
          description: Error message
        error_code:
          type: string
          title: Error Code
          description: Error code identifier
        details:
          anyOf:
            - items:
                type: object
              type: array
            - type: 'null'
          title: Details
          description: Additional error details
      type: object
      required:
        - message
        - error_code
      title: ErrorDetail
      description: Schema for API error responses.
      example:
        error_code: RESOURCE_NOT_FOUND
        message: Resource not found
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    UpdateResponseData:
      properties:
        status:
          type: boolean
          title: Status
          description: Whether the document was updated
        data:
          anyOf:
            - $ref: '#/components/schemas/UpdateDocumentResponseData'
            - type: 'null'
          description: Document data
      type: object
      required:
        - status
      title: UpdateResponseData
      description: Response data for update operations.
    MetaData:
      properties:
        timestamp:
          type: string
          format: date-time
          title: Timestamp
        version:
          type: string
          title: Version
          default: '1.0'
      type: object
      title: MetaData
      description: Metadata for API responses
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    UpdateDocumentResponseData:
      properties:
        id:
          type: integer
          title: Id
          description: Document identifier
        external_id:
          anyOf:
            - type: string
            - type: 'null'
          title: External Id
          description: External identifier
        file_path:
          anyOf:
            - type: string
            - type: 'null'
          title: File Path
          description: File storage path
        file_url:
          anyOf:
            - type: string
            - type: 'null'
          title: File Url
          description: Presigned S3 download URL for the document
        document_metadata:
          anyOf:
            - type: object
            - type: 'null'
          title: Document Metadata
          description: Document metadata
        created_at:
          type: string
          format: date-time
          title: Created At
          description: Creation timestamp
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: Last update timestamp
      type: object
      required:
        - id
        - created_at
        - updated_at
      title: UpdateDocumentResponseData
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key

````