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

# Introduction to BankStmtConverter API

# Getting Started with BankStmtConverter API

Welcome to the BankStmtConverter API documentation!\
Here you will find everything you need to get started with integrating BankStmtConverter into your applications.

***

## API Keys

* **Obtaining**: To access the API, you'll need a valid API key. Retrieve it from the BankStmtConverter billing dashboard. If unavailable, please contact the admin.
* **Authentication**: BankStmtConverter primarily authenticates using API keys.
* **Usage**: Always include your API key in the request header:

```json theme={null}
{
  "Authorization": "Bearer <api_key>"
}
```

### JSON Response

Expect responses from the API in JSON format. Ensure your system can parse this data structure. For errors, check the error key within the JSON response.

### Handling Authentication Errors

If your API key is absent, not formatted correctly, or invalid, you'll receive a 401 Unauthorized HTTP response.

#### API Endpoints

## Convert Bank Statement

#### Endpoint

```
POST /bankstmtconversion/sync
```

#### Request Headers

| Header        | Type   | Description           |
| ------------- | ------ | --------------------- |
| Authorization | String | `Bearer <api_key>`    |
| Content-Type  | String | `multipart/form-data` |

#### Request Body

| Field     | Type   | Description                                           |
| --------- | ------ | ----------------------------------------------------- |
| file      | String | URL of the bank statement file to be converted (PDF). |
| page\_num | Int    | Number of pages to be processed (default is 1).       |

#### Response Body

| Field   | Type   | Description                                   |
| ------- | ------ | --------------------------------------------- |
| url     | String | Presigned URL to download the converted file. |
| doc\_id | String | Document ID for converted file.               |
| error   | String | Error message, if any.                        |

#### Success Codes

| Code | Description            |
| ---- | ---------------------- |
| 200  | Conversion successful. |

#### Error Codes

| Code | Description                                            |
| ---- | ------------------------------------------------------ |
| 400  | Bad Request - Invalid input data.                      |
| 404  | Not found - file is missing.                           |
| 401  | Unauthorized - Invalid API key.                        |
| 422  | Unprocessable Entity - Field required or missing data. |
| 402  | Payment Required - Plan expired.                       |
| 500  | Internal Server Error.                                 |

#### Example Request

```bash theme={null}
curl --request POST \
  --url https://api.bankstmtconverter.com/sync \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form page_num=1 \
  --form file="https://example.com/path/to/your/file.pdf"
```

#### Example Response

Success Response

```json theme={null}
{
  "url": "https://presigned-url.example.com",
  "doc_id": "20240XXX"
}
```

Error Response

```json theme={null}
{
  "code": "Error_Code",
  "error": "Your_error_message"
}
```

### Async Conversion

#### Endpoint

```
POST /bankstmtconversion/async
```

#### Request Headers - Async

| Header        | Type   | Description           |
| ------------- | ------ | --------------------- |
| Authorization | String | `Bearer <api_key>`    |
| Content-Type  | String | `multipart/form-data` |

#### Request Body - Async

| Field        | Type   | Description                                           |
| ------------ | ------ | ----------------------------------------------------- |
| file         | String | URL of the bank statement file to be converted (PDF). |
| page\_num    | Int    | Number of pages to be processed (default is 1).       |
| webhook\_url | String | URL for webhook notification.                         |

#### Response Body

| Field   | Type   | Description                                   |
| ------- | ------ | --------------------------------------------- |
| url     | String | Presigned URL to download the converted file. |
| doc\_id | String | Document id for converted file.               |
| error   | String | Error message, if any.                        |

#### Success Codes

| Code | Description            |
| ---- | ---------------------- |
| 200  | Conversion successful. |

#### Error Codes

| Code | Description                                            |
| ---- | ------------------------------------------------------ |
| 400  | Bad Request - Invalid input data.                      |
| 404  | Not found - file is missing.                           |
| 401  | Unauthorized - Invalid API key.                        |
| 422  | Unprocessable Entity - Field required or missing data. |
| 402  | Payment Required - Plan expired.                       |
| 500  | Internal Server Error.                                 |

#### Example Request - Async

```bash theme={null}
curl --request POST \
  --url https://api.bankstmtconverter.com/async \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: multipart/form-data' \
  --form page_num=1 \
  --form webhook_url="https://your-webhook.example.com/callback" \
  --form file="https://example.com/path/to/your/file.pdf"
```

#### Example Response

Success Response

```json theme={null}
{
  "doc_id": "20240XXX",
  "status": "In-Progress"
}
```

Error Response

```json theme={null}
{
  "code": "Error_Code",
  "error": "Your_error_message"
}
```

### Check Remaining Credits

#### Endpoint

```
GET /bankstmtconversion/balance
```

#### Request Headers

| Header        | Type   | Description        |
| ------------- | ------ | ------------------ |
| Authorization | String | `Bearer <api_key>` |
| Content-Type  | String | `application/json` |

#### Response Body

| Field              | Type   | Description                         |
| ------------------ | ------ | ----------------------------------- |
| remaining\_credits | Int    | Credits after your file processing. |
| error              | String | Error message, if any.              |

#### Success Codes

| Code | Description            |
| ---- | ---------------------- |
| 200  | Conversion successful. |

#### Error Codes

| Code | Description                     |
| ---- | ------------------------------- |
| 401  | Unauthorized - Invalid API key. |

#### Example Request

```bash theme={null}
curl --request GET \
  --url https://api.bankstmtconverter.com/balance \
  --header 'Authorization: Bearer <token>'
```

#### Example Response

Success Response

```json theme={null}
{
  "remaining_credits": 1500
}
```

Error Response

```json theme={null}
{
  "code": "Error_Code",
  "error": "Your_error_message"
}
```

### Support & Assistance

For assistance or further queries, reach out to us.
