# Convert Bank Statement PDF to JSON with an API

> Convert Indian bank statement PDFs, CSV and Excel files to JSON: the result file, every meta and transaction field, signed amounts and running balances.

Source: https://parser.lekhavo.com/bank-statement-to-json/

[Home](https://parser.lekhavo.com/) / Bank statement to JSON 

# Convert a bank statement PDF to JSON

The Statement Parser API reads a statement from one of 16 Indian banks, as PDF, CSV or Excel, and returns one JSON file: statement details in `meta` and every row in `transactions`. The shape is the same for every bank (`schema_version` 2.0), so one importer covers them all. 

## Getting the JSON

1. Register the upload with `POST /v1/uploads`, PUT the file to the URL it returns, then confirm it.
2. Create a job with `POST /v1/jobs`. The bank and layout are detected from the file.
3. Wait for the signed `job.completed` webhook, or poll the job.
4. Call `GET /v1/jobs/{id}/result` and download the file from the short-lived link.

Each call is described in the [API docs](https://parser.lekhavo.com/docs/).

## The result file

The file wraps the parse in `{"document_kind": "bank_statement", "schema_version": "2.0", "result": {…}}`, with keys in alphabetical order. Amounts and balances are strings with two decimal places rather than floating-point numbers, so paise are never rounded on the way. 

| meta field                         | What it holds                                                                                                                                                |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| bank\_name                         | The bank as the parser names it, such as STATE BANK OF INDIA.                                                                                                |
| parser\_name                       | bank\_name in lower case with hyphens; parser\_version is the parser release.                                                                                |
| account\_number                    | As printed on the statement, masked or not.                                                                                                                  |
| ifsc\_code                         | The branch IFSC when the statement prints it and the parser reads it; empty otherwise.                                                                       |
| detected\_currency                 | INR, or the currency the statement prints where the parser reads it.                                                                                         |
| period                             | start and end dates (YYYY-MM-DD): printed on the statement or taken from the first and last rows, depending on the bank; empty strings when neither applies. |
| opening\_balance, closing\_balance | Printed figures or worked out from the rows, depending on the bank; 0.00 when the parser does not report them.                                               |
| source                             | file\_upload for files sent through the API.                                                                                                                 |

| Transaction field        | What it holds                                                                                       |
| ------------------------ | --------------------------------------------------------------------------------------------------- |
| date                     | Posting date, YYYY-MM-DD.                                                                           |
| amount                   | Signed decimal string with two places: credits positive, debits negative.                           |
| description              | The narration as printed, with whitespace tidied and wrapped lines joined.                          |
| metadata.balance\_after  | The running balance after the row. Always present.                                                  |
| metadata.cheque\_no      | Cheque or reference number, for banks that print one; left out when empty or a dash.                |
| metadata.transaction\_id | The bank's own transaction ID, for banks that print one (Union Bank, Federal Bank, IOB, Sarvodaya). |
| metadata.branch\_code    | The posting branch, for banks that print it (Axis Bank).                                            |

Value dates, the account holder's name and address, MICR and branch names are not in the JSON, even where the statement prints them. Each [bank page](https://parser.lekhavo.com/banks/) says which fields that bank fills and how its balances are found. 

## Example

A made-up State Bank of India result:

```
{
  "document_kind": "bank_statement",
  "result": {
    "meta": {
      "account_number": "XXXXXXX9056",
      "bank_name": "STATE BANK OF INDIA",
      "closing_balance": "120250.75",
      "detected_currency": "INR",
      "ifsc_code": "SBIN0XXXXXX",
      "opening_balance": "108450.75",
      "parser_name": "state-bank-of-india",
      "parser_version": "0.1.0",
      "period": {
        "end": "2025-04-04",
        "start": "2025-04-01"
      },
      "source": "file_upload"
    },
    "schema_version": "2.0",
    "transactions": [
      {
        "amount": "15000.00",
        "date": "2025-04-01",
        "description": "BY TRANSFER-NEFT*SAMPLE TRADERS",
        "metadata": {
          "balance_after": "123450.75",
          "cheque_no": "TRF00042"
        }
      },
      {
        "amount": "-3200.00",
        "date": "2025-04-04",
        "description": "TO CLEARING-CHQ PAID-DEMO LANDLORD",
        "metadata": {
          "balance_after": "120250.75",
          "cheque_no": "000917"
        }
      }
    ]
  },
  "schema_version": "2.0"
}
```

## JSON only

The service returns JSON and nothing else: there is no Excel, CSV or Tally export. Map the fields into your own ledger, spreadsheet or accounting import. Pricing is per extracted transaction; see [pricing](https://parser.lekhavo.com/pricing/), or go back to the [Statement Parser API](https://parser.lekhavo.com/).
