Skip to main content
The Edit API allows you to programmatically edit documents, such as filling forms using AI.

API Usage Guide

Calling the edit endpoint initiates a document editing job.
from tensorlake.documentai import DocumentAI, FormFillingOptions

doc_ai = DocumentAI(api_key="YOUR_API_KEY")

form_filling = FormFillingOptions(
    fill_prompt="Fill the form for John Doe, born 01/01/1980.",
    ignore_source_values=True
)

# Returns a job ID
job_id = doc_ai.edit(
    file_id="file_XXX",
    form_filling=form_filling
)

Form Filling

The form_filling object configures how the document should be filled.
ParameterDescriptionDefault Value
fill_promptA custom prompt to use for form filling. This provides context or data to the AI model for filling the form.None
ignore_source_valuesIf true, the model will ignore existing values in the form fields and overwrite them.false
no_acroformIf true, the model will not use AcroForm detection (standard PDF form fields).false
no_gemini_detectionIf true, the model will not use Gemini for visual form field detection.false

Output

The output of the edit operation includes the modified document and metadata.
  • filled_pdf_base64: The base64 encoded string of the filled PDF document.
  • form_filling_metadata: A dictionary containing metadata about the form filling process, such as fields identified and filled.