API Reference
All requests must include the header Authorization: Bearer <your-api-key>. Rate limits apply per key: 1,000 requests per minute on the Starter tier, 10,000 on Growth, and unlimited on Enterprise. Responses follow standard HTTP status codes. Error bodies include code, message, and an optional details array.
POST /v1/intercept
Submit an AI-generated text for policy evaluation. ZeroDrift evaluates the text against all specified policies and returns a compliant version along with a list of any rules that triggered.
Request body
{
"text": "string", // required: raw AI output to evaluate
"policies": ["pol_..."], // required: one or more policy IDs
"context": {}, // optional: arbitrary key/value metadata
"session_id": "string" // optional: groups events in audit log
}
Response body
{
"id": "evt_xxxxxxxxxxxxxxxx",
"text": "string",
"action": "pass" | "rewrite" | "block",
"triggered_rules": [
{
"rule_id": "rul_...",
"policy_id": "pol_...",
"action": "rewrite" | "block",
"category": "string"
}
],
"latency_ms": 18,
"created_at": "2025-11-04T09:22:41Z"
}
GET /v1/policies
List all policies in your account. Returns active and inactive policies. Supports pagination via limit and after cursor parameters.
{
"data": [
{
"id": "pol_xxxxxxxxxxxxxxxx",
"label": "financial-advice-guard",
"active": true,
"rule_count": 12,
"created_at": "2025-09-18T14:05:00Z"
}
],
"has_more": false,
"next_cursor": null
}
POST /v1/policies
Create a new policy from scratch or activate a built-in template. When using a template, the template field specifies the template name and overrides lets you adjust individual rules.
{
"label": "my-policy", // required
"template": "financial-advice-guard", // optional
"rules": [ // required if no template
{
"category": "financial-advice",
"action": "rewrite",
"severity": "high"
}
],
"active": true
}
PUT /v1/policies/{id}
Update an existing policy. You can toggle the active state, add or remove rules, or rename the policy. Only fields included in the request body are modified.
{
"label": "updated-policy-name", // optional
"active": false, // optional: deactivates policy
"rules": [...] // optional: full replacement of rule set
}
DELETE /v1/policies/{id}
Permanently delete a policy. This action cannot be undone. Any future intercept calls that reference this policy ID will receive a 404 error. Existing audit log events that reference this policy ID are retained.
{
"id": "pol_xxxxxxxxxxxxxxxx",
"deleted": true
}
GET /v1/audit-log
Query intercept events for your account. Supports filtering by time range, policy, rule, session, and action type. Results are sorted newest first. Use limit (max 1,000) and after cursor for pagination.
Query parameters
start/end: ISO 8601 timestamps (inclusive range)policy_id: filter to a single policyaction: one ofpass,rewrite,blocksession_id: filter by session identifierlimit: records per page, default 100, max 1,000after: cursor from previous response for pagination
{
"data": [
{
"id": "evt_xxxxxxxxxxxxxxxx",
"action": "rewrite",
"policy_id": "pol_xxxxxxxxxxxxxxxx",
"triggered_rules": ["rul_..."],
"latency_ms": 22,
"session_id": "sess_abc123",
"created_at": "2025-11-04T09:22:41Z"
}
],
"has_more": true,
"next_cursor": "evt_xxxxxxxxxxxxxxxx"
}
Authentication errors
All endpoints return a consistent error shape when authentication or validation fails.
{
"error": {
"code": "invalid_api_key",
"message": "The API key provided is not valid.",
"status": 401
}
}
Common error codes: invalid_api_key (401), policy_not_found (404), rate_limit_exceeded (429), validation_error (422), internal_error (500).