Guards

Create Guard

Creates a new guard in your organization.

Guards evaluate content against a set of checks (regex, LLM, built-in, JSONata) and trigger actions when the combined certainty score exceeds the threshold.

Requires a token with the admin:write scope.

post/api/guards

Request

  • Base URL: https://app.withwillow.ai
  • URL: https://app.withwillow.ai/api/guards
  • Auth: HTTP bearer

Request body

namestring required
slugstring required
descriptionstring
thresholdnumber

Score threshold that triggers the action (default 5)

action'redact' | 'warn' | 'warn_user' | 'block'

Action to take when the threshold is exceeded

messagestring

Message shown to the user when this guard blocks or warns a call

status'active' | 'draft'
scope'buildtime' | 'runtime'

Example request

{
  "name": "Email Detection",
  "slug": "email-detection",
  "checks": [
    {
      "id": "regex-email",
      "name": "Email Address",
      "certainty": 10
    }
  ]
}

Response

Guard created successfully

Example response

{
  "data": {
    "id": "guard_abc123",
    "slug": "email-detection",
    "name": "Email Detection",
    "description": "Detects email addresses in content",
    "checks": [
      {
        "id": "regex-email",
        "name": "Email Address",
        "certainty": 10
      }
    ],
    "threshold": 5,
    "action": "warn",
    "status": "active",
    "created_at": "2026-01-15T09:30:00Z",
    "org_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "updated_at": "2026-01-15T09:30:00Z"
  }
}

Changes

No recorded changes to this operation across all 1 revision of this API.