POST /v1/transactions
Record a manual or Apple Pay transaction. Retrying with the same external_id, or the same Idempotency-Key, is safe.
Auth. Send the token in the X-Ledger-Token header.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
Idempotency-Key | header | string | optional | Send a unique key per logical create. A retry with the same key returns the first response and creates nothing new. Keys are kept for a day. |
Request body
application/json: NewTransaction
| Field | Type | Required | Description |
|---|---|---|---|
source | string: one of manual, apple_pay | required | |
external_id | string | optional | Client-generated unique id, e.g. a UUID per entry |
posted | string (date) | required | |
amount_cents | integer | required | Non-zero, magnitude up to 10000000 |
merchant | string | required | |
category | string | optional | Must be on the category list |
account_id | string | optional | Must match an existing account |
note | string | optional |
Responses
| Status | Meaning | Body |
|---|---|---|
201 | Created | Created |
200 | A transaction with this external_id already exists | Created |
400 | Request rejected | Error |
413 | Request rejected | Error |
415 | 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
{
"created": true
}
Code samples
Set KEY to your own token first.
curl
curl \
-X POST \
-H X-Ledger-Token:$KEY \
-H "Content-Type: application/json" \
-d '{"source": "manual", "external_id": "string", "posted": "2026-10-11", "amount_cents": 0, "merchant": "string", "category": "string", "account_id": "string", "note": "string"}' \
"https://api.sasek.org/ledger/v1/transactions"
JavaScript
const res = await fetch("https://api.sasek.org/ledger/v1/transactions", {
method: "POST",
headers: { "X-Ledger-Token": KEY, "Content-Type": "application/json" },
body: JSON.stringify({
"source": "manual",
"external_id": "string",
"posted": "2026-10-11",
"amount_cents": 0,
"merchant": "string",
"category": "string",
"account_id": "string",
"note": "string"
}),
});
const data = await res.json();
Python
import json
import os
import urllib.request
payload = { 'source': 'manual',
'external_id': 'string',
'posted': '2026-10-11',
'amount_cents': 0,
'merchant': 'string',
'category': 'string',
'account_id': 'string',
'note': 'string'}
request = urllib.request.Request(
"https://api.sasek.org/ledger/v1/transactions",
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))