## ZeroDrift integration
ZeroDrift Enforcement API. Base URL: https://api.zerodrift.ai. Authenticate with the `x-api-key` header using the `ZERODRIFT_API_KEY` environment variable. Never expose the key in source control, logs, client-side code, or prompts.
Enforce text: `POST /api/v3/content/validate` with `{content, model_engine: "anchor_3_0_mini"|"anchor_3_0"|"anchor_3_0_max", mode: "sync"|"async", validation_scope?: {rulepacks?, imports?, rules?, managed_only?}, metadata?}`. Default `model_engine` is Flagship (`anchor_3_0`; older notes called this Base). Mini is detection-only, runs unscoped against its frozen rulebook, and rejects `validation_scope`. A scope-less Flagship call stays on Flagship and checks active managed rules only; activated custom rules are not evaluated. Ask for `anchor_3_0_max` explicitly to enforce activated custom rules. Max returns per-line violations without a rewrite; `fix.suggested_text` is the rule's own fix note when present and otherwise empty. A Flagship request that explicitly names a `cust_*` rule is upgraded to Max (`engine_upgrade_reason: "custom_rules"`). See [Choose a model](/models). Quality and latency: https://zerodrift.com/model/anchor-3-benchmark
Sync mode returns the result inline when processing completes within the inline budget; otherwise it falls back to async mode. Custom rules need `anchor_3_0_max` for an inline sync verdict. Async mode returns `202` with `{job_id, poll.url}`; poll `GET /api/v3/jobs/{job_id}` until `status` is `completed` or `failed`.
Read the enforcement decision from `result.overall_status`: `approved` = Pass (deliver); `needs_changes` = Fix (apply `fix.suggested_text` only when `fix.action` is `replace`); `do not send` = Block (deliver a fallback, never the original). Treat `status` only as job lifecycle state. Escalate when `suggested_text` is empty, `action` is not `replace`, or your policy requires review. Public usage fields are `result.units` and `result.cost`, not raw token counts.
Rulepacks: `GET /api/rulepacks/`; use the returned `id` in `validation_scope.rulepacks`. Rules: `GET /api/policies/rules`; use `rule_id` in `validation_scope.rules` (custom IDs are prefixed `cust_`). Policies: `POST /api/policies/import`, poll the import, activate its rules, then use the import ID in `validation_scope.imports`.
Activity log (30 days): `GET /api/activities`. Rate limit: 10 requests per second with a burst of 50; back off on `429`.
Docs index: https://docs.zerodrift.com/llms.txt
Full docs: https://docs.zerodrift.com/llms-full.txt
OpenAPI spec: https://docs.zerodrift.com/openapi.json
Docs MCP: https://docs.zerodrift.com/mcp