> ## Documentation Index
> Fetch the complete documentation index at: https://docs.apten.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Guardrail Triggered

> Get notified when a guardrail is triggered on a webchat message.

The `webchat.guardrail.triggered` webhook event is triggered whenever one or more
guardrails are activated on an AI response in a webchat session. This can be used to
monitor compliance, safety, or business rule violations in your webchat assistant.

## Payload

```json theme={null}
{
  "event": "webchat.guardrail.triggered",
  "data": {
    "sessionId": "550e8400-e29b-41d4-a716-446655440000",
    "orgId": "org-abc123",
    "profile": "Default Profile",
    "origin": "https://example.com/pricing",
    "messageId": "msg_a3c5e7f9",
    "violatedGuardrails": ["741d2650-f2ff-4842-ba70-af7343d5c464"],
    "blockedContent": "The original AI response that triggered the guardrail.",
    "sanitizedContent": "The replacement message that was actually shown to the visitor.",
    "createdAt": "2024-01-15T14:30:00Z"
  },
  "timestamp": "2024-01-15T14:30:00Z"
}
```

## Properties

| Property                  | Type      | Description                                                                    |
| ------------------------- | --------- | ------------------------------------------------------------------------------ |
| `event`                   | string    | The webhook event type (`webchat.guardrail.triggered`).                        |
| `data.sessionId`          | string    | The unique identifier for the webchat session.                                 |
| `data.orgId`              | string    | The Apten organization ID that owns the session.                               |
| `data.profile`            | string    | The name of the webchat profile that handled the session.                      |
| `data.origin`             | string    | The URL of the page where the webchat widget was opened. Only included if set. |
| `data.messageId`          | string    | The unique identifier for the message that triggered the guardrail.            |
| `data.violatedGuardrails` | string\[] | Array of guardrail IDs that were triggered.                                    |
| `data.blockedContent`     | string    | The original AI response that was blocked by the guardrail.                    |
| `data.sanitizedContent`   | string    | The replacement message that was shown to the visitor.                         |
| `data.createdAt`          | string    | The ISO 8601 timestamp when the guardrail was triggered.                       |
| `timestamp`               | string    | The ISO 8601 timestamp when the webhook was sent.                              |
