Skip to content
ComPDF

First request: sync extraction

This example calls POST /v2/process/idp/documentExtract, uploads a file, and extracts fields with mode=vision (the default mode). Both vision and layout modes take one fixed schema in extract_fields; for layout extraction, explicitly pass mode=layout.

bash
curl --location --request POST 'https://api-server.compdf.com/server/v2/process/idp/documentExtract' \
  --header 'x-api-key: <your-public-key>' \
  --form 'file=@/path/to/handwriting.pdf' \
  --form 'mode=vision' \
  --form 'extract_fields={"name":"Form","keys":{"Name":{"prompt":"Applicant name","mapping":null}},"tableHeaders":{}}'
ParameterRequiredDescription
fileYesSource PDF, image, or office document
modeNolayout or vision; defaults to vision
extract_fieldsYesJSON string of a single schema used by both vision and layout; an empty schema triggers AI field auto-extraction
enable_groundingNoWhether to return bbox grounding, default true; this field only needs to be passed when using layout mode.