Skip to main content

Overview

The form filling API lets you programmatically fill forms in PDFs and images. It works with both:
  • Native PDF forms - Forms with actual form fields
  • Image-based forms - Scanned forms or images with visual form layouts
The API matches your field data to form fields and returns a filled PDF or image.

Basic Usage

Form Filling Options

Field Data Format

Each field in field_data is a dictionary with:
The description helps the API match your field key to the actual form field, especially when field names in the PDF don’t match your data structure.

Example with Multiple Field Types

Using Context

The context parameter provides additional information to improve field matching:

Confidence Threshold

Adjust confidence_threshold to control field matching strictness:
  • Lower values (0.3-0.5): More fields matched, but may have incorrect matches
  • Higher values (0.7-0.9): Fewer fields matched, but more accurate

Form Filling Result

Result Fields

Saving the Filled Form

Filling Image Forms

The API also works with image-based forms (PNG, JPG, etc.):
For images, the output is a PNG with the field values rendered onto the image.

From URL

Fill a form from a URL:

Async Usage

Handling Unmatched Fields

Check which fields couldn’t be matched:

Example: Tax Form

Next Steps

Form Filling Recipe

Detailed guide on form filling with field matching and templates.

File Management

Upload, list, and manage files in Datalab storage.

Conversion SDK

Convert documents to Markdown, HTML, JSON, or chunks.

Pipelines

Chain processors into versioned, reusable pipelines.