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

# Banks API

> Manage bank accounts and ledgers

**Base URL:** `http://localhost:8000`

***

## `GET /banks`

Get all bank accounts.

**Response**

```json theme={null}
[
  {
    "id": 1,
    "name": "HDFC Bank",
    "balance": 50000.0
  }
]
```

***

## `POST /bank`

Create a new bank account.

**Request Body**

```json theme={null}
{ "name": "HDFC Bank" }
```

***

## `PUT /bank/{bank_id}`

Update a bank account's name.

| Parameter | Type    | Description     |
| --------- | ------- | --------------- |
| `bank_id` | integer | Bank account ID |

**Request Body**

```json theme={null}
{ "name": "Updated Bank Name" }
```

***

## `DELETE /bank-account/{bank_id}`

Delete a bank account and all its ledger rows.

| Parameter | Type    | Description     |
| --------- | ------- | --------------- |
| `bank_id` | integer | Bank account ID |

***

## `GET /bank-ledger/{bank_account_id}`

Get all ledger rows for a bank account. Returns rows with IN/OUT entries, running balance, and date.

***

## `POST /bank-ledger/{bank_account_id}`

Add a new ledger row.

**Request Body**

```json theme={null}
{
  "date": "2025-01-15",
  "in_entries": [
    { "description": "Cash deposit", "amount": 10000 }
  ],
  "out_entries": [
    { "description": "Cheque payment", "amount": 5000 }
  ]
}
```

***

## `PUT /bank-ledger/{bank_account_id}`

Update an existing bank ledger row.
