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

# Object model

> The objects in Lead's API, which ones hold your program's money, and how they connect

Every Lead [program](https://docs.lead.bank/v2/core-concepts/platform/programs-and-partners.md) is built from a small set of objects. A program is the product or set of products you offer your customers through Lead. Each object is a core object, a user object, or shared by both, and the kind tells you who creates it, whether you can change it, and whether its amounts are money at Lead or figures from your own records.

## Core and user objects

Core and user objects have the same three levels: an account, the balances in it, and the transactions that change a balance. An account doesn't hold money. The money, or the amount owed, is on a balance.

* **Core objects:** the bank accounts where Lead holds your program's money. Lead creates them, and you read them.
* **User objects:** the products your customers hold with you. You create them.
* **Shared objects:** entities, files, and account numbers. Both kinds use them.
* **Lending objects:** fundings, receivables, and receivable sales. Each connects a user credit balance to a core transaction.

### Core objects at a glance

| Object | What it is | Who creates it | Status |
| - | - | - | - |
| [Core account](#core-account) | One of your program's bank accounts at Lead | Lead | Beta |
| [Core balance](#core-balance) | The money in a core account | Lead | Beta |
| [Core transaction](#core-transaction) | One ledger entry on a core balance | Lead | Beta |

### User objects at a glance

| Object | What it is | Who creates it | Status |
| - | - | - | - |
| [User account](#user-account) | What you open at Lead for each customer | You | Preview |
| [User credit balance](#user-credit-balance) | One loan or line of credit | You | Preview |
| [User credit transaction](#user-credit-transaction) | One change to a user credit balance | You, and Lead for a funding | Preview |
| [User deposit balance](#user-deposit-balance) | A customer's deposits | Not documented | No v2 page |
| User deposit transaction | One change to a user deposit balance | Not documented | No v2 page |
| [Card](#card) | A physical or virtual card you issue to a customer | You | No v2 page |
| [Application](#application) | Your final credit decision | You | Preview |

### Shared objects at a glance

| Object | What it is | Who creates it | Status |
| - | - | - | - |
| [Entity](#entity-shared) | A person or business that holds or uses a Lead product | You, and Lead for its own and your company's entities | Preview |
| [Account number](#account-number-shared) | A routable payment address | You, and Lead on balances Lead holds | Preview |
| [File](#file-shared) | A document linked to an entity, application, or user account | You | Preview |

### Lending objects at a glance

| Object | What it is | Who creates it | Status |
| - | - | - | - |
| [Funding](#lending-objects) | Your instruction to Lead to disburse loan principal | You | Preview |
| [Receivable](#lending-objects) | A loan your program originates, as Lead holds it | Lead | Preview |
| [Receivable sale](#lending-objects) | The daily purchase of your program's loans from Lead | Lead | Preview |

Payment objects such as ACH and wires aren't on this page. They move money through account numbers and post core transactions. See [Money movement](https://docs.lead.bank/v2/core-concepts/platform/money-movement.md).

> [!NOTE]
>
> Each ID starts with its object's name, like `core_account_` or `user_account_`. Store IDs as opaque strings, and don't parse them.

## Entity (shared)

An entity is a person or business that holds or uses a Lead product. You create an entity for each of your customers and for each person who acts for them, then use its `entity_id` on user accounts, applications, and account numbers. Lead creates an entity for itself and one or more for your company during onboarding. Those hold your core accounts, and they're read-only to you.

* **ID prefix:** `entity_`
* **Product page:** [Entities](https://docs.lead.bank/v2/products/entity/overview.md)

## Core objects

These are the bank accounts at Lead that belong to your program: your FBO (for benefit of) account, which holds your customers' money in one pool, and your operating, settlement, revenue, and reserve accounts. Lead opens them during onboarding. You can read them, but you can't create, change, or close them.

### Core account

A core account is one of your program's bank accounts at Lead. Your Lead or partner entities hold it. Its `type` says what it's for. A `direct` account is one you run your program on and can send payments from. An `attributed` account is an FBO whose funds belong to your customers as user balances. A `shadow` account is a sweep or placement position you can read but not transact against. Account numbers attach to a direct account's core balance. On an attributed account they attach to the user deposit balances beneath it. They never attach to a shadow account.

* **ID prefix:** `core_account_`
* **Type:** `direct`, `attributed`, or `shadow`. See [Account types](https://docs.lead.bank/products/core-account/overview.md#account-types).
* **Lifecycle:** `active`, `inactive`, or `closed`, which is final. Lead sets it. See [Core account statuses](https://docs.lead.bank/products/core-account/statuses.md).
* **Product page:** [Core accounts](https://docs.lead.bank/products/core-account/overview.md)

### Core balance

A core balance is the money in a core account. An account number can post to it if Lead has turned on the core account for account numbers.

* **ID prefix:** `core_balance_`, with `core_account_id` pointing to its core account
* **Lifecycle:** `active`, `inactive`, or `closed`, which is final. It usually has the same status as its core account. See [Core balance statuses](https://docs.lead.bank/products/core-balance/statuses.md).
* **Product page:** [Core balances](https://docs.lead.bank/products/core-balance/overview.md)

### Core transaction

A core transaction is one ledger entry on a core balance. Lead creates one when a payment posts, when interest or a fee applies, or when funds sweep.

* **ID prefix:** `core_transaction_`
* **Listing:** you request core transactions for one core balance at a time. They don't send webhooks, so you list them on a schedule.
* **Product page:** [Core transactions](https://docs.lead.bank/products/core-transaction/overview.md)

### How core objects connect

```mermaid theme={null}
%%{init: {"theme": "base", "themeVariables": {"fontSize": "16px"}, "flowchart": {"curve": "stepAfter", "nodeSpacing": 24, "rankSpacing": 48, "padding": 12}}}%%
flowchart TD
  subgraph leadstyle_core_objects_v2["CORE OBJECTS"]
    direction TD
    entity["Lead or partner entity"]
    core_account["Core account"]
    core_balance["Core balance"]
    core_transaction["Core transaction"]
    entity -->|"holds"| core_account
    core_account -->|"has"| core_balance
    core_balance -->|"records"| core_transaction
  end
```

A Lead or partner entity holds each core account. The core account has a core balance, and each change to the core balance is a core transaction.

## User objects

These are the products your customers hold with you. For lending and credit products, you keep the official record in your own system, and Lead keeps a copy that you report to.

### User account

A user account is what you open at Lead for each of your customers. It records who holds it, what it's for, and the compliance data Lead needs. It doesn't hold money. Its balances reference its `user_account_id`.

* **ID prefix:** `user_account_`
* **Before you create one:** create its entities. For underwritten credit, you also need an approved application.
* **Lifecycle:** `active` and `inactive` can change back and forth. `closed` is final, except that you can reactivate a closed user account to correct a mistake. See [User account statuses](https://docs.lead.bank/v2/products/user-accounts/statuses.md).
* **Product page:** [User accounts](https://docs.lead.bank/v2/products/user-accounts/overview.md)

### User credit balance

A user credit balance is one loan or line of credit in a user account. It's Lead's copy of what your ledger shows, so you report every change to it.

* **ID prefix:** `user_credit_balance_`
* **Lifecycle:** `active` and `inactive` can change back and forth. `closed` means repaid or charged off, and `reporting_stopped` means you no longer report on it. See [User credit balance statuses](https://docs.lead.bank/v2/products/user-credit-balance/statuses.md).
* **Product page:** [User credit balances](https://docs.lead.bank/v2/products/user-credit-balance/overview.md)

### User credit transaction

A user credit transaction is one change to a user credit balance. You post one when your ledger records the change. There's no daily cutoff, and nothing to send on days without activity.

* **ID prefix:** `user_credit_transaction_`
* **Lead creates some:** when Lead disburses a funding, it records the user credit transaction for you.
* **Lifecycle:** none. A user credit transaction has one state, posted, and no `status` field.
* **Corrections:** to change an amount, you reverse the user credit transaction. You can update only its description, metadata, and card settlement date.
* **Product page:** [User credit transactions](https://docs.lead.bank/v2/products/user-credit-transaction/overview.md)

### User deposit balance

A user deposit balance is a customer's deposits in a user account. You can give it an account number, and payments to that number settle to your FBO account's core balance. The user deposit balance doesn't have a v2 page, and neither do the user deposit transactions that change it.

### Card

A card is a physical or virtual card you issue to a customer: a debit card for a deposit product, or the card itself for a credit or charge product. You issue it through your card processor and report it to Lead. The card doesn't have a v2 page. On v1, you report cards with the [Cards API](https://docs.lead.bank/products/cards/overview.md), which is in beta, or the card file.

### Application

An application is how you report a final credit decision. A user account for underwritten credit needs an approved one.

* **ID prefix:** `application_`
* **Status:** final outcomes only, `approved`, `declined`, or `canceled`. See [Application statuses](https://docs.lead.bank/v2/products/applications/statuses.md).
* **Product page:** [Applications](https://docs.lead.bank/v2/products/applications/overview.md)

### How user objects connect

```mermaid theme={null}
%%{init: {"theme": "base", "themeVariables": {"fontSize": "16px"}, "flowchart": {"curve": "stepAfter", "nodeSpacing": 24, "rankSpacing": 48, "padding": 12}}}%%
flowchart TD
  subgraph leadstyle_user_objects_v2["USER OBJECTS"]
    direction TD
    entity["Customer's entity"]
    user_account["User account"]
    credit_balance["User credit balance"]
    credit_transaction["User credit transaction"]
    deposit_balance["User deposit balance"]
    application["Application"]
    entity -->|"holds"| user_account
    application -->|"approved, for credit"| user_account
    user_account -->|"has"| credit_balance
    credit_balance -->|"has"| credit_transaction
    user_account -->|"has"| deposit_balance
  end
```

Your customer's entity holds a user account. For underwritten credit, the user account also needs an approved application. The user account has user credit balances and user deposit balances. Each user credit balance has user credit transactions.

## Account number (shared)

An account number is a routable payment address. It doesn't hold money. It references one balance, a user deposit balance or a core balance, and every payment to the number posts there. ACH transfers, wires, instant payments, and internal transfers all reference an `account_number_id`.

* **ID prefix:** `account_number_`
* **Lifecycle:** `active` and `inactive` can change back and forth. `canceled` is final, and the number isn't reused. See [Account number statuses](https://docs.lead.bank/v2/products/account-number/statuses.md).
* **Product page:** [Account numbers](https://docs.lead.bank/v2/products/account-number/overview.md)

## File (shared)

A file is a document you upload so you can link it to an entity, an application, or a user account, like a signed loan agreement.

* **ID prefix:** `file_`
* **Product page:** [Files](https://docs.lead.bank/v2/products/files/overview.md)

## Lending objects

Lending products use three objects of their own:

* **Funding** (`funding_`): your instruction to Lead to disburse loan principal. You name the user credit balance it draws against and the account number the money goes to. Its status goes from `processing` to `posted`, and a funding Lead accepts always posts. See [Funding statuses](https://docs.lead.bank/v2/products/fundings/statuses.md) and [Fundings](https://docs.lead.bank/v2/products/fundings/overview.md).
* **Receivable** (`receivable_`): a loan your program originates, as Lead holds it. Lead is the lender of record, so every loan starts on Lead's balance sheet. See [Receivables](https://docs.lead.bank/v2/products/receivables/overview.md).
* **Receivable sale** (`receivable_sale_`): the daily purchase of your program's loans from Lead, if your program originates loans to sell. Lead debits it from your operating account. Its status goes from `created` to `settled`. If the debit fails, the sale is `failed`, and Lead retries the debit. A failed sale moves to `settled` once a retry goes through. See [Receivable sale statuses](https://docs.lead.bank/v2/products/receivable-sales/statuses.md) and [Receivable sales](https://docs.lead.bank/v2/products/receivable-sales/overview.md).

## How core and user objects connect

A lending product uses both kinds:

1. Each borrower is an entity. You report your decision on them as an application. If you approve, you open a user account for them.
2. The loan's terms and what the borrower owes are a user credit balance in that user account. Each payment, fee, and interest charge you report is a user credit transaction on it.
3. A funding sends the principal to an account number. When it posts, Lead creates a core transaction on that account number's core balance, and the funding's `core_transaction_id` points to it.
4. The disbursed principal becomes a receivable on Lead's books. If your program buys its loans, Lead groups the day's receivables into a receivable sale and debits your operating account, a `direct` core account, for the purchase.

A deposit product uses the same pattern with a user deposit balance in place of the user credit balance. The customer's account number sits on the user deposit balance. A payment to it settles to the core balance of your `attributed` FBO account.

> [!NOTE]
>
> The user deposit balance, user deposit transaction, and card objects don't have v2 pages. Other v2 pages mention user deposit balances only where they reference one.

## How it shows up in the API

| Where | What you'll see | Reference |
| - | - | - |
| The `id` in every response | A prefix with the object's name, like `user_credit_balance_` | The object page for each object |
| A balance's parent | `core_account_id` on a core balance, `user_account_id` on a user credit balance | [The core balance object](https://docs.lead.bank/products/core-balance/core-balance-object.md), [User credit balances](https://docs.lead.bank/v2/products/user-credit-balance/overview.md) |
| An account number's `balance` | The balance its payments post to | [The account number object](https://docs.lead.bank/v2/products/account-number/account-number-object.md) |

## Related

* [Executing vs. reporting](https://docs.lead.bank/v2/core-concepts/platform/executing-vs-reporting.md): which APIs move money and which only report, and what that means for statuses and webhooks
* [Money movement](https://docs.lead.bank/v2/core-concepts/platform/money-movement.md): the five payment rails, what each one is for, and where to find its processing windows
* [Programs and partners](https://docs.lead.bank/v2/core-concepts/platform/programs-and-partners.md): why credentials, reports, and go-live are set per program
* [Versioning and backwards compatibility](https://docs.lead.bank/core-concepts/platform/versioning-and-backwards-compatibility.md): what counts as a breaking change, and how Lead gives notice
