PDF Parse
Parses the text layer of a PDF into text, Markdown, or `flowyn.pdf_parse.v1` JSON. Headings, tables, and reading order are preserved. Pages without a text layer come back empty; Flowyn does not perform OCR.
What pdf parse does
Parses the text layer of a PDF into text, Markdown, or flowyn.pdf_parse.v1 JSON. Headings, tables, and reading order are preserved. Pages without a text layer come back empty; Flowyn does not perform OCR.
When to use pdf parse
- You need the content of invoices, reports, or contracts as structured data
- You feed documents to an LLM or an agent and want Markdown
- You index PDFs for search
Authentication
Send an API key as a bearer token. Keys are shown once, belong in a server environment, and are bound to one environment: flw_test_ keys act in test and flw_live_ keys in live.
Authorization: Bearer flw_test_••••Endpoint
POST https://api.flowyn.dev/v1/pdf/parseRequest
Send an Idempotency-Key so a retried request cannot create a duplicate. The body is JSON.
curl -X POST https://api.flowyn.dev/v1/pdf/parse \
-H "Authorization: Bearer $FLOWYN_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: parse-quarterly-001" \
-d '{
"file_id": "9c1e5b7a-2d4f-4a6b-8e3c-1f0a7d2b5c64",
"output": "markdown"
}'Response
Flowyn returns HTTP 202. The response is abridged here; the OpenAPI document lists every field.
{
"id": "2b7d9e1f-4a6c-4b8d-9f2e-7c1a3e5d8b90",
"object": "job",
"operation": "pdf_parse",
"status": "queued",
"file_id": "9c1e5b7a-2d4f-4a6b-8e3c-1f0a7d2b5c64",
"request_id": "req_5f2a9c1e7b3d4a6f8e0c2b1d"
}Lifecycle
- Upload the file with
POST /v1/files(tus resumable upload). The response is the file with itsid. - Call
POST /v1/pdf/parsewith thefile_id. Flowyn stores the operation and returns HTTP 202 with a job id before any work starts. - A managed worker claims the job, runs the operation, and records an attempt.
- Read
GET /v1/file-jobs/{id}. Whenstatusiscomplete,outputslists the produced files; download one withGET /v1/files/{id}/download.
Status values
| Status | Meaning |
|---|---|
| queued | Accepted, waiting for a worker. |
| delayed | Waiting before a scheduled retry. |
| processing | A worker is running the operation. |
| retrying | The last attempt failed and another is scheduled. |
| complete | Outputs are stored and listed in outputs. |
| failed | The operation could not complete; error explains why. |
| cancelled | Cancelled before it completed. |
Retries
A file operation gets up to 3 attempts. Worker failures and timeouts are retried; an unreadable or unsupported file fails without a retry.
Idempotency
Send Idempotency-Key. The same key and body return the original job.
Errors
| Status | type | Meaning |
|---|---|---|
| 400 | invalid_request | The body is not valid JSON, a field has the wrong type, or the body is over 1 MiB (body_too_large). |
| 401 | unauthorized | Missing, malformed, or revoked API key. |
| 402 | billing_error | The monthly credit allowance is used (credit_limit_exceeded). Reads keep working. |
| 403 | forbidden | The key lacks the ability this call needs (ability_required). |
| 404 | not_found | The id does not exist in this environment. |
| 409 | conflict | For example idempotency_mismatch: the Idempotency-Key was used with a different body. |
| 422 | invalid_request | A field value is out of range, for example invalid_timeout. |
| 429 | rate_limited | Too many requests (rate_limit_exceeded). Wait for Retry-After seconds. |
| 5xx | server_error | Flowyn failed. The body carries an error_id to quote to support. |
Limits
outputistext,markdown, orjson- Files up to 50 MB and 200 pages
- No OCR: image-only pages return empty content
Upload the file first
Uploads use the tus resumable upload protocol. One request can create the upload and send the bytes.
curl -i -X POST https://api.flowyn.dev/v1/files \
-H "Authorization: Bearer $FLOWYN_API_KEY" \
-H "Tus-Resumable: 1.0.0" \
-H "Upload-Length: $(wc -c < report.pdf | tr -d ' ')" \
-H "Upload-Metadata: filename $(printf report.pdf | base64),filetype $(printf application/pdf | base64)" \
-H "Content-Type: application/offset+octet-stream" \
--data-binary @report.pdfRead it back
Keep the id and read the resource whenever you need its current state.
curl https://api.flowyn.dev/v1/file-jobs/2b7d9e1f-4a6c-4b8d-9f2e-7c1a3e5d8b90 \
-H "Authorization: Bearer $FLOWYN_API_KEY"Related
Next step
Try it in the Playground with a sample PDF.
