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

# Ledger Account

> Structure and fields of a ledger account in the chart of accounts

## Overview

A **Ledger Account** represents an individual account within a business's chart of accounts. Accounts are organized hierarchically and track financial transactions using double-entry bookkeeping.

***

## Account Types

Every account belongs to one of five fundamental types:

| Type        | Description                     | Normal Balance |
| ----------- | ------------------------------- | -------------- |
| `asset`     | Resources owned by the business | Debit          |
| `liability` | Obligations owed to others      | Credit         |
| `equity`    | Owner's stake in the business   | Credit         |
| `revenue`   | Income from business operations | Credit         |
| `expense`   | Costs incurred in operations    | Debit          |

***

## Account Subtypes

Subtypes provide more granular classification within each type:

<Tabs>
  <Tab title="Assets">
    | Subtype              | Description                                                 |
    | -------------------- | ----------------------------------------------------------- |
    | `current_assets`     | Cash, receivables, inventory - convertible within 12 months |
    | `non_current_assets` | Property, equipment, long-term investments                  |
  </Tab>

  <Tab title="Liabilities">
    | Subtype                   | Description                                      |
    | ------------------------- | ------------------------------------------------ |
    | `current_liabilities`     | Payables, short-term debt - due within 12 months |
    | `non_current_liabilities` | Long-term loans, bonds, deferred taxes           |
  </Tab>

  <Tab title="Equity">
    | Subtype             | Description                         |
    | ------------------- | ----------------------------------- |
    | `share_capital`     | Capital invested by shareholders    |
    | `share_premium`     | Amount paid above par value         |
    | `reserves`          | Retained profits set aside          |
    | `retained_earnings` | Accumulated profits not distributed |
  </Tab>

  <Tab title="Revenue">
    | Subtype                  | Description                    |
    | ------------------------ | ------------------------------ |
    | `revenue`                | Primary business income        |
    | `other_operating_income` | Secondary operating income     |
    | `finance_income`         | Interest and investment income |
  </Tab>

  <Tab title="Expenses">
    | Subtype              | Description                    |
    | -------------------- | ------------------------------ |
    | `direct_costs`       | Cost of goods sold (COGS)      |
    | `operating_expenses` | Day-to-day business expenses   |
    | `finance_costs`      | Interest and financing charges |
    | `income_tax`         | Tax on profits                 |
  </Tab>
</Tabs>

***

## Account Fields

### Identification

| Field         | Type    | Description                                  |
| ------------- | ------- | -------------------------------------------- |
| `id`          | uuid    | Unique account identifier                    |
| `code`        | string  | Account code (e.g., "1001", "4000")          |
| `name`        | string  | Account name (e.g., "Cash", "Sales Revenue") |
| `description` | string  | Detailed account description                 |
| `is_active`   | boolean | Whether the account accepts transactions     |

### Classification

| Field                     | Type   | Description                                                  |
| ------------------------- | ------ | ------------------------------------------------------------ |
| `account_type`            | enum   | One of: `asset`, `liability`, `equity`, `revenue`, `expense` |
| `account_type_display`    | string | Human-readable type (e.g., "Current Asset")                  |
| `account_subtype`         | enum   | Granular classification (see subtypes above)                 |
| `account_subtype_display` | string | Human-readable subtype                                       |
| `currency`                | string | Account currency (GBP, EUR, USD)                             |

### Balances

| Field                       | Type    | Description                                         |
| --------------------------- | ------- | --------------------------------------------------- |
| `current_balance`           | integer | Current balance in cents                            |
| `current_balance_formatted` | string  | Formatted with currency symbol (e.g., "£12,500.50") |
| `debit_balance`             | integer | Total debits in cents                               |
| `credit_balance`            | integer | Total credits in cents                              |
| `period_balance`            | integer | Period-specific balance (when filtered)             |
| `period_balance_formatted`  | string  | Formatted period balance                            |

### Hierarchy

| Field                 | Type    | Description                                  |
| --------------------- | ------- | -------------------------------------------- |
| `parent_account_code` | string  | Parent account code (null for root accounts) |
| `has_children`        | boolean | Whether this account has sub-accounts        |
| `hierarchy_level`     | integer | Depth in hierarchy (0 for root accounts)     |
| `sub_accounts`        | array   | Nested child accounts                        |

### Bank Account Fields

For bank-type accounts, additional fields are available:

| Field                 | Type   | Description                                  |
| --------------------- | ------ | -------------------------------------------- |
| `institution_name`    | string | Bank name (e.g., "Barclays")                 |
| `iban`                | string | International Bank Account Number            |
| `sort_code`           | string | UK sort code (format: XX-XX-XX)              |
| `account_number_mask` | string | Masked account number (e.g., "\*\*\*\*5555") |

### Activity

| Field                  | Type     | Description                       |
| ---------------------- | -------- | --------------------------------- |
| `total_debits`         | integer  | Count of debit transactions       |
| `total_credits`        | integer  | Count of credit transactions      |
| `last_entry_date`      | datetime | Date of most recent journal entry |
| `last_entry_reference` | string   | Reference of most recent entry    |

***

## Example Account Object

```json theme={null}
{
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "code": "1001",
  "name": "Business Current Account",
  "description": "Primary operating bank account",
  "currency": "GBP",
  "account_type": "asset",
  "account_type_display": "Current Asset",
  "account_subtype": "current_assets",
  "account_subtype_display": "Current Assets",
  "current_balance": 1250050,
  "current_balance_formatted": "£12,500.50",
  "debit_balance": 5000000,
  "credit_balance": 3749950,
  "has_children": false,
  "hierarchy_level": 1,
  "parent_account_code": "1000",
  "is_active": true,
  "institution_name": "Barclays",
  "sort_code": "20-00-00",
  "account_number_mask": "****5555",
  "total_debits": 150,
  "total_credits": 89,
  "last_entry_date": "2024-12-15T14:30:00Z",
  "last_entry_reference": "INV-2024-0089"
}
```
