Ledga

Getting started

Make a first request, post a balanced transaction, read the resulting balance.

Before you start

1. List accounts

curl https://ledga.io/api/v1/accounts \
  -H "Authorization: Bearer sk_xxxxxxxx_your_secret"

A new ledger has no accounts. POST /accounts/initialize-defaults creates a standard chart; POST /accounts creates one at a time.

2. Post a transaction

Debits must equal credits. Amounts are decimal strings. idempotency_key is required.

curl -X POST https://ledga.io/api/v1/transactions \
  -H "Authorization: Bearer sk_xxxxxxxx_your_secret" \
  -H "Content-Type: application/json" \
  -d '{
    "effective_date": "2026-01-15",
    "description": "Invoice INV-001 paid",
    "idempotency_key": "inv-001-payment",
    "entries": [
      { "account_code": "1000", "type": "debit",  "amount": "500.00" },
      { "account_code": "4000", "type": "credit", "amount": "500.00" }
    ]
  }'

The response is 202 Accepted:

{
  "success": true,
  "data": {
    "id": "01997c1e-4d2a-7c3e-9a1b-2f0e8c6d4b5a",
    "status": "pending",
    "idempotency_key": "inv-001-payment",
    "correlation_id": "01997c1e-4d2a-7c3e-9a1b-2f0e8c6d4b5a"
  }
}

Posting is asynchronous. GET /transactions/{id} returns the record with status: "posted" once written.

3. Read a balance

curl https://ledga.io/api/v1/accounts/code/1000/balance \
  -H "Authorization: Bearer sk_xxxxxxxx_your_secret"

data.balances holds settled, pending, overdue and future. Only settled is spendable — see Layers.

Next