Skip to main content
POST
Create a prompt-firewall policy
Creates a policy. action is what makes this endpoint matter: With no policy attached to an agent, the outcome is warn and block is unreachable. Creating a policy with action: "block" and setting the agent’s firewall_policy_id is what turns detection into refusal. Every regex rule is compiled through a safe-regex validator at write time, so a pattern that could backtrack catastrophically is refused here rather than discovered on the hot path. Dry-run a rule set first with Test firewall rules — the tester compiles through the same validator, so a pattern it accepts can actually run. Requires the create capability on ai_gateway. See the control-plane overview for authentication, the {data, meta} envelope, pagination and error types.

Authorizations

Authorization
string
header
required

OAuth 2.1 authentication — recommended for new integrations. Access tokens (kc_ prefix) are minted at the root-host token endpoint https://api.knoxcall.com/oauth/token and passed as Authorization: Bearer <access_token>. Public clients must use PKCE with the authorization_code grant; confidential clients may use client_credentials. The first-party SDKs and the knoxcall login CLI handle token minting, caching, refresh, and DPoP for you.

Body

application/json
name
string
required

2-64 chars. Re-using an existing name creates the next version.

heuristics
object[]
canary_enabled
boolean
default:true
action
enum<string>
default:warn
Available options:
block,
warn,
tag

Response

The created policy.

data
object

A tenant-scoped prompt-firewall policy, attachable to agents and MCP servers.

meta
object

Metadata included with every API response.