API Reference
Generate Extraction Schemas
Auto-generate an extraction schema from a sample document.
Authorizations
X-API-KeystringheaderrequiredYour API key for authentication
Body Parameters
filefilebodyInput PDF, Word, PowerPoint, or image file. Images must be png, jpg, or webp.
file_urlstringbodyOptional file URL (http/https). If provided, the server will download and process it.
modestringbodyOutput mode: 'fast', 'balanced', or 'accurate'.
max_pagesintegerbodyMaximum number of pages to process.
page_rangestringbodyPage range to process, comma separated like 0,5-10,20.
skip_cachebooleanbodySkip the cache and re-run. Defaults to false.
Cookies
wos-sessionstringcookieSession cookie
access_tokenstringcookieAccess token cookie
datalab_active_teamstringcookieActive team cookie
Response
Successful Response
Generate Extraction Schemas
import requests
url = "https://www.datalab.to/api/v1/extract/schema/generate"
files = {
"file.0": ("example-file", open("example-file", "rb"))
}
payload = {
"mode": "fast"
}
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": {}
}