Scans, OCR, and Summaries

Learn how to work with Mail Item scans.

Envelope vs. document scans

A mail item has two images:

  • Envelope Scan: The top-level imageUrl is the image of the envelope
  • Document Scan: The scanDetails.imageUrl that contains a PDF of the contents.

Document Scans are only populated after the item is physically opened and scanned. Items are only opened and scanned when either of these is true:

  • The item has been requested to be scanned via the dashboard or the API
  • The address has auto-scan enabled, which can be set when creating the location via the dashboard or the API

OCR results

OCR results are text that Stable reads from the mail item. There are two sets:

  • The top-level ocrResultUrls contains the text of the envelope
  • scanDetails.ocrResultUrls contains the text inside the envelope

scanDetails.ocrResultUrls can be empty when you receive scan.completed. Instead, you should listen to scan.ocrCompleted. Every scanned item undergoes OCR.

See the AWS documentation for information on interpreting OCR results.

Summaries

scanDetails.summary is a short description (~160 chars) of the mail item's contents. AI is used to write the summary. When the summary is ready, you receive mailItem.summary.created.

AI summarization is best-effort and may not be populated for all items. This means you may not receive an event. See Understanding AI at Stable to understand how we use AI and the controls you have over your data.

Scan notices

Sometimes, Stable cannot scan an item in the usual way due to some physical limitation, for example if the mail item contains a voting ballot, currency, or a USB drive, or if the item exceeds our page limit (1,000 pages).

See What is a scan notice? for more information, and the Mail Items reference for the full list of exceptions.

URLs expire after 24 hours

Stable signs the URLs in each webhook payload when it sends the webhook. Each URL is valid for 24 hours. To get new URLs, call Retrieve a mail item.



Did this page help you?