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

# Update Project Guardrails

> Replace the guardrail config for one of the caller's projects.



## OpenAPI

````yaml /api-reference/openapi-developer.json put /api/v1/projects/{project_id}/guardrails
openapi: 3.1.0
info:
  title: PromptGuard Developer API
  description: >-
    Public API for developers to integrate PromptGuard security into their
    applications
  version: 1.0.0
servers:
  - url: https://api.promptguard.co
    description: Production
security:
  - ApiKeyAuth: []
paths:
  /api/v1/projects/{project_id}/guardrails:
    put:
      tags:
        - guardrails
      summary: Update Project Guardrails
      description: Replace the guardrail config for one of the caller's projects.
      operationId: update_project_guardrails_api_v1_projects__project_id__guardrails_put
      parameters:
        - name: project_id
          in: path
          required: true
          schema:
            type: string
            title: Project Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GuardrailsUpdateRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GuardrailsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    GuardrailsUpdateRequest:
      properties:
        guardrails:
          $ref: '#/components/schemas/GuardrailsConfig'
      type: object
      required:
        - guardrails
      title: GuardrailsUpdateRequest
    GuardrailsResponse:
      properties:
        guardrails:
          $ref: '#/components/schemas/GuardrailsConfig'
      type: object
      required:
        - guardrails
      title: GuardrailsResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GuardrailsConfig:
      properties:
        prompt_injection:
          $ref: '#/components/schemas/LevelConfig'
        pii_detection:
          $ref: '#/components/schemas/PIIDetectionConfig'
        toxicity:
          $ref: '#/components/schemas/ToxicityConfig'
        data_exfiltration:
          $ref: '#/components/schemas/LevelConfig'
        secret_key_detection:
          $ref: '#/components/schemas/LevelConfig'
        url_filtering:
          $ref: '#/components/schemas/ToggleOnlyConfig'
        fraud_detection:
          $ref: '#/components/schemas/ToggleOnlyConfig'
        malware_detection:
          $ref: '#/components/schemas/ToggleOnlyConfig'
        jailbreak_detection:
          $ref: '#/components/schemas/ToggleOnlyConfig'
        tool_injection:
          $ref: '#/components/schemas/ToggleOnlyConfig'
        hallucination:
          $ref: '#/components/schemas/HallucinationConfig'
        mcp_security:
          $ref: '#/components/schemas/MCPSecurityConfig'
      type: object
      title: GuardrailsConfig
      description: Full per-guardrail configuration for a project.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    LevelConfig:
      properties:
        enabled:
          type: boolean
          title: Enabled
          default: true
        level:
          type: string
          enum:
            - strict
            - moderate
            - permissive
          title: Level
          default: moderate
      type: object
      title: LevelConfig
      description: Guardrail with a strict/moderate/permissive sensitivity level.
    PIIDetectionConfig:
      properties:
        enabled:
          type: boolean
          title: Enabled
          default: true
        level:
          type: string
          enum:
            - strict
            - moderate
            - permissive
          title: Level
          default: moderate
        mode:
          type: string
          enum:
            - redact
            - mask
            - block
          title: Mode
          default: redact
        entities:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Entities
      type: object
      title: PIIDetectionConfig
    ToxicityConfig:
      properties:
        enabled:
          type: boolean
          title: Enabled
          default: true
        threshold:
          type: number
          maximum: 1
          minimum: 0
          title: Threshold
          default: 0.7
        categories:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Categories
      type: object
      title: ToxicityConfig
    ToggleOnlyConfig:
      properties:
        enabled:
          type: boolean
          title: Enabled
          default: true
      type: object
      title: ToggleOnlyConfig
    HallucinationConfig:
      properties:
        enabled:
          type: boolean
          title: Enabled
          default: true
        action:
          type: string
          enum:
            - metadata
            - flag
            - block
          title: Action
          default: metadata
        block_threshold:
          type: number
          maximum: 1
          minimum: 0
          title: Block Threshold
          default: 0.6
      type: object
      title: HallucinationConfig
    MCPSecurityConfig:
      properties:
        enabled:
          type: boolean
          title: Enabled
          default: false
        server_allowlist:
          items:
            type: string
          type: array
          title: Server Allowlist
        server_blocklist:
          items:
            type: string
          type: array
          title: Server Blocklist
        enforce_schema_validation:
          type: boolean
          title: Enforce Schema Validation
          default: true
        max_argument_size_bytes:
          type: integer
          maximum: 1000000
          minimum: 100
          title: Max Argument Size Bytes
          default: 10000
      type: object
      title: MCPSecurityConfig
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        PromptGuard API key for developer endpoints. Keys start with pg_live_
        and are created in the dashboard.

````