---
title: "Create Ledger Transaction"
method: POST
path: "/ledger_transactions"
---

# Create Ledger Transaction

`POST /ledger_transactions`

## Request body

- object
  - `status` string — To post a ledger transaction at creation, use `posted`
  - `description` string — An optional free-form description for internal use. Maximum of 1000 characters allowed.
  - `ledger_entries` object[], required — Array of ledger entries. The API supports a maximum of 1000 ledger entries per transaction.
    - `amount` integer, required — Supports any int value up to 10³⁶.
    - `direction` string, required — One of `credit` or `debit`.
    - `ledger_account_id` string, required
    - `lock_version` integer — Lock version of the ledger account. This can be passed when creating a ledger transaction to only succeed if no ledger transactions have posted since the given version. See [this guide](https://docs.moderntreasury.com/docs/handling-concurrency#using-the-lock_version-field) for more details. This will trigger synchronous processing, which imposes an additional rate limit on the API. See [Synchronous Ledger Entry Rate Limiting](https://docs.moderntreasury.com/docs/synchronous-ledger-entry-rate-limiting) for details.
    - `pending_balance_amount` object — Use "gt" (>), "gte" (>=), "'lt" (<), "lte" (<=), or "eq" (=) to lock on the account’s pending balance. If any of these conditions would be false after the transaction is created, the entire call will fail with error code 422. See [this guide](https://docs.moderntreasury.com/docs/handling-concurrency#locking-on-account-balance) for more details. This will trigger synchronous processing, which imposes an additional rate limit on the API. See [Synchronous Ledger Entry Rate Limiting](https://docs.moderntreasury.com/docs/synchronous-ledger-entry-rate-limiting) for details.
      - `lt` integer
      - `lte` integer
      - `eq` integer
      - `gte` integer
      - `gt` integer
      - `not_eq` integer
    - `posted_balance_amount` object — Use "gt" (>), "gte" (>=), "'lt" (<), "lte" (<=), or "eq" (=) to lock on the account’s posted balance. If any of these conditions would be false after the transaction is created, the entire call will fail with error code 422. See [this guide](https://docs.moderntreasury.com/docs/handling-concurrency#locking-on-account-balance) for more details. This will trigger synchronous processing, which imposes an additional rate limit on the API. See [Synchronous Ledger Entry Rate Limiting](https://docs.moderntreasury.com/docs/synchronous-ledger-entry-rate-limiting) for details.
      - `lt` integer
      - `lte` integer
      - `eq` integer
      - `gte` integer
      - `gt` integer
      - `not_eq` integer
    - `available_balance_amount` object — Use "gt" (>), "gte" (>=), "'lt" (<), "lte" (<=), or "eq" (=) to lock on the account’s available balance. If any of these conditions would be false after the transaction is created, the entire call will fail with error code 422. See [this guide](https://docs.moderntreasury.com/docs/handling-concurrency#locking-on-account-balance) for more details. This will trigger synchronous processing, which imposes an additional rate limit on the API. See [Synchronous Ledger Entry Rate Limiting](https://docs.moderntreasury.com/docs/synchronous-ledger-entry-rate-limiting) for details.
      - `lt` integer
      - `lte` integer
      - `eq` integer
      - `gte` integer
      - `gt` integer
      - `not_eq` integer
    - `show_resulting_ledger_account_balances` boolean — If true, response will include the balance of the associated ledger account for the entry and will trigger synchronous processing, which imposes an additional rate limit on the API. See [Synchronous Ledger Entry Rate Limiting](https://docs.moderntreasury.com/docs/synchronous-ledger-entry-rate-limiting) for details.
    - `metadata` string, json
  - `effective_at` string, date — Format: ISO8601 to 6 decimal places. Defaults to time of insertion in the DB if not provided
  - `external_id` string — An optional user-defined unique identifier. Only one pending or posted ledger transaction may have this ID in the ledger.
  - `ledger_account_category_balance_locks` object[] — An array of one or more ledger account category balance locks. Use this to lock on a ledger account category's balance.
    - `ledger_account_category_id` string
    - `available_balance_amount` object — Use "gt" (>), "gte" (>=), "'lt" (<), "lte" (<=), or "eq" (=) to lock on the category's available balance. If any of these conditions would be false after the transaction is created, the entire call will fail with error code 422. See [this guide](https://docs.moderntreasury.com/docs/handling-concurrency#locking-on-account-balance) for more details. This will trigger synchronous processing, which imposes an additional rate limit on the API. See [Synchronous Ledger Entry Rate Limiting](https://docs.moderntreasury.com/docs/synchronous-ledger-entry-rate-limiting) for details.
      - `lt` integer
      - `lte` integer
      - `eq` integer
      - `gte` integer
      - `gt` integer
      - `not_eq` integer
    - `pending_balance_amount` object — Use "gt" (>), "gte" (>=), "'lt" (<), "lte" (<=), or "eq" (=) to lock on the category's pending balance. If any of these conditions would be false after the transaction is created, the entire call will fail with error code 422. See [this guide](https://docs.moderntreasury.com/docs/handling-concurrency#locking-on-account-balance) for more details. This will trigger synchronous processing, which imposes an additional rate limit on the API. See [Synchronous Ledger Entry Rate Limiting](https://docs.moderntreasury.com/docs/synchronous-ledger-entry-rate-limiting) for details.
      - `lt` integer
      - `lte` integer
      - `eq` integer
      - `gte` integer
      - `gt` integer
      - `not_eq` integer
    - `posted_balance_amount` object — Use "gt" (>), "gte" (>=), "'lt" (<), "lte" (<=), or "eq" (=) to lock on the category's posted balance. If any of these conditions would be false after the transaction is created, the entire call will fail with error code 422.See [this guide](https://docs.moderntreasury.com/docs/handling-concurrency#locking-on-account-balance) for more details. This will trigger synchronous processing, which imposes an additional rate limit on the API. See [Synchronous Ledger Entry Rate Limiting](https://docs.moderntreasury.com/docs/synchronous-ledger-entry-rate-limiting) for details.
      - `lt` integer
      - `lte` integer
      - `eq` integer
      - `gte` integer
      - `gt` integer
      - `not_eq` integer
  - `ledgerable_type` string — If the ledger transaction can be reconciled to another object in Modern Treasury, add the ledgerable type here, otherwise null. See possible types at [Ledger Transactions](https://docs.moderntreasury.com/platform/reference/ledger-transaction-object)
  - `ledgerable_id` string — If the ledger transaction can be reconciled to another object in Modern Treasury, add the id of that object here, otherwise null.
  - `archive_on_balance_lock_failure` boolean — When true, creates an archived ledger transaction with archived_reason 'balance_lock_failure' instead of returning a 422 error if balance lock constraints are violated.
  - `metadata` string, json — Metadata to be added to the ledger transaction. Must be a JSON object.

## Response `201`

201

- object
  - `id` string
  - `object` string
  - `live_mode` boolean
  - `external_id` string
  - `ledgerable_type` unknown
  - `ledgerable_id` unknown
  - `ledger_id` string
  - `description` unknown
  - `status` string
  - `archived_reason` unknown
  - `ledger_entries` object[]
    - `id` string
    - `object` string
    - `live_mode` boolean
    - `amount` integer
    - `direction` string
    - `status` string
    - `ledger_account_id` string
    - `ledger_account_currency` string
    - `ledger_account_currency_exponent` integer
    - `ledger_account_lock_version` integer
    - `ledger_transaction_id` string
    - `resulting_ledger_account_balances` object
      - `pending_balance` object
        - `credits` integer
        - `debits` integer
        - `amount` integer
        - `currency` string
        - `currency_exponent` integer
      - `posted_balance` object
        - `credits` integer
        - `debits` integer
        - `amount` integer
        - `currency` string
        - `currency_exponent` integer
      - `available_balance` object
        - `credits` integer
        - `debits` integer
        - `amount` integer
        - `currency` string
        - `currency_exponent` integer
    - `discarded_at` unknown
    - `created_at` string
    - `updated_at` string
  - `posted_at` string
  - `effective_at` string
  - `effective_date` string
  - `metadata` object
  - `created_at` string
  - `updated_at` string

## Other responses

- `422` — 422

---

[API](https://skmtc.net/modern-treasury/apis/modern-treasury-api.md) · [All operations](https://skmtc.net/modern-treasury/apis/modern-treasury-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/modern-treasury/modern-treasury-api/revisions/ed0431a2dcd0/schema)
