PATCH /v1/transactions/{id}

Edit a transaction. Manual and Apple Pay entries can change every field; bank transactions can change only category and note. Sending any other field to a bank transaction returns 400.

Auth. Send the token in the X-Ledger-Token header.

Parameters

NameInTypeRequiredDescription
idpathintegerrequired

Request body

application/json: object

FieldTypeRequiredDescription
amount_centsintegeroptionalManual and Apple Pay entries only. Non-zero, magnitude up to 10000000.
postedstring (date)optionalManual and Apple Pay entries only. Cannot be cleared.
merchantstringoptionalManual and Apple Pay entries only. Cannot be cleared.
payeestring or nulloptionalManual and Apple Pay entries only.
memostring or nulloptionalManual and Apple Pay entries only.
account_idstring or nulloptionalManual and Apple Pay entries only. Must match an existing account.
categorystring or nulloptionalMust be on the category list. null clears it.
notestring or nulloptional

Responses

StatusMeaningBody
200The updated transactionTransaction
400Request rejectedError
404Request rejectedError
409Request rejectedError
429Too many requests from this client address. Wait the number of seconds in Retry-After, then try again.Error

Example response

{
  "id": 0,
  "source": "manual",
  "external_id": "string",
  "account_id": "string",
  "posted": "2026-10-11",
  "transacted_at": "2026-10-11T00:00:00Z",
  "amount_cents": 0,
  "merchant": "string",
  "payee": "string",
  "memo": "string",
  "category": "string",
  "category_source": "manual",
  "rule_id": 0,
  "note": "string"
}

Code samples

Set KEY to your own token first.

curl

curl \
  -X PATCH \
  -H X-Ledger-Token:$KEY \
  -H "Content-Type: application/json" \
  -d '{"amount_cents": 0, "posted": "2026-10-11", "merchant": "string", "payee": "string", "memo": "string", "account_id": "string", "category": "string", "note": "string"}' \
  "https://api.sasek.org/ledger/v1/transactions/{id}"

JavaScript

const res = await fetch("https://api.sasek.org/ledger/v1/transactions/{id}", {
  method: "PATCH",
  headers: { "X-Ledger-Token": KEY, "Content-Type": "application/json" },
  body: JSON.stringify({
    "amount_cents": 0,
    "posted": "2026-10-11",
    "merchant": "string",
    "payee": "string",
    "memo": "string",
    "account_id": "string",
    "category": "string",
    "note": "string"
  }),
});
const data = await res.json();

Python

import json
import os
import urllib.request

payload = {   'amount_cents': 0,
    'posted': '2026-10-11',
    'merchant': 'string',
    'payee': 'string',
    'memo': 'string',
    'account_id': 'string',
    'category': 'string',
    'note': 'string'}

request = urllib.request.Request(
    "https://api.sasek.org/ledger/v1/transactions/{id}",
    method="PATCH",
    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))