POST /v1/transactions/bulk-categorize
Set the category of up to 500 transactions in one request
Auth. Send the token in the X-Ledger-Token header.
Request body
application/json: object
| Field | Type | Required | Description |
|---|---|---|---|
ids | integer[] | required | |
category | string or null | required | Must be on the category list. null hands them back to the rules. |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | How many changed | 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
{
"changed": 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 '{"ids": [1], "category": "string"}' \
"https://api.sasek.org/ledger/v1/transactions/bulk-categorize"
JavaScript
const res = await fetch("https://api.sasek.org/ledger/v1/transactions/bulk-categorize", {
method: "POST",
headers: { "X-Ledger-Token": KEY, "Content-Type": "application/json" },
body: JSON.stringify({
"ids": [
1
],
"category": "string"
}),
});
const data = await res.json();
Python
import json
import os
import urllib.request
payload = {'ids': [1], 'category': 'string'}
request = urllib.request.Request(
"https://api.sasek.org/ledger/v1/transactions/bulk-categorize",
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))