POST /extract
Extracts structured data from a PDF file according to a configured schema. Only the fields defined in the schema are returned — sensitive content in the document is never exposed.
Endpoint
This endpoint accepts multipart/form-data (not JSON). The PDF is sent as a file field alongside the other parameters as regular form fields. Do not set Content-Type manually — your HTTP client must set the correct multipart boundary.
Form fields
| Field | Type | Description | |
|---|---|---|---|
| file | file | required | The PDF to extract data from. Max 10 MB. |
| schema_id | string | required | ID of the schema that defines which fields to extract. |
| provider | string | required | anthropic | openai | gemini | groq | mistral |
| model | string | required | Model to use (e.g. claude-sonnet-4-6, gpt-4o). |
| user_id | string | required | Your Reliant user ID. |
| end_user_id | string | optional | Enables persistent memory scoped to this end user. |
| external_id | string | optional | Extra scope key to isolate memory threads for the same user. |
How it works
Reliant extracts all text from the uploaded PDF and sends it as the user prompt to the configured LLM provider. The schema's JSON Schema definition is used as the output contract — the model is instructed to return only the declared fields. The extraction goes through the same reliability pipeline as /execute: automatic retries, provider fallback, quality scoring, and full audit logging.
If the PDF text exceeds approximately 20 000 tokens, the content is truncated and the response will include "truncated": true. Image-based (scanned) PDFs that contain no extractable text will return a 422 error.
Schema example
Define a schema with only the fields you want to expose. For a purchase order you might use:
Only these four fields will ever appear in the response — any other content in the PDF (bank details, personal data, internal notes) is discarded.
cURL
TypeScript / Node.js
Python
Response — 200 OK
Error responses
| Status | Error | Cause |
|---|---|---|
400 | Validation Error | Missing required field or invalid provider. |
413 | File Too Large | PDF exceeds 10 MB. |
422 | PDF Parse Error | File is corrupted or image-based (no extractable text). |
207 | — | All retries failed; safe_fallback was used if configured. |