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

# Update Document Template

> Update an existing document template with partial attributes. Only provided fields will be updated.

**Updatable Fields:**
- **name**: Template name (must be unique)
- **description**: Template description
- **extraction_config**: Extraction settings including JSON schema
- **fraud_config**: Fraud detection settings, including optional `requires_digital_signature` for documents that must contain a signature

**Validation Schema Convention:**
- Date-based validation should be stored on boolean fields (not on date fields)
- Boolean validation fields use `beltic:validation` with `kind`, `field_ref`, and rule parameters
- `field_ref` is scope-relative and must reference a sibling date field name

**Notes:**
- The template ID in the request body must match the path parameter
- Omitted fields will retain their current values
- Template status cannot be changed after creation



## OpenAPI

````yaml PATCH /v1/document-templates/{id}
openapi: 3.1.0
info:
  title: Beltic Document API
  version: 1.0.0
  description: >-
    # The Beltic Document API provides a comprehensive solution for document
    processing with AI-powered data extraction and fraud detection capabilities.


    ## Key Features


    - **Template-Based Processing**: Create reusable document templates with
    predefined schemas and processing configurations

    - **Ad-Hoc Processing**: Process documents without templates using custom
    configurations

    - **AI Data Extraction**: Intelligent document data extraction powered by AI

    - **Fraud Detection**: Document authenticity verification and fraud analysis

    - **Secure File Handling**: Pre-signed URLs for secure file uploads


    ## Workflow


    1. **Create a Document Template**: Define a template with extraction schema
    and fraud detection settings

    2. **Create a Document**: Initialize a document with either a template
    reference or ad-hoc configuration

    3. **Upload File**: Use the pre-signed URL to upload your document file

    4. **Automatic Processing**: Once uploaded, the document is automatically
    processed with extraction and fraud detection

    5. **Retrieve Results**: Fetch the document to access extracted data and
    fraud analysis results


    ## Authentication


    All endpoints require authentication. Include your API key in the
    `X-Api-Key` header:

    ```

    X-Api-Key: YOUR_API_KEY

    ```


    ## Response Format


    All responses follow the JSON:API specification for consistent data
    structures.
  contact:
    name: Beltic API Support
    email: engineering@beltic.com
servers:
  - url: https://api.beltic.com
    description: Production
security:
  - ApiKeyAuth: []
tags:
  - name: Document Templates
    description: >-
      Manage document templates for repeatable processing workflows. Templates
      define the structure and processing configuration for documents including
      JSON schemas for data extraction and fraud detection settings.
  - name: Documents
    description: >-
      Create and manage documents for processing. Documents can be associated
      with a template for standardized processing, or configured ad-hoc with
      custom settings. The workflow involves creating a document record,
      uploading the file via pre-signed URL, and automatically processing the
      document with AI-powered extraction and fraud detection. Documents track
      their processing status and store extracted data and fraud analysis
      results.
  - name: Webhooks
    description: >-
      Configure webhook endpoints to receive real-time notifications when
      document status changes. Webhooks support automatic retries with
      exponential backoff and provide options for manual resend and DLQ
      reprocessing.
externalDocs:
  description: Beltic Platform Documentation
  url: https://docs.beltic.com
paths:
  /v1/document-templates/{id}:
    patch:
      tags:
        - Document Templates
      summary: Update document template
      description: >-
        Update an existing document template with partial attributes. Only
        provided fields will be updated.


        **Updatable Fields:**

        - **name**: Template name (must be unique)

        - **description**: Template description

        - **extraction_config**: Extraction settings including JSON schema

        - **fraud_config**: Fraud detection settings, including optional
        `requires_digital_signature` for documents that must contain a signature


        **Validation Schema Convention:**

        - Date-based validation should be stored on boolean fields (not on date
        fields)

        - Boolean validation fields use `beltic:validation` with `kind`,
        `field_ref`, and rule parameters

        - `field_ref` is scope-relative and must reference a sibling date field
        name


        **Notes:**

        - The template ID in the request body must match the path parameter

        - Omitted fields will retain their current values

        - Template status cannot be changed after creation
      parameters:
        - schema:
            type: string
            format: uuid
            description: Template unique identifier
            example: 123e4567-e89b-12d3-a456-426614174000
          required: true
          description: Template unique identifier
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - document-template
                    id:
                      type: string
                      format: uuid
                      description: Template ID (must match path parameter)
                      example: 123e4567-e89b-12d3-a456-426614174000
                    attributes:
                      type: object
                      properties:
                        name:
                          type: string
                          minLength: 1
                          maxLength: 255
                          description: Template name
                          example: Passport Document
                        description:
                          type:
                            - string
                            - 'null'
                          description: Optional template description
                          example: Template for processing passport documents
                        extraction_config:
                          type: object
                          properties:
                            enabled:
                              type: boolean
                            schema:
                              type: object
                              properties:
                                type:
                                  type: string
                                  enum:
                                    - object
                                properties:
                                  type: object
                                  additionalProperties: {}
                                required:
                                  type: array
                                  items:
                                    type: string
                                additionalProperties:
                                  type: boolean
                              required:
                                - type
                                - properties
                                - required
                              additionalProperties: {}
                            extraction_rules:
                              type: string
                              default: ''
                          required:
                            - enabled
                            - schema
                          description: >-
                            Extraction configuration including JSON schema and
                            enabled flag
                        fraud_config:
                          type: object
                          properties:
                            enabled:
                              type: boolean
                            requires_digital_signature:
                              type: boolean
                              description: >-
                                When true, the document is required to contain a
                                signature. If fraud detection does not detect a
                                signature, a missing-signature risk indicator is
                                added to the fraud result.
                          required:
                            - enabled
                          description: Fraud detection configuration
                  required:
                    - type
                    - id
                    - attributes
              required:
                - data
      responses:
        '200':
          description: Template updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - document-template
                      id:
                        type: string
                        format: uuid
                        description: Template unique identifier
                        example: 123e4567-e89b-12d3-a456-426614174000
                      attributes:
                        type: object
                        properties:
                          name:
                            type: string
                          description:
                            type:
                              - string
                              - 'null'
                          extraction_config:
                            type: object
                            properties:
                              enabled:
                                type: boolean
                              schema: {}
                              extraction_rules:
                                type: string
                            required:
                              - enabled
                          fraud_config:
                            type: object
                            properties:
                              enabled:
                                type: boolean
                              requires_digital_signature:
                                type: boolean
                            required:
                              - enabled
                          status:
                            type: string
                            enum:
                              - published
                          is_active:
                            type: boolean
                          created_at:
                            type: string
                          updated_at:
                            type: string
                        required:
                          - name
                          - extraction_config
                          - fraud_config
                      relationships:
                        type: object
                        properties: {}
                    required:
                      - type
                      - id
                      - attributes
                required:
                  - data
        '400':
          description: Validation error
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                        title:
                          type: string
                        detail:
                          type: string
                      required:
                        - status
                        - title
                        - detail
                required:
                  - errors
        '404':
          description: Template not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        status:
                          type: string
                        title:
                          type: string
                        detail:
                          type: string
                      required:
                        - status
                        - title
                        - detail
                required:
                  - errors
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      description: |-
        API key for authentication.
        Access https://console.beltic.com/ to obtain your API key.

````