# Bookkeeping Accounts
> Accounts are T-accounts. They can store accounting entries. Your compliance setup might require annotating money movements using this API. Learn more in our [guide to Bookkeeping](https://increase.com/documentation/bookkeeping#bookkeeping).

[Events](https://increase.com/documentation/events.md) will be generated for this resource. The possible event categories are: `bookkeeping_account.created` and `bookkeeping_account.updated`.

## The Bookkeeping Account object
### Example
```json
{
  "account_id": null,
  "compliance_category": "customer_balance",
  "entity_id": "entity_n8y8tnk2p9339ti393yi",
  "id": "bookkeeping_account_e37p1f1iuocw5intf35v",
  "idempotency_key": null,
  "name": "John Doe Balance",
  "type": "bookkeeping_account"
}
```
### Attributes
- `account_id` (string, nullable)
  The API Account associated with this bookkeeping account.

- `compliance_category` (enum, nullable)
  The compliance category of the account.
  Cases:
  * `commingled_cash` (A cash in an commingled Increase Account.)
  * `customer_balance` (A customer balance.)

- `entity_id` (string, nullable)
  The Entity associated with this bookkeeping account.

- `id` (string)
  The account identifier.

- `idempotency_key` (string, nullable)
  The idempotency key you chose for this object. This value is unique across Increase and is used to ensure that a request is only processed once. Learn more about [idempotency](https://increase.com/documentation/idempotency-keys).

- `name` (string)
  The name you choose for the account.

- `type` (string)
  A constant representing the object's type. For this resource it will always be `bookkeeping_account`.

## List Bookkeeping Accounts
GET /bookkeeping_accounts

### Example
```curl
curl \
  --url "${INCREASE_URL}/bookkeeping_accounts" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}"
```

### Query Parameters
- `cursor` (string, optional)
  Return the page of entries after this one.

- `limit` (integer, optional)
  Limit the size of the list that is returned. The default (and maximum) is 100 objects.

- `idempotency_key` (string, optional)
  Filter records to the one with the specified `idempotency_key` you chose for that object. This value is unique across Increase and is used to ensure that a request is only processed once. Learn more about [idempotency](https://increase.com/documentation/idempotency-keys).

### Returns a Bookkeeping Account List object:
```json
{
  "data": [
    {
      "account_id": null,
      "compliance_category": "customer_balance",
      "entity_id": "entity_n8y8tnk2p9339ti393yi",
      "id": "bookkeeping_account_e37p1f1iuocw5intf35v",
      "idempotency_key": null,
      "name": "John Doe Balance",
      "type": "bookkeeping_account"
    }
  ],
  "next_cursor": "v57w5d"
}
```

## Create a Bookkeeping Account
POST /bookkeeping_accounts

### Example
```curl
curl -X "POST" \
  --url "${INCREASE_URL}/bookkeeping_accounts" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}" \
  -H "Content-Type: application/json" \
  -d $'{
    "name": "New Account!"
  }'
```

### Body Parameters
- `account_id` (string, optional)
  The account, if `compliance_category` is `commingled_cash`.

- `compliance_category` (enum, optional)
  The account compliance category.
  Cases:
  * `commingled_cash` (A cash in an commingled Increase Account.)
  * `customer_balance` (A customer balance.)

- `entity_id` (string, optional)
  The entity, if `compliance_category` is `customer_balance`.

- `name` (string, required)
  The name you choose for the account.

## Update a Bookkeeping Account
PATCH /bookkeeping_accounts/{bookkeeping_account_id}

### Example
```curl
curl -X "PATCH" \
  --url "${INCREASE_URL}/bookkeeping_accounts/bookkeeping_account_e37p1f1iuocw5intf35v" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}" \
  -H "Content-Type: application/json" \
  -d $'{
    "name": "Deprecated Account"
  }'
```
### Path Parameters
- `bookkeeping_account_id` (string, required)
  The bookkeeping account you would like to update.

### Body Parameters
- `name` (string, required)
  The name you choose for the account.

## Retrieve a Bookkeeping Account Balance
GET /bookkeeping_accounts/{bookkeeping_account_id}/balance

### Example
```curl
curl \
  --url "${INCREASE_URL}/bookkeeping_accounts/bookkeeping_account_e37p1f1iuocw5intf35v/balance" \
  -H "Authorization: Bearer ${INCREASE_API_KEY}"
```
### Path Parameters
- `bookkeeping_account_id` (string, required)
  The identifier of the Bookkeeping Account to retrieve.

### Query Parameters
- `at_time` (string, optional)
  The moment to query the balance at. If not set, returns the current balances.

### Returns a Bookkeeping Balance Lookup object:
```json
{
  "balance": 100,
  "bookkeeping_account_id": "bookkeeping_account_e37p1f1iuocw5intf35v",
  "type": "bookkeeping_balance_lookup"
}
```