Bank Statements API

The Bank Statements API enables you to fetch and create bank statements with period-based grouping and reconciliation status tracking. Bank statements include transaction details, balance information, and reconciliation status indicators.

Available Endpoints

Get Bank Statements by Period

GET /api/v2/banking/bank-statements/by-period

Retrieve bank statements grouped by specified time interval (day, month, year). Each statement includes transaction counts, balance information, and reconciliation status.

Query Parameters

Parameter Type Required Description
bank_account_id integer Yes ID of the bank account
from_date string Yes Start date (YYYY-MM-DD)
to_date string No End date (YYYY-MM-DD). Defaults to today
interval string No Time interval for grouping. Auto-derived from date range if omitted: day (≤31 days), month (≤366 days), year (>366 days). See Interval Values

Interval Values

Value Description
day Group transactions by day
month Group transactions by calendar month
year Group transactions by calendar year

When interval is not provided, the system selects the granularity automatically based on the date range.

Example Request

GET /api/v2/banking/bank-statements/by-period?bank_account_id=123&interval=month&from_date=2024-01-01&to_date=2024-03-31

Example Response

{
  "data": [
    {
      "bank_account_id": 123,
      "period_start": "2024-01-01",
      "period_end": "2024-01-31",
      "period_start_balance": "10000.00",
      "period_end_balance": "12500.00",
      "total_transactions": 45,
      "reconciled_transactions": 42,
      "unreconciled_transactions": 3,
      "is_reconciled": false,
      "is_balanced": true,
      "import_documents": [
        {
          "id": 456,
          "document_type": "BANK_STATEMENT",
          "document_date": "2024-01-31",
          "document_number": "BS-2024-01"
        }
      ]
    }
  ]
}

Create Bank Statement

POST /api/v2/banking/bank-statements

Create a new bank statement with transactions and balance information. The endpoint validates transaction matching and balance consistency.

Request Body

{
  "bank_account_id": 123,
  "period_start": "2024-01-01",
  "period_end": "2024-01-31",
  "period_start_balance": "10000.00",
  "period_end_balance": "12500.00",
  "transactions": [
    {
      "booking_date": "2024-01-15",
      "amount": "2500.00",
      "currency": "NOK",
      "memo": "Customer payment"
    }
  ]
}

Response

{
  "data": {
    "bank_account_id": 123,
    "period_start": "2024-01-01",
    "period_end": "2024-01-31",
    "period_start_balance": "10000.00",
    "period_end_balance": "12500.00",
    "total_transactions": 1,
    "reconciled_transactions": 0,
    "unreconciled_transactions": 1,
    "is_reconciled": false,
    "is_balanced": true
  }
}

Statement Attributes

Attribute Type Description
bank_account_id integer ID of the bank account
period_start date Start date of the statement period
period_end date End date of the statement period
period_start_balance decimal Opening balance at the start of the period
period_end_balance decimal Closing balance at the end of the period
total_transactions integer Total number of transactions in the period (read-only, computed)
reconciled_transactions integer Number of reconciled transactions (read-only, computed)
unreconciled_transactions integer Number of unreconciled transactions (read-only, computed)
is_reconciled boolean Whether all transactions are reconciled (read-only, computed)
is_balanced boolean Whether balances and transactions are consistent (read-only, computed)

Error Responses

Status Code Description
400 INVALID_REQUEST Missing required parameters or invalid date range
403 FORBIDDEN Bank account not accessible
422 VALIDATION_ERROR Invalid balance or transaction data