> ## 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.

# Create Document Template

> Create a new document template to standardize document processing workflows. Templates define reusable configurations including extraction schemas and fraud detection rules.

**Template Components:**
- **Schema**: Defines the expected structure of extracted data
- **Fraud Config**: Pipeline configuration for fraud detection. Set `requires_digital_signature: true` when documents processed with this template must contain a signature; if no signature is detected, the fraud result includes a missing-signature RISK indicator.
- **Validation Fields**: Date checks should be represented as boolean fields with `beltic:validation`

**Validation Field Pattern:**
- Keep the source date field as `type: ["string", "null"]` with `"custom:type": "date"`
- Add a sibling boolean field with `"beltic:validation"`
- Use `field_ref` to reference the source date field in the same object scope
- Works in top-level objects, nested objects, and array item objects

**Best Practices:**
- Use descriptive names and detailed descriptions for team clarity
- Test with sample documents before using in production
- Keep templates focused on specific document types (e.g., "Passport", "Driver License")



## OpenAPI

````yaml POST /v1/document-templates
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:
    post:
      tags:
        - Document Templates
      summary: Create document template
      description: >-
        Create a new document template to standardize document processing
        workflows. Templates define reusable configurations including extraction
        schemas and fraud detection rules.


        **Template Components:**

        - **Schema**: Defines the expected structure of extracted data

        - **Fraud Config**: Pipeline configuration for fraud detection. Set
        `requires_digital_signature: true` when documents processed with this
        template must contain a signature; if no signature is detected, the
        fraud result includes a missing-signature RISK indicator.

        - **Validation Fields**: Date checks should be represented as boolean
        fields with `beltic:validation`


        **Validation Field Pattern:**

        - Keep the source date field as `type: ["string", "null"]` with
        `"custom:type": "date"`

        - Add a sibling boolean field with `"beltic:validation"`

        - Use `field_ref` to reference the source date field in the same object
        scope

        - Works in top-level objects, nested objects, and array item objects


        **Best Practices:**

        - Use descriptive names and detailed descriptions for team clarity

        - Test with sample documents before using in production

        - Keep templates focused on specific document types (e.g., "Passport",
        "Driver License")
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                data:
                  type: object
                  properties:
                    type:
                      type: string
                      enum:
                        - document-template
                    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 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:
                        - name
                        - extraction_config
                        - fraud_config
                  required:
                    - type
                    - attributes
              required:
                - data
      responses:
        '201':
          description: Template created 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
      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.

````