Create Document Type

Step-by-step guide to create custom document types using the AI-powered creation wizard

Create Custom Document Type

This guide will help you create a custom document type using Docutray's AI-powered creation wizard.

Prerequisites

Before you begin, make sure you have:

  • An active Docutray account
  • At least one sample document of the type you want to create (PDF, JPG, PNG, etc.)
  • A clear description of the data you want to extract from the document

Step 1: Access the Creation Wizard

  1. Log in to your Docutray account at https://app.docutray.com

  2. In the sidebar menu, navigate to Document Types

  3. Click the New Document Type button

New document type button

Step 2: Upload Sample Documents

The wizard will show you an upload zone where you can upload your sample documents.

Supported Formats

  • PDF: PDF documents
  • Images: JPG, PNG, GIF, BMP, WebP

Limits

  • Maximum size: 10MB per file
  • Maximum quantity: 5 files at a time

How to Upload

You have two options:

  1. Drag and drop: Drag files directly to the upload zone
  2. Select files: Click the upload zone to open the file selector

Document upload zone

Tip: Upload multiple examples of the same document type to get better schema generation results.

Step 3: Describe the Data to Extract

Once at least one document is uploaded, a configuration panel with a text field will appear.

Describe the Fields

In the description field, clearly indicate what data you want to extract from the document. Be specific about:

  • Field names you want to obtain
  • Expected data types (text, numbers, dates, lists)
  • Approximate location in the document if relevant

Description Example

Extract the following data from the invoice:
- Invoice number
- Issue date
- Issuer tax ID
- Issuer company name
- Recipient tax ID
- Net total
- Tax (e.g., VAT)
- Total amount due
- List of items with: quantity, description, unit price, and total

Configuration panel

Step 4: Generate the Schema

  1. Click the Generate Schema with AI button

  2. The system will analyze your documents and automatically generate:

    • A JSON schema with detected fields
    • A suggested name for the document type
    • A description of the document type
  3. While generating, you'll see progress indicators:

    • Analyzing documents...
    • Generating schema...
    • Extracting test data...

Generation progress

Generation can take 10-30 seconds depending on document complexity.

Step 5: Review and Edit the Schema

Once generated, you can view and edit the schema in an interactive table.

Edit Fields

For each field you can modify:

  • Name: The field identifier name
  • Type: Text, Number, Boolean, Array, or Object
  • Description: A field description
  • Required: Whether the field is mandatory

Available Field Types

TypeIconUse
TextAText strings
Number#Numeric values
BooleanToggleTrue/False
Array[ ]Arrays of values
Object{ }Nested structures

Add or Remove Fields

  • Add: Use the "Add Field" button at the bottom of the table
  • Remove: Use the trash icon on each row

Schema editor

Step 6: Test the Extraction

The system automatically runs an extraction test after generating the schema.

View Results

  1. Switch to the Results tab

  2. You'll see the extracted data from the sample document in structured format

  3. You can toggle between tree view and JSON to review the data

If Results are Incorrect

  1. Go back to the Configuration tab
  2. Adjust the schema as needed
  3. Click Regenerate to test again

Extraction results

Step 7: Configure Metadata

Before creating the document type, configure its information:

Name (Required)

  • Enter a descriptive name for the document type
  • Example: "Electronic Invoice", "Fee Receipt"

Description (Optional)

  • Add a description to help identify the document's purpose

Save as Draft

  • Check this option if you want to save the type without activating it immediately
  • Drafts are not available for API use until activated

Metadata form

Step 8: Create the Document Type

  1. Review that all data is correct

  2. Click the Create Document button in the top right corner

  3. The system will save the document type and redirect you to its detail page

Create document button

Congratulations! Your new document type is ready to use.

Error Handling

Common Errors

ErrorSolution
File too largeReduce file size to under 10MB
Unsupported formatUse PDF, JPG, PNG, GIF, BMP, or WebP
Generation errorCheck your connection and retry
Extraction errorAdjust the description and regenerate schema

Retry Operations

If an error occurs during generation or extraction:

  1. An alert will appear with the error message
  2. Use the Retry button to re-execute the operation
  3. If the error persists, try with a more detailed description

Next Steps

Once your document type is created, you can:

  • Use the API: Convert documents using the /api/convert endpoint
  • Create Flows: Automate processing with DocFlows
  • Configure Webhooks: Receive notifications when documents are processed

Keyboard Shortcuts

For faster navigation:

ActionShortcut
Open file selectorEnter or Space on upload zone
Navigate between fieldsTab
Expand/collapse nested fieldsEnter on expand button

On this page