API ReferencePOST

Search

Resolve the governing rule, overridden base rules, superseded versions, and hop trace.

Endpoint

POSThttps://api.runmackerel.com/v1/search

Evaluates rules in corpus after filtering out entries outside the caller's groups, returning the active governing rule and full override chain.

Headers

Authorizationstringheaderrequired
Bearer token formatted as Bearer mk_live_... or Bearer mk_test_....
X-Mackerel-ZDRbooleanheaderdefault: false
Set to true to omit query text from request logs (query stored as NULL).

Body parameters

corpusstringbodyrequired
Target corpus slug. Every workspace includes demo_sops out of the box.
querystringbodyrequired
Question between 3 and 2,000 characters. Include entity, region, role, or contract tier when relevant so conditional addenda trigger cleanly.
groupsstring[]bodydefault: []
Caller ACL groups. Rules declaring acl tags outside this array are dropped before scoring.
modelstringbodydefault: mackerel-flash
mackerel-flash ($0.002/query, 350ms budget) or mackerel-base ($0.005/query, 420ms budget).

Response schema

idstringalways present
Unique trace ID (tr_...) recorded in Request Logs and audit history.
governingRuleHit[]always present
Active rule(s) that govern the query. Empty when abstained is true.
overriddenRuleHit[]always present
Base rules matched on topic but superseded by a narrower rule in governing.
supersededAuditRef[]always present
Retired document versions kept out of governing and listed only for auditability.
abstainedbooleanalways present
true when no authorized rule covers the question.
traceobjectalways present
Resolution steps, considered (authorized rule count), and pruned count.
usageobjectalways present
Per-query cost_usd and updated workspace balance_usd.

Multi-language examples

curl -sS https://api.runmackerel.com/v1/search \
  -H "Authorization: Bearer $MACKEREL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Mackerel-ZDR: true" \
  -d '{
    "corpus": "demo_sops",
    "query": "Can a contractor on our German entity expense a €140 client dinner?",
    "groups": ["finance-emea"],
    "model": "mackerel-flash"
  }' | jq '{governing: .governing[0].id, overrides: .governing[0].overrides, abstained}'
POST/v1/search

DACH addendum (€95 cap) overrides the global €150 meal cap and keeps the retired 2024 handbook out.

Caller ACL groups:
Request JSON
{
  "corpus": "demo_sops",
  "query": "Can a contractor on our German entity expense a €140 client dinner?",
  "groups": [
    "finance-emea"
  ],
  "model": "mackerel-flash"
}
Response JSON

Click Run to query the demo_sops corpus.