# Accounting API

*/Software/Accounting_API*

## Solution Overview

The Ledger Core API translates raw bank feeds and unstructured receipt data into validated, double-entry journal entries. It maintains a programmatic general ledger that applies custom chart-of-account rules to incoming financial events and outputs strictly formatted balance sheets in JSON. The system produces a mathematically balanced, auditable financial record without requiring interaction with a graphical interface.

Engineering teams building automated expense platforms, embedded fintech apps, and autonomous CFO services integrate this API to bypass the rate limits and complex authentication schemas of legacy accounting software. It eliminates the need to build custom web scrapers or brittle workarounds when giving autonomous systems read and write access to a company's financial core.

Operating as a headless SaaS primitive, the API consumes standardized transaction data from banking aggregators below it. It is consumed from above by specialized finance agents that use its structured ledger outputs to calculate tax liabilities, generate investor updates, or trigger vendor payouts. A designated error queue routes any transaction lacking a high-confidence categorization match to a human controller for manual coding before it posts to the permanent ledger.

## Headless Saas Data Model

**Entities**:
- Name: JournalEntry · Description: A mathematically balanced, double-entry financial record
- Name: LedgerLine · Description: An individual debit or credit line within a journal entry
- Name: SourceTransaction · Description: Raw, standardized financial event from a banking aggregator
- Name: Account · Description: A node in the programmatic chart of accounts
- Name: ReviewTask · Description: An error queue task for manual categorization by a human controller
- Name: Ledger · Description: The root tenant container for a company's financial core
**Relations**:
- To: JournalEntry · From: Ledger · Label: contains entries · Cardinality: one-to-many
- To: Account · From: Ledger · Label: defines chart of accounts · Cardinality: one-to-many
- To: SourceTransaction · From: Ledger · Label: receives transactions · Cardinality: one-to-many
- To: LedgerLine · From: JournalEntry · Label: balances with · Cardinality: one-to-many
- To: LedgerLine · From: Account · Label: records lines · Cardinality: one-to-many
- To: JournalEntry · From: SourceTransaction · Label: generates entry · Cardinality: one-to-one
- To: ReviewTask · From: SourceTransaction · Label: triggers review · Cardinality: one-to-one
**Tenant Anchor**: Ledger
**Primary Resource**: JournalEntry

## Api Definition

**Protocols**:
- REST
- SDK
- MCP
- Webhooks
**Consumed By**:
- [Tax Calculation Agent](/Agents/Tax_Calculation_Agent)
- [Investor Reporting Agent](/Agents/Investor_Reporting_Agent)
- [Accounts Payable Agent](/Agents/Accounts_Payable_Agent)
- [Autonomous CFO Agent](/Agents/Autonomous_CFO_Agent)
**Integrations**:
- [Plaid](/Products/Plaid)
- [Stripe](/Products/Stripe)
- [Teller](/Products/Teller)
**Consumption Model**: An autonomous CFO agent connects via the MCP server to call Ingest Bank Feed daily, and subscribes to the review_task.created webhook to handle categorization exceptions.
**Workflow Wrappers**:
- Name: Ingest Bank Feed · Wraps: ingests raw transactions, applies rules, and posts balanced journal entries or creates tasks
- Name: Generate Balance Sheet · Wraps: aggregates posted ledger lines across accounts and exports a strictly formatted JSON statement
- Name: Resolve Exception Task · Wraps: applies manual coding to a low-confidence transaction, posts the entry, and clears tasks

## Api Function Cascade

**Ai Role**: Generative models map raw transaction strings to standard ledger codes straight-through, bounded by deterministic ingestion and double-entry validation code that routes low-confidence exceptions to external consumers via webhook.
**Cascade**:
- Kind: Code · Note: Pulls raw transaction feeds from Plaid, Stripe, and Teller. · Step: Fetch Bank Transactions · Verb: ingest · Realizes: Ingest Financial Data · Oversight: none
- Kind: Code · Step: Normalize Transaction Formats · Verb: transform · Realizes: Standardize Financial Records · Oversight: none
- Kind: Generative · Note: Assigns chart of accounts categories based on transaction metadata. · Step: Predict Ledger Coding · Verb: classify · Realizes: Categorize Financial Transactions · Oversight: none
- Kind: Code · Note: Validates double-entry balance constraints. · Step: Construct Journal Entries · Verb: reconcile · Realizes: Prepare Journal Entries · Oversight: none
- Kind: Code · Note: Posts high-confidence entries or emits webhook tasks for manual review. · Step: Post Entry Or Flag · Verb: post · Realizes: Post Financial Transactions · Oversight: review-on-exception
**Optimizes**:
- [Categorization Match Rate](/Metrics/Categorization_Match_Rate)
- [Straight-Through Processing Rate](/Metrics/Straight-Through_Processing_Rate)
- [Journal Entry Cycle Time](/Metrics/Journal_Entry_Cycle_Time)

## Headless Saas Representative Offer

**Warranty**: 99.9% API uptime SLA with a strict system guarantee that all posted ledger entries balance to zero.
**Price Band**: Roughly $0.01 to $0.05 per ingested bank transaction or posted journal entry, depending on volume
**Pricing Kind**: UsageMeter
**Deliverables**:
- Bank feed ingestion endpoints with automated rule application
- Double-entry journal posting primitives
- JSON-formatted balance sheet and financial statement exports
- Webhook notifications for unmapped transaction exception handling
**Delivery Mode**: Self-serve API access provisioned instantly, with usage metered per endpoint call and billed automatically at the end of the billing cycle.
**Business Function**: ProvideService
**Agent Checkout Support**:
- agentic-commerce-protocol
- stored-credential

## Headless Saas Crud Surface

**Auth Model**: Service Account
**Endpoints**:
- GET /journal-entries — list journal entries
- POST /journal-entries — create a new journal entry
- GET /journal-entries/{id} — fetch a specific journal entry
- PATCH /journal-entries/{id} — update a journal entry
- POST /journal-entries/{id}/post — commit the journal entry to the ledger
- GET /journal-entries/{id}/ledger-lines — list the balancing ledger lines for this entry
- GET /ledger-lines — list individual ledger lines
- POST /ledger-lines — create a ledger line
- GET /ledger-lines/{id} — fetch a specific ledger line
- PATCH /ledger-lines/{id} — update a ledger line
- GET /source-transactions — list raw source transactions
- POST /source-transactions — ingest a source transaction from a banking aggregator
- GET /source-transactions/{id} — fetch a specific source transaction
- PATCH /source-transactions/{id} — update a source transaction
- GET /source-transactions/{id}/journal-entries — retrieve the journal entry generated by this transaction
- GET /source-transactions/{id}/review-tasks — retrieve the manual review task triggered by this transaction
- GET /accounts — list accounts in the programmatic chart of accounts
- POST /accounts — create a new account
- GET /accounts/{id} — fetch a specific account
- PATCH /accounts/{id} — update an account
- GET /accounts/{id}/ledger-lines — list all ledger lines recorded against this account
- GET /review-tasks — list manual categorization error queue tasks
- POST /review-tasks — create a review task
- GET /review-tasks/{id} — fetch a specific review task
- PATCH /review-tasks/{id} — update a review task
- POST /review-tasks/{id}/resolve — mark the review task as resolved after manual categorization
- GET /ledgers — list root tenant ledger containers
- POST /ledgers — create a new ledger
- GET /ledgers/{id} — fetch a specific ledger
- PATCH /ledgers/{id} — update a ledger
- GET /ledgers/{id}/journal-entries — list all journal entries contained within this ledger
- GET /ledgers/{id}/accounts — list the chart of accounts defined for this ledger
- GET /ledgers/{id}/source-transactions — list all source transactions received by this ledger
**Multitenancy**: Row-level isolation
**Webhook Events**:
- source_transaction.ingested
- review_task.created
- journal_entry.posted
- account.created

## Headless Saas Erd

```mermaid
erDiagram
    Ledger ||--o{ JournalEntry : "contains entries"
    Ledger ||--o{ Account : "defines chart of accounts"
    Ledger ||--o{ SourceTransaction : "receives transactions"
    JournalEntry ||--o{ LedgerLine : "balances with"
    Account ||--o{ LedgerLine : "records lines"
    SourceTransaction ||--|| JournalEntry : "generates entry"
    SourceTransaction ||--|| ReviewTask : "triggers review"

    JournalEntry {
        UUID id PK
        UUID ledgerId FK
        UUID sourceTransactionId FK
        TIMESTAMP postedAt
        VARCHAR description
        VARCHAR status
    }
    LedgerLine {
        UUID id PK
        UUID journalEntryId FK
        UUID accountId FK
        VARCHAR direction
        DECIMAL amount
    }
    SourceTransaction {
        UUID id PK
        UUID ledgerId FK
        VARCHAR providerTransactionId
        DECIMAL amount
        DECIMAL categorizationConfidence
        VARCHAR status
    }
    Account {
        UUID id PK
        UUID ledgerId FK
        VARCHAR code
        VARCHAR name
        VARCHAR accountType
        VARCHAR normalBalance
    }
    ReviewTask {
        UUID id PK
        UUID sourceTransactionId FK
        UUID assignedUserId FK
        VARCHAR status
        TIMESTAMP createdAt
    }
    Ledger {
        UUID id PK "Tenant"
        VARCHAR companyName
        VARCHAR baseCurrency
        VARCHAR status
        TIMESTAMP createdAt
    }
```

## Neighborhood

### Optimizes

- [Straight-Through Processing Rate](/Metrics/Straight-Through_Processing_Rate) — optimizes · Metrics
- [Journal Entry Cycle Time](/Metrics/Journal_Entry_Cycle_Time) — optimizes · Metrics
- [Categorization Match Rate](/Metrics/Categorization_Match_Rate) — optimizes · Metrics
- [Exception Resolution Time](/Metrics/Exception_Resolution_Time) — optimizes · Metrics
- [Categorization Accuracy](/Metrics/Categorization_Accuracy) — optimizes · Metrics
- [Ledger Posting Latency](/Metrics/Ledger_Posting_Latency) — optimizes · Metrics

### Who consumes this

- [Tax Calculation Agent](/Agents/Tax_Calculation_Agent) — consumed by · Agents
- [Accounts Payable Agent](/Agents/Accounts_Payable_Agent) — consumed by · Agents
- [Autonomous CFO Agent](/Agents/Autonomous_CFO_Agent) — consumed by · Agents
- [Investor Reporting Agent](/Agents/Investor_Reporting_Agent) — consumed by · Agents
- [Vendor Payout Agent](/Agents/Vendor_Payout_Agent) — consumed by · Agents

### What it uses

- [Plaid](/Products/Plaid) — uses · Products
- [Teller](/Products/Teller) — uses · Products
- [Stripe](/Software/Stripe) — uses · Software

### Similar Software

- [Accounting General Ledgers](/Resources/Client_financial_data/Software/Accounting_General_Ledgers) — similar · Software
- [Core Banking Systems](/Resources/Client_financial_data/Software/Core_Banking_Systems) — similar · Software
- [Ledger Sync API](/Software/Ledger_Sync_API) — similar · Software
- [General Ledger Software](/Metrics/Number_of_journal_entries_per_FTE_that_performs_the_process_"perform_general_accounting"/Software/General_Ledger_Software) — similar · Software
- [ERP Ledger Sync API](/Software/ERP_Ledger_Sync_API) — similar · Software
- [Ledger Reconciliation API](/Software/Ledger_Reconciliation_API) — similar · Software
- [Journal Posting Endpoint](/Software/Journal_Posting_Endpoint) — similar · Software
- [Ledger Close Orchestration API](/Software/Ledger_Close_Orchestration_API) — similar · Software
- [Open Banking APIs](/Resources/Client_financial_data/Software/Open_Banking_APIs) — similar · Software
- [Tax Ledger Backends](/Resources/Proprietary_tax_templates/Software/Tax_Ledger_Backends) — similar · Software
- [Bank Feed API](/Software/Bank_Feed_API) — similar · Software
- [Transaction Sync API](/Software/Transaction_Sync_API) — similar · Software
- [Cryptographic Ledger Engine](/Software/Cryptographic_Ledger_Engine) — similar · Software

### Similar Startups

- [Bookkeepercode](/Startups/Bookkeepercode) — similar · Startups
- [Accountantapi](/Startups/Accountantapi) — similar · Startups

### Similar Agents

- [Multi-Ledger Sync API](/Agents/Multi-Ledger_Sync_API) — similar · Agents
- [Ledger Loop](/Agents/Ledger_Loop) — similar · Agents
