/// REFERENCE

How do I extract structured JSON from a PDF?

Schema-driven extraction with Claude Sonnet 5. Returns the fields you describe with per-field confidence, and a review queue for the uncertain ones.

Published: Last updated:

Answer: pdf-to-data extracts the fields you describe in a schema object and returns each value with a confidence score; three credits. When the lowest score falls below confidence_threshold the result is marked needs_review and waits in the review queue, where you correct and approve it — approval fires the review.approved webhook with the corrected data.

Request

Upload to the v1 tool route with the schema in options, or post JSON with a file_url to /api/v1/extract/data. A missing or empty schema is a 400 schema_required.

bash
curl -X POST https://www.ashdocs.com/api/v1/tools/pdf-to-data \
  -H "X-API-Key: ash_test_xxxxxxxx" \
  -F "files=@invoice.pdf" \
  -F 'options={"schema":{"invoice_number":"string","total":"number"},"confidence_threshold":0.9}'

The review queue

The four review routes in the table are session (dashboard) routes. A result created with zero retention writes no review row, so it never enters the queue — its confidence stays inline in the response only.

Options and review routes

Generated from the backend source.

Sent inKeyWhat it does
pdf-to-data options / /api/v1/extract/data bodyschemaRequired, non-empty object describing the fields to extract. Missing or empty is a 400 schema_required.
options / form fieldconfidence_thresholdDefault 0.85. When the lowest field confidence is below it, the result is marked needs_review and enters the review queue.
/api/v1/extract/tables and /extract/bank-statementconfidence_threshold (form)The same threshold as a multipart form field on the extract endpoints.
optionson_low_confidencefail returns 422 low_confidence instead of completing; flag (default) or ignore completes the job and reports needs_review.
review queueGET /api/reviewYour results awaiting review (only_pending=true by default; limit up to 200), each with signed links to its source file.
review queueGET /api/review/{result_id}One result with its extracted data, confidence and source file.
review queuePATCH /api/review/{result_id}Save corrected extracted_json; approve: true clears needs_review and fires the review.approved webhook.
review queuePOST /api/review/{result_id}/rejectReject the result: it leaves the queue marked rejected.

Frequently asked questions

What happens when confidence is low?

The job completes with needs_review: true and the result waits in the review queue. Send on_low_confidence: fail to get a 422 low_confidence instead.

Which model does the extraction?

Claude Sonnet 5.

Do zero-retention results appear in the review queue?

No. Zero retention stores no review row, so only the inline response carries the confidence.