OCR Summary
Summarize scanned PDFs and images: the pages are read with OCR first, then summarized.
document.ocr_summarize runs in two steps: OCR reads the text from a scanned PDF or a batch of page images, then the text is summarized in the language you choose. Use document.summarize instead when the document already has selectable text.
| Operation | Input | Credits | Result |
|---|---|---|---|
| document.ocr_summarize | One PDF up to 50 MB, or 1 to 50 JPG, PNG or WEBP images up to 10 MB each | 30 per PDF page or image, plus 30 per summary page delivered | summary text and pages |
Input
uploadIdstringoptionalOne scanned PDF. Send this or uploadIds, not both.
uploadIdsstring[]optional1 to 50 images, in reading order. Images only: a PDF goes in uploadId.
summaryLanguagestringrequiredLanguage of the summary, as a name (Hindi) or code (hi). Same list as translation.
summaryPagesintegeroptionaldefault: 1Length of the summary in pages, 1 to 20. You are charged for the pages delivered, never more than requested.
focusstringoptionalSummary style preset.
customInstructionsstringoptionalExtra guidance for the summary, up to 1000 characters.
modelstringoptionaldefault: basicSummary model tier.
ocrProfilestringoptionaldefault: regularOCR tuned for the script: indic for Indian scripts, regular for everything else.
webhookUrlstringoptionalPublic HTTPS URL that receives signed job updates (top-level, next to operation). See Webhooks.
Code Example
curl -X POST https://api.transpera.io/v1/jobs \
-H "authorization: Bearer tp_test_..." \
-H "content-type: application/json" \
-H "idempotency-key: $(uuidgen)" \
-d '{
"operation": "document.ocr_summarize",
"input": {"uploadIds":["UPLOAD_ID_1","UPLOAD_ID_2"],"summaryLanguage":"English","summaryPages":2,"focus":"key_takeaways","ocrProfile":"indic"}
}'Response
{
"job": {
"id": "JOB_ID",
"operation": "document.ocr_summarize",
"status": "succeeded",
"chargedCredits": 120,
"result": {
"type": "summary",
"text": "The fact sheet describes...",
"pages": [
{ "pageNumber": 1, "title": "Key takeaways", "content": "The fact sheet describes...", "wordCount": 412 }
]
}
}
}Errors
| Status | Code | When |
|---|---|---|
| 400 | invalid_input | A field is missing, unknown or out of range, or the upload is not yours. |
| 400 | unsupported_file | The operation does not take this file type. |
| 400 | file_too_large | PDF over 50 MB, office or spreadsheet file over 25 MB, or image over 10 MB. |
| 400 | unreadable_document | The document's pages could not be counted. |
| 402 | insufficient_credits | The wallet, or a test key's spend cap, does not cover the estimate. |
| 409 | conflict | The Idempotency-Key was already used with a different input or operation. |
| errorCode | Meaning |
|---|---|
| extraction_failed | OCR could not read the file. |
| no_text_found | OCR finished but found no readable text. |
| failed | The summary could not be written. |
| missing_output | The summary step returned no text. |
| enqueue_failed | The job could not be handed to the worker. Retry with a new Idempotency-Key. |