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

NameInTypeRequiredDescription
idpathstring: one of collectrrequired

Request body

application/json: object

FieldTypeRequiredDescription
enabledbooleanoptionalTurn the source on or off.
configobjectoptionalThe source's settings. For collectr, profile_url is the public Collectr page.

Responses

StatusMeaningBody
200The saved settingsSourceSettings
400Request rejectedError
404Request rejectedError
429Too 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))