Insights Studio

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.

OperationInputCreditsResult
document.ocr_summarizeOne PDF up to 50 MB, or 1 to 50 JPG, PNG or WEBP images up to 10 MB each30 per PDF page or image, plus 30 per summary page deliveredsummary text and pages

Input

uploadIdstringoptional

One scanned PDF. Send this or uploadIds, not both.

uploadIdsstring[]optional

1 to 50 images, in reading order. Images only: a PDF goes in uploadId.

summaryLanguagestringrequired

Language of the summary, as a name (Hindi) or code (hi). Same list as translation.

summaryPagesintegeroptionaldefault: 1

Length of the summary in pages, 1 to 20. You are charged for the pages delivered, never more than requested.

focusstringoptional

Summary style preset.

Allowed values:
abridgedexecutive_summarykey_takeawaysaction_itemslegal_risk_reviewacademic_synopsisinvestor_briefcompliance_obligations
customInstructionsstringoptional

Extra guidance for the summary, up to 1000 characters.

modelstringoptionaldefault: basic

Summary model tier.

Allowed values:
basicpremium
ocrProfilestringoptionaldefault: regular

OCR tuned for the script: indic for Indian scripts, regular for everything else.

Allowed values:
regularindic
webhookUrlstringoptional

Public 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

Result of a finished document.ocr_summarize job
{
  "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

StatusCodeWhen
400invalid_inputA field is missing, unknown or out of range, or the upload is not yours.
400unsupported_fileThe operation does not take this file type.
400file_too_largePDF over 50 MB, office or spreadsheet file over 25 MB, or image over 10 MB.
400unreadable_documentThe document's pages could not be counted.
402insufficient_creditsThe wallet, or a test key's spend cap, does not cover the estimate.
409conflictThe Idempotency-Key was already used with a different input or operation.
errorCodeMeaning
extraction_failedOCR could not read the file.
no_text_foundOCR finished but found no readable text.
failedThe summary could not be written.
missing_outputThe summary step returned no text.
enqueue_failedThe job could not be handed to the worker. Retry with a new Idempotency-Key.