Documents
Upload, list, inspect and manage documents. Processing is asynchronous: poll a document, listen on the event stream, or subscribe a webhook.
List documents#
Filters combine with AND. status is repeatable. assignedTo takes a user id, me or unassigned. search also matches extracted field values. sort is <column>:<asc|desc> (default createdAt:desc).
/api/v2/documentsRequires documents:read on the queue it touches.queue-scopedcursor-paginated
Query parameters
queueIdstringstatus"received" | "processing" | "needs_review" | "approved" | "rejected" | "exported" | "failed" | "split" (repeatable)searchstringassignedTostringsourcestringdocumentTypestringfromstringtostringminConfidencenumbermaxConfidencenumbertagsstring | string[]sortstringcursorstringlimitnumber
Responses
OK. Cursor-paginated: pass nextCursor back as cursor; null means the last page.
curl -X GET "https://docuflow.pendral.io/api/v2/documents" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"items": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices","queueId": "clx9k2m4p0001qh8z3v7d5f2a","status": "received","stage": "stage","progress": 100,"mimeType": "application/pdf","size": 184233,"pageCount": 2,"documentType": "invoice","priority": 0,"assignedToId": null,"confidence": 0.94,"avgConfidence": 0.91,"fieldCount": 1,"flaggedCount": 1,"source": "upload","parentDocumentId": null,"legalHold": false,"dueAt": null,"reviewedAt": "2026-10-01T12:00:00.000Z","exportedAt": null,"createdAt": "2026-10-01T12:00:00.000Z","updatedAt": "2026-10-01T12:00:00.000Z","queue": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices","slug": "invoices"},"assignedTo": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null},"tags": "tags","createdBy": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null},"match": null,"duplicateOf": null}],"nextCursor": "clx9k2m4p0001qh8z3v7d5f2a"}
Upload documents#
One or more file parts into a queue. Returns immediately; processing runs in the background.
/api/v2/documentsRequires documents:create on the queue it touches.queue-scoped
Body
multipart/form-datafilefile[]required- PDF, image, TIFF, Office or EML. Repeat the part for several files.
queueIdstring- Target queue id (or use
queue). queuestring- Target queue slug.
prioritystring- Integer -10…10; higher is reviewed first.
tagsstring- Comma-separated tags.
dedupe"true" | "false"- Skip files whose bytes were already ingested into this queue.
Responses
OK
curl -X POST "https://docuflow.pendral.io/api/v2/documents" \-H "Authorization: Bearer $DOCUFLOW_API_KEY" \-F "file=@invoice.pdf" \-F "queue=invoices"
{"documents": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "invoice-1042.pdf","duplicate": false}]}
Counts by status and queue#
Counts by status and queue
/api/v2/documents/statsRequires documents:read on the queue it touches.queue-scoped
Query parameters
queueIdstring
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/documents/stats" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"byStatus": {"key": 1},"total": 1,"byQueue": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices","slug": "invoices","needsReview": 1,"failed": 1,"processing": 1}],"autoApprovedToday": 1,"oldestWaitingAt": "2026-10-01T12:00:00.000Z","oldestWaitingId": "clx9k2m4p0001qh8z3v7d5f2a"}
Bulk actions#
Assign, move, reprioritise, tag (add_tags/remove_tags), reprocess or delete up to 500 documents. The permission checked depends on action (documents:assign|update|reprocess|delete); ids the caller can't act on are skipped.
/api/v2/documents/bulkRequires documents:update on the queue it touches.queue-scoped
Body
application/jsonaction"assign"idsstring[]assignedToIdstring | nullqueueIdstringpriorityintegerfromScratchbooleantagsstring[]
Responses
OK
curl -X POST "https://docuflow.pendral.io/api/v2/documents/bulk" \-H "Authorization: Bearer $DOCUFLOW_API_KEY" \-H "Content-Type: application/json" \-d '{"action": "assign","ids": ["clx9k2m4p0001qh8z3v7d5f2a"],"assignedToId": "clx9k2m4p0001qh8z3v7d5f2a"}'
{"affected": 1,"failed": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","error": "error"}],"skipped": 1}
Get a document#
With pages, latest run, fields (with bounding boxes), timeline events and comments.
/api/v2/documents/{id}Requires documents:read on the queue it touches.queue-scoped
Path parameters
idstringrequired- Document id.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/documents/{id}" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices","queueId": "clx9k2m4p0001qh8z3v7d5f2a","status": "received","stage": "stage","progress": 100,"mimeType": "application/pdf","size": 184233,"pageCount": 2,"documentType": "invoice","priority": 0,"assignedToId": null,"confidence": 0.94,"avgConfidence": 0.91,"fieldCount": 1,"flaggedCount": 1,"source": "upload","parentDocumentId": null,"legalHold": false,"dueAt": null,"reviewedAt": "2026-10-01T12:00:00.000Z","exportedAt": null,"createdAt": "2026-10-01T12:00:00.000Z","updatedAt": "2026-10-01T12:00:00.000Z","queue": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices","slug": "invoices"},"assignedTo": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null},"tags": ["urgent"],"createdBy": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null},"match": null,"duplicateOf": null,"sourceRef": {},"pages": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","pageNumber": 1,"width": 1,"height": 1}],"events": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","type": "type","message": "message","createdAt": "2026-10-01T12:00:00.000Z"}],"comments": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","body": "Please confirm the PO number with the supplier.","fieldPath": "invoiceTotal","author": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null},"createdAt": "2026-10-01T12:00:00.000Z"}],"latestRun": {"id": "clx9k2m4p0001qh8z3v7d5f2a","status": "status","model": "model"},"fields": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","runId": "clx9k2m4p0001qh8z3v7d5f2a","path": "invoiceTotal","key": "invoiceNumber","label": "Invoice number","type": "type","value": "1240.00","originalValue": "originalValue","normalizedValue": "normalizedValue","page": 1,"bbox": "bbox","confidence": 0.94,"ocrConfidence": 1,"matchScore": 1,"status": "status","validation": "validation","editedBy": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices"}}]}
Update a document#
Rename, reprioritise, tag, assign (documents:assign), move between queues or toggle legal hold.
/api/v2/documents/{id}Requires documents:update on the queue it touches.queue-scoped
Path parameters
idstringrequired- Document id.
Body
application/jsonnamestringpriorityintegertagsstring[]assignedToIdstring | nulllegalHoldbooleanqueueIdstring
Responses
OK
curl -X PATCH "https://docuflow.pendral.io/api/v2/documents/{id}" \-H "Authorization: Bearer $DOCUFLOW_API_KEY" \-H "Content-Type: application/json" \-d '{"name": "Invoices","priority": 0,"tags": ["urgent"]}'
{"document": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "invoice-1042.pdf","queueId": "clx9k2m4p0001qh8z3v7d5f2a","status": "received","stage": "stage","progress": 100,"mimeType": "application/pdf","size": 184233,"pageCount": 2,"documentType": "invoice","priority": 0,"assignedToId": null,"confidence": 0.94,"avgConfidence": 0.91,"fieldCount": 1,"flaggedCount": 1,"source": "upload","parentDocumentId": null,"legalHold": false,"dueAt": null,"reviewedAt": "2026-10-01T12:00:00.000Z","exportedAt": null,"createdAt": "2026-10-01T12:00:00.000Z","updatedAt": "2026-10-01T12:00:00.000Z"}}
Delete a document#
Soft-deletes now; files are purged later unless on legal hold.
/api/v2/documents/{id}Requires documents:delete on the queue it touches.queue-scoped
Path parameters
idstringrequired- Document id.
Responses
OK
curl -X DELETE "https://docuflow.pendral.io/api/v2/documents/{id}" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"ok": true}
Download the file#
The normalised PDF, or the original upload with original=1.
/api/v2/documents/{id}/fileRequires documents:read on the queue it touches.queue-scoped
Path parameters
idstringrequired- Document id.
Query parameters
original"1"- Return the original upload.
downloadstring- Any value:
Content-Disposition: attachment.
Responses
The file (application/pdf or the original MIME type).
curl -X GET "https://docuflow.pendral.io/api/v2/documents/{id}/file" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
<application/octet-stream bytes>
Page image or OCR words#
The rendered page as WebP. thumb=1 for the thumbnail; words=1 for OCR words JSON. Send v=<page id> for an immutable cacheable response; otherwise responses carry an ETag.
/api/v2/documents/{id}/pages/{n}Requires documents:read on the queue it touches.queue-scoped
Path parameters
idstringrequired- Document id.
nstringrequired- 1-based page number.
Query parameters
thumb"1"words"1"vstring- Page id (version) for immutable caching.
Responses
Page raster. With words=1: application/json (see schema).
curl -X GET "https://docuflow.pendral.io/api/v2/documents/{id}/pages/{n}" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"page": 1,"width": 1,"height": 1,"words": [{"text": "text","bbox": {"x": 1,"y": 1,"w": 1,"h": 1},"confidence": 0.94}],"lines": [null]}
Reprocess#
Re-run extraction; fromScratch=1 also re-renders pages and OCR.
/api/v2/documents/{id}/reprocessRequires documents:reprocess on the queue it touches.queue-scoped
Path parameters
idstringrequired- Document id.
Query parameters
fromScratch"1"
Responses
OK
curl -X POST "https://docuflow.pendral.io/api/v2/documents/{id}/reprocess" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"ok": true}
Export one document#
Extracted data as a file download.
/api/v2/documents/{id}/exportRequires documents:export on the queue it touches.queue-scoped
Path parameters
idstringrequired- Document id.
Query parameters
format"json" | "csv" | "xlsx"- Default
"json"
Responses
application/json, text/csv or XLSX.
curl -X GET "https://docuflow.pendral.io/api/v2/documents/{id}/export" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
<application/octet-stream bytes>
Document timeline#
Everything that happened to the document: status changes, assignments, comments, reprocessing, duplicates. Oldest first unless order=desc. The document detail carries only the first 200; this pages through all of them.
/api/v2/documents/{id}/eventsRequires documents:read on the queue it touches.queue-scopedcursor-paginated
Path parameters
idstringrequired- Document id.
Query parameters
typestring- Only events of this type (e.g.
status,comment,assigned,duplicate). order"asc" | "desc"asc(default) is oldest first, like the timeline.- Default
"asc" cursorstringlimitinteger- Page size (default 50, max 200).
Responses
OK. Cursor-paginated: pass nextCursor back as cursor; null means the last page.
curl -X GET "https://docuflow.pendral.io/api/v2/documents/{id}/events" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"items": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","type": "type","message": "message","data": null,"actor": {"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "Ada Lovelace","email": "ada@example.com","image": null},"createdAt": "2026-10-01T12:00:00.000Z"}],"nextCursor": "clx9k2m4p0001qh8z3v7d5f2a"}
List pages#
Dimensions, rotation and OCR metadata per page, with links to the page image, thumbnail and OCR words. The links are API paths: call them with the same credential.
/api/v2/documents/{id}/pagesRequires documents:read on the queue it touches.queue-scoped
Path parameters
idstringrequired- Document id.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/documents/{id}/pages" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"pages": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","pageNumber": 1,"width": 1,"height": 1,"rotation": 1,"textLayer": false,"ocrEngine": "ocrEngine","ocrConfidence": 1,"wordCount": 1,"hasThumbnail": false,"hasWords": false,"createdAt": "2026-10-01T12:00:00.000Z","links": {"image": "image","thumbnail": "thumbnail","words": "words"}}]}
Split documents#
Documents split out of this one (parentDocumentId), in split order, narrowed to those the caller can see.
/api/v2/documents/{id}/childrenRequires documents:read on the queue it touches.queue-scoped
Path parameters
idstringrequired- Document id.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/documents/{id}/children" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"documents": [{"id": "clx9k2m4p0001qh8z3v7d5f2a","name": "invoice-1042.pdf","queueId": "clx9k2m4p0001qh8z3v7d5f2a","status": "received","stage": "stage","progress": 100,"mimeType": "application/pdf","size": 184233,"pageCount": 2,"documentType": "invoice","priority": 0,"assignedToId": null,"confidence": 0.94,"avgConfidence": 0.91,"fieldCount": 1,"flaggedCount": 1,"source": "upload","parentDocumentId": null,"legalHold": false,"dueAt": null,"reviewedAt": "2026-10-01T12:00:00.000Z","exportedAt": null,"createdAt": "2026-10-01T12:00:00.000Z","updatedAt": "2026-10-01T12:00:00.000Z"}]}
Duplicates#
The document this one duplicates (duplicateOf), and the documents later flagged as duplicates of it. exact is the same bytes; content the same text.
/api/v2/documents/{id}/duplicatesRequires documents:read on the queue it touches.queue-scoped
Path parameters
idstringrequired- Document id.
Responses
OK
curl -X GET "https://docuflow.pendral.io/api/v2/documents/{id}/duplicates" \-H "Authorization: Bearer $DOCUFLOW_API_KEY"
{"duplicateOf": null,"duplicates": [{"documentId": "clx9k2m4p0001qh8z3v7d5f2a","name": "Invoices","status": "received","kind": "exact","similarity": 1,"createdAt": "2026-10-01T12:00:00.000Z"}]}