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

# Update Document

> Update Document



## OpenAPI

````yaml /api-reference/openapi.json patch /documents/{documentId}
openapi: 3.1.0
info:
  title: Cradl API
  version: '2026-01-28T09:00:46Z'
servers:
  - url: https://api.cradl.ai/{basePath}
    variables:
      basePath:
        default: v1
security: []
paths:
  /documents/{documentId}:
    patch:
      parameters:
        - in: header
          name: Content-Type
          required: true
          schema:
            type: string
        - in: path
          name: documentId
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchDocumentId'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
          description: 200 response
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: 400 response
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: 403 response
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: 404 response
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '415':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: 415 response
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
          description: 500 response
          headers:
            Access-Control-Allow-Headers:
              schema:
                type: string
            Access-Control-Allow-Origin:
              schema:
                type: string
      security:
        - OAuth2:
            - documents:write
components:
  schemas:
    PatchDocumentId:
      title: PATCH /documents/{documentId}
      minProperties: 1
      type: object
      properties:
        groundTruth:
          type: array
          items:
            required:
              - label
              - value
            type: object
            properties:
              pages:
                maxItems: 10
                type: array
                items:
                  type: integer
              rawValue:
                anyOf:
                  - maxLength: 1024
                    minLength: 0
                    type: string
                    nullable: true
                  - type: boolean
                    nullable: true
                  - type: number
                    nullable: true
              confidence:
                maximum: 1
                minimum: 0
                type: number
              label:
                maxLength: 36
                minLength: 1
                pattern: ^[0-9A-Za-z-_]+$
                type: string
              value:
                anyOf:
                  - maxLength: 1024
                    minLength: 0
                    type: string
                    nullable: true
                  - type: boolean
                    nullable: true
                  - type: number
                    nullable: true
                  - $ref: '#/components/schemas/groundTruthList'
                    nullable: true
            additionalProperties: false
          nullable: true
        metadata:
          type: object
        retentionInDays:
          maximum: 1825
          minimum: 1
          type: integer
        name:
          maxLength: 4096
          type: string
          nullable: true
        description:
          maxLength: 4096
          type: string
          nullable: true
        datasetId:
          pattern: ^(cradl|las):dataset:[a-f0-9]{32}$
          type: string
      additionalProperties: false
    Document:
      title: document
      required:
        - createdBy
        - createdTime
        - description
        - documentId
        - metadata
        - name
        - retentionInDays
        - updatedBy
        - updatedTime
      type: object
      properties:
        updatedTime:
          pattern: >-
            ^[0-9]{4}-?[0-9]{2}-?[0-9]{2}(
            |T)?[0-9]{2}:?[0-9]{2}:?[0-9]{2}(.[0-9]{1,6})?(Z|[+][0-9]{2}(:|)[0-9]{2})$
          type: string
          nullable: true
        contentMD5:
          maxLength: 4096
          type: string
          nullable: true
        metadata:
          type: object
          nullable: true
        retentionInDays:
          maximum: 1825
          minimum: 1
          type: integer
        ocrFileUrl:
          pattern: ^http://localhost.*|^https://.*
          type: string
          nullable: true
        updatedBy:
          maxLength: 4096
          type: string
          nullable: true
        description:
          maxLength: 4096
          type: string
          nullable: true
        agentRunId:
          pattern: >-
            ^((cradl|las):organization:[a-z0-9-_]+/)?cradl:agent:[a-z0-9-_]+/cradl:run:[a-z0-9-_]+$
          type: string
          nullable: true
        content:
          maxLength: 6250000
          minLength: 1
          type: string
          nullable: true
        groundTruth:
          type: array
          items:
            required:
              - label
              - value
            type: object
            properties:
              pages:
                maxItems: 10
                type: array
                items:
                  type: integer
              rawValue:
                anyOf:
                  - maxLength: 1024
                    minLength: 0
                    type: string
                    nullable: true
                  - type: boolean
                    nullable: true
                  - type: number
                    nullable: true
              confidence:
                maximum: 1
                minimum: 0
                type: number
              label:
                maxLength: 36
                minLength: 1
                pattern: ^[0-9A-Za-z-_]+$
                type: string
              value:
                anyOf:
                  - maxLength: 1024
                    minLength: 0
                    type: string
                    nullable: true
                  - type: boolean
                    nullable: true
                  - type: number
                    nullable: true
                  - $ref: '#/components/schemas/groundTruthList'
                    nullable: true
            additionalProperties: false
        consentId:
          pattern: ^las:consent:[a-f0-9]{32}$
          type: string
        createdBy:
          maxLength: 4096
          type: string
        name:
          maxLength: 4096
          type: string
          nullable: true
        createdTime:
          pattern: >-
            ^[0-9]{4}-?[0-9]{2}-?[0-9]{2}(
            |T)?[0-9]{2}:?[0-9]{2}:?[0-9]{2}(.[0-9]{1,6})?(Z|[+][0-9]{2}(:|)[0-9]{2})$
          type: string
        datasetId:
          pattern: ^(cradl|las):dataset:[a-f0-9]{32}$
          type: string
        documentId:
          pattern: ^(cradl|las):document:[a-f0-9]{32}$
          type: string
        fileUrl:
          pattern: ^http://localhost.*|^https://.*
          type: string
          nullable: true
        contentType:
          type: string
          enum:
            - application/pdf
            - image/jpeg
            - image/png
            - image/tiff
            - image/webp
            - message/rfc822
          nullable: true
        annotationFileUrl:
          pattern: ^http://localhost.*|^https://.*
          type: string
          nullable: true
      additionalProperties: false
    Error:
      title: Error Schema
      type: object
      properties:
        message:
          type: string
    groundTruthList:
      anyOf:
        - type: array
          items:
            required:
              - label
              - value
            type: object
            properties:
              pages:
                maxItems: 10
                type: array
                items:
                  type: integer
              rawValue:
                anyOf:
                  - maxLength: 1024
                    minLength: 0
                    type: string
                    nullable: true
                  - type: boolean
                    nullable: true
                  - type: number
                    nullable: true
              confidence:
                maximum: 1
                minimum: 0
                type: number
              label:
                maxLength: 36
                minLength: 1
                pattern: ^[0-9A-Za-z-_]+$
                type: string
              value:
                anyOf:
                  - maxLength: 1024
                    minLength: 0
                    type: string
                    nullable: true
                  - type: boolean
                    nullable: true
                  - type: number
                    nullable: true
                  - $ref: '#/components/schemas/groundTruthList'
                    nullable: true
            additionalProperties: false
        - type: array
          items:
            type: array
            items:
              required:
                - label
                - value
              type: object
              properties:
                pages:
                  maxItems: 10
                  type: array
                  items:
                    type: integer
                rawValue:
                  anyOf:
                    - maxLength: 1024
                      minLength: 0
                      type: string
                      nullable: true
                    - type: boolean
                      nullable: true
                    - type: number
                      nullable: true
                confidence:
                  maximum: 1
                  minimum: 0
                  type: number
                label:
                  maxLength: 36
                  minLength: 1
                  pattern: ^[0-9A-Za-z-_]+$
                  type: string
                value:
                  anyOf:
                    - maxLength: 1024
                      minLength: 0
                      type: string
                      nullable: true
                    - type: boolean
                      nullable: true
                    - type: number
                      nullable: true
                    - $ref: '#/components/schemas/groundTruthList'
                      nullable: true
              additionalProperties: false
  securitySchemes:
    OAuth2:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://auth.cradl.ai/oauth2/token
          scopes:
            actions.runs:read: Read permissions
            actions.runs:write: Write permissions
            actions:read: Read permissions
            actions:write: Write permissions
            agents.runs:read: Read permissions
            agents.runs:write: Write permissions
            agents.statistics:read: Read permissions
            agents:read: Read permissions
            agents:write: Write permissions
            appclients:read: Read permissions
            appclients:write: Write permissions
            documents:read: Read permissions
            documents:write: Write permissions
            hooks.runs:read: Read permissions
            hooks.runs:write: Write permissions
            hooks:read: Read permissions
            hooks:write: Write permissions
            logs:read: Read permissions
            models:read: Read permissions
            models:write: Write permissions
            organizations:read: Read permissions
            organizations:write: Write permissions
            predictions:read: Read permissions
            predictions:write: Write permissions
            users:read: Read permissions
            users:write: Write permissions
            validations.tasks:read: Read permissions
            validations.tasks:write: Write permissions
            validations:read: Read permissions
            validations:write: Write permissions
            workflows:read: Read permissions
            workflows:write: Write permissions

````