Reference / Management API
Management API
Everything the console does, over HTTP: the rules, their tests, the vocabulary, the directory, keys and bindings, agents and the ledger. Every change is checked, needs a signed-in author and a reason, and is recorded before it is made.
Base URL
Your installation's address, the one you sign in at: https://app.example.com/api/.... The PDP's AuthZEN routes live at their own address.
Sign in
read -s PASS
TOKEN=$(printf '{"name":"%s","passphrase":"%s"}' "$AUTHOR" "$PASS" \
| curl -sf https://app.example.com/api/auth/login \
-H 'Content-Type: application/json' -H 'X-Caroline-Request: 1' --data @- \
| python3 -c 'import json,sys; print(json.load(sys.stdin)["token"])')
unset PASS
POST /api/auth/login takes {name, passphrase} and answers {token, name, expires}. Send the token as Authorization: Bearer. A session lasts 8 hours and ends when Caroline restarts. Accounts signed in with Google or Microsoft use the console; scripts use an author account.
Conventions
| On | Send or expect |
| every write (POST, PUT) | X-Caroline-Request: 1, or 403 missing_request_header |
| every change | a reason; it goes into the ledger |
| edits to something that exists | its version from the ETag in If-Match; a stale one answers 412 and changes nothing |
creates and edits under /api/v1 | a fresh Idempotency-Key; the same request sent again gets the first answer |
| a change that would break something | 409 confirm_needed with what would break; send again with "confirm": true |
any refusal under /api/v1 | RFC 9457 problem JSON |
| the ledger cannot record | 503 ledger_unavailable; nothing changed |
| a viewer's account | reads; writes answer 403 read_only |
Routes under /api/v1 are versioned. The other routes below are the ones the caroline command uses.
Sign-in
POST/api/auth/login | a session token |
POST/api/auth/logout | ends it |
GET/api/auth/whoami | who you are; never 401 |
GET/api/auth/providers | the single sign-on providers this installation offers |
Rules
GET/api/policies | the rule document and its revision |
GET/api/policy-files | the same as files: [{path, text}] |
GET/api/policy-schema | the rule schema, for an editor |
POST/api/policies/preview | the checks, the changes and the past decisions that would flip; nothing saved |
PUT/api/policies | publish: document or files, a message, and base_revision, the revision you previewed, so a change made since is refused rather than overwritten |
GET/api/policy-history | every published change |
GET/api/policy-history/{revision} | one change, in words |
Tests and impact
GET/api/v1/tests | the installation's tests; the ETag is the revision |
POST/api/v1/tests/run | run them, on the live rules or on a copy you send |
PUT/api/v1/tests/{name} | add or change a test |
POST/api/v1/tests/suggest | tests for the questions no test asks yet |
POST/api/bench/impact | who gains and who loses access under a copy of the rules |
Vocabulary
GET/api/v1/actions | the actions, with the list's ETag |
POST/api/v1/actions | add one |
PUT/api/v1/actions/{name} | edit one |
POST/api/v1/actions/{name}/retire, /reinstate | take one out of use, or put it back |
GET/api/v1/attributes | the attribute definitions, with the list's ETag |
POST/api/v1/attributes | declare one |
PUT/api/v1/attributes/{describes}/{name} | edit one (describes: who or what it is about) |
POST/api/v1/attributes/{describes}/{name}/retire, /reinstate | take one out of use, or put it back; an attribute a rule reads cannot be retired |
Directory
{kind} is people, agents or resources. Every write is checked against the attribute definitions.
GET/api/v1/{kind} | a page of records |
GET/api/v1/{kind}/{id} | one record, with its ETag |
POST/api/v1/{kind} | create |
PUT/api/v1/{kind}/{id} | edit |
POST/api/v1/{kind}/{id}/remove | remove; the engine refuses a removed id, and removing an agent revokes its keys |
POST/api/v1/{kind}/{id}/restore | bring a removed record back |
Keys and gateways
GET/api/v1/keys | the gateways, their bindings and every key with its state; never a token |
POST/api/v1/keys | issue a key; the token is in this answer only |
POST/api/v1/keys/{key_id}/revoke | revoke, for good |
PUT/api/v1/gateways/{id}/binding | bind, or change the binding |
POST/api/v1/gateways/{id}/binding/remove | unbind |
See Gateway keys and binding.
Agents
GET/api/agents | the agents Caroline holds |
PUT/api/agents/{id}/settings | status (active or suspended), delegation (whether it must act for a person) and credential (whether it must send its own key), each required or optional; a suspension acts at once |
POST/api/agents/approvals | a person's signed, single-use approval for one step; never by the agent's owner |
GET/api/agents/signals | the rogue-agent signal for every agent |
GET/api/agents/{id}/signals | the evidence behind one agent's flag |
POST/api/agents/{id}/signals/review | mark a flag reviewed |
Ledger
GET/api/audit/ledger | records, newest first: limit, source, before_seq |
GET/api/audit/verify | recompute the chain |
GET/api/audit/export/{YYYY-MM-DD} | one day as NDJSON |
GET/api/audit/export | the whole ledger as a zip with its own offline check |
Authors only. See The decision ledger.
Installation
GET/api/v1/installation | the installation's id, profile and what it offers |
GET/api/v1/installation/engine | the engine build the PDP last reported |
POST/api/v1/installation/starter | import a pack's rules into an empty installation |
GET/api/v1/state | whether the directory and key store are in step with the ledger |