# IRPCScanningAndOCR.GetOCRUploadedFileStatus

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/GetOCRUploadedFileStatus/

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

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.

- **Service:** [Scanning and OCR](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/index.md) `MFiles.IRPCScanningAndOCR`
- **gRPC method:** `/MFiles.IRPCScanningAndOCR/GetOCRUploadedFileStatus`
- **HTTP (mf-http-grpc):** `POST /grpc/v1/get-ocruploaded-file-status`
- **Request:** [`GetOCRUploadedFileStatusRequest`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/GetOCRUploadedFileStatus/index.md#request)
- **Response:** [`GetOCRUploadedFileStatusResponse`](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/GetOCRUploadedFileStatus/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.".
- The job belongs to the login session that started it; other sessions get "The OCR job was not
  found in this session.". Once a completed, failed or canceled state has been returned, the
  job is released.

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

## Request: GetOCRUploadedFileStatusRequest

> 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 from [OCRUploadedFile](https://developer.m-files.com/APIs/gRPC-API/Reference/MFiles.IRPCScanningAndOCR/OCRUploadedFile/index.md). |
| `cancel` | `bool` | True to request the cancellation of the job. The returned state can still be queued or running until the job has stopped. |

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

## Response: GetOCRUploadedFileStatusResponse

> 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 |
|---|---|---|
| `state` | [`OCRUploadedFileState`](https://developer.m-files.com/APIs/gRPC-API/Reference/Enums/MFiles.OCRUploadedFileState/index.md) | The state of the job. Values: `OCRUPLOADED_FILE_STATE_UNSPECIFIED` (0), `OCRUPLOADED_FILE_STATE_QUEUED` (1), `OCRUPLOADED_FILE_STATE_RUNNING` (2), `OCRUPLOADED_FILE_STATE_COMPLETED` (3), `OCRUPLOADED_FILE_STATE_FAILED` (4), `OCRUPLOADED_FILE_STATE_CANCELED` (5). |
| `pages_total` | `uint32` | The number of pages to process. Zero if not known yet. |
| `pages_completed` | `uint32` | The number of pages processed. |
| `result_file_ref` | `string` | If the state is completed, the file_ref of the searchable PDF, as a stateless upload that can be attached like an upload ended with FileUploadEnd. Otherwise empty. |
| `result_file_size` | `int64` | If the state is completed, the size of the searchable PDF in bytes. Otherwise zero. |
| `error_code` | `int32` | If the state is failed, the M-Files error code of the job; otherwise 0. |
| `error_message` | `string` | If the state is failed, the error message of the job. Otherwise empty. |
