---
title: "Create a new transaction to a ledger"
method: POST
path: "/{ledger}/transactions"
tags: ["ledger.v1"]
---

# Create a new transaction to a ledger

`POST /{ledger}/transactions`

## Path parameters

- `ledger` string, required

## Query parameters

- `preview` boolean

## Request body

- PostTransaction
  - `timestamp` string, date-time — The transaction time to record, letting you backdate or postdate the transaction. See [bi-temporality](https://docs.formance.com/modules/ledger/working-with/bi-temporality)
  - `postings` Posting[] — Fund movements to apply. Mutually exclusive with script
    - `amount` integer, required — Amount to move, as an arbitrary-precision integer expressed in the asset's smallest unit
    - `asset` string, required — The asset being moved, optionally carrying a scale suffix such as USD/2
    - `destination` string, required — Address of the account credited by this posting
    - `source` string, required — Address of the account debited by this posting
  - `script` object — A Numscript program executed to produce the postings. Mutually exclusive with postings
    - `plain` string, required
    - `vars` object
  - `reference` string — Optional caller-supplied identifier, unique within the ledger, used to deduplicate transactions
  - `metadata` Metadata, nullable — Arbitrary key/value pairs attached to the resource

## Response `200`

OK

- TransactionsResponse
  - `data` Transaction[], required — The transactions that were created
    - `timestamp` string, date-time, required — The transaction time: when the transaction is considered to have occurred. See [bi-temporality](https://docs.formance.com/modules/ledger/working-with/bi-temporality)
    - `postings` Posting[], required — The fund movements making up the transaction
      - `amount` integer, required — Amount to move, as an arbitrary-precision integer expressed in the asset's smallest unit
      - `asset` string, required — The asset being moved, optionally carrying a scale suffix such as USD/2
      - `destination` string, required — Address of the account credited by this posting
      - `source` string, required — Address of the account debited by this posting
    - `reference` string — Optional caller-supplied identifier, unique within the ledger, used to deduplicate transactions
    - `metadata` Metadata, nullable — Arbitrary key/value pairs attached to the resource
    - `txid` integer, required — Unique sequential identifier for this transaction within the ledger
    - `preCommitVolumes` AggregatedVolumes — Volumes aggregated per account and per asset
    - `postCommitVolumes` AggregatedVolumes — Volumes aggregated per account and per asset

## Other responses

- `default` — Error

---

[API](https://skmtc.dev/formancehq/apis/ledger-api.md) · [All operations](https://skmtc.dev/formancehq/apis/ledger-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/formancehq/ledger-api/revisions/fe945da1b75d/schema)
