---
title: "Convert a photo of a document or receipt into words with location"
method: POST
path: "/ocr/photo/to/words-with-location"
tags: ["ImageOcr"]
---

# Convert a photo of a document or receipt into words with location

`POST /ocr/photo/to/words-with-location`

Converts a photo of a document or receipt in common formats such as JPEG, PNG into words/text with location information and other metdata via Optical Character Recognition.  This API is intended to be run on photographs of documents.  If you want to OCR scanned documents (e.g. taken with a scanner), be sure to use the image/toText API instead, as it is designed for that use case.  Note: for free tier API keys, it is required to add a credit card to your account for security reasons, to use the free tier key with this API.

## Headers

- `recognitionMode` string
- `language` string
- `preprocessing` string
- `diagnostics` string

## Response `200`

OK

- PhotoToWordsWithLocationResult — Result of an photo to words-with-location OCR operation
  - `Successful` boolean — True if successful, false otherwise
  - `TextElements` OcrPhotoTextElement[] — Word elements in the image
    - `Text` string — Text of the word
    - `XLeft` integer — X location of the left edge of the word in pixels
    - `YTop` integer — Y location of the top edge of the word in pixels
    - `Width` integer — Width of the word in pixels
    - `Height` integer — Height of the word in pixels
    - `BoundingPoints` Point[] — Points that form the bounding polygon around the text
      - `X` integer — X location in 2D in the image, where 0 represents the left edge of the image
      - `Y` integer — Y location in 2D in the image, where 0 represents the top edge of the image
    - `ConfidenceLevel` number, double — Confidence level of the machine learning result; possible values are 0.0 (lowest accuracy) - 1.0 (highest accuracy)
  - `DiagnosticImage` string, byte — Typically null. To analyze OCR performance, enable diagnostic mode by adding the HTTP header "DiagnosticMode" with the value "true". When this is true, a diagnostic image showing the details of the OCR result will be set in PNG format into DiagnosticImage.

---

[API](https://skmtc.net/cloudmersive/apis/ocrapi.md) · [All operations](https://skmtc.net/cloudmersive/apis/ocrapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cloudmersive/ocrapi/revisions/809f1a173306/schema)
