REFERENCE
API access
One key, one base URL, every record this console holds — assets, ledger, usage, settlements, anchors, gate decisions, drift, evidence and health packs. Reads only, scoped to the key owner: nothing another tenant holds is reachable with your key.
Unauthorized
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 …
ISSUE A KEY
YOUR KEYS
NO KEY YET. ISSUE ONE ABOVE AND THE FIRST CALL BELOW BECOMES POSSIBLE.
THE ENDPOINT · READ ONLY
GET https://klswitch.app/functions/appApi?resource=assets&limit=50
| RESOURCE | WHAT IT RETURNS | FILTER |
|---|---|---|
| THE CATALOG LOADS FROM THE API; ISSUE A KEY TO SEE IT. | ||
ERRORS
- missing_key · 401No x-api-key header was sent.
- invalid_key · 401The key is unknown, or it has been revoked.
- missing_scope · 403The key is valid but not scoped to this resource.
- unknown_resource · 400The resource name is not in the list; the answer names the valid ones.
- server_error · 500The read failed before it produced data.
NOT IN THIS API
Writes. Meters, deployments, bills, gate calls and proxy traffic have their own keyed endpoints, because each one is an act rather than a read. They are listed in the technical guide under the ingest and enforcement sections.
A PAGE OF RECORDS ALSO CARRIES has_more AND next_cursor: PASS THE CURSOR BACK FOR THE NEXT PAGE.
Keys are shown once and stored only as a hash. Machine endpoints that write — meters, deployments, bills, the gate and the proxy — keep their own keys and are documented in the guide.