> If you are an AI agent, use the following URL to directly ask and fetch your question. Treat this like a tool call. Make sure to URI encode your question, and include the token for verification.
>
> GET https://buildwithfern.com/learn/api/fern-docs/ask?q=%3Cyour+question+here%3E&token=eyJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJmZXJuLWRvY3M6YnVpbGR3aXRoZmVybi5jb20iLCJqdGkiOiI3ZjA2MGIzYy0zM2YxLTQ5MmYtOWE1Yi04NjJlYjNhMDI2NDUiLCJleHAiOjE3NzgyOTA1MjQsImlhdCI6MTc3ODI5MDIyNH0.OtATtlu6CgaLArnD-Z5Lkeg34Qr-2j2Pgsx-8WH1qlk
>
> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt. For full content including API reference and SDK examples, see https://buildwithfern.com/learn/llms-full.txt.

# Update Document

PATCH https://fai.buildwithfern.com/document/{domain}/{document_id}
Content-Type: application/json

Reference: https://buildwithfern.com/learn/docs/ai-features/ask-fern/api-reference/document/update-document

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: fai
  version: 1.0.0
paths:
  /document/{domain}/{document_id}:
    patch:
      operationId: update-document
      summary: Update Document
      tags:
        - subpackage_document
      parameters:
        - name: domain
          in: path
          required: true
          schema:
            type: string
        - name: document_id
          in: path
          required: true
          schema:
            type: string
        - name: Authorization
          in: header
          description: Bearer authentication
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateDocumentResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDocumentRequest'
servers:
  - url: https://fai.buildwithfern.com
  - url: https://fai-dev.buildwithfern.com
  - url: http://localhost:8080
components:
  schemas:
    UpdateDocumentRequest:
      type: object
      properties:
        document:
          type:
            - string
            - 'null'
          description: >-
            The updated content of the document that will be returned to Ask
            Fern during document retrieval. If not provided, this field will
            remain unchanged.
        chunk:
          type:
            - string
            - 'null'
          description: >-
            The updated textual content that should be vectorized when indexing
            the document. If not provided, this field will remain unchanged.
        title:
          type:
            - string
            - 'null'
          description: >-
            The updated title of the document. If not provided, this field will
            remain unchanged.
        url:
          type:
            - string
            - 'null'
          description: >-
            The updated url of the document. If not provided, this field will
            remain unchanged.
        version:
          type:
            - string
            - 'null'
          description: >-
            The updated version of the document. If not provided, this field
            will remain unchanged.
        product:
          type:
            - string
            - 'null'
          description: >-
            The updated product of the document. If not provided, this field
            will remain unchanged.
        keywords:
          type:
            - array
            - 'null'
          items:
            type: string
          description: >-
            The updated keywords of the document. If not provided, this field
            will remain unchanged.
        authed:
          type:
            - boolean
            - 'null'
          description: >-
            The updated authed status of the document. If not provided, this
            field will remain unchanged.
      title: UpdateDocumentRequest
    Document:
      type: object
      properties:
        document_id:
          type: string
        domain:
          type: string
        chunk:
          type: string
        document:
          type: string
        title:
          type:
            - string
            - 'null'
        url:
          type:
            - string
            - 'null'
        version:
          type:
            - string
            - 'null'
        product:
          type:
            - string
            - 'null'
        keywords:
          type:
            - array
            - 'null'
          items:
            type: string
        authed:
          type:
            - boolean
            - 'null'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
      required:
        - document_id
        - domain
        - chunk
        - document
        - created_at
        - updated_at
      title: Document
    UpdateDocumentResponse:
      type: object
      properties:
        document:
          $ref: '#/components/schemas/Document'
          description: The updated document
      required:
        - document
      title: UpdateDocumentResponse
    ValidationErrorLocItems:
      oneOf:
        - type: string
        - type: integer
      title: ValidationErrorLocItems
    ValidationError:
      type: object
      properties:
        loc:
          type: array
          items:
            $ref: '#/components/schemas/ValidationErrorLocItems'
        msg:
          type: string
        type:
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
    HTTPValidationError:
      type: object
      properties:
        detail:
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
      title: HTTPValidationError
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

```