POST /v1/transfers
Link two transactions as a transfer by hand
Use this for pairs the matcher reports for review. The same rules apply as for automatic matching: money out and money in of equal size, in two different accounts, with neither side already in a transfer.
Auth. Send the token in the X-Ledger-Token header.
Request body
application/json: object
| Field | Type | Required | Description |
|---|---|---|---|
out_tx_id | integer | required | |
in_tx_id | integer | required |
Responses
| Status | Meaning | Body |
|---|---|---|
201 | Linked. The method is recorded as manual. | object |
400 | Request rejected | Error |
429 | Too many requests from this client address. Wait the number of seconds in Retry-After, then try again. | Error |
Example response
{
"id": 0,
"amount_cents": 0,
"method": "manual",
"out_tx_id": 0,
"in_tx_id": 0
}
Code samples
Set KEY to your own token first.
curl
curl \
-X POST \
-H X-Ledger-Token:$KEY \
-H "Content-Type: application/json" \
-d '{"out_tx_id": 0, "in_tx_id": 0}' \
"https://api.sasek.org/ledger/v1/transfers"
JavaScript
const res = await fetch("https://api.sasek.org/ledger/v1/transfers", {
method: "POST",
headers: { "X-Ledger-Token": KEY, "Content-Type": "application/json" },
body: JSON.stringify({
"out_tx_id": 0,
"in_tx_id": 0
}),
});
const data = await res.json();
Python
import json
import os
import urllib.request
payload = {'out_tx_id': 0, 'in_tx_id': 0}
request = urllib.request.Request(
"https://api.sasek.org/ledger/v1/transfers",
method="POST",
headers={
"X-Ledger-Token": os.environ["KEY"],
"Content-Type": "application/json",
},
data=json.dumps(payload).encode(),
)
with urllib.request.urlopen(request) as response:
print(json.load(response))