# Loan sanction letter OCR API

> A bank's letter sanctioning a credit facility: amount, tenure, interest, margin, security and terms. A letter may list several facilities; report the term loan for machinery when there are several, and the total otherwise.

- Page: https://patrapi.com/recipes/loan-sanction-letter
- Category: Finance
- Template name: `loan_sanction_letter`
- Fields: 12

## Fields

| Field | Key | Type | Required | Notes |
| --- | --- | --- | --- | --- |
| Loan application date | `application_date` | Date | no |  |
| Loan sanction date | `sanction_date` | Date | yes |  |
| Firm name | `firm_name` | Name | yes | Borrower |
| Loan amount | `loan_amount` | Amount (₹) | yes | Sanctioned amount, not the requested amount |
| Loan repayment month | `repayment_months` | Whole number | yes | Repayment period in months |
| Moratorium period | `moratorium_months` | Whole number | no | In months |
| Margin | `margin` | Percentage | yes |  |
| Loan under CGTMSE | `under_cgtmse` | Choice | no |  |
| Rate of interest | `rate_of_interest` | Text | yes | As printed, e.g. RLLR + 1.50% = 9.75% p.a. |
| Bank | `bank` | Text | yes |  |
| Branch | `branch` | Text | yes |  |
| Branch address | `branch_address` | Address | no |  |

## Request

Publish the recipe as a workflow in the app, then send it files. The workflow id and an API key come from the app. Full steps: https://patrapi.com/docs

```bash
curl https://api.patrapi.com/v1/workflows/wf_YOUR_WORKFLOW_ID/extractions \
  -H "Authorization: Bearer $PATRAPI_KEY" \
  -F file=@loan-sanction-letter.pdf
```

## Response

Each field is an object; values are elided here.

```json
{
  "object": "extraction",
  "id": "ext_…",
  "status": "succeeded",
  "document_type": "loan_sanction_letter",
  "pages": …,
  "credits": …,
  "fields": {
    "application_date": { "value": …, "normalized": …, "status": "present", "page": …, "source_text": …, "bbox": … },
    "sanction_date": { "value": …, "normalized": …, "status": "present", "page": …, "source_text": …, "bbox": … },
    "firm_name": { "value": …, "normalized": …, "status": "present", "page": …, "source_text": …, "bbox": … },
    "loan_amount": { "value": …, "normalized": …, "status": "present", "page": …, "source_text": …, "bbox": … },
    "repayment_months": { "value": …, "normalized": …, "status": "present", "page": …, "source_text": …, "bbox": … },
    "moratorium_months": { "value": …, "normalized": …, "status": "present", "page": …, "source_text": …, "bbox": … },
    "margin": { "value": …, "normalized": …, "status": "present", "page": …, "source_text": …, "bbox": … },
    "under_cgtmse": { "value": …, "normalized": …, "status": "present", "page": …, "source_text": …, "bbox": … },
    "rate_of_interest": { "value": …, "normalized": …, "status": "present", "page": …, "source_text": …, "bbox": … },
    "bank": { "value": …, "normalized": …, "status": "present", "page": …, "source_text": …, "bbox": … },
    "branch": { "value": …, "normalized": …, "status": "present", "page": …, "source_text": …, "bbox": … },
    "branch_address": { "value": …, "normalized": …, "status": "present", "page": …, "source_text": …, "bbox": … }
  }
}
```

| Key | Meaning |
| --- | --- |
| `value` | What was read, as printed on the document. |
| `normalized` | The same value in a clean, typed form: dates as YYYY-MM-DD, amounts as numbers, names in capitals. |
| `status` | Whether the value was found: present, not_present, unreadable, redacted, conflicting. |
| `page` | The page it was read from. |
| `source_text` | The text on the page the value came from: the evidence. |
| `bbox` | Where on the page, as four numbers, when known. |

## Pricing

- 1¢ a page (₹1 in India), pay as you go. Every page of a document counts; failed documents and repeats of the same file are free.
- A new account starts with 200 free pages, no card.
- Consultant plan, for firms that read every day: $30 a month (₹2,500 in India) for 5,000 pages, then 1¢ a page (₹0.50 in India).
- While building, the first 25 test and assistant runs on each workflow are free (up to 100 a month per account).

## Questions

### What does the Loan sanction letter API extract?

12 fields: Loan application date, Loan sanction date, Firm name, Loan amount, Loan repayment month, Moratorium period, Margin, Loan under CGTMSE, Rate of interest, Bank, Branch and Branch address. You can rename them, drop the ones you don't need or add your own before publishing.

### What comes back for each field?

A JSON object with value, normalized, status, page, source_text and bbox. The status is one of present, not_present, unreadable, redacted and conflicting, so a value that is not on the document comes back as null instead of a guess.

### Which Loan sanction letter fields are optional?

Loan application date, Moratorium period, Loan under CGTMSE and Branch address. When the document doesn't carry one, the field comes back with the status not_present and a null value.

### How much does Loan sanction letter extraction cost?

1¢ a page (₹1 in India), and every page counts. Failed documents and repeats of the same file are free.

### Can I test Loan sanction letter extraction for free?

Yes. You can try it without an account: 15 test runs on documents of up to 15 pages. A new account starts with 200 free pages, and the first 25 test and assistant runs on each workflow cost nothing (up to 100 a month per account).

## Links

- API quickstart: https://patrapi.com/docs
- API reference: https://api.patrapi.com/docs
- OpenAPI spec: https://api.patrapi.com/openapi.json
- All recipes: https://patrapi.com/recipes
