API Reference
Form Filling
Fill PDF or image forms with provided field data. Supports PDFs with and without native form fields.
Authorizations
X-API-KeystringheaderrequiredYour API key for authentication
Body Parameters
field_datastringbodyrequiredJSON string mapping field keys to values and descriptions. Format: {"field_key": {"value": "...", "description": "..."}}
file_urlstringbodyOptional file URL (http/https). If provided, the server will download and process it.
contextstringbodyOptional context to guide form filling (e.g., 'Initial hire for new employee').
confidence_thresholdnumberbodyMinimum confidence for field matching (0.0-1.0). Fields below this threshold won't be filled.
page_rangestringbodyPages to process, comma separated like 0,5-10,20.
skip_cachebooleanbodySkip the cache and re-run the inference. Defaults to false.
filefilebodyInput PDF, Word, PowerPoint, or image file. Images must be png, jpg, or webp.
Cookies
wos-sessionstringcookieSession cookie
access_tokenstringcookieAccess token cookie
datalab_active_teamstringcookieActive team cookie
Response
Successful Response
Form Filling
import requests
url = "https://www.datalab.to/api/v1/fill"
files = {
"file.0": ("example-file", open("example-file", "rb"))
}
payload = {
"field_data": "<string>",
"file_url": "<string>",
"context": "<string>",
"confidence_threshold": "0.5",
"page_range": "<string>",
"skip_cache": "false"
}
headers = {"X-API-Key": "<api-key>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)200Success
{
"request_id": "<string>",
"request_check_url": "<string>",
"success": true,
"error": "<string>",
"versions": {}
}