Parse a document
POST
/api/v1/models/{modelId}/parse
const url = 'https://api.langparse.dev/api/v1/models/example/parse';const options = { method: 'POST', headers: {'X-Api-Key': '<X-Api-Key>', 'Content-Type': 'application/json'}, body: '{"fileBase64":"example","sourceKey":"example","fileName":"invoice.pdf","pages":[3,5],"workflowId":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.langparse.dev/api/v1/models/example/parse \ --header 'Content-Type: application/json' \ --header 'X-Api-Key: <X-Api-Key>' \ --data '{ "fileBase64": "example", "sourceKey": "example", "fileName": "invoice.pdf", "pages": [ 3, 5 ], "workflowId": "example" }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”modelId
required
string
Request Bodyrequired
Section titled “Request Bodyrequired”Provide fileBase64 (inline) OR sourceKey (from /uploads).
Media typeapplication/json
object
fileBase64
Base64-encoded file bytes (≤ ~12 MB). Provide this OR sourceKey.
string format: byte
sourceKey
Key from POST /uploads after you PUT the file to its URL. No size limit.
string
fileName
string
Example
invoice.pdfpages
Only extract these 1-indexed pages (e.g. [3,5]). Omit for all pages.
Array<integer>
Example
[ 3, 5]workflowId
Run this workflow on the file after the document is created.
string
Responses
Section titled “Responses”Parse job accepted
Media typeapplication/json
object
id
string
status
string
debugId
string
pollUrl
string
Example
{ "status": "queued"}Missing or invalid API key
Model not found