PUT /v1/sources/{id}/settings
Turn a source on or off, and set what it needs. Admin token only. Omitted fields keep their current values; config replaces the whole config. A source cannot be enabled until its config has profile_url. Only https URLs are accepted.
Auth. Send the token in the X-Ledger-Token header.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
id | path | string: one of collectr | required |
Request body
application/json: object
| Field | Type | Required | Description |
|---|---|---|---|
enabled | boolean | optional | Turn the source on or off. |
config | object | optional | The source's settings. For collectr, profile_url is the public Collectr page. |
Responses
| Status | Meaning | Body |
|---|---|---|
200 | The saved settings | SourceSettings |
400 | Request rejected | Error |
404 | 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
{
"source": "collectr",
"enabled": true,
"config": {},
"updated_at": "2026-10-11T00:00:00Z"
}
Code samples
Set KEY to your own token first.
curl
curl \
-X PUT \
-H X-Ledger-Token:$KEY \
-H "Content-Type: application/json" \
-d '{"enabled": true, "config": {"profile_url": "string"}}' \
"https://api.sasek.org/ledger/v1/sources/{id}/settings"
JavaScript
const res = await fetch("https://api.sasek.org/ledger/v1/sources/{id}/settings", {
method: "PUT",
headers: { "X-Ledger-Token": KEY, "Content-Type": "application/json" },
body: JSON.stringify({
"enabled": true,
"config": {
"profile_url": "string"
}
}),
});
const data = await res.json();
Python
import json
import os
import urllib.request
payload = {'enabled': True, 'config': {'profile_url': 'string'}}
request = urllib.request.Request(
"https://api.sasek.org/ledger/v1/sources/{id}/settings",
method="PUT",
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))