Make the stored set match a list, atomically (`policy`).
const url = 'https://ferritor.example.internal:7070/v1/policy-apply';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"dry_run":true,"expected_revision":1,"policies":[{"actions":["read"],"all_paths":true,"description":"example","identity":"example","name":"example","paths":["example"]}],"prune":true}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://ferritor.example.internal:7070/v1/policy-apply \ --header 'Content-Type: application/json' \ --data '{ "dry_run": true, "expected_revision": 1, "policies": [ { "actions": [ "read" ], "all_paths": true, "description": "example", "identity": "example", "name": "example", "paths": [ "example" ] } ], "prune": true }'Creates and replaces what’s listed, and with prune deletes every other
stored policy. One invalid policy refuses the whole call.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”The stored set as it should be.
object
Report what would change; write nothing.
Only if the stored set is still at this revision.
As many as may be stored, so the whole set fits in one apply (at most 16 MiB in all).
One policy in an apply.
object
What it’s for (printable ASCII, newlines and tabs; at most 1 KiB).
The <name> of a ferritor://<name> identity, or <prefix>/* for
every identity below the prefix.
Secret-path rules, e.g. apps/billing-read (never config:…).
Path prefixes, whole segments; exactly one of paths and
all_paths.
Delete every stored policy not listed. The only write allowed over a stored set that doesn’t verify (the repair).
Responses
Section titled “Responses”What changed (or would).
object
It created a new policy key (the old one was missing or didn’t open).
It replaced a stored set that didn’t verify.
The revision now (for a dry run: what it would be).
Example generated
{ "created": [ "example" ], "deleted": [ "example" ], "dry_run": true, "new_policy_key": true, "replaced_unverified": true, "revision": 1, "unchanged": [ "example" ], "updated": [ "example" ]}default
Section titled “default”An error: see error.code.
Every error’s body.
object
object
Match on this, never on the message.
For people; may change.
Example
{ "error": { "code": "invalid_argument" }}