REFERENCE · INTEGRATE
Account API
One key, one base URL: every resource this console holds, scoped to whoever issued the key. Reads are open to a key; writes stay on the purpose-built endpoints, each with its own credential.
SETUP · FOUR STEPS
01
Issue an account key
A key reads this console as you: your assets, your ledger, your anchors. Nothing another tenant holds is reachable with it. Issue one below and it is shown once.
02
Store it in the calling system
Set it as KLSWITCH_API_KEY wherever the call is made. It is never shown again; if it leaks, revoke it and issue another in the same minute.
03
Call the base URL
Every resource hangs off one path. Send the key as a header, never in a shared URL.
04
Read the answer
A 200 carries data, a count, and a next_cursor when there is more. 401 means the key is wrong or revoked, 403 means it is not scoped to that resource, 400 names a resource that does not exist.
THE FIRST CALL · NO RESOURCE, SO IT LISTS WHAT YOUR KEY MAY READ
curl -s "https://klswitch.app/functions/appApi" \ -H "x-api-key: $KLSWITCH_API_KEY"
THEN ADD ?resource=ASSETS · LEDGER · ANCHORS · GATE · HEALTH …
A key reads as its owner. Nothing another tenant holds is reachable with it, and revoking one answers 401 from the next call onward while every record it already read keeps its history.