> For the complete documentation index, see [llms.txt](/llms.txt).

# Upload a JSON bank statement

**POST** `https://www.iwoca.co.uk/api/lending/v2.2/bank_statements/{customer_id}/`


Upload a business or personal bank statement in JSON format.
If you collect bank statement data for the customer via Open Banking,
you can use this endpoint as instead of uploading their statements as a PDF.

The format of the JSON statement is your choice, but must contain certain information.
Please inform your Partnership Manager of your desired format in advance.

For each statement, the following information is required:
- Account number
- Sort code
- Account holder name
- Currency
- Bank name
The following data points are not required, but are recommended:
- Account type (business or personal)
- Period (date of earliest and latest transaction)

For each transaction in a statement, the following information is required:
- Date
- Reference
- Amount
- Running balance*
*or you can provide a starting balance and closing balance for
the statement instead of a running balance on each transaction.

You can only send one statement at a time, so to send multiple statements you must make multiple requests.


## Path parameters
- `customer_id` (string, required) — The unique customer_id used to represent a customer.

## Query parameters
- `bank_statement_type` (string)

## Body
```json
{
  "data": {
    "accountInfo": {
      "accountHolder": "ABC business",
      "accountId": "account0",
      "accountName": "xyz",
      "accountNumber": "12345678",
      "accountType": "sole",
      "availableBalance": 161.16,
      "bankName": "ABCBank",
      "currency": "GBP",
      "currentBalance": 161.16,
      "iban": "123",
      "numberOfTransactions": 1,
      "sortCode": "123456",
      "subType": "EMoney",
      "type": "Business"
    },
    "transactions": [
      {
        "accountId": "account0",
        "amount": -100,
        "currencyCode": "GBP",
        "description": "Transfer to Main account. Internal transfer out",
        "primaryCategoryDescription": "Transfers / Other",
        "runningBalance": 161.16,
        "subCategoryDescription": "Bank Transfer",
        "transactionDate": "2023-03-21T00:00:00+00:00",
        "transactionId": 12345676789
      }
    ]
  }
}
```

### Body fields

## Responses
### 201 — Success
```json
{
  "data": {
    "bank_statement_id": "string",
    "bank_statement_type": "business"
  }
}
```

### 400 — Bad Request
```json
{
  "errors": [
    {
      "code": "string",
      "detail": "string",
      "meta": {},
      "source": {
        "parameter": "string",
        "pointer": "string"
      }
    }
  ]
}
```

### 403 — Permission Denied
```json
{
  "errors": [
    {
      "code": "PermissionDenied",
      "detail": "string",
      "meta": {}
    }
  ]
}
```

### 500 — Unexpected Error
```json
{
  "errors": [
    {
      "code": "string",
      "detail": "string",
      "meta": {}
    }
  ]
}
```

## Example (curl)
```bash
curl 'https://www.iwoca.co.uk/api/lending/v2.2/bank_statements/<customer_id>/?bank_statement_type=<bank_statement_type>' \
  --request POST \
  --header 'Authorization: Bearer <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "data": {
    "accountInfo": {
      "accountHolder": "ABC business",
      "accountId": "account0",
      "accountName": "xyz",
      "accountNumber": "12345678",
      "accountType": "sole",
      "availableBalance": 161.16,
      "bankName": "ABCBank",
      "currency": "GBP",
      "currentBalance": 161.16,
      "iban": "123",
      "numberOfTransactions": 1,
      "sortCode": "123456",
      "subType": "EMoney",
      "type": "Business"
    },
    "transactions": [
      {
        "accountId": "account0",
        "amount": -100,
        "currencyCode": "GBP",
        "description": "Transfer to Main account. Internal transfer out",
        "primaryCategoryDescription": "Transfers / Other",
        "runningBalance": 161.16,
        "subCategoryDescription": "Bank Transfer",
        "transactionDate": "2023-03-21T00:00:00+00:00",
        "transactionId": 12345676789
      }
    ]
  }
}'
```