Extract Document
Description
This endpoint extracts structured data from document files based on a user-defined prompt. It supports input via URL or base64-encoded file content and uses vision-capable Large Language Models (LLMs) to interpret and extract relevant information from the PDFs.
The following file extensions are supported:
.123
.602
.abw
.bib
.bmp
.cdr
.cgm
.cmx
.csv
.cwk
.dbf
.dif
.doc
.docm
.docx
.dot
.dotm
.dotx
.dxf
.emf
.eps
.epub
.fodg
.fodp
.fods
.fodt
.fopd
.gif
.htm
.html
.hwp
.jpeg
.jpg
.key
.ltx
.lwp
.mcw
.met
.mml
.mw
.numbers
.odd
.odg
.odm
.odp
.ods
.odt
.otg
.oth
.otp
.ots
.ott
.pages
.pbm
.pcd
.pct
.pcx
.pdb
.pdf
.pgm
.png
.pot
.potm
.potx
.ppm
.pps
.ppt
.pptm
.pptx
.psd
.psw
.pub
.pwp
.pxl
.ras
.rtf
.sda
.sdc
.sdd
.sdp
.sdw
.sgl
.slk
.smf
.stc
.std
.sti
.stw
.svg
.svm
.swf
.sxc
.sxd
.sxg
.sxi
.sxm
.sxw
.tga
.tif
.tiff
.txt
.uof
.uop
.uos
.uot
.vdx
.vor
.vsd
.vsdm
.vsdx
.webp
.wb2
.wk1
.wks
.wmf
.wpd
.wpg
.wps
.xbm
.xhtml
.xls
.xlsb
.xlsm
.xlsx
.xlt
.xltm
.xltx
.xlw
.xml
.xpm
.zabw
Endpoint
Headers
- Content-Type:
application/json
- Authorization: Bearer
<API_KEY>
(required)
Request Body
Responses
Success (200)
Returns the extracted data based on the provided prompt, along with additional information.
- Content-Type: application/json
- X-RateLimit-Limit: The rate limit for the user.
- X-RateLimit-Remaining: The remaining number of requests for the user.
Bad Request (400)
Returned if the request is invalid or the total file size exceeds the limit.
Unauthorized (401)
Returned if the API key is invalid or missing.
Internal Server Error (500)
Returned if there’s an error during the document extraction process.
Example Request
Notes
- The maximum total file size for all documents combined is 100MB.
- The maximum file size for a single document is 30MB.
- The maximum number of pages that can be processed in a single request is ~3000 pages.
- The maximum output is 8,192 tokens.
- Credit usage:
- Base cost: 10 credits
- Additional 1 credit per page processed
- The total credit usage is returned in the response as
creditUsage
. - If using the URL method, ensure the file is publicly accessible.
- The
jsonMode
parameter determines whether the output is formatted as JSON (true) or plain text (false). - We apply vision-based LLMs to all pages of the document for extraction.
- The endpoint can process multiple document files in a single request.
- Temporary files are created during processing and are deleted after use.
- You can get a list of supported file extensions by calling:
Rate Limiting
Rate limit headers (X-RateLimit-Limit
and X-RateLimit-Remaining
) are included in the response to indicate the user’s current rate limit status.
Error Handling
- If the required parameters (
files
orprompt
) are missing, a 400 Bad Request error is returned. - If the total file size exceeds 100MB, a 400 Bad Request error is returned.
- If there’s an error during extraction, a 500 Internal Server Error is returned with details about the failure.
Security and Privacy
- Uploaded files are temporarily stored and then deleted after processing.