v1

latestOpenAPI 3.0.32026-07-1765123145.7 KB
ledger.v2

Create a new transaction to a ledger

post/v2/{ledger}/transactions

Path parameters

ledgerstring required
Example:ledger001

Name of the ledger.

Query parameters

dryRunboolean
Example:true

Set the dryRun mode. dry run mode doesn't add the logs to the database or publish a message to the message broker.

forceboolean
Example:true

Disable balance checks when passing postings

schemaVersionstring
Example:v1.0.0

Schema version to use for validation

Headers

Idempotency-Keystring

Use an idempotency key

Request body

timestampstring date-time
runtime'experimental-interpreter' | 'machine'

The numscript runtime used to execute the script. Uses "machine" by default, unless the "--experimental-numscript-interpreter" feature flag is passed.

referencestring
metadataV2Metadata required
accountMetadataobject
forceboolean

Example request

{
  "postings": [
    {
      "amount": 100,
      "asset": "COIN",
      "destination": "users:002",
      "source": "users:001"
    }
  ],
  "script": {
    "template": "CUSTOMER_DEPOSIT",
    "plain": "vars {\naccount $user\n}\nsend [COIN 10] (\n\tsource = @world\n\tdestination = $user\n)\n",
    "vars": {
      "user": "users:042"
    }
  },
  "reference": "ref:001",
  "metadata": {
    "admin": "true"
  }
}

Response

OK

Example response

{
  "data": {
    "postings": [
      {
        "amount": 100,
        "asset": "COIN",
        "destination": "users:002",
        "source": "users:001"
      }
    ],
    "reference": "ref:001",
    "metadata": {
      "admin": "true"
    },
    "preCommitVolumes": {
      "orders:1": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      },
      "orders:2": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      }
    },
    "postCommitVolumes": {
      "orders:1": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      },
      "orders:2": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      }
    },
    "preCommitEffectiveVolumes": {
      "orders:1": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      },
      "orders:2": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      }
    },
    "postCommitEffectiveVolumes": {
      "orders:1": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      },
      "orders:2": {
        "USD": {
          "input": 100,
          "output": 10,
          "balance": 90
        }
      }
    }
  }
}