GET /v1/tokens

Named API tokens, admin token only. The tokens themselves are never shown here.

Auth. Admin token only. Any other caller gets a 404, the same as an unknown route.

Responses

StatusMeaningBody
200Tokens, oldest firstApiToken[]
404Not found. Any caller without the admin token gets this, the same as an unknown route.Error
429Too many requests from this client address. Wait the number of seconds in Retry-After, then try again.Error

Example response

[
  {
    "id": 0,
    "name": "string",
    "scope": "read",
    "created_at": "2026-10-11T00:00:00Z",
    "last_used_at": "2026-10-11T00:00:00Z",
    "revoked_at": "2026-10-11T00:00:00Z"
  }
]

Code samples

Set KEY to your own token first.

curl

curl \
  -H X-Ledger-Token:$KEY \
  "https://api.sasek.org/ledger/v1/tokens"

JavaScript

const res = await fetch("https://api.sasek.org/ledger/v1/tokens", {
  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/tokens",
    method="GET",
    headers={
        "X-Ledger-Token": os.environ["KEY"],
    },
)
with urllib.request.urlopen(request) as response:
    print(json.load(response))