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

# Update Guardrail

> Replaces an existing guardrail's configuration by its unique ID. This is a full replace of every client-settable field, not a partial patch. `key` is never changed by an update, even if `name` changes.



## OpenAPI

````yaml PUT /ext/guardrail/{id}
openapi: 3.0.3
info:
  title: TruGen Developer Platform API
  version: 1.0.0
  description: OpenAPI specification for MCP endpoint
servers:
  - url: https://api.trugen.ai/v1
security: []
paths:
  /ext/guardrail/{id}:
    put:
      summary: Update Guardrail
      description: >-
        Replaces an existing guardrail's configuration by its unique ID. This is
        a full replace of every client-settable field, not a partial patch.
        `key` is never changed by an update, even if `name` changes.
      operationId: updateGuardrailById
      parameters:
        - name: id
          in: path
          required: true
          description: The UUID of the guardrail
          schema:
            type: string
            format: uuid
            example: dfbaa3c6-1e90-43df-869a-b023896a198c
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: >-
                    Human-readable label. Also used to derive the permanent
                    `key` used at runtime (lowercased, punctuation replaced with
                    underscores, deduplicated with a numeric suffix on
                    collision).
                  example: Hate Speech Filter
                category:
                  type: string
                  description: >-
                    Free-text tag for grouping guardrails. No fixed list - any
                    string is accepted, including an empty one.
                  example: Content Safety
                prompt:
                  type: string
                  description: >-
                    The rule text the agent's LLM evaluates a user's message
                    against to decide whether this guardrail applies.
                  example: >-
                    Trigger when the user uses hateful, discriminatory, or
                    abusive language toward a person or group.
                response_message:
                  type: string
                  description: >-
                    Spoken to the user verbatim when this guardrail fires. If
                    omitted, the guardrail falls back to a moderation-endpoint
                    check instead of a canned response.
                  example: >-
                    I'm sorry, but I can't help with that. Let's keep things
                    respectful.
                callback_url:
                  type: string
                  format: uri
                  description: >-
                    Where a `guardrail_triggered` event is POSTed when this
                    guardrail fires. Must be a well-formed http(s):// URL if
                    present. Delivery is fire-and-forget - no retries.
                  example: https://yourapp.com/webhooks/guardrail
                is_active:
                  type: boolean
                  default: true
                  description: >-
                    Set to false to exclude this guardrail from live
                    conversations without deleting it.
              required:
                - name
                - prompt
            example:
              name: Hate Speech Filter
              category: Content Safety
              prompt: Updated prompt text.
              response_message: Let's keep things respectful.
              callback_url: ''
              is_active: false
      responses:
        '200':
          description: Guardrail updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    example: dfbaa3c6-1e90-43df-869a-b023896a198c
                  message:
                    type: string
                    example: Guardrail updated
                required:
                  - id
                  - message
        '400':
          description: Invalid request body
        '401':
          description: Unauthorized - missing or invalid API key
        '404':
          description: Guardrail not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
              example:
                message: Guardrail not found
        '500':
          description: Internal server error
      security:
        - apiKeyAuth: []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````