Detect Text in an Image with Einstein OCR (Generally Available)

Get optical character recognition (OCR) models that detect alphanumeric text in an image with Einstein OCR. Access the models from a single REST API endpoint. Each model has specific use cases, such as business card scanning, product lookup, and digitizing documents and tables.

Where: This change applies to Lightning Experience, Salesforce Classic, and all versions of the Salesforce app in Group, Professional, Enterprise, Performance, Unlimited, Developer, and Contact Manager editions.

How: When you call the API, you send in an image, and the JSON response contains various elements based on the value of the task parameter.
  • String of alphanumeric characters that the model predicts.
  • Confidence (probability) that the detected bounding box contains text.
  • XY coordinates for the location of the character string within the image (also called a bounding box).
  • For tabular data, the table row and column in which the text is located.
  • For business cards, the entity type of the detected text such as ORG, PERSON, and so on.
Here’s what a cURL call to the OCR endpoint looks like.
curl -X POST -H "Authorization: Bearer <TOKEN>" -F sampleLocation="https://www.publicdomainpictures.net/pictures/​240000/velka/emergency-evacuation-route-signpost.jpg" -F task="text" -F modelId="OCRModel" https://api.einstein.ai/v2/vision/ocr
Image of an emergency evacuation route sign
The response JSON returns the text and coordinates of a bounding box (in pixels) for that text.
{
  "task": "text",
  "probabilities": [
    {
      "probability": 0.99937266,
      "label": "ROUTE",
      "boundingBox": {
        "minX": 582,
        "minY": 685,
        "maxX": 1151,
        "maxY": 815
      }
    },
    {
      "probability": 0.99471515,
      "label": "EMERGENCY",
      "boundingBox": {
        "minX": 361,
        "minY": 208,
        "maxX": 1383,
        "maxY": 346
      }
    },
    {
      "probability": 0.99469215,
      "label": "EVACUATION",
      "boundingBox": {
        "minX": 331,
        "minY": 438,
        "maxX": 1401,
        "maxY": 570
      }
    }
  ],
  "object": "predictresponse"
}