Skip to content

Extractor test sets

Each extractor has a test set of sample documents with expected output, and test runs that score the draft or a version against it. How to use them is in Test sets and publishing; this page is the endpoint reference. Reading needs extractors:read, changing and starting runs needs extractors:write.

{
"object": "extractor_test_document",
"id": "etd_01JE4KJ2M3N4P5Q6R7S8T9V0W1",
"file_name": "bill-0912.pdf",
"file_type": "pdf",
"file_size": 184233,
"pages": null,
"has_expected": true,
"expected": { "invoice_number": "INV-2026/0912", "total": 29800 },
"source": "upload",
"job_id": null,
"created_at": "2026-12-04T10:14:52.001Z"
}
Field Type Description
id string etd_ followed by a ULID
file_name, file_type, file_size As detected on upload; file_type uses the same values as the job object
pages integer | null Not populated today
has_expected, expected Whether an expected output is set, and the object itself
source string upload or from_job
job_id string | null The job the file was copied from

GET https://api.deskew.dev/v1/extractors/{name}/test-documents

Scope extractors:read. Oldest first; not paginated.

Terminal window
curl https://api.deskew.dev/v1/extractors/hospital-invoice/test-documents -H "Authorization: Bearer $DESKEW_API_KEY"
{ "object": "list", "data": [ { "object": "extractor_test_document", "id": "etd_01JE4KJ2M3N4P5Q6R7S8T9V0W1", "...": "..." } ] }

POST https://api.deskew.dev/v1/extractors/{name}/test-documents

Scope extractors:write. multipart/form-data.

Field Type Description
file file The sample document, up to 25 MB. One of file or job_id is required
job_id string Copy the original file of this job (any job of the project, test or live). When the job used this extractor and completed, expected is pre-filled from its extraction.data unless you send one
expected string A JSON object (as a string, since this is a form) of the correct data. Optional
Terminal window
curl https://api.deskew.dev/v1/extractors/hospital-invoice/test-documents \
-H "Authorization: Bearer $DESKEW_API_KEY" \
-F "file=@samples/bill-0912.pdf" \
-F 'expected={"invoice_number":"INV-2026/0912","total":29800}'

201 Created with the test document object.

Status Code When
403 plan_limit The extractor has the plan’s maximum number of test documents
404 extractor_not_found Unknown or archived extractor
404 job_not_found job_id is not a job of this project
404 job_file_expired The job’s original file has been deleted (jobs are retained 24 hours by default)
413 payload_too_large File over 25 MB
415 / 422 unsupported_type, image_too_large, archive_too_large, empty_file The same input checks as POST /v1/extract
422 validation_error Neither file nor job_id, or expected is not a JSON object

PUT https://api.deskew.dev/v1/extractors/{name}/test-documents/{id}

Scope extractors:write. application/json.

Body field Type Description
expected object | null Required. The correct data, or null to clear it
Terminal window
curl -X PUT https://api.deskew.dev/v1/extractors/hospital-invoice/test-documents/etd_01JE4KJ2M3N4P5Q6R7S8T9V0W1 \
-H "Authorization: Bearer $DESKEW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"expected": {"invoice_number": "INV-2026/0912", "total": 29800, "paid": null}}'

200 OK with the updated test document object.

Status Code When
404 test_document_not_found No such document on this extractor

DELETE https://api.deskew.dev/v1/extractors/{name}/test-documents/{id}

Scope extractors:write. Removes the document and its stored file. 204 No Content.

Status Code When
404 test_document_not_found
{
"object": "extractor_test_run",
"id": "etr_01JE4KM6N7P8Q9R0S1T2U3V4W5",
"target": "draft",
"version": null,
"status": "running",
"documents": 2,
"summary": null,
"started_at": "2026-12-04T10:20:03.117Z",
"finished_at": null
}
Field Type Description
id string etr_ followed by a ULID
target string draft or version
version integer | null The version tested; null for the draft
status string running until every job is finished, then completed
documents integer Test documents in the run
summary object | null Aggregate scores; partial (with complete: false) while running. Fields in Summary fields
results array One entry per document; only on GET .../test-runs/{id}. Fields in Per-field statuses

POST https://api.deskew.dev/v1/extractors/{name}/test-runs

Scope extractors:write. Creates one test-mode job per test document and returns at once.

Body field Type Default Description
target string draft draft or version
version integer current published With target: "version"
document_ids string[] all Subset of test documents
Terminal window
curl -X POST https://api.deskew.dev/v1/extractors/hospital-invoice/test-runs \
-H "Authorization: Bearer $DESKEW_API_KEY" \
-H "Content-Type: application/json" \
-d '{"target": "draft"}'

202 Accepted with the test run object in status: "running".

Status Code When
404 extractor_not_found Unknown or archived extractor
404 extractor_version_not_found version does not exist
409 extractor_unpublished target: "version" with nothing published
409 no_test_documents The extractor has no test documents (or none matched document_ids)
422 extractor_invalid target: "draft" and the draft does not validate
429 test_daily_cap The run’s pages exceed the key’s remaining test pages for today

GET https://api.deskew.dev/v1/extractors/{name}/test-runs

Scope extractors:read. Newest first, without results.

Query Default Description
limit 10 1 to 50
{ "object": "list", "data": [ { "object": "extractor_test_run", "id": "etr_01JE4KM6N7P8Q9R0S1T2U3V4W5", "status": "completed", "summary": { "...": "..." }, "...": "..." } ] }

GET https://api.deskew.dev/v1/extractors/{name}/test-runs/{run_id}

Scope extractors:read. The run with results[]. Reading a running run folds in any jobs that have finished since, so the summary moves as you poll.

{
"object": "extractor_test_run",
"id": "etr_01JE4KM6N7P8Q9R0S1T2U3V4W5",
"target": "draft",
"version": null,
"status": "completed",
"documents": 2,
"summary": { "documents": 2, "passed": 1, "failed": 1, "failed_jobs": 0, "scored_documents": 2, "field_accuracy": 0.75, "fields_matched": 3, "fields_total": 4, "flags": 1, "worst_fields": [{ "field": "total", "misses": 1 }], "credits": 14, "complete": true },
"started_at": "2026-12-04T10:20:03.117Z",
"finished_at": "2026-12-04T10:20:41.902Z",
"results": [
{
"document_id": "etd_01JE4KJ2M3N4P5Q6R7S8T9V0W1",
"file_name": "bill-0912.pdf",
"job_id": "job_01JE4KM7A1B2C3D4E5F6G7H8J9",
"job_status": "completed",
"extraction_status": "ok",
"flags": [],
"actual": { "...": "..." },
"comparison": { "scored": true, "passed": true, "matched": 2, "total": 2, "fields": { "invoice_number": { "status": "match", "expected": "INV-2026/0912", "actual": "INV-2026/0912" }, "total": { "status": "match", "expected": 29800, "actual": 29800.0 } } },
"passed": true
}
]
}

A result whose job failed has passed: false and error (the job’s error object) instead of extraction_status, flags, actual and comparison.

Status Code When
404 test_run_not_found No such run on this extractor