curl https://transform.unstructured.io/api/v2/extract \
-H "unstructured-api-key: $UNSTRUCTURED_API_KEY" \
-F "input=@document.pdf" \
--form-string 'schema={"type":"object","properties":{"invoice_number":{"type":"string"}}}'
{
"id": "7e3f0f72-4f99-4d6f-b42b-00cdaf7d54e6",
"status": "completed",
"profile": "balanced",
"warnings": [],
"markdown": null,
"format_version": "2.0",
"metadata": {
"page_count": 1
},
"extracted_data": [
{
"data": {
"invoice_number": "INV-1001"
}
}
],
"elements": [],
"source": {
"file_id": "invoice-9eb6c914.pdf",
"filename": "invoice.pdf",
"mimetype": "application/pdf",
"expires_at": "2026-09-18T18:34:26Z"
}
}Extract fields from a Parse or document
Extract structured fields from a document or a completed Parse with a schema. Review required inputs, returned values, and pending responses.
curl https://transform.unstructured.io/api/v2/extract \
-H "unstructured-api-key: $UNSTRUCTURED_API_KEY" \
-F "input=@document.pdf" \
--form-string 'schema={"type":"object","properties":{"invoice_number":{"type":"string"}}}'
{
"id": "7e3f0f72-4f99-4d6f-b42b-00cdaf7d54e6",
"status": "completed",
"profile": "balanced",
"warnings": [],
"markdown": null,
"format_version": "2.0",
"metadata": {
"page_count": 1
},
"extracted_data": [
{
"data": {
"invoice_number": "INV-1001"
}
}
],
"elements": [],
"source": {
"file_id": "invoice-9eb6c914.pdf",
"filename": "invoice.pdf",
"mimetype": "application/pdf",
"expires_at": "2026-09-18T18:34:26Z"
}
}| Input | Content type | Body fields |
|---|---|---|
| A document | multipart/form-data | input: the file to upload. schema: a JSON Schema serialized as a JSON string. |
| A previously uploaded file | multipart/form-data | file_id: the uploaded file ID, instead of input. schema: a JSON Schema serialized as a JSON string. |
| A completed Parse | application/json | parse_id: the completed Parse ID. schema: a JSON Schema object. |
input and schema together. You do not need to upload or parse the document first.
In the cURL example, -F "input=@document.pdf" uploads document.pdf as the input field.
To view the fields for each format, use the content-type selector beside Body: select multipart/form-data for document uploads or application/json for a completed Parse.
curl https://transform.unstructured.io/api/v2/extract \
-H "unstructured-api-key: $UNSTRUCTURED_API_KEY" \
-F "input=@document.pdf" \
--form-string 'schema={"type":"object","properties":{"invoice_number":{"type":"string"}}}'
parse_id to reuse its content.Authorizations
API keys must be sent in this header.
Headers
Wait up to this many seconds for completed extraction. When omitted the request waits up to 15 minutes, then returns 202 with the job to poll.
Body
A parse ID to extract from, and the shape to extract into.
The ID of the parse to extract against. It is not parsed again.
"9eb6c914-02a5-4c5d-8490-a06476946a38"
A JSON Schema. Subject to the same engine constraints as schema on the parse call: it must be a valid JSON Schema (drafts 6, 7, 2019-09 or 2020-12), required and additionalProperties are filled in automatically when omitted so they are not the caller's burden, and the serialized schema is limited to 1,048,576 bytes.
Optional free-text guidance that shapes how extracted fields are filled. Limited to 1,048,576 bytes when encoded as UTF-8.
Response
Fields extracted. Check status for partial success.
Parse operation metadata plus the canonical document, possibly before extraction has finished.
Underlying job id, for support and tracing.
Document processing or terminal status.
processing, completed, completed_with_warnings The effective profile used for raw-document partitioning.
balanced, best Rendered Markdown projection when requested; null when elements are requested.
The document envelope version.
Public document-level metadata.
Show child attributes
Show child attributes
Completed extraction results are available only after extraction has finished.
Show child attributes
Show child attributes
Public document elements.
Show child attributes
Show child attributes
The associated original uploaded source file, when known.
Show child attributes
Show child attributes
Notes about a result that still succeeded.
Show child attributes
Show child attributes
Pages that could not be processed and have no elements in this result.
Show child attributes
Show child attributes
Pages that are in this result although some of their content could not be recognized.
Show child attributes
Show child attributes
Was this page helpful?

