extraction
Extract Structured Data
Extract structured data from a file or URL using AI.
Upload a file (or provide a URL) along with a typed JSON schema describing the fields you want extracted. Each field must have a type and description. Returns structured data matching your schema with guaranteed type conformance.
Example schema:
{
"invoice_number": {"type": "string", "description": "The invoice number"},
"total_amount": {"type": "number", "description": "Total amount due", "required": true},
"status": {"type": "string", "enum": ["paid", "unpaid", "overdue"]},
"line_items": {
"type": "array",
"description": "Each line item",
"items": {
"type": "object",
"properties": {
"description": {"type": "string"},
"quantity": {"type": "integer"},
"unit_price": {"type": "number"}
}
}
}
}
Supported types: string, number, integer, boolean, array, object
Supported formats: PDF, DOCX, XLSX, PPTX, CSV, images (JPG, PNG), and any file type supported by the markdown conversion endpoint.
Vision mode: For images or scanned documents, set use_vision=true for highest accuracy on visual content.
post/api/v1/extract
Request
- Base URL: https://docs.thedrive.ai (the document declares no server; this is the origin it was published from)
- URL: https://docs.thedrive.ai/api/v1/extract
- Auth: none declared
Headers
X-API-Keystring
Response
Successful Response
Example response
{
"citations": {
"invoice_number": "Invoice #: INV-2024-0042",
"total_amount": "Total Due: $1,234.56"
},
"confidence": {
"invoice_number": 0.96,
"total_amount": 0.91,
"vendor_name": 0.94
},
"content_type": "application/pdf",
"credits_used": 7,
"data": {
"invoice_number": "INV-2024-0042",
"total_amount": 1234.56,
"vendor_name": "Acme Corp"
},
"extraction_method": "text",
"field_status": {
"invoice_number": {
"confidence": 0.96,
"required": false,
"status": "found",
"type": "string"
},
"total_amount": {
"confidence": 0.91,
"required": true,
"status": "found",
"type": "number"
},
"vendor_name": {
"confidence": 0.94,
"required": false,
"status": "found",
"type": "string"
}
},
"filename": "invoice.pdf",
"model_used": "fast",
"pages_processed": 50,
"schema_format": "typed",
"success": true,
"text_length": 2450,
"total_pages": 1200
}Changes
No recorded changes to this operation across all 1 revision of this API.