---
title: "Replace the rules"
method: PUT
path: "/policy"
---

# Replace the rules

`PUT /policy`

## Request

- Base URL: `https://secureai.one/v1`
- URL: `https://secureai.one/v1/policy`
- Auth: HTTP bearer

Refuses the whole policy when any rule is malformed, naming the index — a parser that dropped the rule it could not read would hand back a policy weaker than the one its author believed they saved.

## Request body

- object
  - `policy` Policy
    - `version` 1, required
    - `fallback` 'allow' | 'redact' | 'approve' | 'block', required: What happens to a kind no rule mentions.
    - `rules` Rule[], required
      - `kind` 'secret' | 'card' | 'iban' | 'ssn' | 'govid' | 'email' | 'phone' | 'address' | 'postcode' | 'name' | 'host', required
      - `decision` 'allow' | 'redact' | 'approve' | 'block', required
      - `tools` string[]: Only these tools. Exact, or a single trailing "*". Absent means all.
      - `direction` 'outbound' | 'inbound': Absent means both.
    - `denyTools` string[]: Tools that may not be called at all, whatever is inside them.
    - `allow` string[]: Literal values that are never sensitive here. A leading "@" exempts a whole domain. These are stored, unlike anything in the audit trail.
    - `gatewayAllow` string[]: Hosts the gateway may forward to. Empty or absent means any public host. A leading "." matches a domain and its subdomains. Private-address rules still apply and cannot be opened up from here.
    - `webhook` object: Where to POST when an action is refused. The payload is the audit record, which holds kinds and locations and never values.
      - `url` string, required: https only. Private and link-local addresses are refused, as everywhere else.
      - `on` string[]: Which decisions to send. Defaults to blocks only — a notification on every allowed action is one nobody reads.
      - `secret` string: When set, each delivery carries X-Secure-AI-Signature: sha256=<hmac of the body>.
    - `approvalTtlSeconds` integer: How long a held action waits before it is denied. Expiry is a denial and never a release — an action somebody wanted reviewed must not proceed because nobody had time to review it.

## Response `200`

Stored.

- object
  - `policy` Policy
    - `version` 1, required
    - `fallback` 'allow' | 'redact' | 'approve' | 'block', required: What happens to a kind no rule mentions.
    - `rules` Rule[], required
      - `kind` 'secret' | 'card' | 'iban' | 'ssn' | 'govid' | 'email' | 'phone' | 'address' | 'postcode' | 'name' | 'host', required
      - `decision` 'allow' | 'redact' | 'approve' | 'block', required
      - `tools` string[]: Only these tools. Exact, or a single trailing "*". Absent means all.
      - `direction` 'outbound' | 'inbound': Absent means both.
    - `denyTools` string[]: Tools that may not be called at all, whatever is inside them.
    - `allow` string[]: Literal values that are never sensitive here. A leading "@" exempts a whole domain. These are stored, unlike anything in the audit trail.
    - `gatewayAllow` string[]: Hosts the gateway may forward to. Empty or absent means any public host. A leading "." matches a domain and its subdomains. Private-address rules still apply and cannot be opened up from here.
    - `webhook` object: Where to POST when an action is refused. The payload is the audit record, which holds kinds and locations and never values.
      - `url` string, required: https only. Private and link-local addresses are refused, as everywhere else.
      - `on` string[]: Which decisions to send. Defaults to blocks only — a notification on every allowed action is one nobody reads.
      - `secret` string: When set, each delivery carries X-Secure-AI-Signature: sha256=<hmac of the body>.
    - `approvalTtlSeconds` integer: How long a held action waits before it is denied. Expiry is a denial and never a release — an action somebody wanted reviewed must not proceed because nobody had time to review it.

## Other responses

- `400`: The policy could not be parsed. The message names the offending rule.
- `401`: Missing or invalid API key.

---

[API](https://skmtc.dev/secureai/apis/secure-ai.md) · [All operations](https://skmtc.dev/secureai/apis/secure-ai/llms.txt) · [OpenAPI document](https://skmtc.dev/secureai/apis/secure-ai/revisions/6eefd7f53f8b?raw)
