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"
}
}API endpoints
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.
POST
/
api
/
v2
/
extract
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 structured data directly from a document, or reuse a completed Parse. Choose the request format for your input:
For direct document extraction, send
Start with Parse your first document.
Chain Parse and Extract: pass a completed Parse ID as
| 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
ApiKeyAuthBearerAuth
Headers
Body
application/jsonmultipart/form-data
A parse ID to extract from, and the shape to extract into.
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.
Response
Fields extracted. Check status for partial success.
Parse operation metadata plus the canonical document, possibly before extraction has finished.
Was this page helpful?

