curl --request POST \
--url http://localhost/api/ledger/v2/{ledger}/transactions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"admin": "true"
},
"timestamp": "2023-11-07T05:31:56Z",
"postings": [
{
"amount": 100,
"asset": "COIN",
"destination": "users:002",
"source": "users:001"
}
],
"script": {
"plain": "vars {\naccount $user\n}\nsend [COIN 10] (\n\tsource = @world\n\tdestination = $user\n)\n",
"vars": {
"user": "users:042"
}
},
"runtime": "experimental-interpreter",
"reference": "ref:001",
"accountMetadata": {},
"force": true
}
'{
"data": {
"timestamp": "2023-11-07T05:31:56Z",
"postings": [
{
"amount": 100,
"asset": "COIN",
"destination": "users:002",
"source": "users:001"
}
],
"metadata": {
"admin": "true"
},
"id": 1,
"reverted": true,
"insertedAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"reference": "ref:001",
"revertedAt": "2023-11-07T05:31:56Z",
"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
}
}
}
}
}curl --request POST \
--url http://localhost/api/ledger/v2/{ledger}/transactions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"metadata": {
"admin": "true"
},
"timestamp": "2023-11-07T05:31:56Z",
"postings": [
{
"amount": 100,
"asset": "COIN",
"destination": "users:002",
"source": "users:001"
}
],
"script": {
"plain": "vars {\naccount $user\n}\nsend [COIN 10] (\n\tsource = @world\n\tdestination = $user\n)\n",
"vars": {
"user": "users:042"
}
},
"runtime": "experimental-interpreter",
"reference": "ref:001",
"accountMetadata": {},
"force": true
}
'{
"data": {
"timestamp": "2023-11-07T05:31:56Z",
"postings": [
{
"amount": 100,
"asset": "COIN",
"destination": "users:002",
"source": "users:001"
}
],
"metadata": {
"admin": "true"
},
"id": 1,
"reverted": true,
"insertedAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"reference": "ref:001",
"revertedAt": "2023-11-07T05:31:56Z",
"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
}
}
}
}
}The access token received from the authorization server in the OAuth 2.0 flow.
Use an idempotency key
Name of the ledger.
"ledger001"
Set the dryRun mode. dry run mode doesn't add the logs to the database or publish a message to the message broker.
true
Disable balance checks when passing postings
true
The request body must contain at least one of the following objects:
postings: suitable for simple transactionsscript: enabling more complex transactions with NumscriptThe numscript runtime used to execute the script. Uses "machine" by default, unless the "--experimental-numscript-interpreter" feature flag is passed.
experimental-interpreter, machine "ref:001"
OK
Show child attributes
x >= 0"ref:001"
Show child attributes
Show child attributes
{
"USD": { "input": 100, "output": 10, "balance": 90 },
"EUR": { "input": 100, "output": 10, "balance": 90 }
}{
"orders:1": {
"USD": { "input": 100, "output": 10, "balance": 90 }
},
"orders:2": {
"USD": { "input": 100, "output": 10, "balance": 90 }
}
}Show child attributes
Show child attributes
{
"USD": { "input": 100, "output": 10, "balance": 90 },
"EUR": { "input": 100, "output": 10, "balance": 90 }
}{
"orders:1": {
"USD": { "input": 100, "output": 10, "balance": 90 }
},
"orders:2": {
"USD": { "input": 100, "output": 10, "balance": 90 }
}
}Show child attributes
Show child attributes
{
"USD": { "input": 100, "output": 10, "balance": 90 },
"EUR": { "input": 100, "output": 10, "balance": 90 }
}{
"orders:1": {
"USD": { "input": 100, "output": 10, "balance": 90 }
},
"orders:2": {
"USD": { "input": 100, "output": 10, "balance": 90 }
}
}Show child attributes
Show child attributes
{
"USD": { "input": 100, "output": 10, "balance": 90 },
"EUR": { "input": 100, "output": 10, "balance": 90 }
}{
"orders:1": {
"USD": { "input": 100, "output": 10, "balance": 90 }
},
"orders:2": {
"USD": { "input": 100, "output": 10, "balance": 90 }
}
}