POST/transaction

Create a transaction

Move money as a balanced set of postings. Accepts a two-party shorthand ({ amount, account:{from,to} }) or a multi-leg { entries:[...] } where debits must equal credits.

Required Attributes

amountinteger

Amount in minor units (two-party shorthand)

Example: 284300

statusstring

'pending' (default) or 'posted'

Example: "posted"

accountobject

{ from, to } account ids (two-party shorthand)

Example: {"to":"ent_payroll","from":"ent_treasury"}

entriesarray

Multi-leg entries: [{ entity_id, direction, amount }]. Debits must equal credits.

Example: [{"amount":10000,"direction":"debit","entity_id":"ent_customer"},{"amount":10000,"direction":"credit","entity_id":"ent_merchant"}]

metadataobject

Arbitrary JSON

descriptionstringrequired

Statement description

Example: "Vendor payout"

Request
POST/transaction
curl --location 'https://api.ledgr.dev/v1/transaction' \
--header 'Authorization: {api_key}' \
--header 'Content-Type: application/json' \
--data '{
  "amount": 284300,
  "status": "posted",
  "account": {
    "to": "ent_payroll",
    "from": "ent_treasury"
  },
  "entries": [
    {
      "amount": 10000,
      "direction": "debit",
      "entity_id": "ent_customer"
    },
    {
      "amount": 10000,
      "direction": "credit",
      "entity_id": "ent_merchant"
    }
  ],
  "metadata": {},
  "description": "Vendor payout"
}'
Response

The created transaction group

{
  "status": "success",
  "transactions": [
    {
      "amount": 284300,
      "status": "posted",
      "direction": "debit",
      "entity_id": "ent_treasury",
      "transaction_id": "trx_a1"
    },
    {
      "amount": 284300,
      "status": "posted",
      "direction": "credit",
      "entity_id": "ent_payroll",
      "transaction_id": "trx_b2"
    }
  ],
  "transaction_group_id": "trx-grp_49202f18"
}
Create a transaction - Ledgr | Padle