# IRPCScanningAndOCR.OCRUploadedFile

Location: [gRPC API](https://developer.m-files.com/APIs/gRPC-API/index.md) > [Vault API](https://developer.m-files.com/APIs/gRPC-API/vault/index.md) > [Scanning and OCR](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/index.md)

HTML version: https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/OCRUploadedFile/

Badges: `Vault API / standard` `write` `session`

Starts an OCR job that converts the file of a stateless upload to a searchable PDF.

- **Service:** [Scanning and OCR](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/index.md) `MFiles.IRPCScanningAndOCR`
- **gRPC method:** `/MFiles.IRPCScanningAndOCR/OCRUploadedFile`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/ocruploaded-file`
- **Request:** [`OCRUploadedFileRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/OCRUploadedFile/index.md#request)
- **Response:** [`OCRUploadedFileResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/OCRUploadedFile/index.md#response)
- **Book and level:** Vault API, standard
- **Kind:** write
- **Session:** Required: the session ID from LogIn in the mfiles-session-id-bin metadata.
- **Idempotent:** no
- **Returns metadata structure version:** no
- **Streaming:** none (unary)

<a id="remarks"></a>

## Remarks

- Not available on current servers: the call fails with "Not implemented.". Use
  [OCROperation_BeginAfterUpload](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/OCROperation_BeginAfterUpload/index.md)
  instead.
- Takes the `file_ref` of an upload ended with
  [FileUploadEnd](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCFileTransfer/FileUploadEnd/index.md). Only
  `OCROPERATION_TYPE_CONVERT_TO_SEARCHABLE_PDF` and
  `OCROPERATION_TYPE_CONVERT_TO_SEARCHABLE_ARCHIVE_PDF` are accepted.
- Follow the job with
  [GetOCRUploadedFileStatus](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/GetOCRUploadedFileStatus/index.md).

<a id="request"></a>

## Request: OCRUploadedFileRequest

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `file_ref` | `string` | The file_ref of a stateless upload ended with FileUploadEnd, to be used as input for the OCR job. |
| `source_file_extension` | `string` | The filename extension (without dot) of the source file. Required, as a file_ref has no file name. |
| `type` | [`OCROperationType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.OCROperationType/index.md) | `OCROPERATION_TYPE_CONVERT_TO_SEARCHABLE_PDF` or `OCROPERATION_TYPE_CONVERT_TO_SEARCHABLE_ARCHIVE_PDF`; other types fail. Values: `OCROPERATION_TYPE_NONE` (0), `OCROPERATION_TYPE_CONVERT_TO_SEARCHABLE_PDF` (1), `OCROPERATION_TYPE_RECOGNIZE_SPECIFIC_BLOCKS` (2), `OCROPERATION_TYPE_RECOGNIZE_ANY_BLOCKS` (3), `OCROPERATION_TYPE_CONVERT_TO_SEARCHABLE_PDF_AND_RECOGNIZE_SPECIFIC_BLOCKS` (4), `OCROPERATION_TYPE_CONVERT_TO_SEARCHABLE_PDF_AND_RECOGNIZE_ANY_BLOCKS` (5), `OCROPERATION_TYPE_CONVERT_TO_SEARCHABLE_ARCHIVE_PDF` (6), `OCROPERATION_TYPE_CONVERT_TO_SEARCHABLE_ARCHIVE_PDF_AND_RECOGNIZE_SPECIFIC_BLOCKS` (7), `OCROPERATION_TYPE_CONVERT_TO_SEARCHABLE_ARCHIVE_PDF_AND_RECOGNIZE_ANY_BLOCKS` (8). |
| `options` | [`OCROptions`](https://developer.m-files.com/APIs/gRPC-API/Reference/Messages/MFiles.OCROptions/index.md) | OCR options to be used for this job. If unset, default settings are used. |
| `options.languages[]` | repeated [`OCRLanguageType`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.OCRLanguageType/index.md) | Languages/character sets/dictionaries to be used as recognition hints. Can be unset. |
| `options.ocr_automatic_language_detection` | `bool` | True if the OCR automatic language detection is to be used. |

<a id="response"></a>

## Response: OCRUploadedFileResponse

> Nested message fields are expanded to depth 3; follow a type link for deeper levels and for the type's own page.

| Field | Type | Description |
|---|---|---|
| `job_id` | `string` | The ID of the job, for [GetOCRUploadedFileStatus](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/GetOCRUploadedFileStatus/index.md). |

<a id="related"></a>

## Related methods

- [OCROperation_BeginAfterUpload](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/OCROperation_BeginAfterUpload/index.md): Starts an OCR job on a file that the caller uploaded with UploadTempFile.
- [IRPCFileTransfer.FileUploadEnd](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCFileTransfer/FileUploadEnd/index.md): Completes an upload in blocks. Binds the content to no object; use FileUploadAttach or AddObjectWithFiles for that.
- [GetOCRUploadedFileStatus](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/GetOCRUploadedFileStatus/index.md): Gets the state of an OCR job started with OCRUploadedFile and, when it has completed, its result as a `file_ref`. Optionally requests the cancellation of the job.
