Skip to content

Make the stored set match a list, atomically (`policy`).

POST
/v1/policy-apply
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.

Media typeapplication/json

The stored set as it should be.

object
dry_run

Report what would change; write nothing.

boolean
expected_revision

Only if the stored set is still at this revision.

integer | null format: int64
policies
required

As many as may be stored, so the whole set fits in one apply (at most 16 MiB in all).

Array<object>
<= 10000 items

One policy in an apply.

object
actions
required
Array<string>
>= 1 items
Allowed values: read write delete list label
all_paths
boolean
description

What it’s for (printable ASCII, newlines and tabs; at most 1 KiB).

string
identity
required

The <name> of a ferritor://<name> identity, or <prefix>/* for every identity below the prefix.

string
name
required

Secret-path rules, e.g. apps/billing-read (never config:…).

string
paths

Path prefixes, whole segments; exactly one of paths and all_paths.

Array<string>
<= 64 items
prune

Delete every stored policy not listed. The only write allowed over a stored set that doesn’t verify (the repair).

boolean

What changed (or would).

Media typeapplication/json
object
created
required
Array<string>
deleted
required
Array<string>
dry_run
required
boolean
new_policy_key
required

It created a new policy key (the old one was missing or didn’t open).

boolean
replaced_unverified
required

It replaced a stored set that didn’t verify.

boolean
revision
required

The revision now (for a dry run: what it would be).

integer format: int64
unchanged
required
Array<string>
updated
required
Array<string>

Example generated

{
"created": [
"example"
],
"deleted": [
"example"
],
"dry_run": true,
"new_policy_key": true,
"replaced_unverified": true,
"revision": 1,
"unchanged": [
"example"
],
"updated": [
"example"
]
}

An error: see error.code.

Media typeapplication/json

Every error’s body.

object
error
required
object
code
required

Match on this, never on the message.

string
Allowed values: invalid_argument unauthenticated permission_denied not_found method_not_allowed version_mismatch live_version no_namespace unknown_profile busy aborted misdirected_request sealed unaudited unknown_kek policy_unverified rate_limited unavailable failed_precondition internal
message
required

For people; may change.

string

Example

{
"error": {
"code": "invalid_argument"
}
}