API ReferencePOST

Corpora & rules

Create isolated workspace corpora and upsert rules with ACLs, overrides, and supersession pointers.

Endpoints

POSThttps://api.runmackerel.com/v1/corpora
POSThttps://api.runmackerel.com/v1/corpora/{slug}/rules

Every workspace can manage custom corpora via HTTP, MCP (mackerel_upsert_rule), or Dashboard → Corpora.

Rule fields

rule_keystringbodyrequired
Unique stable identifier inside the corpus (e.g. sec-1-gov). Re-sending the same key updates the node in place.
sourcestringbodyrequired
Human-readable document title shown in citations.
sectionstringbodyrequired
Clause or section heading (e.g. §1(a) GovCloud SSH).
textstringbodyrequired
Full rule text returned verbatim when governing.
aclstring[]bodydefault: []
Allowed caller groups. Leave empty for workspace-wide visibility.
overridesstring[]bodydefault: []
Array of base rule_key IDs overridden when this rule's conditions match.
superseded_bystring | nullbody
Optional rule_key that replaces this retired version.

Create & upsert examples

curl -X POST https://api.runmackerel.com/v1/corpora \
  -H "Authorization: Bearer $MACKEREL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"slug":"acme_security","name":"Acme Security Policies","description":"Prod access and FedRAMP addenda"}'

curl -X POST https://api.runmackerel.com/v1/corpora/acme_security/rules \
  -H "Authorization: Bearer $MACKEREL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "rule_key": "sec-1-gov",
    "source": "FedRAMP Addendum",
    "section": "§1(a) GovCloud SSH",
    "text": "GovCloud production SSH is prohibited; use recorded bastion sessions.",
    "effective": "2026-06-01",
    "acl": ["security"],
    "overrides": ["sec-1"]
  }'