DELETE /v1/tokens/{id}
Revoke a named token, admin token only. It stops working at once and cannot be restored; create a new one instead.
Auth. Admin token only. Any other caller gets a 404, the same as an unknown route.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | integer | required |
Responses
| Status | Meaning | Body |
|---|---|---|
204 | Revoked | — |
404 | Not found. Any caller without the admin token gets this, the same as an unknown or already revoked token. | Error |
429 | Too 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/tokens/{id}"
JavaScript
const res = await fetch("https://api.sasek.org/ledger/v1/tokens/{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/tokens/{id}",
method="DELETE",
headers={
"X-Ledger-Token": os.environ["KEY"],
},
)
with urllib.request.urlopen(request) as response:
print(json.load(response))