> ## Documentation Index
> Fetch the complete documentation index at: https://docs.argyle.com/llms.txt
> Use this file to discover all available pages before exploring further.

# OCR and Authenticity

> OCR and Authenticity information for document uploads.

Argyle offers uploaded document processing through [Ocrolus' optical character recognition (OCR) service](https://www.ocrolus.com/). The text within uploaded documents is scanned, and the authenticity of the document is evaluated. The results are made available to view directly in Console or retrieve via Argyle's API.

> [!NOTE]
>
> Ocrolus is available for W-2, 1099, and paystub [document uploads](https://docs.argyle.com/workflows/document-processing.md).

![Image showing the process of integrating third party OCR data with Argyle.](https://mintcdn.com/argyle/X2Ud-Ls5bpXC3Xsk/images/argyle-guides/integrations/document-ocr-processors/1-OCR.png?fit=max\&auto=format\&n=X2Ud-Ls5bpXC3Xsk\&q=85\&s=6de9ad37fde8b3ebf60776ae3d35fa3a)

## Uploading documents

Documents can be uploaded via Argyle's API or directly by users through Argyle Link.

> [!NOTE]
>
> Refer to our [Document Processing Guide](https://docs.argyle.com/workflows/document-processing.md#uploading-documents) for more information on setting up document uploads.

## Document classification

After documents are uploaded, you can optionally choose to classify the documents. This classification pre-processing step will return:

* The document type (e.g. paystubs or W-2)
* Key data fields (e.g. pay date or year)

This document information can be used to decide which documents are sent to full OCR data extraction and authenticity analysis (i.e. send only paystubs to full OCR).

> [!NOTE]
>
> If you are interested in document classification, reach out to your Argyle customer success manager.

## Retrieving OCR data

### Console

![Uploaded document OCR information can be viewed by selecting the  JSON toggle within the Connections sections of Console.](https://mintcdn.com/argyle/X2Ud-Ls5bpXC3Xsk/images/argyle-guides/integrations/document-ocr-processors/2-OCR.png?fit=max\&auto=format\&n=X2Ud-Ls5bpXC3Xsk\&q=85\&s=15a597c09e758e006539b57076d826f8)

1. Select an individual user within the [Connections](https://console.argyle.com/connections) section of Console.
2. When viewing **Uploaded documents**:
   * An `OCR` tag is shown when OCR data is available.
   * The **Authenticity** column will display the document's [Authenticity score](https://docs.argyle.com/integrations/ocr/ocrolus.md#authenticity-scores).
3. Click the `{} JSON` toggle to view OCR data and detailed Authenticity information.
   * The [`ocr_documents`](https://docs.argyle.com/api-reference/user-uploads#object-metadata-ocr_documents) array contains OCR and authenticity results for each detected document.
   > [!NOTE]
   >
   > Refer to Ocrolus' documentation for [data field descriptions](https://docs.ocrolus.com/docs/capture) and [how document authenticity is evaluated](https://docs.ocrolus.com/docs/authenticity-score).
4. Click the `View summary` button to view a summary of authenticity information for the uploaded document.
   > [!NOTE]
   >
   > Additional OCR data including employee, employer, and income details will also be shown for paystubs.

![Summary information of document authenticity returned by Ocrolus can be viewed in Console.](https://mintcdn.com/argyle/X2Ud-Ls5bpXC3Xsk/images/argyle-guides/integrations/document-ocr-processors/3-OCR.png?fit=max\&auto=format\&n=X2Ud-Ls5bpXC3Xsk\&q=85\&s=46a236fa361202ed5b0c193b1e16c898)

### API

Uploaded documents can be retrieved through Argyle's [`/user-uploads`](https://docs.argyle.com/api-reference/user-uploads) endpoint.

`metadata.ocr_documents` contains OCR and authenticity results for each document detected within the uploaded file.

> [accordion] Example JSON — Uploaded document with OCR and Authenticity data
>
> ```json theme={}
> {
>   "id": "0187bf23-cd80-118d-c0b8-58023e21c8e5",
>   "account": "01856c65-43b6-8b5d-b32a-56b8fbda5c28",
>   "document_type": "paystub",
>   "file_url": "www.argyle.com/storagename",
>   "file_name": "2024_10_paystub.pdf",
>   "status": "submitted",
>   "metadata": {
>     "ocr_data": {}, // Deprecated in favor of ocr_documents
>     "ocr_authenticity": {}, // Deprecated in favor of ocr_documents.ocr_authenticity
>     "ocr_authenticity_score": 40, // Deprecated in favor of ocr_documents.ocr_authenticity_score
>     "ocr_documents": [
>       {
>         "ocr_data": {
>           "uuid": "d38a23ef-835e-4e72-a5d3-9fefc3e5a989",
>           "status": "COMPLETED",
>           "net_pay": {
>             "totals": {
>               "ytd_pay": {
>                 "amount": null,
>                 "currency": null
>               },
>               "current_pay": {
>                 "amount": "426.93",
>                 "currency": "USD"
>               },
>               "description": "NET PAY",
>               "canonical_description": null
>             },
>             "distribution_details": [
>               {
>                 "bank_name": null,
>                 "current_pay": {
>                   "amount": "426.93",
>                   "currency": "USD"
>                 },
>                 "description": "CHECKING 1699",
>                 "account_number": "1699",
>                 "bank_account_type": "CHECKING"
>               }
>             ]
>           },
>           "doc_uuid": "3b43a2fb-0b2b-4c9b-a24c-26e216c3426f",
>           "earnings": {
>             "totals": [
>               {
>                 "ytd_pay": {
>                   "amount": "1399.80",
>                   "currency": "USD"
>                 },
>                 "current_pay": {
>                   "amount": "427.05",
>                   "currency": "USD"
>                 },
>                 "description": "GROSS PAY",
>                 "current_hours": "28.47",
>                 "canonical_description": null
>               }
>             ],
>             "subtotals": [
>               {
>                 "ytd_pay": {
>                   "amount": "1324.80",
>                   "currency": "USD"
>                 },
>                 "current_pay": {
>                   "amount": "427.05",
>                   "currency": "USD"
>                 },
>                 "description": "REGULAR",
>                 "current_rate": "15.0000",
>                 "current_hours": "28.47",
>                 "canonical_description": "REGULAR PAY"
>               },
>               {
>                 "ytd_pay": {
>                   "amount": "75.00",
>                   "currency": "USD"
>                 },
>                 "current_pay": {
>                   "amount": "45.00",
>                   "currency": "USD"
>                 },
>                 "description": "SURGE PREM $ 5",
>                 "current_rate": "5.000",
>                 "current_hours": "9.00",
>                 "canonical_description": "OTHER"
>               }
>             ]
>           },
>           "employee": {
>             "name": "BOB JONES",
>             "address": {
>               "city": null,
>               "line1": "759 VICTORIA PLAZA",
>               "line2": null,
>               "state_code": "NY",
>               "postal_code": "10014"
>             },
>             "taxpayer_id": {
>               "id_type": null,
>               "last_4_digits": null
>             },
>             "marital_status": "SINGLE"
>           },
>           "employer": {
>             "name": "WAREHOUSE SERVICES INC",
>             "address": {
>               "city": "SEATTLE",
>               "line1": "202 WESTLAKE AVE N",
>               "line2": null,
>               "state_code": "WA",
>               "postal_code": "98109"
>             }
>           },
>           "book_uuid": "b6ded9fb-72b9-45ab-b788-deeeb424bc4b",
>           "confidence": "EXACT_MATCH",
>           "deductions": {
>             "totals": [],
>             "subtotals": [
>               {
>                 "ytd_pay": {
>                   "amount": "20.30",
>                   "currency": "USD"
>                 },
>                 "current_pay": {
>                   "amount": "6.85",
>                   "currency": "USD"
>                 },
>                 "description": "MEDICARE TAX",
>                 "canonical_description": "MEDICARE TAX"
>               },
>               {
>                 "ytd_pay": {
>                   "amount": "14.00",
>                   "currency": "USD"
>                 },
>                 "current_pay": {
>                   "amount": "9.00",
>                   "currency": "USD"
>                 },
>                 "description": "MO STATE INCOME TAX",
>                 "canonical_description": "STATE TAX"
>               },
>               {
>                 "ytd_pay": {
>                   "amount": "86.79",
>                   "currency": "USD"
>                 },
>                 "current_pay": {
>                   "amount": "29.27",
>                   "currency": "USD"
>                 },
>                 "description": "SOCIAL SECURITY TAX",
>                 "canonical_description": "SOCIAL SECURITY TAX"
>               }
>             ]
>           },
>           "ocr_page_count": 1,
>           "paystub_details": {
>             "pay_date": "2020-12-28",
>             "pay_frequency": null,
>             "paystub_provider": "ADP",
>             "pay_period_end_date": "2020-12-26",
>             "pay_period_start_date": "2020-12-16",
>             "pay_frequency_captured": "NOT LISTED"
>           },
>           "doc_page_numbers": [
>             1
>           ],
>           "rejection_reason": null,
>           "confidence_scores": [
>             {
>               "key": "earnings.subtotals[0].current_hours",
>               "confidence": 1.0
>             },
>             {
>               "key": "earnings.subtotals[0].ytd_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "deductions.subtotals[2].current_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "net_pay.distribution_details[0].account_number",
>               "confidence": 1.0
>             },
>             {
>               "key": "deductions.subtotals[0].description",
>               "confidence": 1.0
>             },
>             {
>               "key": "earnings.subtotals[0].description",
>               "confidence": 1.0
>             },
>             {
>               "key": "earnings.totals[0].current_hours",
>               "confidence": 1.0
>             },
>             {
>               "key": "earnings.subtotals[1].description",
>               "confidence": 1.0
>             },
>             {
>               "key": "deductions.subtotals[0].ytd_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "deductions.subtotals[0].current_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "net_pay.distribution_details[0].current_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "earnings.totals[0].current_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "net_pay.distribution_details[0].bank_account_type",
>               "confidence": 1.0
>             },
>             {
>               "key": "deductions.subtotals[1].ytd_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "earnings.subtotals[1].ytd_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "deductions.subtotals[2].ytd_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "earnings.subtotals[0].current_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "earnings.subtotals[1].current_rate",
>               "confidence": 1.0
>             },
>             {
>               "key": "deductions.subtotals[1].current_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "earnings.totals[0].ytd_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "earnings.subtotals[0].current_rate",
>               "confidence": 1.0
>             },
>             {
>               "key": "net_pay.totals.current_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "earnings.subtotals[1].current_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "deductions.subtotals[2].description",
>               "confidence": 1.0
>             },
>             {
>               "key": "deductions.subtotals[1].description",
>               "confidence": 1.0
>             },
>             {
>               "key": "earnings.subtotals[1].current_hours",
>               "confidence": 1.0
>             },
>             {
>               "key": "employment_details.annual_salary.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "employee.address.city",
>               "confidence": 1.0
>             },
>             {
>               "key": "employee.address.line1",
>               "confidence": 1.0
>             },
>             {
>               "key": "employee.address.line2",
>               "confidence": 1.0
>             },
>             {
>               "key": "employee.address.postal_code",
>               "confidence": 1.0
>             },
>             {
>               "key": "employee.address.state_code",
>               "confidence": 1.0
>             },
>             {
>               "key": "employee.name",
>               "confidence": 1.0
>             },
>             {
>               "key": "employer.address.city",
>               "confidence": 1.0
>             },
>             {
>               "key": "employer.address.line1",
>               "confidence": 1.0
>             },
>             {
>               "key": "employer.address.line2",
>               "confidence": 1.0
>             },
>             {
>               "key": "employer.address.postal_code",
>               "confidence": 1.0
>             },
>             {
>               "key": "employer.address.state_code",
>               "confidence": 1.0
>             },
>             {
>               "key": "employer.name",
>               "confidence": 1.0
>             },
>             {
>               "key": "employment_details.hire_date",
>               "confidence": 1.0
>             },
>             {
>               "key": "employment_details.hourly_rate.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "employee.marital_status",
>               "confidence": 1.0
>             },
>             {
>               "key": "net_pay.totals.ytd_pay.amount",
>               "confidence": 1.0
>             },
>             {
>               "key": "employment_details.pay_basis",
>               "confidence": 1.0
>             },
>             {
>               "key": "paystub_details.pay_date",
>               "confidence": 1.0
>             },
>             {
>               "key": "paystub_details.pay_frequency_captured",
>               "confidence": 1.0
>             },
>             {
>               "key": "paystub_details.pay_period_end_date",
>               "confidence": 1.0
>             },
>             {
>               "key": "paystub_details.pay_period_start_date",
>               "confidence": 1.0
>             },
>             {
>               "key": "paystub_details.paystub_provider",
>               "confidence": 1.0
>             },
>             {
>               "key": "employee.taxpayer_id.last_4_digits",
>               "confidence": 1.0
>             }
>           ],
>           "employment_details": {
>             "hire_date": null,
>             "pay_basis": "HOURLY",
>             "hourly_rate": {
>               "amount": null,
>               "currency": null
>             },
>             "annual_salary": {
>               "amount": null,
>               "currency": null
>             }
>           },
>           "uploaded_image_bucket_uuid": null
>         },
>         "ocr_authenticity": {
>           "book_uuid": "e048543d-043f-441a-b1cf-524328034ddf",
>           "doc_analysis": [
>             {
>               "detect_status": "COMPLETED",
>               "form_analysis": [
>                 {
>                   "signals": [
>                     {
>                       "identifier": "earnings_edits",
>                       "page_number": 1,
>                       "display_name": "Earnings Edits",
>                       "signal_count": 1,
>                       "supporting_data": [
>                         {
>                           "values": [
>                             {
>                               "key": "field_name",
>                               "value": "earnings:grossPay(Current)",
>                               "data_type": "str"
>                             },
>                             {
>                               "key": "original_text",
>                               "value": "427.05",
>                               "data_type": "str"
>                             },
>                             {
>                               "key": "tampered_text",
>                               "value": "100.000",
>                               "data_type": "str"
>                             }
>                           ]
>                         }
>                       ]
>                     }
>                   ],
>                   "form_type": "PAYSTUB",
>                   "form_uuid": "83fc263e-4463-4ed1-aeeb-407ed3123178",
>                   "form_authenticity": {
>                     "score": 40,
>                     "version": "1.0",
>                     "reason_codes": [
>                       {
>                         "code": "004-H",
>                         "confidence": "HIGH",
>                         "description": "original document recovered"
>                       },
>                       {
>                         "code": "330-H",
>                         "confidence": "HIGH",
>                         "description": "paystub earnings tampered"
>                       }
>                     ]
>                   }
>                 }
>               ],
>               "uploaded_doc_type": "PAYSTUB",
>               "uploaded_doc_uuid": "56fc50b0-d162-43d0-ab1a-809b85b3a3c1",
>               "is_image_based_pdf": false
>             }
>           ]
>         },
>         "ocr_authenticity_score": 40
>       },
>       {
>         "ocr_data": {},
>         "ocr_authenticity": {},
>         "ocr_authenticity_score": null
>       }
>     ]
>   },
>   "created_at": "2023-03-17T10:40:00.672Z",
>   "updated_at": "2023-03-17T10:45:20.035Z"
> }
> ```

The following fields contain OCR and authenticity information:

* `ocr_documents` — Array. Contains one OCR and authenticity result for each document detected within the uploaded file.
* `ocr_data` — Deprecated object. Use `ocr_documents[].ocr_data`.
* `ocr_authenticity` — Deprecated object. Use `ocr_documents[].ocr_authenticity`.
* `ocr_authenticity_score` — Deprecated integer. Use `ocr_documents[].ocr_authenticity_score`.

> [!NOTE]
>
> Refer to Ocrolus' documentation for [data field descriptions](https://docs.ocrolus.com/docs/capture) and [how document authenticity is evaluated](https://docs.ocrolus.com/docs/authenticity-score).
>
> > [!NOTE]
> >
> > Argyle does not return HTTP or Ocrolus-specific status codes returned by the Ocrolus API.

## Authenticity scores

Authenticity scores are [determined by Ocrolus](https://docs.ocrolus.com/docs/authenticity-score).

| Score range | Authenticity level | Examples |
| - | - | - |
| 0-29 | Very low authenticity | Identity information (SSN, employee name, address) tampering |
| 30-49 | Low authenticity | Created as a template, income tampering |
| 50-79 | Medium authenticity | Editing software detected, dates tampering, fields misaligned |
| 80+ | High authenticity | Document is an image (80 score) |

> [!NOTE]
>
> Available for paystubs, W-2s, and the following 1099 forms: 1099-MISC, 1099-K, 1099-R, and SSA-1099.

## OCR webhooks

Subscribe to the following webhooks to be notified of OCR updates:

* [`user_uploads.ocr_completed`](https://docs.argyle.com/api-reference/user-uploads-webhooks/ocr-completed)
* [`user_uploads.ocr_failed`](https://docs.argyle.com/api-reference/user-uploads-webhooks/ocr-failed)
* [`user_uploads.ocr_authenticity`](https://docs.argyle.com/api-reference/user-uploads-webhooks/ocr-authenticity)

## OCR errors

If an uploaded document cannot be processed by Ocrolus, an `error` object will be returned in `ocr_documents`.

This `error` object will contain:

* A `status` field listing the [Ocrolus document status](https://docs.ocrolus.com/docs/document-status). For errors, the value will either be `FAILED` or `REJECTED`.
* A `rejection_reason` field listing the [Ocrolus rejection reason](https://docs.ocrolus.com/docs/rejection-reasons) for `REJECTED` documents.

The two most common rejection errors are:

* `DOCUMENT TYPE NOT SUPPORTED` — For example, a bank statement was submitted when a paystub was expected.
* `DOCUMENT IS UNREADABLE` — The document was too blurry to read and could not be processed.

```json theme={}
"metadata": {
    "ocr_documents": [
      {
        "ocr_data": {
          "error": {
            "pk": 80352036,
            "md5": "e623b68dc110aad14158fdba31d40c6f",
            "name": "form/paystubs/4e6ad54c-4232-4459-9e20-96fa721b9a38",
            "uuid": "2cba5abd-3a2d-48a1-b786-0c6d4550d4ea",
            "pages": 1,
            "status": "REJECTED",
            "document_class": "COMPLETE",
            "image_group_pk": null,
            "rejection_reason": "DOCUMENT TYPE NOT SUPPORTED",
            "mixed_uploaded_doc_pk": null,
            "rejection_reason_description": null
          }
        },
        "ocr_authenticity": {},
        "ocr_authenticity_score": null
      }
    ]
}
```
