openapi: 3.0.3
info:
  title: RAI Policy API
  version: 1.0.0
  description: API for managing RAI policies.
servers:
  - url: https://rai-prod.studio.lyzr.ai
paths:
  /v1/rai/policies:
    post:
      summary: Create Policy
      description: Create a new RAI policy.
      operationId: createPolicy
      tags:
        - RAI
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                description:
                  type: string
                allowed_topics:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    topics:
                      type: array
                      items:
                        type: string
                banned_topics:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    topics:
                      type: array
                      items:
                        type: string
                keywords:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    keywords:
                      type: array
                      items:
                        type: string
                toxicity_check:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    threshold:
                      type: number
                prompt_injection:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    threshold:
                      type: number
                secrets_detection:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    action:
                      type: string
                pii_detection:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    types:
                      type: object
                      additionalProperties:
                        type: string
                    custom_pii:
                      type: array
                      items:
                        type: object
                        properties:
                          label:
                            type: string
                          replacement:
                            type: string
                          action:
                            type: string
                user_id:
                  type: string
                created_at:
                  type: string
                  format: date-time
                updated_at:
                  type: string
                  format: date-time
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  _id:
                    type: string
                  name:
                    type: string
                  description:
                    type: string
                  allowed_topics:
                    type: object
                    properties:
                      enabled:
                        type: boolean
                      topics:
                        type: array
                        items:
                          type: string
                  banned_topics:
                    type: object
                    properties:
                      enabled:
                        type: boolean
                      topics:
                        type: array
                        items:
                          type: string
                  keywords:
                    type: object
                    properties:
                      enabled:
                        type: boolean
                      keywords:
                        type: array
                        items:
                          type: string
                  toxicity_check:
                    type: object
                    properties:
                      enabled:
                        type: boolean
                      threshold:
                        type: number
                  prompt_injection:
                    type: object
                    properties:
                      enabled:
                        type: boolean
                      threshold:
                        type: number
                  secrets_detection:
                    type: object
                    properties:
                      enabled:
                        type: boolean
                      action:
                        type: string
                  pii_detection:
                    type: object
                    properties:
                      enabled:
                        type: boolean
                      types:
                        type: object
                        additionalProperties:
                          type: string
                      custom_pii:
                        type: array
                        items:
                          type: object
                          properties:
                            label:
                              type: string
                            replacement:
                              type: string
                            action:
                              type: string
                  user_id:
                    type: string
                  created_at:
                    type: string
                    format: date-time
                  updated_at:
                    type: string
                    format: date-time
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  detail:
                    type: array
                    items:
                      type: object
                      properties:
                        loc:
                          type: array
                          items:
                            type: string
                        msg:
                          type: string
                        type:
                          type: string
      security:
        - ApiKeyAuth: []
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
