CarolineDocs

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

OnSend or expect
every write (POST, PUT)X-Caroline-Request: 1, or 403 missing_request_header
every changea reason; it goes into the ledger
edits to something that existsits version from the ETag in If-Match; a stale one answers 412 and changes nothing
creates and edits under /api/v1a fresh Idempotency-Key; the same request sent again gets the first answer
a change that would break something409 confirm_needed with what would break; send again with "confirm": true
any refusal under /api/v1RFC 9457 problem JSON
the ledger cannot record503 ledger_unavailable; nothing changed
a viewer's accountreads; 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/logina session token
POST/api/auth/logoutends it
GET/api/auth/whoamiwho you are; never 401
GET/api/auth/providersthe single sign-on providers this installation offers

Rules

GET/api/policiesthe rule document and its revision
GET/api/policy-filesthe same as files: [{path, text}]
GET/api/policy-schemathe rule schema, for an editor
POST/api/policies/previewthe checks, the changes and the past decisions that would flip; nothing saved
PUT/api/policiespublish: 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-historyevery published change
GET/api/policy-history/{revision}one change, in words

Tests and impact

GET/api/v1/teststhe installation's tests; the ETag is the revision
POST/api/v1/tests/runrun 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/suggesttests for the questions no test asks yet
POST/api/bench/impactwho gains and who loses access under a copy of the rules

Vocabulary

GET/api/v1/actionsthe actions, with the list's ETag
POST/api/v1/actionsadd one
PUT/api/v1/actions/{name}edit one
POST/api/v1/actions/{name}/retire, /reinstatetake one out of use, or put it back
GET/api/v1/attributesthe attribute definitions, with the list's ETag
POST/api/v1/attributesdeclare one
PUT/api/v1/attributes/{describes}/{name}edit one (describes: who or what it is about)
POST/api/v1/attributes/{describes}/{name}/retire, /reinstatetake 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}/removeremove; the engine refuses a removed id, and removing an agent revokes its keys
POST/api/v1/{kind}/{id}/restorebring a removed record back

Keys and gateways

GET/api/v1/keysthe gateways, their bindings and every key with its state; never a token
POST/api/v1/keysissue a key; the token is in this answer only
POST/api/v1/keys/{key_id}/revokerevoke, for good
PUT/api/v1/gateways/{id}/bindingbind, or change the binding
POST/api/v1/gateways/{id}/binding/removeunbind

See Gateway keys and binding.

Agents

GET/api/agentsthe agents Caroline holds
PUT/api/agents/{id}/settingsstatus (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/approvalsa person's signed, single-use approval for one step; never by the agent's owner
GET/api/agents/signalsthe rogue-agent signal for every agent
GET/api/agents/{id}/signalsthe evidence behind one agent's flag
POST/api/agents/{id}/signals/reviewmark a flag reviewed

Ledger

GET/api/audit/ledgerrecords, newest first: limit, source, before_seq
GET/api/audit/verifyrecompute the chain
GET/api/audit/export/{YYYY-MM-DD}one day as NDJSON
GET/api/audit/exportthe whole ledger as a zip with its own offline check

Authors only. See The decision ledger.

Installation

GET/api/v1/installationthe installation's id, profile and what it offers
GET/api/v1/installation/enginethe engine build the PDP last reported
POST/api/v1/installation/starterimport a pack's rules into an empty installation
GET/api/v1/statewhether the directory and key store are in step with the ledger
Caroline DocsAuthZEN 1.0 · OPA