DELETE /v1/accounts/{id}

Delete an account. Refused while it holds transactions, balances, holdings or imports.

An account can only be deleted when it holds nothing, so no history is lost by accident. If an account is still linked at the bank, the next sync recreates it. Remove the link in SimpleFIN Bridge first.

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

Parameters

NameInTypeRequiredDescription
idpathstringrequired

Responses

StatusMeaningBody
204Deleted—
404Request rejectedError
409The account holds data. The body gives the counts.object
429Too many requests from this client address. Wait the number of seconds in Retry-After, then try again.Error

Code samples

Set KEY to your own token first.

curl

curl \
  -X DELETE \
  -H X-Ledger-Token:$KEY \
  "https://api.sasek.org/ledger/v1/accounts/{id}"

JavaScript

const res = await fetch("https://api.sasek.org/ledger/v1/accounts/{id}", {
  method: "DELETE",
  headers: { "X-Ledger-Token": KEY },
});
const data = await res.json();

Python

import json
import os
import urllib.request

request = urllib.request.Request(
    "https://api.sasek.org/ledger/v1/accounts/{id}",
    method="DELETE",
    headers={
        "X-Ledger-Token": os.environ["KEY"],
    },
)
with urllib.request.urlopen(request) as response:
    print(json.load(response))