openapi: 3.0.0
paths:
  /user:
    get:
      operationId: UsersController_getCurrentUser
      summary: Get current user
      description: Get the currently authenticated user
      parameters: []
      responses:
        '200':
          description: Current user retrieved successfully
      tags: &ref_0
        - Users
    post:
      operationId: UsersController_createUser
      summary: Create user
      description: Create a new user
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateUserDto'
      responses:
        '201':
          description: User created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreatedUserResponseDto'
      tags: *ref_0
  /user/keycloak:
    get:
      operationId: UsersController_getCurrentUserWithKeycloakInfo
      summary: Get current user with Keycloak info
      description: Get the currently authenticated user with Keycloak information
      parameters: []
      responses:
        '200':
          description: Current user with Keycloak info retrieved successfully
      tags: *ref_0
  /user/reset-password/non-onboarded-user:
    post:
      operationId: UsersController_resetPasswordOfNonOnboardedUser
      summary: Reset password for non-onboarded user
      description: Reset the password for a user who has not completed onboarding
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResetPasswordNonOnboardedUserDto'
      responses:
        '201':
          description: Password reset successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ResetPasswordNonOnboardedUserResponseDto'
      tags: *ref_0
  /user/reset-password/onboarded-user:
    post:
      operationId: UsersController_resetPasswordOfOnboardedUser
      summary: Reset password for onboarded user
      description: Reset the password for a user who has completed onboarding
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResetPasswordOnboardedUserDto'
      responses:
        '201':
          description: Password reset successfully
      tags: *ref_0
  /user/all:
    get:
      operationId: UsersController_getAllUsers
      summary: Get all users
      description: Get all users with optional filtering and organization level roles
      parameters:
        - name: includeOrgLevelRoles
          required: false
          in: query
          description: Include organization level roles in the response
          schema:
            type: boolean
        - name: search
          required: false
          in: query
          description: Search term to filter users
          schema:
            type: string
      responses:
        '200':
          description: Users retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AllUsersDto'
      tags: *ref_0
  /user/{id}/role/org-level:
    put:
      operationId: UsersController_updateOrgLevelRole
      summary: Update organization level role
      description: Update the organization level roles for a user
      parameters:
        - name: id
          required: true
          in: path
          description: User ID
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOrgLevelRoleDto'
      responses:
        '200':
          description: Organization level role updated successfully
      tags: *ref_0
  /user/{id}:
    delete:
      operationId: UsersController_deleteUser
      summary: Delete user
      description: Delete a user by ID
      parameters:
        - name: id
          required: true
          in: path
          description: User ID to delete
          schema:
            type: string
      responses:
        '200':
          description: User deleted successfully
        '400':
          description: Cannot delete self
      tags: *ref_0
  /user/scopes/org-level:
    get:
      operationId: UsersController_getCurrentUserOrgLevelScopes
      summary: Get current user organization level scopes
      description: Get the organization level scopes for the currently authenticated user
      parameters: []
      responses:
        '200':
          description: Organization level scopes retrieved successfully
      tags: *ref_0
  /user/terms-consent-status:
    get:
      operationId: UsersController_getCurrentUserTermsConsentStatus
      summary: Get current user terms consent status
      description: Get the terms and consent status for the currently authenticated user
      parameters: []
      responses:
        '200':
          description: Terms consent status retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TermsConsentStatusResponse'
      tags: *ref_0
  /user/update-terms-consent:
    patch:
      operationId: UsersController_updateCurrentUserTermsConsent
      summary: Update current user terms consent
      description: Update the terms and consent status for the currently authenticated user
      parameters: []
      requestBody:
        required: true
        description: Array of terms consent updates
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/UpdateUserTermsConsentDto'
      responses:
        '200':
          description: Terms consent updated successfully
      tags: *ref_0
  /user/token:
    post:
      operationId: UsersController_createToken
      summary: Create API token
      description: Create an API token for the currently authenticated user
      parameters: []
      responses:
        '201':
          description: API token created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  apiKey:
                    type: string
                    description: The generated API key
      tags: *ref_0
  /user/setup:
    post:
      operationId: UsersController_setupUser
      summary: Setup user
      description: Setup a user by ID with configuration, policies, and models
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetupUserTargetDto'
      responses:
        '201':
          description: User setup completed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SetupUserResponseDto'
      tags: *ref_0
  /terms-consents:
    get:
      operationId: TermsConsentController_getAllTermsConsents
      summary: Get all terms consents
      description: Get all terms consents
      parameters: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ReturnTermsConsentsDto'
      tags:
        - DynamoAI Terms Consents
  /moderation/analyze:
    post:
      operationId: ModerationController_analyzeText
      summary: Apply policies on messages
      parameters:
        - name: X-Num-Tokens
          in: header
          description: Number of tokens analyzed by policies
          schema:
            type: string
        - name: Warning
          in: header
          description: Warning displayed about tokens being not analyzed due to length
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalyzeDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnAnalyzeDto'
        '500':
          description: Error occured
      tags:
        - DynamoGuard Analyze
  /moderation/model/{modelId}/logs:
    get:
      operationId: ModerationController_getLogs
      summary: Get Logs
      description: >-
        Retrieve logs from chat and analyze interactions. Narrow search down by
        using the query filters.
      parameters:
        - name: modelId
          required: true
          in: path
          schema:
            type: string
        - name: startTime
          required: false
          in: query
          description: The start time (in UTC seconds) to filter by
          schema:
            type: number
        - name: endTime
          required: false
          in: query
          description: The end time (in UTC seconds) to filter by
          schema:
            type: number
        - name: pageNum
          required: false
          in: query
          description: The page number
          schema:
            default: 1
            type: number
        - name: perPage
          required: false
          in: query
          description: The number of results per page
          schema:
            default: 50
            type: number
        - name: sortDir
          required: false
          in: query
          description: The direction to sort results by.
          schema:
            default: desc
            enum:
              - asc
              - desc
            type: string
        - name: policyId
          required: false
          in: query
          description: The policy id to filter by
          schema:
            type: string
        - name: policyType
          required: false
          in: query
          description: The policy type to filter by
          schema:
            enum:
              - PII
              - TOXICITY
              - ALIGNMENT
              - HALLUCINATION
              - RAG_HALLUCINATION
              - INPUT_RELEVANCE
              - RESPONSE_RELEVANCE
              - OOB_HALLUCINATION
              - KEYWORD
            type: string
        - name: actions
          required: false
          in: query
          description: List of actions to filter by
          schema:
            type: array
            items:
              type: string
        - name: textType
          required: false
          in: query
          description: The text type to filter by
          schema:
            enum:
              - MODEL_INPUT
              - MODEL_RESPONSE
            type: string
        - name: action
          required: false
          in: query
          description: The policy action to filter by
          schema:
            enum:
              - BLOCK
              - WARN
              - REDACT
              - SANITIZE
              - NONE
            type: string
        - name: clientId
          required: false
          in: query
          description: The client id to filter by
          schema:
            type: string
        - name: userId
          required: false
          in: query
          description: The user id to filter by
          schema:
            type: string
        - name: policyTypes
          required: false
          in: query
          description: List of policy types to filter by
          schema:
            type: array
            items:
              type: string
        - name: metadata
          required: false
          in: query
          description: User-defined log metadata to filter by. Should be a json string
          schema:
            example: >-
              {origin: {platform: "chatgpt.com", browser: "Chrome"}, version:
              "3.16"}
            type: string
        - name: isMultiturn
          required: false
          in: query
          description: >-
            Filter by multiturn status (true for multiturn, false for
            single-turn including historical logs)
          schema:
            type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FullReturnLogDto'
      tags:
        - DynamoGuard Logs
  /moderation/model/{modelId}/logs/count:
    get:
      operationId: ModerationController_getLogsCount
      summary: Get Count of Logs
      description: >-
        Retrieve number of log entries from chat and analyze interactions.
        Narrow search down by using the query filters.
      parameters:
        - name: modelId
          required: true
          in: path
          schema:
            type: string
        - name: startTime
          required: false
          in: query
          description: The start time (in UTC seconds) to filter by
          schema:
            type: number
        - name: endTime
          required: false
          in: query
          description: The end time (in UTC seconds) to filter by
          schema:
            type: number
        - name: policyId
          required: false
          in: query
          description: The policy id to filter by
          schema:
            type: string
        - name: policyType
          required: false
          in: query
          description: The policy type to filter by
          schema:
            enum:
              - PII
              - TOXICITY
              - ALIGNMENT
              - HALLUCINATION
              - RAG_HALLUCINATION
              - INPUT_RELEVANCE
              - RESPONSE_RELEVANCE
              - OOB_HALLUCINATION
              - KEYWORD
            type: string
        - name: actions
          required: false
          in: query
          description: List of actions to filter by
          schema:
            type: array
            items:
              type: string
        - name: textType
          required: false
          in: query
          description: The text type to filter by
          schema:
            enum:
              - MODEL_INPUT
              - MODEL_RESPONSE
            type: string
        - name: action
          required: false
          in: query
          description: The policy action to filter by
          schema:
            enum:
              - BLOCK
              - WARN
              - REDACT
              - SANITIZE
              - NONE
            type: string
        - name: clientId
          required: false
          in: query
          description: The client id to filter by
          schema:
            type: string
        - name: userId
          required: false
          in: query
          description: The user id to filter by
          schema:
            type: string
        - name: policyTypes
          required: false
          in: query
          description: List of policy types to filter by
          schema:
            type: array
            items:
              type: string
        - name: metadata
          required: false
          in: query
          description: User-defined log metadata to filter by. Should be a json string
          schema:
            example: >-
              {origin: {platform: "chatgpt.com", browser: "Chrome"}, version:
              "3.16"}
            type: string
        - name: isMultiturn
          required: false
          in: query
          description: >-
            Filter by multiturn status (true for multiturn, false for
            single-turn including historical logs)
          schema:
            type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: number
      tags:
        - DynamoGuard Logs
  /moderation/model/{modelId}/logs/metadata-fields:
    get:
      operationId: ModerationController_getMetadataFields
      summary: Get unique metadata fields
      description: >-
        Return the complete set of unique metadata fields observed for this
        model across its lifetime.
      parameters:
        - name: modelId
          required: true
          in: path
          description: The AI System (model) id
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MetadataFieldsResponseDto'
      tags:
        - DynamoGuard Logs
  /moderation/ai-systems/has-multiturn-logs:
    get:
      operationId: ModerationController_hasMultiturnLogs
      summary: Check if AI systems have multiturn logs
      description: >-
        Returns whether any of the specified AI systems have logged multiturn
        interactions
      parameters:
        - name: aiSystemIds
          required: false
          in: query
          description: Array of AI System IDs to check for multiturn logs
          schema:
            example:
              - 507f1f77bcf86cd799439011
              - 507f1f77bcf86cd799439012
            type: array
            items:
              type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HasMultiturnLogsResponseDto'
      tags:
        - DynamoGuard Logs
  /moderation/model/{modelId}/stats:
    get:
      operationId: ModerationController_getStats
      summary: Get stats
      description: >-
        Retrieve dashboard metrics. Narrow search down by using the query
        filters. At least one of modelId, clientId, or userId must be specified.
      parameters:
        - name: modelId
          required: true
          in: path
          schema:
            type: string
        - name: startTime
          required: false
          in: query
          description: The start time to filter by
          schema:
            type: number
        - name: endTime
          required: false
          in: query
          description: The end time to filter by
          schema:
            type: number
        - name: numDataPoints
          required: false
          in: query
          description: >-
            Number of data points to discretize time period. Must be greater
            than 1.
          schema:
            default: 2
            type: number
        - name: clientId
          required: false
          in: query
          description: The client id to filter by
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnStatsDto'
      tags:
        - DynamoGuard Stats
  /moderation/model/{modelId}/chat/{session_id}:
    post:
      operationId: ModerationController_chat
      summary: Guardrailed Chat
      description: >-
        Apply policies to messages and send non-violating prompts to LLM. Routes
        messages to the LLM behind modelId. Blocks/modifies prompt/response as
        policies dictate
      parameters:
        - name: modelId
          required: true
          in: path
          schema:
            type: string
        - name: session_id
          required: true
          in: path
          description: Session id to link chat messages to
          schema:
            type: string
        - name: X-Num-Tokens
          in: header
          description: Number of tokens analyzed by policies
          schema:
            type: string
        - name: Warning
          in: header
          description: Warning displayed about tokens being not analyzed due to length
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ChatDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FullReturnChatDto'
      tags:
        - DynamoGuard Chat
  /moderation/model/{id}/policies:
    put:
      operationId: ModerationController_updateModelPolicies
      summary: Update policies applied to a model
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateModelPoliciesDto'
      responses:
        '200':
          description: ''
      tags:
        - DynamoGuard Policy
  /moderation/generate-behaviors:
    post:
      operationId: ModerationController_generatePolicyBehaviors
      summary: Generate behaviors for policy
      description: Generates allowed and disallowed behaviors for an alignment policy
      parameters:
        - name: id
          required: true
          in: path
          description: Policy id to generate behaviors for
          schema: {}
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GenerateBehaviorsDto'
      responses:
        '200':
          description: Allowed and disallowed behaviors generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenerateBehaviorsReturnDto'
      tags:
        - DynamoGuard Policy
  /moderation/user/email/{userEmail}/logs:
    get:
      operationId: ModerationController_getLogsByUserEmailAndTimeRange
      summary: Get Logs by User Email and Time Range
      description: >-
        Retrieve logs for a specific user within a given time range. The maximum
        allowed time range is 1 month (30 Days).
      parameters:
        - name: userEmail
          required: true
          in: path
          schema:
            type: string
        - name: startTime
          required: true
          in: query
          schema:
            type: number
        - name: endTime
          required: true
          in: query
          schema:
            type: number
        - name: sortDir
          required: true
          in: query
          schema:
            type: string
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LogsByUserEmailAndTimeRangeResponseDto'
      tags:
        - DynamoGuard Logs
  /moderation/policy:
    post:
      operationId: PolicyController_createPolicy
      summary: Create policy
      description: |-
        Creates a policy on DynamoGuard. 
                    Each policy uses methodParams as arguments for the underlying policy and 
                    decisionParams to determine the action to take based on the policy result.
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePolicyDto'
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnPolicyDto'
        '400':
          description: Either a rate limit was hit or policy failed validation
        '500':
          description: Policy fields failed validation
      tags:
        - DynamoGuard Policy
    get:
      operationId: PolicyController_getAllPolicies
      summary: Get all policies
      description: >-
        Retrieves all policies a user made. If modelId is specified, attaches
        policy statuses as well
      parameters:
        - name: policyType
          required: false
          in: query
          description: Policy type to filter on
          schema:
            enum:
              - PII
              - TOXICITY
              - ALIGNMENT
              - HALLUCINATION
              - RAG_HALLUCINATION
              - INPUT_RELEVANCE
              - RESPONSE_RELEVANCE
              - OOB_HALLUCINATION
              - KEYWORD
            type: string
        - name: modelId
          required: false
          in: query
          description: If specified, attaches policy status in relation to the modelId
          schema:
            type: string
        - name: expand
          required: false
          in: query
          description: 'If true, attaches dataset info. Only available for content policies '
          schema:
            type: boolean
        - name: attachModels
          required: false
          in: query
          description: If specified, attaches models policy is applied to
          schema:
            type: boolean
        - name: inferred
          required: false
          in: query
          description: >-
            If true, returns inferred policy fields instead of the original
            policy
          schema:
            type: boolean
        - name: filterDeprecatedPolicies
          required: false
          in: query
          description: If true, filters out deprecated policies
          schema:
            type: boolean
        - name: page
          required: true
          in: query
          schema:
            type: number
        - name: limit
          required: true
          in: query
          schema:
            type: number
        - name: includeAllowedScopes
          required: true
          in: query
          schema:
            type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AllAugmentedReturnPoliciesDto'
      tags:
        - DynamoGuard Policy
  /moderation/policy/creation-limit:
    get:
      operationId: PolicyController_getPolicyCreationLimit
      summary: Check if policy creation limit(s) reached
      parameters: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PolicyCreationLimitDto'
      tags:
        - DynamoGuard Policy
  /moderation/policy/resource-level-roles:
    get:
      operationId: PolicyController_getPolicyResourceLevelRoles
      summary: Get policy resource level roles
      parameters: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/RoleResponseDto'
      tags:
        - DynamoGuard Policy
  /moderation/policy/{id}/inferred:
    put:
      operationId: PolicyController_updateInferredPolicy
      summary: Update inferred policy
      description: Updates only the inferred policy fields for ALIGNMENT type policies.
      parameters:
        - name: id
          required: true
          in: path
          description: Policy id to update
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateInferredPolicyDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnPolicyDto'
        '400':
          description: Policy failed validation
        '500':
          description: Policy fields failed validation
      tags:
        - DynamoGuard Policy
  /moderation/policy/{id}:
    put:
      operationId: PolicyController_updatePolicy
      summary: 'Update policy '
      description: >-
        Updates the base policy fields for all types of policies. Also updates
        the inferred policy fields for ALIGNMENT type policies.
      parameters:
        - name: id
          required: true
          in: path
          description: Policy id to update
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePolicyDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnPolicyDto'
        '400':
          description: Policy failed validation
        '500':
          description: Policy fields failed validation
      tags:
        - DynamoGuard Policy
    get:
      operationId: PolicyController_getPolicy
      summary: Get policy
      description: Use query params to add additional information
      parameters:
        - name: id
          required: true
          in: path
          description: Policy id to retrieve
          schema:
            type: string
        - name: expand
          required: false
          in: query
          description: 'If true, attaches dataset info. Only available for content policies '
          schema:
            type: boolean
        - name: modelId
          required: false
          in: query
          description: >-
            If specified, attaches policy status in reference to the given
            model. Also filters policy stats.
          schema:
            type: string
        - name: promptId
          required: false
          in: query
          description: If specified, attaches feedback for the prompt
          schema:
            type: string
        - name: attachModels
          required: false
          in: query
          description: If specified, attaches models policy is applied to
          schema:
            type: boolean
        - name: inferred
          required: false
          in: query
          description: >-
            If true, returns inferred policy fields instead of the orignal
            policy
          schema:
            type: boolean
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AugmentedReturnPolicyDto'
      tags:
        - DynamoGuard Policy
    delete:
      operationId: PolicyController_deletePolicy
      summary: Delete policy
      parameters:
        - name: id
          required: true
          in: path
          description: Policy id to delete
          schema:
            type: string
      responses:
        '200':
          description: >-
            Policy deleted successfully. Returns list of any resources that
            failed to clean up.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeletePolicyResponseDto'
        '404':
          description: Policy not found
      tags:
        - DynamoGuard Policy
  /moderation/policy/{id}/behaviors:
    post:
      operationId: PolicyController_addPolicyBehaviors
      summary: Add behaviors to policy
      description: Appends allowed and disallowed behaviors to an existing alignment policy
      parameters:
        - name: id
          required: true
          in: path
          description: Policy id to add behaviors to
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddPolicyBehaviorsDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnPolicyDto'
        '400':
          description: Behaviors can only be added to alignment policies
        '404':
          description: Policy not found
      tags:
        - DynamoGuard Policy
  /moderation/policy/{id}/generate-behaviors:
    post:
      operationId: PolicyController_generateBehaviors
      summary: Generate behaviors for policy
      description: >-
        Automatically generates allowed and disallowed behaviors for an
        alignment policy
      parameters:
        - name: id
          required: true
          in: path
          description: Policy id to generate behaviors for
          schema:
            type: string
      responses:
        '204':
          description: Behavior generation job started successfully
        '400':
          description: Behaviors can only be generated for alignment policies
        '404':
          description: Policy not found
      tags:
        - DynamoGuard Policy
  /moderation/policy/{id}/models:
    put:
      operationId: PolicyController_updatePolicyModels
      summary: Add/remove policy to/from models
      parameters:
        - name: id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePolicyModelsDto'
      responses:
        '200':
          description: ''
      tags:
        - DynamoGuard Policy
  /moderation/policy/{id}/share/collaborator:
    put:
      operationId: PolicyController_sharePolicyWithCollaboratorAtMultipleRoles
      summary: Add collaborator with multiple roles
      parameters:
        - name: id
          required: true
          in: path
          description: Policy id to add collaborator to
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollaboratorWithMultipleRolesDto'
      responses:
        '200':
          description: ''
      tags:
        - DynamoGuard Policy
    delete:
      operationId: PolicyController_sharePolicyRemoveUser
      summary: Remove Collaborator from the policy
      parameters:
        - name: id
          required: true
          in: path
          description: Policy id to remove Collaborator from
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollaboratorDto'
      responses:
        '200':
          description: ''
      tags:
        - DynamoGuard Policy
  /moderation/policy/{id}/share/public:
    put:
      operationId: PolicyController_sharePolicyPublicAccess
      summary: Update public access of the policy
      parameters:
        - name: id
          required: true
          in: path
          description: Policy id to update the public access for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResourcePublicAccessDto'
      responses:
        '200':
          description: ''
      tags:
        - DynamoGuard Policy
  /moderation/policy/{_id}/scopes:
    get:
      operationId: PolicyController_getCurrentUserPolicyScopes
      summary: Get Policy Resource level scopes
      description: Get the resource level scopes associated with the policy for the user
      parameters:
        - name: _id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: ''
      tags:
        - Policy
  /moderation/policy/{_id}/access:
    get:
      operationId: PolicyController_getPolicyAccess
      summary: Get the resource level access of policy
      description: Get the resource level access of the policy
      parameters:
        - name: _id
          required: true
          in: path
          schema:
            type: string
      responses:
        '201':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ShareResourceDto'
        '400':
          description: Policy does not exist
        '403':
          description: User does not have get access permission on the policy
        '500':
          description: Get Access unknown error
      tags:
        - Policy
  /moderation/policy/domain/usecase:
    post:
      operationId: PolicyController_addUseCase
      summary: Add Usecase
      description: Add a usecase
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddUseCaseDto'
      responses:
        '201':
          description: Usecase added successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetUsecaseReturnDto'
      tags:
        - DynamoGuard Policy
    get:
      operationId: PolicyController_getUseCases
      summary: Get All Usecases
      description: Get all usecases
      parameters: []
      responses:
        '200':
          description: All usecases retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GetUsecaseReturnDto'
      tags:
        - DynamoGuard Policy
  /moderation/policy/domain/usecase/{id}:
    put:
      operationId: PolicyController_updateUsecase
      summary: Update Usecase
      description: Update a usecase
      parameters:
        - name: id
          required: true
          in: path
          description: Usecase id to update
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddUseCaseDto'
      responses:
        '200':
          description: Usecase updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetUsecaseReturnDto'
      tags:
        - DynamoGuard Policy
    get:
      operationId: PolicyController_getUsecase
      summary: Get Usecase
      description: Get a usecase by id
      parameters:
        - name: id
          required: true
          in: path
          description: Usecase id to get
          schema:
            type: string
      responses:
        '200':
          description: Usecase retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetUsecaseReturnDto'
      tags:
        - DynamoGuard Policy
    delete:
      operationId: PolicyController_deleteUsecase
      summary: Delete Usecase
      description: Delete a usecase
      parameters:
        - name: id
          required: true
          in: path
          description: Usecase id to delete
          schema:
            type: string
      responses:
        '204':
          description: Usecase deleted successfully
      tags:
        - DynamoGuard Policy
  /moderation/policy/domain/usecase/any/{id}:
    get:
      operationId: PolicyController_getAnyUsecase
      summary: Get Any Usecase
      description: Get a usecase by id
      parameters:
        - name: id
          required: true
          in: path
          description: Usecase id to get
          schema:
            type: string
      responses:
        '200':
          description: Usecase retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetUsecaseReturnDto'
      tags:
        - DynamoGuard Policy
  /moderation/policy/{id}/update-threshold:
    put:
      operationId: PolicyController_updatePolicyDecisionParameters
      summary: Add decision parameters to policy
      description: >-
        Adds or updates decision parameters for a policy, starting with
        threshold configuration
      parameters:
        - name: id
          required: true
          in: path
          description: Policy id to update decision parameters
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdatePolicyDecisionParamsDto'
      responses:
        '200':
          description: ''
      tags:
        - DynamoGuard Policy
  /guardrail-dataset/{policyId}:
    patch:
      operationId: GuardrailDatasetController_updateGuardrailDataset
      summary: Update guardrail dataset
      description: Updates the configuration of a guardrail dataset
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to update dataset for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateGuardrailDatasetDto'
      responses:
        '200':
          description: Dataset updated successfully
        '404':
          description: Guardrail dataset for given policyId not found.
      tags: &ref_1
        - Guardrail Dataset
    get:
      operationId: GuardrailDatasetController_getGuardrailDataset
      summary: Get guardrail dataset
      description: Retrieves a guardrail dataset and all its metadata by policy ID
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to get dataset for
          schema:
            type: string
        - name: page
          required: false
          in: query
          description: Page number for pagination (starting from 1)
          schema:
            default: 1
            type: number
        - name: limit
          required: false
          in: query
          description: >-
            Number of items per page. Takes default value of 300 if not
            specified. Maximum limit is 500
          schema:
            default: 300
            type: number
        - name: includeDataset
          required: false
          in: query
          description: Whether to include the dataset in the response
          schema:
            default: true
            type: boolean
        - name: populateCreatorEmails
          required: false
          in: query
          description: Whether to populate creator emails in the response
          schema:
            default: true
            type: boolean
      responses:
        '200':
          description: Dataset retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnGuardrailDatasetDto'
        '400':
          description: Invalid pagination parameters
        '404':
          description: Guardrail dataset does not exist for given policyId.
      tags: *ref_1
  /guardrail-dataset/input/{policyId}:
    post:
      operationId: GuardrailDatasetController_createInputGuardrailDataset
      summary: Create input guardrail dataset
      description: Creates a new input guardrail dataset for a policy
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to create dataset for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGuardrailDatasetDto'
      responses:
        '201':
          description: Dataset created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnGuardrailDatasetDto'
        '400':
          description: A guardrail dataset for policyId already exists.
        '404':
          description: Policy not found.
      tags: *ref_1
  /guardrail-dataset/output/{policyId}:
    post:
      operationId: GuardrailDatasetController_createOutputGuardrailDataset
      summary: Create output guardrail dataset
      description: Creates a new output guardrail dataset for a policy
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to create dataset for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGuardrailDatasetDto'
      responses:
        '201':
          description: Dataset created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnGuardrailDatasetDto'
        '400':
          description: A guardrail dataset for policyId already exists.
        '404':
          description: Policy not found.
      tags: *ref_1
  /guardrail-dataset/input/{policyId}/review:
    post:
      operationId: GuardrailDatasetController_reviewInputGuardrailDataset
      summary: Review input guardrail dataset
      description: Reviews and updates an input guardrail dataset
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to review dataset for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateInputGuardrailDatasetDto'
      responses:
        '200':
          description: Review successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnGuardrailDatasetDto'
        '404':
          description: Guardrail dataset does not exist for given policyId.
      tags: *ref_1
  /guardrail-dataset/output/{policyId}/review:
    post:
      operationId: GuardrailDatasetController_reviewOutputGuardrailDataset
      summary: Review output guardrail dataset
      description: Reviews and updates an output guardrail dataset
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to review dataset for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateOutputGuardrailDatasetDto'
      responses:
        '200':
          description: Review successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnGuardrailDatasetDto'
        '404':
          description: Guardrail dataset does not exist for given policyId.
      tags: *ref_1
  /guardrail-dataset/{policyId}/feedback:
    post:
      operationId: GuardrailDatasetController_feedbackGuardrailDataset
      summary: Feedback guardrail dataset
      description: Provides feedback on a guardrail dataset
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to provide feedback for
          schema:
            type: string
      responses:
        '200':
          description: Feedback provided successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnGuardrailDatasetDto'
        '404':
          description: Guardrail dataset does not exist for given policyId.
      tags: *ref_1
    get:
      operationId: GuardrailDatasetController_getFeedbackGuardrailDataset
      summary: Get feedback guardrail dataset
      description: Retrieves feedback on a guardrail dataset
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to get feedback for
          schema:
            type: string
      responses:
        '200':
          description: Feedback retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FeedbackGuardrailDatasetDto'
      tags: *ref_1
  /guardrail-dataset/{policyId}/feedback/apply:
    post:
      operationId: GuardrailDatasetController_applyGuardrailFeedbackDto
      summary: Apply guardrail feedback
      description: Applies feedback on a guardrail dataset
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to apply feedback for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApplyGuardrailFeedbackDto'
      responses:
        '200':
          description: Feedback applied successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplyGuardrailFeedbackResponseDto'
        '404':
          description: Policy not found.
      tags: *ref_1
  /guardrail-dataset/{policyId}/feedback/reject:
    post:
      operationId: GuardrailDatasetController_rejectGuardrailFeedbackDto
      summary: Get guardrail dataset
      description: Retrieves a guardrail dataset by policy ID
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to get dataset for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RejectGuardrailFeedbackDto'
      responses:
        '200':
          description: Dataset retrieved successfully
        '404':
          description: Guardrail dataset does not exist for given policyId.
      tags: *ref_1
  /guardrail-dataset/{policyId}/get-latest-finetuned-model:
    get:
      operationId: GuardrailDatasetController_getLatestFinetunedModel
      summary: Get latest finetuned model info
      description: Retrieves the latest finetuned model info for a policy
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to get latest finetuned model info for
          schema:
            type: string
      responses:
        '200':
          description: Latest finetuned model info retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetFinetunedModelDto'
        '404':
          description: Policy not found.
      tags: *ref_1
  /guardrail-dataset/fineTunedModelInfo/{modelId}:
    get:
      operationId: GuardrailDatasetController_getFineTunedModelInfo
      summary: Get fine-tuned model info
      description: Retrieves fine-tuned model info by model ID
      parameters:
        - name: modelId
          required: true
          in: path
          description: ID of the fine-tuned model to get info for
          schema:
            type: string
      responses:
        '200':
          description: Fine-tuned model info retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetFineTunedModelInfoDto'
        '404':
          description: Model not found.
      tags: *ref_1
    patch:
      operationId: GuardrailDatasetController_updateAndDeployFineTunedModel
      summary: Update fine-tuned model info
      description: >-
        Updates the fine-tuned model info by model ID (also deploys the model if
        needed)
      parameters:
        - name: modelId
          required: true
          in: path
          description: ID of the fine-tuned model to update info for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateFinetunedModelInfoDto'
      responses:
        '200':
          description: Fine-tuned model info updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetFineTunedModelInfoDto'
        '404':
          description: Model not found.
      tags: *ref_1
  /guardrail-dataset/fineTunedModelInfo/{modelId}/deploymentStatus:
    get:
      operationId: GuardrailDatasetController_getFineTunedModelDeploymentStatus
      summary: Get deployment status of a fine-tuned model
      description: Retrieves the deployment status of a fine-tuned model
      parameters:
        - name: modelId
          required: true
          in: path
          description: ID of the fine-tuned model to get deployment status for
          schema:
            type: string
      responses:
        '200':
          description: Deployment status retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FineTunedModelDeploymentStatusDto'
      tags: *ref_1
  /guardrail-dataset/redeploy/{policyId}:
    patch:
      operationId: GuardrailDatasetController_redeployPolicy
      summary: Redeploy a policy
      description: Attempts to redeploy a policy
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to be redeployed
          schema:
            type: string
      responses:
        '200':
          description: Policy model deployed successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetFineTunedModelInfoDto'
        '400':
          description: Default policy cannot be redeployed.
        '404':
          description: Policy or underlying model not found.
        '500':
          description: >-
            Error redeploying policy- most probably an error with kubernetes
            permission.
      tags: *ref_1
  /guardrail-dataset/{policyId}/config:
    put:
      operationId: GuardrailDatasetController_updateGuardrailConfig
      summary: Update guardrail config
      description: Updates the configuration of a guardrail policy
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to update config for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateGuardrailConfigDto'
      responses:
        '200':
          description: Config updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnGuardrailConfigDto'
        '404':
          description: Policy not found.
      tags: *ref_1
  /guardrail-dataset/{policyId}/dataset:
    post:
      operationId: GuardrailDatasetController_addGeneratedGuardrailDatasetPoints
      summary: Add generated guardrail dataset points
      description: Adds generated guardrail dataset points for a given policy
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to add dataset points for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddGuardrailDatasetPointsDto'
      responses:
        '200':
          description: Points added successfully
        '404':
          description: Policy not found.
      tags: *ref_1
    put:
      operationId: GuardrailDatasetController_updateGuardrailDatasetPoint
      summary: Update guardrail dataset point
      description: Updates a single guardrail dataset point for a given policy
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to update dataset point for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateGuardrailDatasetPointDto'
      responses:
        '200':
          description: Point updated successfully
        '404':
          description: Policy not found.
      tags: *ref_1
    delete:
      operationId: GuardrailDatasetController_deleteGuardrailDatasetPoint
      summary: Delete guardrail dataset points
      description: Deletes guardrail dataset points for a given policy
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to delete dataset points for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteGuardrailDatasetPointsDto'
      responses:
        '200':
          description: Points deleted successfully
        '404':
          description: Policy not found.
      tags: *ref_1
  /guardrail-dataset/{policyId}/dataset/user-defined:
    post:
      operationId: GuardrailDatasetController_addUserDefinedGuardrailDatasetPoint
      summary: Add user-defined guardrail dataset point
      description: Adds a single user-defined guardrail dataset point for a given policy
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to add dataset point for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddUserDefinedGuardrailDatasetPointDto'
      responses:
        '200':
          description: Point added successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddUserDefinedDatapointResponseDto'
        '404':
          description: Policy not found.
      tags: *ref_1
  /guardrail-dataset/{policyId}/pendingChanges:
    get:
      operationId: GuardrailDatasetController_getPendingChanges
      summary: Get pending changes
      description: >-
        Retrieves pending changes for a guardrail dataset, which are the diffs
        that aren't yet trained.
      parameters:
        - name: policyId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: Pending changes retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetPendingChangesResponseDto'
      tags: *ref_1
  /guardrail-dataset/{policyId}/startTraining:
    post:
      operationId: GuardrailDatasetController_startTraining
      summary: Start training
      description: Starts training for a guardrail dataset
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to train
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/StartTrainingDto'
      responses:
        '200':
          description: Training started successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StartTrainingResponseDto'
        '404':
          description: Policy not found.
      tags: *ref_1
  /guardrail-dataset/{policyId}/restartTraining:
    post:
      operationId: GuardrailDatasetController_restartTraining
      summary: Restart training
      description: >-
        Restarts training for a guardrail dataset, marking all AWAITING_TRAINING
        diffs as IN_TRAINING and restarting the training job
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to restart training
          schema:
            type: string
      responses:
        '200':
          description: Training restarted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StartTrainingResponseDto'
        '400':
          description: Latest job is not a training job or is not in a restartable state
        '404':
          description: Policy or guardrail dataset not found
      tags: *ref_1
  /guardrail-dataset/{policyId}/cancelTraining:
    post:
      operationId: GuardrailDatasetController_cancelTraining
      summary: Cancel training
      description: Cancels training for a guardrail dataset
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to cancel training
          schema:
            type: string
      responses:
        '200':
          description: Training cancelled successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelTrainingResponseDto'
      tags: *ref_1
  /guardrail-dataset/{policyId}/cancelDataGeneration:
    post:
      operationId: GuardrailDatasetController_cancelDataGeneration
      summary: Cancel data generation
      description: Cancels data generation for a guardrail dataset
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to cancel data generation for
          schema:
            type: string
      responses:
        '200':
          description: Data generation cancelled successfully
        '400':
          description: Dataset not in data generation stage or no valid job found
        '404':
          description: Policy or guardrail dataset not found
      tags: *ref_1
  /guardrail-dataset/{policyId}/restartDataGeneration:
    post:
      operationId: GuardrailDatasetController_restartDataGeneration
      summary: Restart data generation
      description: >-
        Restarts data generation for a guardrail dataset from scratch,
        discarding all non-user reviewed datapoints
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to restart data generation for
          schema:
            type: string
      responses:
        '200':
          description: Data generation restarted successfully
        '400':
          description: >-
            Latest job is not a data processing job or is not in a restartable
            state
        '404':
          description: Policy or guardrail dataset not found
      tags: *ref_1
  /guardrail-dataset/{policyId}/resumeDataGeneration:
    post:
      operationId: GuardrailDatasetController_resumeDataGeneration
      summary: Resume data generation
      description: >-
        Resumes data generation for a guardrail dataset from where it was
        previously cancelled, failed, or timed out
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to resume data generation for
          schema:
            type: string
      responses:
        '200':
          description: Data generation resumed successfully
        '400':
          description: >-
            Dataset not in correct stage, no resumable job found, or invalid job
            progress
        '404':
          description: Policy or guardrail dataset not found
      tags: *ref_1
  /guardrail-dataset/{policyId}/updateTrainingStatus:
    post:
      operationId: GuardrailDatasetController_updateTrainingStatus
      summary: Update training status
      description: Updates the training status for a guardrail dataset
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to update training status
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateTrainingStatusDto'
      responses:
        '200':
          description: Training status updated successfully
        '404':
          description: Policy not found.
      tags: *ref_1
  /guardrail-dataset/{policyId}/versioning:
    get:
      operationId: GuardrailDatasetController_getVersioningInfo
      summary: Get versioning info
      description: Retrieves versioning info for a guardrail dataset
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to get versioning info
          schema:
            type: string
      responses:
        '200':
          description: Versioning info retrieved successfully
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/GuardrailVersionDto'
      tags: *ref_1
  /guardrail-dataset/{policyId}/restore:
    post:
      operationId: GuardrailDatasetController_restoreVersion
      summary: Restore version
      description: Restores a guardrail dataset to a specific version
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to revert
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/RestoreVersionDto'
      responses:
        '200':
          description: Version reverted successfully
        '404':
          description: Policy not found.
      tags: *ref_1
  /guardrail-dataset/{policyId}/regenerate:
    post:
      operationId: GuardrailDatasetController_regenerateGuardrailDataset
      summary: Regenerate guardrail dataset
      description: Regenerates the guardrail dataset for a policy
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to regenerate dataset
          schema:
            type: string
      responses:
        '200':
          description: Dataset regenerated successfully
        '404':
          description: Guardrail dataset for given policyId not found.
      tags: *ref_1
  /guardrail-dataset/{policyId}/upload:
    post:
      operationId: GuardrailDatasetController_uploadCsv
      summary: Upload CSV dataset
      description: Upload a CSV file to populate the guardrail dataset
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to upload dataset
          schema:
            type: string
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                file:
                  type: string
                  format: binary
                replaceDuplicates:
                  type: boolean
      responses:
        '201':
          description: File uploaded successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadCsvResponseDto'
        '400':
          description: No file uploaded
        '404':
          description: Guardrail dataset for given policyId not found.
      tags: *ref_1
  /guardrail-dataset/{policyId}/augmentDatapoints:
    post:
      operationId: GuardrailDatasetController_augmentDatapoints
      summary: Augment datapoints
      description: >-
        Augments user-provided datapoints to generate additional synthetic
        datapoints (max 100 at a time)
      parameters:
        - name: policyId
          required: true
          in: path
          description: ID of the policy to augment datapoints for
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AugmentDatapointsDto'
      responses:
        '201':
          description: Augmentation job created successfully
        '400':
          description: >-
            Invalid request: policy not in approveReady stage, more than 100
            datapoints, or datapoint IDs do not exist
        '404':
          description: Policy or guardrail dataset not found
      tags: *ref_1
  /in-cluster-models/{deploymentId}/upsert:
    post:
      operationId: InClusterModelController_upsertModel
      summary: Upsert in cluster model
      description: Upsert an in cluster model
      parameters:
        - name: deploymentId
          required: true
          in: path
          description: Deployment id of the in cluster model
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateDeploymentStatusDto'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InClusterModelResponseDto'
      tags: &ref_2
        - DynamoGuard In Cluster Models
  /in-cluster-models:
    get:
      operationId: InClusterModelController_getAllModels
      summary: Get all in cluster models
      description: Get all in cluster models
      parameters: []
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/InClusterModelResponseDto'
      tags: *ref_2
  /in-cluster-models/{deploymentId}:
    get:
      operationId: InClusterModelController_getModel
      summary: Get in cluster model
      description: Get an in cluster model by deployment id
      parameters:
        - name: deploymentId
          required: true
          in: path
          description: Deployment id of the in cluster model
          schema:
            type: string
      responses:
        '200':
          description: In cluster model retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InClusterModelResponseDto'
      tags: *ref_2
    delete:
      operationId: InClusterModelController_deleteModel
      summary: Delete in cluster model
      description: Delete an in cluster model by deployment id
      parameters:
        - name: deploymentId
          required: true
          in: path
          description: Deployment id of the in cluster model
          schema:
            type: string
      responses:
        '204':
          description: In cluster model deleted successfully
      tags: *ref_2
  /health:
    get:
      operationId: HealthController_health
      summary: API Health Endpoint
      description: To check if the api is healthy
      parameters: []
      responses:
        '200':
          description: ''
      tags:
        - Health
  /health/live:
    get:
      operationId: HealthController_live
      summary: API Liveliness Health Status
      description: To check if the DynamoAI API is live
      parameters: []
      responses:
        '200':
          description: ''
      tags:
        - Health
  /health/ready:
    get:
      operationId: HealthController_ready
      summary: DynamoAI API Readiness Health Status
      description: >-
        To check if the DynamoAI API is ready to serve trafiic. The readiness is
        determined by validating critical external dependencies as well
      parameters: []
      responses:
        '200':
          description: ''
      tags:
        - Health
  /health/status:
    get:
      operationId: HealthController_status
      summary: DynamoAI API dependencies health status
      description: To check the health status of the dependencies of DynamoAI API
      parameters: []
      responses:
        '200':
          description: ''
      tags:
        - Health
  /version:
    get:
      operationId: VersionController_version
      summary: API Version Endpoint
      description: To return the api version
      parameters: []
      responses:
        '200':
          description: API version
      tags:
        - Version
  /extension/moderation/domains:
    get:
      operationId: ExtensionController_getDomains
      parameters: []
      responses:
        '200':
          description: Retrieve domains configured by admin to apply guardrails to.
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
      tags:
        - DynamoGuard Extension Get Domains
  /extension/moderation/analyze:
    post:
      operationId: ExtensionController_analyzeText
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ExtensionAnalyzeDto'
      responses:
        '200':
          description: Retrieve domains configured by admin to apply guardrails to.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReturnAnalyzeDto'
      tags:
        - DynamoGuard Analyze
  /applications:
    post:
      operationId: ApplicationController_createApplication
      summary: Create a new application
      description: Create a new application with optional AI systems
      parameters: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApplicationDto'
      responses:
        '201':
          description: Application created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateApplicationResponseDto'
        '400':
          description: Invalid request body
      tags: &ref_3
        - Application
    get:
      operationId: ApplicationController_listApplications
      summary: List applications with pagination
      parameters:
        - name: page
          required: true
          in: query
          schema:
            type: number
        - name: limit
          required: true
          in: query
          schema:
            type: number
        - name: includeAllowedScopes
          required: true
          in: query
          schema:
            type: boolean
        - name: includeModerationPolicies
          required: true
          in: query
          schema:
            type: boolean
        - name: includePolicyCreator
          required: true
          in: query
          schema:
            type: boolean
        - name: includeApplicationCreator
          required: true
          in: query
          schema:
            type: boolean
        - name: includePolicyStatus
          required: true
          in: query
          schema:
            type: boolean
      responses:
        '200':
          description: Applications successfully retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AllApplicationsDto'
        '400':
          description: Invalid query parameters.
        '500':
          description: Internal server error.
      tags: *ref_3
  /applications/{_id}/share/collaborator:
    put:
      operationId: ApplicationController_shareApplicationWithCollaboratorAtMultipleRoles
      summary: Share application with collaborator
      description: Share a application with a collaborator and assign specific roles
      parameters:
        - name: _id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollaboratorWithMultipleRolesDto'
      responses:
        '200':
          description: Application shared successfully
        '400':
          description: Invalid request parameters
        '403':
          description: User does not have edit permission on the application
      tags: *ref_3
    delete:
      operationId: ApplicationController_shareApplicationRemoveUser
      summary: Remove collaborator from application
      description: Remove a collaborator and their associated roles from the application
      parameters:
        - name: _id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CollaboratorDto'
      responses:
        '200':
          description: Collaborator removed successfully
        '400':
          description: Invalid request parameters
        '403':
          description: User does not have edit permission on the application
      tags: *ref_3
  /applications/{_id}/share/public:
    put:
      operationId: ApplicationController_shareApplicationPublicAccess
      summary: Update application public access
      description: Update the public access settings and roles for the application
      parameters:
        - name: _id
          required: true
          in: path
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResourcePublicAccessDto'
      responses:
        '200':
          description: Public access updated successfully
        '400':
          description: Invalid request parameters
        '403':
          description: User does not have edit permission on the application
      tags: *ref_3
  /applications/{_id}/access:
    get:
      operationId: ApplicationController_getApplicationAccess
      summary: Get application access information
      description: Get the resource level access information for the application
      parameters:
        - name: _id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: Application access information retrieved successfully
        '400':
          description: Application does not exist
        '403':
          description: User does not have get access permission on the application
        '500':
          description: Get Access unknown error
      tags: *ref_3
  /applications/resource-level-roles:
    get:
      operationId: ApplicationController_getApplicationResourceLevelRoles
      summary: Get application resource level roles
      description: Get the resource level roles associated with the application
      parameters: []
      responses:
        '200':
          description: Application resource level roles retrieved successfully
        '400':
          description: Application does not exist
        '403':
          description: User does not have get access permission on the application
      tags: *ref_3
  /applications/{_id}/scopes:
    get:
      operationId: ApplicationController_getCurrentUserApplicationScopes
      summary: Get application resource level scopes
      description: >-
        Get the resource level scopes associated with the application for the
        current user
      parameters:
        - name: _id
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: Application scopes retrieved successfully
        '400':
          description: Application does not exist
        '403':
          description: User does not have get access permission on the application
      tags: *ref_3
  /applications/{id}:
    get:
      operationId: ApplicationController_getApplicationById
      summary: Get a specific application by its ID
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the application to retrieve
          schema:
            type: number
        - name: includeAllowedScopes
          required: true
          in: query
          schema:
            type: boolean
        - name: includeModerationPolicies
          required: true
          in: query
          schema:
            type: boolean
        - name: includePolicyCreator
          required: true
          in: query
          schema:
            type: boolean
        - name: includePolicyStatus
          required: true
          in: query
          schema:
            type: boolean
      responses:
        '200':
          description: Application details successfully retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationDto'
        '400':
          description: Invalid application ID format.
        '404':
          description: Application not found.
        '500':
          description: Internal server error.
      tags: *ref_3
    put:
      operationId: ApplicationController_updateApplication
      summary: Update an existing application
      description: Updates specified fields of an existing application.
      parameters:
        - name: id
          required: true
          in: path
          description: Application ID
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateApplicationDto'
      responses:
        '200':
          description: Application updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateApplicationResponseDto'
        '400':
          description: Invalid request body or parameters
        '403':
          description: User does not have permission to update this application
        '404':
          description: Application not found
      tags: *ref_3
    delete:
      operationId: ApplicationController_deleteApplication
      summary: Delete an existing application
      description: Deletes an existing application by its ID.
      parameters:
        - name: id
          required: true
          in: path
          description: Application ID
          schema:
            type: integer
      responses:
        '200':
          description: Application deleted successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DeleteApplicationResponseDto'
        '403':
          description: User does not have permission to delete this application
        '404':
          description: Application not found
      tags: *ref_3
  /applications/{id}/all-ai-systems:
    get:
      operationId: ApplicationController_getAllAiSystemsForApplication
      summary: Get all AI systems for application (active + removed)
      description: >-
        Retrieves all AI systems that were ever linked to the application for
        logs filtering UI
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the application to retrieve AI systems for
          schema:
            type: number
      responses:
        '200':
          description: All AI systems successfully retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AllAiSystemsForApplicationDto'
        '400':
          description: Invalid application ID format.
        '404':
          description: Application not found.
        '500':
          description: Internal server error.
      tags: *ref_3
  /applications/{id}/logs:
    get:
      operationId: ApplicationController_getApplicationLogs
      summary: Get application logs
      description: >-
        Retrieve logs for a specific application with enhanced AI system
        information and filtering capabilities.
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the application
          schema:
            type: number
        - name: startTime
          required: false
          in: query
          description: The start time (in UTC seconds) to filter by
          schema:
            type: number
        - name: endTime
          required: false
          in: query
          description: The end time (in UTC seconds) to filter by
          schema:
            type: number
        - name: pageNum
          required: false
          in: query
          description: The page number
          schema:
            default: 1
            type: number
        - name: perPage
          required: false
          in: query
          description: The number of results per page
          schema:
            default: 50
            type: number
        - name: sortDir
          required: false
          in: query
          description: The direction to sort results by.
          schema:
            default: desc
            enum:
              - asc
              - desc
            type: string
        - name: policyId
          required: false
          in: query
          description: The policy id to filter by
          schema:
            type: string
        - name: policyType
          required: false
          in: query
          description: The policy type to filter by
          schema:
            enum:
              - PII
              - TOXICITY
              - ALIGNMENT
              - HALLUCINATION
              - RAG_HALLUCINATION
              - INPUT_RELEVANCE
              - RESPONSE_RELEVANCE
              - OOB_HALLUCINATION
              - KEYWORD
            type: string
        - name: actions
          required: false
          in: query
          description: List of actions to filter by
          schema:
            type: array
            items:
              type: string
        - name: textType
          required: false
          in: query
          description: The text type to filter by
          schema:
            enum:
              - MODEL_INPUT
              - MODEL_RESPONSE
            type: string
        - name: action
          required: false
          in: query
          description: The policy action to filter by
          schema:
            enum:
              - BLOCK
              - WARN
              - REDACT
              - SANITIZE
              - NONE
            type: string
        - name: clientId
          required: false
          in: query
          description: The client id to filter by
          schema:
            type: string
        - name: userId
          required: false
          in: query
          description: The user id to filter by
          schema:
            type: string
        - name: policyTypes
          required: false
          in: query
          description: List of policy types to filter by
          schema:
            type: array
            items:
              type: string
        - name: metadata
          required: false
          in: query
          description: User-defined log metadata to filter by. Should be a json string
          schema:
            example: >-
              {origin: {platform: "chatgpt.com", browser: "Chrome"}, version:
              "3.16"}
            type: string
        - name: isMultiturn
          required: false
          in: query
          description: >-
            Filter by multiturn status (true for multiturn, false for
            single-turn including historical logs)
          schema:
            type: boolean
        - name: aiSystemIds
          required: false
          in: query
          description: Array of specific AI System IDs to filter logs
          schema:
            example:
              - 507f1f77bcf86cd799439011
              - 507f1f77bcf86cd799439012
            type: array
            items:
              type: string
        - name: includeRemovedAiSystems
          required: false
          in: query
          description: >-
            Whether to include logs from AI systems that have been removed from
            the application
          schema:
            default: true
            example: true
            type: boolean
      responses:
        '200':
          description: Application logs successfully retrieved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApplicationLogsResponseDto'
        '400':
          description: Invalid request parameters or query filters.
        '401':
          description: User is not authenticated.
        '403':
          description: User does not have permission to view logs for this application.
        '404':
          description: Application not found.
        '500':
          description: Internal server error.
      tags: *ref_3
  /applications/{id}/logs/count:
    get:
      operationId: ApplicationController_getApplicationLogsCount
      summary: Get application logs count
      description: >-
        Retrieve the count of logs for a specific application with the same
        filtering capabilities as the main logs endpoint.
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the application
          schema:
            type: number
        - name: startTime
          required: false
          in: query
          description: The start time (in UTC seconds) to filter by
          schema:
            type: number
        - name: endTime
          required: false
          in: query
          description: The end time (in UTC seconds) to filter by
          schema:
            type: number
        - name: pageNum
          required: false
          in: query
          description: The page number
          schema:
            default: 1
            type: number
        - name: perPage
          required: false
          in: query
          description: The number of results per page
          schema:
            default: 50
            type: number
        - name: sortDir
          required: false
          in: query
          description: The direction to sort results by.
          schema:
            default: desc
            enum:
              - asc
              - desc
            type: string
        - name: policyId
          required: false
          in: query
          description: The policy id to filter by
          schema:
            type: string
        - name: policyType
          required: false
          in: query
          description: The policy type to filter by
          schema:
            enum:
              - PII
              - TOXICITY
              - ALIGNMENT
              - HALLUCINATION
              - RAG_HALLUCINATION
              - INPUT_RELEVANCE
              - RESPONSE_RELEVANCE
              - OOB_HALLUCINATION
              - KEYWORD
            type: string
        - name: actions
          required: false
          in: query
          description: List of actions to filter by
          schema:
            type: array
            items:
              type: string
        - name: textType
          required: false
          in: query
          description: The text type to filter by
          schema:
            enum:
              - MODEL_INPUT
              - MODEL_RESPONSE
            type: string
        - name: action
          required: false
          in: query
          description: The policy action to filter by
          schema:
            enum:
              - BLOCK
              - WARN
              - REDACT
              - SANITIZE
              - NONE
            type: string
        - name: clientId
          required: false
          in: query
          description: The client id to filter by
          schema:
            type: string
        - name: userId
          required: false
          in: query
          description: The user id to filter by
          schema:
            type: string
        - name: policyTypes
          required: false
          in: query
          description: List of policy types to filter by
          schema:
            type: array
            items:
              type: string
        - name: metadata
          required: false
          in: query
          description: User-defined log metadata to filter by. Should be a json string
          schema:
            example: >-
              {origin: {platform: "chatgpt.com", browser: "Chrome"}, version:
              "3.16"}
            type: string
        - name: isMultiturn
          required: false
          in: query
          description: >-
            Filter by multiturn status (true for multiturn, false for
            single-turn including historical logs)
          schema:
            type: boolean
        - name: aiSystemIds
          required: false
          in: query
          description: Array of specific AI System IDs to filter logs
          schema:
            example:
              - 507f1f77bcf86cd799439011
              - 507f1f77bcf86cd799439012
            type: array
            items:
              type: string
        - name: includeRemovedAiSystems
          required: false
          in: query
          description: >-
            Whether to include logs from AI systems that have been removed from
            the application
          schema:
            default: true
            example: true
            type: boolean
      responses:
        '200':
          description: Application logs count successfully retrieved.
          content:
            application/json:
              schema:
                type: number
        '400':
          description: Invalid request parameters or query filters.
        '401':
          description: User is not authenticated.
        '403':
          description: User does not have permission to view logs for this application.
        '404':
          description: Application not found.
        '500':
          description: Internal server error.
      tags: *ref_3
  /applications/{id}/assign-ai-systems:
    post:
      operationId: ApplicationController_assignAiSystems
      summary: Assign (add/remove) AI Systems to/from an Application
      description: >-
        Adds and/or removes AI Systems from an application and synchronizes
        moderation policies.
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the application
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssignAiSystemsDto'
      responses:
        '200':
          description: >-
            AI Systems processed for the application. Check response body for
            individual outcomes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssignAiSystemsResponseDto'
        '400':
          description: >-
            Invalid request body or parameters (e.g., non-numeric application
            ID, invalid AI System ID format, or neither addAiSystems nor
            removeAiSystems provided).
        '401':
          description: User is not authenticated.
        '404':
          description: >-
            Application with the specified ID not found, or user not found for
            operations.
        '500':
          description: An unexpected error occurred on the server.
      tags: *ref_3
  /applications/{id}/assign-policies:
    post:
      operationId: ApplicationController_assignPolicies
      summary: Assign (add/remove) Policies to/from an Application
      description: >-
        Adds and/or removes Policies from an application and synchronizes them
        with all existing AI systems.
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the application
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AssignPoliciesDto'
      responses:
        '200':
          description: >-
            Policies processed for the application. Check response body for
            individual outcomes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AssignPoliciesResponseDto'
        '400':
          description: >-
            Invalid request body or parameters (e.g., non-numeric application
            ID, invalid Policy ID format, or neither addPolicies nor
            removePolicies provided).
        '401':
          description: User is not authenticated.
        '404':
          description: >-
            Application with the specified ID not found, or user not found for
            operations.
        '500':
          description: An unexpected error occurred on the server.
      tags: *ref_3
  /applications/{id}/manage-policies:
    post:
      operationId: ApplicationController_managePolicies
      summary: Manage Policies for an Application
      description: >-
        Replace existing policies with specific sets of policies for individual
        AI systems within the application.
      parameters:
        - name: id
          required: true
          in: path
          description: The ID of the application
          schema:
            type: number
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ManagePoliciesDto'
      responses:
        '207':
          description: >-
            Policies managed for the application. Check response body for
            individual outcomes.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagePoliciesResponseDto'
        '400':
          description: >-
            Invalid request body or parameters (e.g., non-numeric application
            ID, invalid AI System ID format, or invalid manage request
            structure).
        '401':
          description: User is not authenticated.
        '403':
          description: >-
            User does not have permission to manage policies for this
            application.
        '404':
          description: >-
            Application with the specified ID not found, or user not found for
            operations.
        '500':
          description: An unexpected error occurred on the server.
      tags: *ref_3
info:
  title: DynamoFL API
  description: ''
  version: 3.25.7
  contact: {}
tags: []
servers: []
components:
  schemas:
    CreateUserDto:
      type: object
      properties:
        email:
          type: string
          description: Email address of the user
          example: user@example.com
        password:
          type: string
          description: Password for the user (optional)
          example: SecurePassword123!
        orgLevelRoleNames:
          description: >-
            Array of organization level role names. Valid roles:
            org:dynamoeval:admin, org:dynamoeval:developer,
            org:dynamoeval:member, org:dynamoguard:admin,
            org:dynamoguard:developer, org:dynamoguard:member,
            org:dynamoguard:extensionUser, org:dynamoguard:extensionAdmin,
            org:iam:admin, org:iam:editor, org:iam:viewer, org:platform:admin
          example:
            - org:dynamoeval:admin
            - org:dynamoguard:developer
            - org:iam:viewer
          type: array
          items:
            type: string
      required:
        - email
        - orgLevelRoleNames
    CreatedUserResponseDto:
      type: object
      properties:
        email:
          type: string
          description: Email address of the created user
          example: user@example.com
        temporaryPassword:
          type: string
          description: Temporary password for the user (if generated)
          example: TempPassword123!
        keycloakId:
          type: string
          description: Keycloak user ID
          example: 123e4567-e89b-12d3-a456-426614174000
        dynamoAIId:
          type: string
          description: DynamoAI user ID
          example: 507f1f77bcf86cd799439011
      required:
        - email
        - keycloakId
        - dynamoAIId
    ResetPasswordNonOnboardedUserDto:
      type: object
      properties:
        email:
          type: string
          description: Email address of the user
          example: user@example.com
        password:
          type: string
          description: New password for the user (optional)
          example: NewSecurePassword123!
      required:
        - email
    ResetPasswordNonOnboardedUserResponseDto:
      type: object
      properties:
        email:
          type: string
          description: Email address of the user
          example: user@example.com
        temporaryPassword:
          type: string
          description: Temporary password for the user (if generated)
          example: TempPassword123!
      required:
        - email
    ResetPasswordOnboardedUserDto:
      type: object
      properties:
        email:
          type: string
          description: Email address of the user
          example: user@example.com
        currentPassword:
          type: string
          description: Current password of the user
          example: CurrentPassword123!
        newPassword:
          type: string
          description: New password for the user
          example: NewSecurePassword123!
      required:
        - email
        - currentPassword
        - newPassword
    AllUsersDto:
      type: object
      properties:
        total:
          type: number
          description: Total number of users
          example: 100
        users:
          description: Array of users with Keycloak and DynamoAI information
          example:
            - keycloakId: 123e4567-e89b-12d3-a456-426614174000
              dynamoAIId: 507f1f77bcf86cd799439011
              email: user@example.com
              firstName: John
              lastName: Doe
              orgLevelRoles:
                - Admin
              enabled: true
          type: array
          items:
            type: array
      required:
        - total
        - users
    UpdateOrgLevelRoleDto:
      type: object
      properties:
        orgLevelRoles:
          description: >-
            Array of organization level role names. Valid roles:
            org:dynamoeval:admin, org:dynamoeval:developer,
            org:dynamoeval:member, org:dynamoguard:admin,
            org:dynamoguard:developer, org:dynamoguard:member,
            org:dynamoguard:extensionUser, org:dynamoguard:extensionAdmin,
            org:iam:admin, org:iam:editor, org:iam:viewer, org:platform:admin
          example:
            - org:dynamoeval:admin
            - org:dynamoguard:developer
            - org:iam:viewer
          type: array
          items:
            type: string
      required:
        - orgLevelRoles
    TermsConsentStatusResponse:
      type: object
      properties: {}
    UpdateUserTermsConsentDto:
      type: object
      properties: {}
    SetupUserTargetDto:
      type: object
      properties:
        userId:
          type: string
          description: User ID to setup
          example: 507f1f77bcf86cd799439011
      required:
        - userId
    SetupUserStepResultDto:
      type: object
      properties:
        step:
          type: string
          description: The setup step
          enum:
            - CONFIG
            - POLICIES
            - MODELS
          example: CONFIG
        status:
          type: string
          description: Status of the setup step
          enum:
            - success
            - failed
            - skipped
          example: success
        code:
          type: string
          description: Error code (if step failed)
          example: ERROR_CODE
        message:
          type: string
          description: Error message (if step failed)
          example: An error occurred
      required:
        - step
        - status
    SetupUserResponseDto:
      type: object
      properties:
        success:
          type: boolean
          description: Whether the setup was successful
          example: true
        steps:
          description: Array of setup step results
          type: array
          items:
            $ref: '#/components/schemas/SetupUserStepResultDto'
      required:
        - success
        - steps
    Version:
      type: object
      properties:
        _id:
          type: string
          description: The ID of the version
        date:
          type: string
          description: The date of the version
          format: date-time
      required:
        - _id
        - date
    ReturnTermsConsentsDto:
      type: object
      properties:
        code:
          type: string
          description: The code of the terms consent
        name:
          type: string
          description: The name of the terms consent
        optional:
          type: boolean
          description: Whether the terms consent is optional
        versions:
          description: The versions of the terms consent
          type: array
          items:
            $ref: '#/components/schemas/Version'
      required:
        - code
        - name
        - optional
        - versions
    AnalyzeMessage:
      type: object
      properties:
        role:
          type: string
          description: Role
          enum: &ref_12
            - user
            - assistant
            - system
        content:
          type: string
          description: Text to send
        ragContext:
          type: string
          description: >-
            Context retrieved from RAG. Currently only used for analyze
            endpoint, not chat.
      required:
        - role
        - content
    LoggingControlDto:
      type: object
      properties:
        enabled:
          type: boolean
          description: Whether to log this interaction. Default is true.
          default: true
        forceLogOnFinalAction:
          type: array
          description: >-
            Force log if final action matches these values. Default is empty (no
            forced logging). By default, respect the "enabled" flag, and only
            override when explicitly configured
          default: []
          items:
            type: string
            enum:
              - BLOCK
              - WARN
              - REDACT
              - SANITIZE
              - NONE
    AnalyzeDto:
      type: object
      properties:
        messages:
          description: OpenAI style messages with optional RAG context to analyze
          type: array
          items:
            $ref: '#/components/schemas/AnalyzeMessage'
        textType:
          type: string
          description: Whether last message is a prompt or response
          enum: &ref_22
            - MODEL_INPUT
            - MODEL_RESPONSE
        policyIds:
          description: List of policies to apply
          type: array
          items:
            type: string
        inheritPolicies:
          type: boolean
          description: Whether to inherit policies from the modelId passed
          default: false
        modelId:
          type: string
          description: The model id of the LLM to associate inference with
        clientId:
          type: string
          description: The client id of the sender
        metadata:
          type: object
          description: Metadata to be attached to the request
        loggingControl:
          description: Logging control settings
          allOf:
            - $ref: '#/components/schemas/LoggingControlDto'
        multiturnMetadata:
          type: object
          description: Multi turn metadata to be attached to the request
      required:
        - messages
        - textType
        - policyIds
    CondensedReturnPolicyDto:
      type: object
      properties:
        id:
          type: string
          description: Id of the policy
        name:
          type: string
          description: Name of the policy
        description:
          type: string
          description: Description of the policy
        isEnabled:
          type: boolean
          description: Whether the policy is enabled or disabled
          default: true
        method:
          type: string
          description: Type of policy
          enum: &ref_4
            - PII
            - TOXICITY
            - ALIGNMENT
            - HALLUCINATION
            - RAG_HALLUCINATION
            - INPUT_RELEVANCE
            - RESPONSE_RELEVANCE
            - OOB_HALLUCINATION
            - KEYWORD
          externalDocs: &ref_5
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Types
            description: Information about policy types
        action:
          type: string
          description: The action to take if the policy is violated
          enum: &ref_6
            - BLOCK
            - WARN
            - REDACT
            - SANITIZE
            - NONE
          default: NONE
          externalDocs: &ref_7
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Actions
            description: Information about policy actions
        decisionParams:
          type: object
          description: >-
            The parameters for determining the policy action from outputs. These
            differ depending on the policy type
          externalDocs: &ref_8
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Decision%20Params
            description: Information on policy types
        language:
          type: string
          description: The language of the policy
          enum: &ref_9
            - en
            - ja
            - zh
        applicableTo:
          type: string
          description: Which type of message the policy should apply to
          enum: &ref_10
            - INPUT
            - OUTPUT
            - ALL
          default: ALL
        created_at:
          format: date-time
          type: string
          description: Creation time of the policy
        creatorId:
          type: string
          description: Creator id of the policy
        updated_at:
          format: date-time
          type: string
          description: Time the policy was last updated
        usecaseId:
          type: string
          description: Usecase id of the policy
        allowedBehaviors:
          description: List of allowed behaviors
          type: array
          items:
            type: string
        disallowedBehaviors:
          description: List of disallowed behaviors
          type: array
          items:
            type: string
      required:
        - id
        - name
        - description
        - isEnabled
        - method
        - action
        - decisionParams
        - language
        - applicableTo
        - created_at
        - creatorId
        - updated_at
        - usecaseId
        - allowedBehaviors
        - disallowedBehaviors
    AppliedPolicyDto:
      type: object
      properties:
        policy:
          description: Policy information
          allOf:
            - $ref: '#/components/schemas/CondensedReturnPolicyDto'
        outputs:
          type: object
          description: Outputs from the policy
          externalDocs:
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Outputs
            description: Output object
        action:
          type: string
          description: Action taken after applying the policy
          externalDocs:
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Actions
            description: Information about policy actions
      required:
        - policy
        - outputs
        - action
    ReturnAnalyzeDto:
      type: object
      properties:
        text:
          type: string
          description: Text that was analyzed
        textType:
          type: string
          description: Whether the text was a prompt or response
          enum: &ref_11
            - MODEL_INPUT
            - MODEL_RESPONSE
        finalAction:
          type: string
          description: Final action based on all of the applied policies
          enum:
            - BLOCK
            - WARN
            - REDACT
            - SANITIZE
            - NONE
        appliedPolicies:
          description: List of policies that were applied
          type: array
          items:
            $ref: '#/components/schemas/AppliedPolicyDto'
        error:
          type: string
          description: 'Error message '
      required:
        - text
        - textType
        - finalAction
        - appliedPolicies
    ReturnPolicyDto:
      type: object
      properties:
        id:
          type: string
          description: Id of the policy
        name:
          type: string
          description: Name of the policy
        description:
          type: string
          description: Description of the policy
        isEnabled:
          type: boolean
          description: Whether the policy is enabled or disabled
          default: true
        method:
          type: string
          description: Type of policy
          enum: *ref_4
          externalDocs: *ref_5
        action:
          type: string
          description: The action to take if the policy is violated
          enum: *ref_6
          default: NONE
          externalDocs: *ref_7
        methodParams:
          type: object
          description: >-
            The arguments for the policy. These differ depending on the policy
            type
          externalDocs: &ref_13
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Method%20Params
            description: Information on policy types
        decisionParams:
          type: object
          description: >-
            The parameters for determining the policy action from outputs. These
            differ depending on the policy type
          externalDocs: *ref_8
        language:
          type: string
          description: The language of the policy
          enum: *ref_9
        applicableTo:
          type: string
          description: Which type of message the policy should apply to
          enum: *ref_10
          default: ALL
        created_at:
          format: date-time
          type: string
          description: Creation time of the policy
        creatorId:
          type: string
          description: Creator id of the policy
        updated_at:
          format: date-time
          type: string
          description: Time the policy was last updated
        usecaseId:
          type: string
          description: Usecase id of the policy
        allowedBehaviors:
          description: List of allowed behaviors
          type: array
          items:
            type: string
        disallowedBehaviors:
          description: List of disallowed behaviors
          type: array
          items:
            type: string
      required:
        - id
        - name
        - description
        - isEnabled
        - method
        - action
        - methodParams
        - decisionParams
        - language
        - applicableTo
        - created_at
        - creatorId
        - updated_at
        - usecaseId
        - allowedBehaviors
        - disallowedBehaviors
    PolicyWithFeedback:
      type: object
      properties:
        outputs:
          type: object
          description: Outputs from the policy
          externalDocs:
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Outputs
            description: Output object
        violated:
          type: boolean
          description: Whether the policy was violated
        feedback:
          type: object
          description: Feedback for the policy
        promptId:
          type: string
          description: Id of the prompt
        policy:
          description: Policy information
          allOf:
            - $ref: '#/components/schemas/ReturnPolicyDto'
        action:
          type: string
          description: Action taken
          enum:
            - BLOCK
            - WARN
            - REDACT
            - SANITIZE
            - NONE
      required:
        - outputs
        - violated
        - feedback
        - promptId
        - policy
        - action
    ReturnAnalysisWithFeedback:
      type: object
      properties:
        text:
          type: string
          description: Text that was analyzed
        textType:
          type: string
          description: Whether the text was a prompt or response
          enum: *ref_11
        appliedPolicies:
          description: List of policies that were applied
          type: array
          items:
            $ref: '#/components/schemas/PolicyWithFeedback'
      required:
        - text
        - textType
        - appliedPolicies
    ReturnLogEntry:
      type: object
      properties:
        timestamp:
          type: string
          description: UTC timestamp of interaction
        analyses:
          description: Analyses used during the interaction. Will be of length at most 2
          type: array
          items:
            $ref: '#/components/schemas/ReturnAnalysisWithFeedback'
        action:
          type: string
          description: Most severe action of the analyses
          enum: &ref_23
            - BLOCK
            - WARN
            - REDACT
            - SANITIZE
            - NONE
        metadata:
          type: object
          description: metadata
        multiturnMetadata:
          type: object
          description: Multi-Turn metadata
      required:
        - timestamp
        - analyses
        - action
    UserWarning:
      type: object
      properties:
        name:
          type: string
          description: Warning Name
          enum:
            - Token Length Exceeded Warning
            - Deprecation Warning
            - Temporary Disabled Warning
        message:
          type: string
          description: Full warning message
      required:
        - name
        - message
    FullReturnLogDto:
      type: object
      properties:
        logs:
          description: Paginated logs
          type: array
          items:
            $ref: '#/components/schemas/ReturnLogEntry'
        totalCount:
          type: number
          description: Total number of un-paginated logs
        warnings:
          description: Warning the user should be aware of
          type: array
          items:
            $ref: '#/components/schemas/UserWarning'
      required:
        - logs
        - totalCount
        - warnings
    MetadataFieldsResponseDto:
      type: object
      properties:
        fields:
          description: Unique metadata field keys observed for this AI system
          example:
            - sessionId
            - traceId
            - order.id
          type: array
          items:
            type: string
      required:
        - fields
    HasMultiturnLogsResponseDto:
      type: object
      properties:
        hasMultiturnLogs:
          type: boolean
          description: Whether any of the specified AI systems have multiturn logs
          example: true
      required:
        - hasMultiturnLogs
    OverviewSubStats:
      type: object
      properties:
        total:
          description: Frequency polygon of total entries. Buckets are the timestamps.
          type: array
          items:
            type: number
        flagged:
          description: Frequency polygon of flagged entries. Buckets are the timestamps.
          type: array
          items:
            type: number
      required:
        - total
        - flagged
    OverviewStats:
      type: object
      properties:
        MODEL_INPUT:
          description: Stats for all prompts
          allOf:
            - $ref: '#/components/schemas/OverviewSubStats'
        MODEL_RESPONSE:
          description: Stats for all LLM responses
          allOf:
            - $ref: '#/components/schemas/OverviewSubStats'
      required:
        - MODEL_INPUT
        - MODEL_RESPONSE
    PrivacySubStats:
      type: object
      properties:
        entity_types:
          type: object
          description: >-
            Flagged PII by category. Maps the entity type to list a frequency
            polygon of occurences. Buckets are the timestamps.
          additionalProperties:
            type: array
            items:
              type: number
          example:
            LOCATION:
              - 0
              - 37
        total:
          description: >-
            Frequency polygon of total PII violations. Buckets are the
            timestamps.
          type: array
          items:
            type: number
      required:
        - entity_types
        - total
    PrivacyStats:
      type: object
      properties:
        MODEL_INPUT:
          description: Stats for all prompts
          allOf:
            - $ref: '#/components/schemas/PrivacySubStats'
        MODEL_RESPONSE:
          description: Stats for all LLM responses
          allOf:
            - $ref: '#/components/schemas/PrivacySubStats'
      required:
        - MODEL_INPUT
        - MODEL_RESPONSE
    KeywordSubStats:
      type: object
      properties:
        entity_types:
          type: object
          description: >-
            Flagged Keywords. Maps the keyword to list a frequency polygon of
            occurences. Buckets are the timestamps.
          additionalProperties:
            type: array
            items:
              type: number
          example:
            lawyer:
              - 0
              - 37
        total:
          description: >-
            Frequency polygon of total Keyword violations. Buckets are the
            timestamps.
          type: array
          items:
            type: number
      required:
        - entity_types
        - total
    KeywordStats:
      type: object
      properties:
        MODEL_INPUT:
          description: Stats for all prompts
          allOf:
            - $ref: '#/components/schemas/KeywordSubStats'
        MODEL_RESPONSE:
          description: Stats for all LLM responses
          allOf:
            - $ref: '#/components/schemas/KeywordSubStats'
      required:
        - MODEL_INPUT
        - MODEL_RESPONSE
    AggregateValue:
      type: object
      properties:
        value:
          type: number
          description: Actual value across the entire time period
        data:
          description: Frequency polygon of occurences. Buckets are the timestamps.
          type: array
          items:
            type: number
      required:
        - value
        - data
    ToxicitySubStats:
      type: object
      properties:
        total:
          description: >-
            Frequency polygon of total toxicity violations. Buckets are the
            timestamps.
          type: array
          items:
            type: number
        violation_rate:
          description: Fraction of entries classified as unsafe
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
      required:
        - total
        - violation_rate
    ToxicityStats:
      type: object
      properties:
        MODEL_INPUT:
          description: Stats for all prompts
          allOf:
            - $ref: '#/components/schemas/ToxicitySubStats'
        MODEL_RESPONSE:
          description: Stats for all LLM responses
          allOf:
            - $ref: '#/components/schemas/ToxicitySubStats'
      required:
        - MODEL_INPUT
        - MODEL_RESPONSE
    ContentPolicyStat:
      type: object
      properties:
        name:
          type: string
          description: Name of the policy
        num_violations:
          description: >-
            Frequency polygon of number of violations. Buckets are the
            timestamps.
          type: array
          items:
            type: number
        violation_rate:
          description: Fraction of entries violated
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
      required:
        - name
        - num_violations
        - violation_rate
    ContentSubStats:
      type: object
      properties:
        total:
          description: >-
            Frequency polygon of total content violations. Buckets are the
            timestamps.
          type: array
          items:
            type: number
        policies:
          type: object
          description: Breakdown per policy
          additionalProperties:
            $ref: '#/components/schemas/ContentPolicyStat'
      required:
        - total
        - policies
    ContentStats:
      type: object
      properties:
        MODEL_INPUT:
          description: Stats for all prompts
          allOf:
            - $ref: '#/components/schemas/ContentSubStats'
        MODEL_RESPONSE:
          description: Stats for all LLM responses
          allOf:
            - $ref: '#/components/schemas/ContentSubStats'
      required:
        - MODEL_INPUT
        - MODEL_RESPONSE
    HallucinationSubStats:
      type: object
      properties:
        total:
          description: >-
            Frequency polygon of total hallucination violations. Buckets are the
            timestamps.
          type: array
          items:
            type: number
        violation_rate:
          description: Fraction of entries classified as a hallucination
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
      required:
        - total
        - violation_rate
    HallucinationStats:
      type: object
      properties:
        MODEL_RESPONSE:
          description: Stats for all LLM responses
          allOf:
            - $ref: '#/components/schemas/HallucinationSubStats'
      required:
        - MODEL_RESPONSE
    InputRelevanceSubStats:
      type: object
      properties:
        entries:
          description: Number of entries
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
        violations:
          description: Number of entries classified as off-topic
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
        violation_rate:
          description: Fraction of entries classified as off-topic for this metric
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
      required:
        - entries
        - violations
        - violation_rate
    InputRelevanceStats:
      type: object
      properties:
        MODEL_INPUT:
          description: Stats for all prompts
          allOf:
            - $ref: '#/components/schemas/InputRelevanceSubStats'
      required:
        - MODEL_INPUT
    ResponseRelevanceMetrics:
      type: object
      properties:
        violations:
          description: Number of violations for this metric
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
        violation_rate:
          description: Fraction of entries classified as a violation for this metric
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
      required:
        - violations
        - violation_rate
    ResponseRelevanceSubStats:
      type: object
      properties:
        entries:
          description: Number of entries
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
        violations:
          description: Number of entries classified as off-topic
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
        contextRelevance:
          description: Response context relevance stats
          allOf:
            - $ref: '#/components/schemas/ResponseRelevanceMetrics'
        responseRelevance:
          description: Response relevance stats
          allOf:
            - $ref: '#/components/schemas/ResponseRelevanceMetrics'
      required:
        - entries
        - violations
        - contextRelevance
        - responseRelevance
    ResponseRelevanceStats:
      type: object
      properties:
        MODEL_RESPONSE:
          description: Stats for all prompts
          allOf:
            - $ref: '#/components/schemas/ResponseRelevanceSubStats'
      required:
        - MODEL_RESPONSE
    LatencyPercentile:
      type: object
      properties:
        percentile50:
          description: 50th percentile
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
        percentile90:
          description: 90th percentile
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
        percentile99:
          description: 99th percentile
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
      required:
        - percentile50
        - percentile90
        - percentile99
    LatencyRequests:
      type: object
      properties:
        successful:
          description: 'Number of successful requests '
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
        failed:
          description: Number of failed requests
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
      required:
        - successful
        - failed
    LatencyFailureTypes:
      type: object
      properties:
        http4xx:
          description: Number of 4xx requests
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
        http5xx:
          description: Number of 5xx requests
          allOf:
            - $ref: '#/components/schemas/AggregateValue'
      required:
        - http4xx
        - http5xx
    LatencyStats:
      type: object
      properties:
        e2eLatency:
          description: End to end latency
          allOf:
            - $ref: '#/components/schemas/LatencyPercentile'
        inputGuardrailLatency:
          description: Input guardrail latency
          allOf:
            - $ref: '#/components/schemas/LatencyPercentile'
        outputGuardrailLatency:
          description: Output guardrail latency
          allOf:
            - $ref: '#/components/schemas/LatencyPercentile'
        llmCompletionLatency:
          description: LLM completion latency
          allOf:
            - $ref: '#/components/schemas/LatencyPercentile'
        requests:
          description: Types of requests
          allOf:
            - $ref: '#/components/schemas/LatencyRequests'
        failureTypes:
          description: Types of failed requests
          allOf:
            - $ref: '#/components/schemas/LatencyFailureTypes'
      required:
        - e2eLatency
        - inputGuardrailLatency
        - outputGuardrailLatency
        - llmCompletionLatency
        - requests
        - failureTypes
    RuleStats:
      type: object
      properties:
        ruleViolations:
          type: number
          description: Number of times a policy has been violated in the time period
        rulesActive:
          type: number
          description: Number of rules that are active (has been used in the time period)
      required:
        - ruleViolations
        - rulesActive
    ReturnStatsDto:
      type: object
      properties:
        overview:
          description: Stats of all usage logs
          allOf:
            - $ref: '#/components/schemas/OverviewStats'
        privacy:
          description: Stats for all PII logs
          allOf:
            - $ref: '#/components/schemas/PrivacyStats'
        keyword:
          description: Stats for all PII logs
          allOf:
            - $ref: '#/components/schemas/KeywordStats'
        toxicity:
          description: Stats for all toxicity logs
          allOf:
            - $ref: '#/components/schemas/ToxicityStats'
        alignment:
          description: Stats for all content logs
          allOf:
            - $ref: '#/components/schemas/ContentStats'
        hallucination:
          description: Stats for all hallucination logs
          allOf:
            - $ref: '#/components/schemas/HallucinationStats'
        inputRelevance:
          description: Stats for all off-topic input relevance logs
          allOf:
            - $ref: '#/components/schemas/InputRelevanceStats'
        responseRelevance:
          description: Stats for all off-topic response relevance logs
          allOf:
            - $ref: '#/components/schemas/ResponseRelevanceStats'
        latency:
          description: Latency and request metrics
          allOf:
            - $ref: '#/components/schemas/LatencyStats'
        timestamps:
          description: >-
            List of UTC timestamps (in milliseconds) that represent the
            discretization buckets
          type: array
          items:
            type: number
        rules:
          description: Stats of all policies
          allOf:
            - $ref: '#/components/schemas/RuleStats'
      required:
        - overview
        - privacy
        - keyword
        - toxicity
        - alignment
        - hallucination
        - inputRelevance
        - responseRelevance
        - latency
        - timestamps
        - rules
    ChatMessage:
      type: object
      properties:
        role:
          type: string
          description: Role
          enum: *ref_12
        content:
          type: string
          description: Text to send
      required:
        - role
        - content
    ChatDto:
      type: object
      properties:
        clientId:
          type: string
          description: The client id of the sender
        messages:
          description: OpenAI style messages to send to the LLM
          type: array
          items:
            $ref: '#/components/schemas/ChatMessage'
        metadata:
          type: object
          description: Metadata to be attached to the request
        overridePolicyIds:
          description: >-
            Explicit list of policies to apply instead of the ones attached to
            the model
          type: array
          items:
            type: string
      required:
        - messages
    ReturnSourceDto:
      type: object
      properties:
        user:
          type: string
          description: Id of the user who sent the request
        session:
          type: string
          description: Session id. Only present for chat requests
        model:
          type: string
          description: Model id. Only present for chat requests
        client:
          type: string
          description: Client id. Only present for chat requests
      required:
        - user
    ReturnChatDto:
      type: object
      properties:
        queryId:
          type: string
          description: Unique id of the query if chat request succeeds
        prompt:
          type: string
          description: Original user input
        preprocessedPrompt:
          type: string
          description: >-
            User input after policies are applied. This could contain the
            redacted iput. Not present if an error occurs.
        response:
          type: string
          description: >-
            Original LLM response. Not present if user input was blocked or an
            error occured when calling the LLM.
        desanitizedResponse:
          type: string
          description: >-
            If the user input had a sanitize policy applied, this field contains
            the result after reverse mapping redacted entities to plaintext.
        postprocessedResponse:
          type: string
          description: >-
            The LLM response after policies are applied. This could contain
            redacted input.
        ragContext:
          type: string
          description: >-
            Retrieved context from RAG endpoint. Only applicable to Custom RAG
            models.
        error:
          type: string
          description: Error message if one occurs
      required:
        - queryId
        - prompt
    TokensUsage:
      type: object
      properties:
        inputGuardrailTokens:
          type: number
          description: Tokens used for input guardrailing
        outputGuardrailTokens:
          type: number
          description: Tokens used for output guardrailing
        totalGuardrailTokens:
          type: number
          description: Total tokens used for guardrailing
      required:
        - inputGuardrailTokens
        - outputGuardrailTokens
        - totalGuardrailTokens
    FullReturnChatDto:
      type: object
      properties:
        source:
          description: Information about the request
          allOf:
            - $ref: '#/components/schemas/ReturnSourceDto'
        chat:
          description: Query lifecyle as policies are applied
          allOf:
            - $ref: '#/components/schemas/ReturnChatDto'
        metadata:
          type: object
          description: Any metadata that was attached to the request
        analyses:
          description: Analyses used during the interaction. Will be of length at most 2
          type: array
          items:
            $ref: '#/components/schemas/ReturnAnalyzeDto'
        usage:
          description: Tokens usage by the request
          allOf:
            - $ref: '#/components/schemas/TokensUsage'
        warnings:
          description: Warning the user should be aware of
          type: array
          items:
            $ref: '#/components/schemas/UserWarning'
      required:
        - source
        - analyses
        - usage
        - warnings
    UpdateModelPoliciesDto:
      type: object
      properties:
        policyIds:
          description: List of policy ids to activate on the model
          type: array
          items:
            type: string
        action:
          type: string
          description: Operation to perform on models
          enum:
            - ADD
            - REMOVE
            - REPLACE
      required:
        - policyIds
        - action
    GenerateBehaviorsDto:
      type: object
      properties: {}
    GenerateBehaviorsReturnDto:
      type: object
      properties: {}
    LogsByUserEmailAndTimeRangeResponseDto:
      type: object
      properties:
        presignedUrl:
          type: string
          description: Presigned URL for the uploaded logs
        logCount:
          type: number
          description: Total number of logs retrieved
      required:
        - presignedUrl
        - logCount
    CreatePolicyDto:
      type: object
      properties:
        name:
          type: string
          description: Name of the policy
        description:
          type: string
          description: Description of the policy
        method:
          type: string
          description: Type of policy
          enum:
            - PII
            - TOXICITY
            - ALIGNMENT
            - HALLUCINATION
            - RAG_HALLUCINATION
            - INPUT_RELEVANCE
            - RESPONSE_RELEVANCE
            - OOB_HALLUCINATION
            - KEYWORD
          externalDocs:
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Types
            description: Information about policy types
        action:
          type: string
          description: The action to take if the policy is violated
          enum:
            - BLOCK
            - WARN
            - REDACT
            - SANITIZE
            - NONE
          default: NONE
          externalDocs:
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Actions
            description: Information about policy actions
        methodParams:
          type: object
          description: >-
            The arguments for the policy. These differ depending on the policy
            type
          externalDocs:
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Method%20Params
            description: Information on policy types
        decisionParams:
          type: object
          description: >-
            The parameters for determining the policy action from outputs. These
            differ depending on the policy type
          externalDocs:
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Decision%20Params
            description: Information on policy types
        applicableTo:
          type: string
          description: Which type of message the policy should apply to
          enum:
            - INPUT
            - OUTPUT
            - ALL
          default: ALL
        language:
          type: string
          description: Language of the policy (ISO 639-1 code)
          enum:
            - en
            - ja
            - zh
          default: en
      required:
        - name
        - method
        - action
        - methodParams
        - decisionParams
        - applicableTo
    AlignmentPolicyCreationLimitInfoDto:
      type: object
      properties:
        hasReachedPolicyCreationLimit:
          type: boolean
          description: Whether creation limit has been reached
        currentNoOfPoliciesCreated:
          type: number
          description: Current number of policies created
        totalNoOfPoliciesAllowed:
          type: number
          description: Total number of policies allowed (-1 indicates unlimited/no limit)
      required:
        - hasReachedPolicyCreationLimit
        - currentNoOfPoliciesCreated
        - totalNoOfPoliciesAllowed
    PolicyCreationLimitDto:
      type: object
      properties:
        alignment:
          description: Alignment policy creation limits
          allOf:
            - $ref: '#/components/schemas/AlignmentPolicyCreationLimitInfoDto'
      required:
        - alignment
    RoleResponseDto:
      type: object
      properties:
        name:
          type: string
          description: Name of the role
          example: '"dynamoguard:policy:editor'
        description:
          type: string
          description: Description of the role
          example: 'DynamoGuard: Editor role for policy'
        label:
          type: string
          description: Label of the role
          example: DynamoGuard Policy Editor
      required:
        - name
        - description
        - label
    UpdateInferredPolicyDto:
      type: object
      properties:
        name:
          type: string
          description: Name of the policy
        description:
          type: string
          description: Description of the policy
        allowedBehaviors:
          description: List of allowed behaviors for the policy
          example:
            - Provide factual information
            - Answer general knowledge questions
          type: array
          items:
            type: string
        disallowedBehaviors:
          description: List of disallowed behaviors for the policy
          example:
            - Share personal opinions
            - Provide medical advice
          type: array
          items:
            type: string
      required:
        - name
        - description
        - allowedBehaviors
        - disallowedBehaviors
    UpdatePolicyDto:
      type: object
      properties:
        name:
          type: string
          description: Name of the policy
        description:
          type: string
          description: Description of the policy
        action:
          type: string
          description: The action to take if the policy is violated
          enum:
            - BLOCK
            - WARN
            - REDACT
            - SANITIZE
            - NONE
          externalDocs:
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Actions
            description: Information about policy actions
        methodParams:
          type: object
          description: >-
            The arguments for the policy. These differ depending on the policy
            type
          externalDocs:
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Method%20Params
            description: Information on policy types
        decisionParams:
          type: object
          description: >-
            The parameters for determining the policy action from outputs. These
            differ depending on the policy type
          externalDocs:
            url: /docs/DynamoGuard/API%20Appendix/Policy%20Decision%20Params
            description: Information on policy types
        applicableTo:
          type: string
          description: Which type of message the policy should apply to
          enum:
            - INPUT
            - OUTPUT
            - ALL
        language:
          type: string
          description: Language of the policy (ISO 639-1 code)
          enum:
            - en
            - ja
            - zh
        isEnabled:
          type: boolean
          description: Whether the policy is enabled or disabled
          default: true
    AddPolicyBehaviorsDto:
      type: object
      properties:
        allowedBehaviors:
          description: Additional allowed behaviors to add to the policy
          example:
            - Provide factual information
            - Answer general knowledge questions
          type: array
          items:
            type: string
        disallowedBehaviors:
          description: Additional disallowed behaviors to add to the policy
          example:
            - Share personal opinions
            - Provide medical advice
          type: array
          items:
            type: string
    InputFeedbackDatapoint:
      type: object
      properties:
        prompt:
          type: string
          description: Prompt that feedback was given for
        isCompliant:
          type: boolean
          description: Whether the user rated the prompt as compliant
        feedback:
          type: boolean
          description: Reason for the isCompliant rating
      required:
        - prompt
        - isCompliant
        - feedback
    InputFeedback:
      type: object
      properties:
        promptId:
          type: string
          description: Prompt id
        review:
          description: Feedback submitted
          allOf:
            - $ref: '#/components/schemas/InputFeedbackDatapoint'
        createdAt:
          format: date-time
          type: string
          description: Timestamp of when feedback was added
        creator:
          type: string
          description: User who added the feedback
      required:
        - promptId
        - review
        - createdAt
        - creator
    TrainingProgressDto:
      type: object
      properties:
        percentage:
          type: number
          description: Percentage of completion from 0-100
        totalNoOfItems:
          type: number
          description: Total number of items to be processed
        noOfItemsProcessed:
          type: number
          description: Number of items that have been processed
      required:
        - percentage
    TrainingDataGenFailureDetailsDto:
      type: object
      properties:
        type:
          type: string
          description: Categorized failure type
          enum:
            - INTERNAL_SERVER_ERROR
            - SYNTHETIC_DATA_GENERATION_ERROR
            - LLM_RATE_LIMIT_ERROR
            - API_CONNECTION_ERROR
            - S3_CONNECTION_ERROR
            - TIMED_OUT_ERROR
            - UNKNOWN_PROCESSING_ERROR
        message:
          type: string
          description: Detailed error message from the job
      required:
        - type
        - message
    TrainingStatusDetailsDto:
      type: object
      properties:
        jobId:
          type: string
          description: >-
            The ID of the job currently performing data generation or training,
            useful for restart operations
        progress:
          description: Progress information for the underlying data generation job
          allOf:
            - $ref: '#/components/schemas/TrainingProgressDto'
        lastProgress:
          description: >-
            Progress information from before the job was resumed (only present
            when wasResumed is true)
          allOf:
            - $ref: '#/components/schemas/TrainingProgressDto'
        queuedForTooLong:
          type: boolean
          description: >-
            Whether the job has been in queue for an unusually long time (>3
            hours). Only present for queued statuses.
        wasResumed:
          type: boolean
          description: Whether the job was resumed after a previous failure
        failure:
          description: Structured failure details for failed jobs
          allOf:
            - $ref: '#/components/schemas/TrainingDataGenFailureDetailsDto'
        totalElapsedTime:
          type: number
          description: >-
            Total elapsed time in milliseconds from job's queue entry to
            completion (or current time if still in-progress)
      required:
        - jobId
        - wasResumed
    JobStatsDto:
      type: object
      properties: {}
    AugmentedReturnPolicyDto:
      type: object
      properties:
        id:
          type: string
          description: Id of the policy
        name:
          type: string
          description: Name of the policy
        description:
          type: string
          description: Description of the policy
        isEnabled:
          type: boolean
          description: Whether the policy is enabled or disabled
          default: true
        method:
          type: string
          description: Type of policy
          enum: *ref_4
          externalDocs: *ref_5
        action:
          type: string
          description: The action to take if the policy is violated
          enum: *ref_6
          default: NONE
          externalDocs: *ref_7
        methodParams:
          type: object
          description: >-
            The arguments for the policy. These differ depending on the policy
            type
          externalDocs: *ref_13
        decisionParams:
          type: object
          description: >-
            The parameters for determining the policy action from outputs. These
            differ depending on the policy type
          externalDocs: *ref_8
        language:
          type: string
          description: The language of the policy
          enum: *ref_9
        applicableTo:
          type: string
          description: Which type of message the policy should apply to
          enum: *ref_10
          default: ALL
        created_at:
          format: date-time
          type: string
          description: Creation time of the policy
        creatorId:
          type: string
          description: Creator id of the policy
        updated_at:
          format: date-time
          type: string
          description: Time the policy was last updated
        usecaseId:
          type: string
          description: Usecase id of the policy
        allowedBehaviors:
          description: List of allowed behaviors. Only available for content policies.
          type: array
          items:
            type: string
        disallowedBehaviors:
          description: List of disallowed behaviors. Only available for content policies.
          type: array
          items:
            type: string
        stage:
          type: string
          description: >-
            The stage of synthetic data generation the policy is in. Only
            available for content policies.
          enum: &ref_14
            - seed
            - reviewReady
            - generatingInReviewReady
            - improve
            - augment
            - approveReady
            - regenerate
            - userDataAugment
        feedback:
          description: Feedback for policy. Only applicable to content policies
          allOf:
            - $ref: '#/components/schemas/InputFeedback'
        trainingStatus:
          type: string
          description: >-
            The training status of the policy. Represents the state of custom
            policies during the creation process
          enum: &ref_15
            - CREATING
            - DATA_GENERATION_QUEUED
            - DATA_GENERATING
            - DATA_GENERATION_FAILED
            - DATA_GENERATION_CANCELLED
            - REVIEWING
            - READY_TO_TRAIN
            - TRAINING_QUEUED
            - TRAINING
            - TRAINING_COMPLETE
            - TRAINING_FAILED
            - TRAINING_CANCELLED
            - NEW_CHANGES_PENDING
        appliedStatus:
          type: string
          description: >-
            The applied status of the policy. Represents whether the policy is
            applied to an AI System
          enum: &ref_16
            - IN_DEVELOPMENT
            - READY_TO_APPLY
            - APPLIED
        resourceDeploymentStatus:
          type: string
          description: >-
            The deployment status of the policy. Represents whether the policy
            is deployed to a resource and inferences can be run on the model
          enum: &ref_17
            - DEPLOYED
            - NOT_DEPLOYED
            - DEPLOYMENT_FAILED
            - SCALING_UP
            - SCALING_DOWN
            - ERROR_FETCHING_STATUS
        trainingStatusDetails:
          description: >-
            Detailed metadata about the training status, including job
            information and queue status. Only present for policies with active
            training processes.
          allOf:
            - $ref: '#/components/schemas/TrainingStatusDetailsDto'
        latestJobStat:
          description: The latest JobStat attached to the policy
          nullable: true
          allOf:
            - $ref: '#/components/schemas/JobStatsDto'
        models:
          description: Models that policy is attached to
          type: array
          items:
            type: string
      required:
        - id
        - name
        - description
        - isEnabled
        - method
        - action
        - methodParams
        - decisionParams
        - language
        - applicableTo
        - created_at
        - creatorId
        - updated_at
        - usecaseId
        - latestJobStat
    PopulatedCreator:
      type: object
      properties:
        id:
          type: string
          description: Id of the creator
        email:
          type: string
          description: Email of the creator
      required:
        - id
        - email
    AugmentedReturnPolicyWithPopulatedCreatorDto:
      type: object
      properties:
        id:
          type: string
          description: Id of the policy
        name:
          type: string
          description: Name of the policy
        description:
          type: string
          description: Description of the policy
        isEnabled:
          type: boolean
          description: Whether the policy is enabled or disabled
          default: true
        method:
          type: string
          description: Type of policy
          enum: *ref_4
          externalDocs: *ref_5
        action:
          type: string
          description: The action to take if the policy is violated
          enum: *ref_6
          default: NONE
          externalDocs: *ref_7
        methodParams:
          type: object
          description: >-
            The arguments for the policy. These differ depending on the policy
            type
          externalDocs: *ref_13
        decisionParams:
          type: object
          description: >-
            The parameters for determining the policy action from outputs. These
            differ depending on the policy type
          externalDocs: *ref_8
        language:
          type: string
          description: The language of the policy
          enum: *ref_9
        applicableTo:
          type: string
          description: Which type of message the policy should apply to
          enum: *ref_10
          default: ALL
        created_at:
          format: date-time
          type: string
          description: Creation time of the policy
        creatorId:
          type: string
          description: Creator id of the policy
        updated_at:
          format: date-time
          type: string
          description: Time the policy was last updated
        usecaseId:
          type: string
          description: Usecase id of the policy
        allowedBehaviors:
          description: List of allowed behaviors. Only available for content policies.
          type: array
          items:
            type: string
        disallowedBehaviors:
          description: List of disallowed behaviors. Only available for content policies.
          type: array
          items:
            type: string
        stage:
          type: string
          description: >-
            The stage of synthetic data generation the policy is in. Only
            available for content policies.
          enum: *ref_14
        feedback:
          description: Feedback for policy. Only applicable to content policies
          allOf:
            - $ref: '#/components/schemas/InputFeedback'
        trainingStatus:
          type: string
          description: >-
            The training status of the policy. Represents the state of custom
            policies during the creation process
          enum: *ref_15
        appliedStatus:
          type: string
          description: >-
            The applied status of the policy. Represents whether the policy is
            applied to an AI System
          enum: *ref_16
        resourceDeploymentStatus:
          type: string
          description: >-
            The deployment status of the policy. Represents whether the policy
            is deployed to a resource and inferences can be run on the model
          enum: *ref_17
        trainingStatusDetails:
          description: >-
            Detailed metadata about the training status, including job
            information and queue status. Only present for policies with active
            training processes.
          allOf:
            - $ref: '#/components/schemas/TrainingStatusDetailsDto'
        latestJobStat:
          description: The latest JobStat attached to the policy
          nullable: true
          allOf:
            - $ref: '#/components/schemas/JobStatsDto'
        models:
          description: Models that policy is attached to
          type: array
          items:
            type: string
        creator:
          description: Information about the policy creator
          allOf:
            - $ref: '#/components/schemas/PopulatedCreator'
      required:
        - id
        - name
        - description
        - isEnabled
        - method
        - action
        - methodParams
        - decisionParams
        - language
        - applicableTo
        - created_at
        - creatorId
        - updated_at
        - usecaseId
        - latestJobStat
        - creator
    AllAugmentedReturnPoliciesDto:
      type: object
      properties:
        total:
          type: number
          description: Total number of policies
        policies:
          description: List of policies
          type: array
          items:
            $ref: '#/components/schemas/AugmentedReturnPolicyWithPopulatedCreatorDto'
      required:
        - total
        - policies
    DeletePolicyResponseDto:
      type: object
      properties:
        failedToDeleteRelatedResources:
          description: List of resource categories that failed to delete during cleanup
          example:
            - guardrail
            - policy_access
          type: array
          items:
            type: string
      required:
        - failedToDeleteRelatedResources
    UpdatePolicyModelsDto:
      type: object
      properties:
        modelIds:
          description: List of model ids to add/remove policy to
          type: array
          items:
            type: string
        action:
          type: string
          description: Operation to perform on models
          enum:
            - ADD
            - REMOVE
            - REPLACE
      required:
        - modelIds
        - action
    CollaboratorWithMultipleRolesDto:
      type: object
      properties:
        userEmail:
          type: string
          description: Email of the collaborator
        resourceLevelRoles:
          description: Role of the collaborator at which this resource is being shared
          type: array
          items:
            type: string
      required:
        - userEmail
        - resourceLevelRoles
    CollaboratorDto:
      type: object
      properties:
        userEmail:
          type: string
          description: Email of the collaborator
      required:
        - userEmail
    ResourcePublicAccessDto:
      type: object
      properties:
        isPublic:
          type: boolean
          description: Whether the resource is shared with public
        publicResourceLevelRoles:
          description: The role at which the public is allowed to access this resource
          type: array
          items:
            type: string
      required:
        - isPublic
    ShareResourceDto:
      type: object
      properties:
        collaborators:
          description: List of collaborators with the permissions to the resource
          type: array
          items:
            $ref: '#/components/schemas/CollaboratorDto'
        isPublic:
          type: boolean
          description: Whether the resource is shared with public
        publicResourceLevelRoles:
          description: The role at which the public is allowed to access this resource
          type: array
          items:
            type: string
      required:
        - collaborators
        - isPublic
    AddUseCaseDto:
      type: object
      properties: {}
    GetUsecaseReturnDto:
      type: object
      properties: {}
    UpdatePolicyDecisionParamsDto:
      type: object
      properties:
        classification_threshold:
          type: number
          description: Classification threshold value between 0 and 1
          minimum: 0
          maximum: 1
      required:
        - classification_threshold
    GeneratedDto:
      type: object
      properties:
        response:
          type: string
          description: Generated response string
          example: Factory design pattern is a creational pattern...
        isCompliant:
          type: object
          description: >-
            Whether the generated content is compliant (can be null if
            borderline)
          example: true
        prompt:
          type: string
          description: Prompt string used to generate the response
          example: Can you please tell me what factory design pattern is?
        rationale:
          type: string
          description: Rationale behind the response
          example: Prompt is asking for a design pattern explanation, which is safe.
        trickiness:
          type: string
          description: Trickiness level of the generated datapoint
          enum:
            - in_domain
            - borderline
            - diverse
            - jailbreak
            - aligned
            - neutral
            - inapplicable
          example: in_domain
        relevantBehaviors:
          description: Relevant behaviors for the generated response
          example:
            - Can talk about design principles
          type: array
          items:
            type: string
        violatedCategoriesResolutionCodes:
          description: Violated categories resolution codes if any
          example:
            - category_123
          type: array
          items:
            type: string
        policyAnalysisRationale:
          type: string
          description: Policy analysis rationale if any
          example: This response is safe
      required:
        - prompt
        - rationale
    ReviewDto:
      type: object
      properties:
        prompt:
          type: string
          description: Revised/updated prompt (if applicable)
          example: Can you please tell me what factory design pattern is?
        isCompliant:
          type: boolean
          description: Whether the content is compliant
          example: true
        isAccepted:
          type: boolean
          description: Whether the content is accepted
          example: true
        feedback:
          type: string
          description: Additional feedback about the prompt/response
          example: >-
            Prompt is asking for a design pattern explanation and the response
            answers it, which is safe.
        response:
          type: string
          description: Revised/updated response (if applicable)
          example: Factory design pattern is a creational pattern...
    UpdateGuardrailDatapointDto:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the datapoint
          example: datapoint_123
        round:
          type: number
          description: Round number for the datapoint
          example: 2
        generated:
          description: Generated data for this datapoint
          allOf:
            - $ref: '#/components/schemas/GeneratedDto'
        review:
          description: Optional review data for this datapoint
          allOf:
            - $ref: '#/components/schemas/ReviewDto'
        creatorType:
          type: string
          description: Type of creator for this datapoint
          enum:
            - user
            - model
            - file-upload
            - generated
            - feedback
          example: generated
        creatorId:
          type: string
          description: MongoDB ObjectId of the creator
          example: 507f1f77bcf86cd799439011
      required:
        - id
        - round
        - generated
    UpdateGuardrailDatasetDto:
      type: object
      properties:
        stage:
          type: string
          description: Stage of the guardrail dataset
          example: REVIEW
        dataset:
          description: Array of datapoints for the guardrail dataset
          type: array
          items:
            $ref: '#/components/schemas/UpdateGuardrailDatapointDto'
        bestTemperature:
          type: number
          description: Best temperature determined so far
          example: 0.7
        bestInstruction:
          type: string
          description: Best instruction determined so far
          example: You are an expert in providing helpful responses...
    CreateGuardrailDatasetDto:
      type: object
      properties:
        allowedBehaviors:
          description: An array of allowed behaviors
          example:
            - Can talk about generic programming questions.
            - Can talk about design principles.
          type: array
          items:
            type: string
        disallowedBehaviors:
          description: An array of disallowed behaviors
          example:
            - Cannot talk about tax advise.
            - Cannot talk about investment advise.
          type: array
          items:
            type: string
        manualCreation:
          type: boolean
          description: Indicates whether this dataset was manually created
          example: false
      required:
        - manualCreation
    DatapointDto:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the datapoint
          example: dp_123
        round:
          type: number
          description: Round number for the datapoint
          example: 1
        generated:
          description: Generated data for the datapoint
          allOf:
            - $ref: '#/components/schemas/GeneratedDto'
        review:
          description: Review data for the datapoint (if any)
          allOf:
            - $ref: '#/components/schemas/ReviewDto'
        creatorType:
          type: string
          description: Type of creator for this datapoint
          enum:
            - user
            - model
            - file-upload
            - generated
            - feedback
          example: user
        creatorId:
          type: string
          description: ID of the creator if available
          example: user_abc
        createdAt:
          format: date-time
          type: string
          description: Creation timestamp
          example: '2024-03-14T12:00:00Z'
        updatedAt:
          format: date-time
          type: string
          description: Last update timestamp
          example: '2024-03-14T12:00:00Z'
      required:
        - id
        - round
        - generated
        - creatorType
    PageDetailsDto:
      type: object
      properties:
        page:
          type: number
          description: Current page number
          example: 1
        limit:
          type: number
          description: Number of items per page
          example: 100
        totalPages:
          type: number
          description: Total number of pages
          example: 28
        totalItems:
          type: number
          description: Total number of items
          example: 2750
      required:
        - page
        - limit
        - totalPages
        - totalItems
    ObjectId:
      type: object
      properties: {}
    FeedbackGuardrailDatasetDto:
      type: object
      properties:
        _id:
          description: MongoDB ObjectId of the dataset
          example: 507f1f77bcf86cd799439011
          allOf:
            - $ref: '#/components/schemas/ObjectId'
        promptId:
          type: string
          description: ID of the prompt (optional if not applicable)
          example: prompt_123
        generated:
          description: Generated data associated with this feedback
          allOf:
            - $ref: '#/components/schemas/GeneratedDto'
        review:
          description: Review data associated with this feedback
          allOf:
            - $ref: '#/components/schemas/ReviewDto'
        creatorType:
          type: string
          description: Type of creator for this datapoint
          enum:
            - user
            - model
            - file-upload
            - generated
            - feedback
          example: user
        creator:
          description: MongoDB ObjectId of the creator
          example: 507f1f77bcf86cd799439012
          allOf:
            - $ref: '#/components/schemas/ObjectId'
        createdAt:
          format: date-time
          type: string
          description: Creation timestamp in string format
          example: '2024-03-14T12:00:00Z'
        updatedAt:
          format: date-time
          type: string
          description: Last update timestamp in string format
          example: '2024-03-14T12:00:00Z'
      required:
        - _id
        - generated
        - review
        - creatorType
        - creator
    ReturnGuardrailDatasetDto:
      type: object
      properties:
        policyId:
          type: string
          description: Policy ID this dataset belongs to
          example: policy_12345
        creator:
          type: string
          description: Creator of this dataset (ID or name)
          example: admin
        allowedBehaviors:
          description: List of allowed behaviors for the policy
          example:
            - Can talk about design principles
            - Can talk about generic programming questions
          type: array
          items:
            type: string
        disallowedBehaviors:
          description: List of disallowed behaviors for the policy
          example:
            - Cannot talk abouttax advise
            - Cannot talk about investment advise
          type: array
          items:
            type: string
        stage:
          type: string
          description: Stage of the guardrail dataset
          enum:
            - seed
            - reviewReady
            - generatingInReviewReady
            - improve
            - augment
            - approveReady
            - regenerate
            - userDataAugment
          example: seed
        currentRound:
          type: number
          description: Current round number of the dataset
          example: 2
        dataset:
          description: All datapoints in this guardrail dataset
          type: array
          items:
            $ref: '#/components/schemas/DatapointDto'
        datasetPageDetails:
          description: Pagination details for the dataset
          allOf:
            - $ref: '#/components/schemas/PageDetailsDto'
        feedback:
          description: Feedback items associated with this guardrail dataset
          type: array
          items:
            $ref: '#/components/schemas/FeedbackGuardrailDatasetDto'
        version:
          type: number
          description: Version number of the dataset
          example: 3
        bestTemperature:
          type: number
          description: Best temperature determined for generation
          example: 0.8
        bestInstruction:
          type: string
          description: Best instruction determined for generation
          example: You are an expert in providing helpful responses...
        created_at:
          format: date-time
          type: string
          description: Creation timestamp
          example: '2024-03-14T12:00:00Z'
        updated_at:
          format: date-time
          type: string
          description: Last update timestamp
          example: '2024-03-14T12:00:00Z'
      required:
        - policyId
        - creator
        - stage
        - currentRound
        - dataset
        - feedback
    ReviewedInputGuardrailDataset:
      type: object
      properties:
        isAccepted:
          type: boolean
          description: >-
            Whether the datapoint is accepted by the user. False means it was
            discarded.
          example: true
        prompt:
          type: string
          description: The prompt string of the datapoint
          example: Can you please tell me what factory design pattern is?
        isCompliant:
          type: boolean
          description: Indicates if the prompt is compliant with the policy
          example: true
        feedback:
          type: string
          description: Any user feedback on the prompt
          example: The prompt seems compliant and safe for our guardrail.
        id:
          type: string
          description: Unique identifier for the datapoint
          example: abc123
      required:
        - isAccepted
        - id
    UpdateInputGuardrailDatasetDto:
      type: object
      properties:
        reviewedDataset:
          description: Array of reviewed guardrail datapoints for input
          type: array
          items:
            $ref: '#/components/schemas/ReviewedInputGuardrailDataset'
      required:
        - reviewedDataset
    ReviewedOutputGuardrailDataset:
      type: object
      properties:
        isAccepted:
          type: boolean
          description: >-
            Whether the datapoint is accepted by the user. False means it was
            discarded.
          example: true
        prompt:
          type: string
          description: The prompt string of the datapoint
          example: Can you please tell me what factory design pattern is?
        isCompliant:
          type: boolean
          description: Indicates if the prompt is compliant with the policy
          example: true
        feedback:
          type: string
          description: Any user feedback on the prompt
          example: The prompt seems compliant and safe for our guardrail.
        id:
          type: string
          description: Unique identifier for the datapoint
          example: def456
        response:
          type: string
          description: The response string of the datapoint
          example: 42 is the meaning of life.
        userName:
          type: string
          description: Name of the user who reviewed the datapoint
          example: Alice
        userId:
          type: string
          description: User ID of the reviewer
          example: user_12345
        updateTime:
          type: string
          description: Timestamp of the review update (string format)
          example: '2024-03-14T12:00:00Z'
      required:
        - isAccepted
        - id
    UpdateOutputGuardrailDatasetDto:
      type: object
      properties:
        reviewedDataset:
          description: Array of reviewed guardrail datapoints for output
          type: array
          items:
            $ref: '#/components/schemas/ReviewedOutputGuardrailDataset'
      required:
        - reviewedDataset
    ApplyGuardrailFeedbackDto:
      type: object
      properties:
        ids:
          description: Array of feedback item IDs to apply
          example:
            - feedback_111
            - feedback_222
          type: array
          items:
            type: string
      required:
        - ids
    ApplyGuardrailFeedbackResponseDto:
      type: object
      properties:
        datapointIds:
          description: Array of IDs of the newly created datapoints
          example: &ref_21
            - 123e4567-e89b-12d3-a456-426614174000
            - 123e4567-e89b-12d3-a456-426614174001
          type: array
          items:
            type: string
      required:
        - datapointIds
    RejectGuardrailFeedbackDto:
      type: object
      properties:
        ids:
          description: Array of feedback item IDs to reject
          example:
            - feedback_333
            - feedback_444
          type: array
          items:
            type: string
      required:
        - ids
    GetFinetunedModelDto:
      type: object
      properties:
        status:
          type: string
          description: Status of the fine-tuning process
          enum: &ref_18
            - QUEUED
            - TRAINING
            - TRAINED
            - DEPLOYING
            - COMPLETED
            - DEPLOYMENT_FAILED
            - FAILED
            - CANCELLED
          example: COMPLETED
        deploymentId:
          description: Id of the underlying kubernetes deployment
          example: no-political-advice-09809a0c098efb0
          type: array
          items:
            type: string
        creator:
          type: string
          description: Creator of the model
          example: user_123
        policyIds:
          description: List of associated policy IDs
          example:
            - 68ac89f890a89f890a89f890
          type: array
          items:
            $ref: '#/components/schemas/ObjectId'
        modelType:
          type: string
          description: Type of the model
          enum:
            - input_mini
            - output_mini
            - input_large
            - output_medium
            - output_3p
          example: input_mini
        fineTunedModelZipS3Path:
          type: string
          description: Path to the fine-tuned model zip in S3
          example: s3://my-bucket/models/model.zip
        isModelEncrypted:
          type: boolean
          description: Is the model encrypted
          example: true
        trainingJobId:
          type: string
          description: ID of the training job
          example: job_123
        errorMessage:
          type: string
          description: Error message during training of the model
      required:
        - status
        - deploymentId
        - creator
        - policyIds
        - modelType
        - fineTunedModelZipS3Path
        - isModelEncrypted
        - trainingJobId
        - errorMessage
    GetFineTunedModelInfoDto:
      type: object
      properties:
        status:
          type: string
          description: Status of the fine-tuning process
          enum: *ref_18
          example: COMPLETED
        modelId:
          type: string
          description: ID of the model
          example: finetuned_model_abc
        policyIds:
          description: List of associated policy IDs
          example:
            - policy_123
            - policy_456
          type: array
          items:
            type: string
        deploymentId:
          description: Id of the underlying kubernetes deployment
          example: no-political-advice-09809a0c098efb0
          type: array
          items:
            type: string
      required:
        - status
        - modelId
        - policyIds
        - deploymentId
    FineTunedModelDeploymentStatusDto:
      type: object
      properties:
        status:
          type: string
          enum:
            - COMPLETED
            - FAILED
            - IN_PROGRESS
            - DEPLOYMENT_DOES_NOT_EXIST
            - UNKNOWN
          description: The current status of the deployment
          example: COMPLETED
        reason:
          type: string
          enum:
            - DeploymentReady
            - ScaledToZero
            - DeploymentProgressing
            - DeploymentNotReady
            - ModelClassMissing
            - FetchModelClassError
            - InvalidSpec
            - DeploymentError
            - ServiceError
            - MinimumReplicasUnavailable
            - ProgressDeadlineExceeded
          description: The reason for the current status
        message:
          type: string
          description: A human-readable message explaining the status
        readyReplicas:
          type: number
          description: The number of ready replicas
        observedGeneration:
          type: number
          description: The observed generation of the deployment
        modelPhase:
          type: string
          description: The phase of the deployment
      required:
        - status
    UpdateFinetunedModelInfoDto:
      type: object
      properties:
        status:
          type: string
          description: Status of the fine-tuning process
          enum:
            - QUEUED
            - TRAINING
            - TRAINED
            - DEPLOYING
            - COMPLETED
            - DEPLOYMENT_FAILED
            - FAILED
            - CANCELLED
          example: QUEUED
        datasetS3Path:
          type: string
          description: Path to the dataset in S3
          example: s3://my-bucket/datasets/dataset.csv
        fineTunedModelZipS3Path:
          type: string
          description: Path to the fine-tuned model zip in S3
          example: s3://my-bucket/models/model.zip
        isModelEncrypted:
          type: boolean
          description: Is the model encrypted
          example: true
        error:
          type: string
          description: Error message if training fails
          example: Out of memory error
      required:
        - status
    UpdateGuardrailConfigDto:
      type: object
      properties:
        name:
          type: string
          description: Name of the guardrail config
          example: No tax/investment advise
        description:
          type: string
          description: Description of the guardrail config
          example: This guardrail prevents tax and investment advise.
        allowedBehaviors:
          description: List of allowed behaviors
          example: &ref_19
            - Can talk about generic programming questions
            - Can talk about design principles
          type: array
          items:
            type: string
        disallowedBehaviors:
          description: List of disallowed behaviors
          example: &ref_20
            - Cannot talk about tax advise
            - Cannot talk about investment advise
          type: array
          items:
            type: string
    ReturnGuardrailConfigDto:
      type: object
      properties:
        name:
          type: string
          description: Name of the guardrail config
          example: No tax/investment advise
        description:
          type: string
          description: Description of the guardrail config
          example: This guardrail prevents tax and investment advise.
        allowedBehaviors:
          description: List of allowed behaviors
          example: *ref_19
          type: array
          items:
            type: string
        disallowedBehaviors:
          description: List of disallowed behaviors
          example: *ref_20
          type: array
          items:
            type: string
        _id:
          description: Unique identifier of the guardrail config
          example: 507f1f77bcf86cd799439011
          allOf:
            - $ref: '#/components/schemas/ObjectId'
        policyId:
          type: string
          description: ID of the associated policy
          example: 507f1f77bcf86cd799439012
        version:
          type: number
          description: Version number of the config
          example: 1
        created_at:
          format: date-time
          type: string
          description: Creation timestamp
          example: '2024-03-14T12:00:00Z'
        updated_at:
          format: date-time
          type: string
          description: Last update timestamp
          example: '2024-03-14T12:00:00Z'
      required:
        - _id
        - policyId
        - version
        - created_at
        - updated_at
    AddGuardrailDatasetPointsDto:
      type: object
      properties:
        dataset:
          description: An array of datapoints to add to the guardrail dataset
          type: array
          items:
            $ref: '#/components/schemas/UpdateGuardrailDatapointDto'
      required:
        - dataset
    AddUserDefinedGuardrailDatasetPointDto:
      type: object
      properties:
        prompt:
          type: string
          description: Prompt text for the user-defined dataset point
          example: Can you please tell me what factory design pattern is?
        response:
          type: string
          description: In case of output guard-rails, the response for the prompt
          example: 'Factory design pattern is a creational pattern... '
        isCompliant:
          type: boolean
          description: Indicates if the datapoint is compliant
          example: true
      required:
        - prompt
        - isCompliant
    AddUserDefinedDatapointResponseDto:
      type: object
      properties:
        datapointIds:
          description: Array of IDs of the newly created datapoints
          example: *ref_21
          type: array
          items:
            type: string
      required:
        - datapointIds
    UpdateGuardrailDatasetPointDto:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier for the dataset point
          example: xyz789
        prompt:
          type: string
          description: The prompt text for the dataset point
          example: Can you please tell me what factory design pattern is?
        response:
          type: string
          description: In case of output guard-rails, response for the dataset point
          example: 'Factory design pattern is a creational pattern... '
        isAccepted:
          type: boolean
          description: Indicates if the datapoint is accepted
          example: true
        isCompliant:
          type: boolean
          description: Indicates if the datapoint is compliant
          example: true
      required:
        - id
        - prompt
    DeleteGuardrailDatasetPointsDto:
      type: object
      properties:
        ids:
          description: Array of IDs to delete
          example:
            - xyz789
            - abc456
          type: array
          items:
            type: string
      required:
        - ids
    VersionInfoDto:
      type: object
      properties:
        grdVersion:
          type: string
          description: Guardrail dataset version
          example: v2
        grdConfigVersion:
          type: string
          description: Guardrail config version
          example: v1.1
      required:
        - grdVersion
        - grdConfigVersion
    RestoredFromDto:
      type: object
      properties:
        id:
          type: string
          description: ID of the version restored from
          example: 507f1f77bcf86cd799439011
        title:
          type: string
          description: Title of the version restored from
          example: Version 1.0
      required:
        - id
        - title
    DiffDto:
      type: object
      properties:
        type:
          type: string
          enum:
            - init
            - name
            - description
            - feedback
            - training_data
            - behaviors
            - restore
          description: Type of diff
          example: behaviors
        additions:
          type: number
          description: Number of additions
          example: 5
        deletions:
          type: number
          description: Number of deletions
          example: 2
        updations:
          type: number
          description: Number of updates
          example: 1
        restoredFrom:
          description: For RESTORE diffs, details about the version restored from
          allOf:
            - $ref: '#/components/schemas/RestoredFromDto'
      required:
        - type
    CreatorInfoDto:
      type: object
      properties:
        email:
          type: string
          description: Email address of the creator
          example: user@example.com
      required:
        - email
    GuardrailDiffDto:
      type: object
      properties:
        _id:
          description: MongoDB ObjectId for the diff
          example: 507f1f77bcf86cd799439011
          allOf:
            - $ref: '#/components/schemas/ObjectId'
        currentVersion:
          description: Information about the current version
          allOf:
            - $ref: '#/components/schemas/VersionInfoDto'
        previousVersion:
          description: Information about the previous version (if any)
          allOf:
            - $ref: '#/components/schemas/VersionInfoDto'
        policyId:
          type: string
          description: Associated policy ID
          example: policy_abc
        diff:
          description: Array of diffs indicating changes
          type: array
          items:
            $ref: '#/components/schemas/DiffDto'
        status:
          type: string
          description: Training status after these diffs
          enum:
            - in_training
            - training_failed
            - cancelled
            - awaiting_training
            - trained
          example: in_training
        creator:
          description: Creator information of these diffs
          allOf:
            - $ref: '#/components/schemas/CreatorInfoDto'
        createdAt:
          format: date-time
          type: string
          description: Timestamp when the diff was created
          example: '2025-01-01T12:00:00Z'
        updatedAt:
          format: date-time
          type: string
          description: Timestamp when the diff was last updated
          example: '2025-01-02T15:00:00Z'
        isInitalChange:
          type: boolean
          description: >-
            (Deprecated) determines if the diff is an initial change occurred
            before approve ready stage
          example: false
        isPreApproveReadyChange:
          type: boolean
          description: >-
            Determines if the diff is a change occurred before approve ready
            stage
          example: false
      required:
        - _id
        - currentVersion
        - policyId
        - diff
        - status
        - creator
        - createdAt
        - updatedAt
    GetPendingChangesResponseDto:
      type: object
      properties:
        diffs:
          description: Array of diffs describing the changes
          type: array
          items:
            $ref: '#/components/schemas/GuardrailDiffDto'
        shouldRegenerate:
          type: boolean
          description: Whether the model should be regenerated
          example: true
      required:
        - diffs
        - shouldRegenerate
    StartTrainingDto:
      type: object
      properties:
        title:
          type: string
          description: Optional title for the current model training session
          example: Training session 1
        description:
          type: string
          description: Description of the training session
          example: This training focuses on moderate content response behaviors.
      required:
        - description
    StartTrainingResponseDto:
      type: object
      properties:
        diffs:
          description: Array of diffs describing the changes
          type: array
          items:
            $ref: '#/components/schemas/GuardrailDiffDto'
        shouldRegenerate:
          type: boolean
          description: Whether the model should be regenerated
          example: true
      required:
        - diffs
        - shouldRegenerate
    CancelTrainingResponseDto:
      type: object
      properties:
        diffs:
          description: Array of diffs describing the changes
          type: array
          items:
            $ref: '#/components/schemas/GuardrailDiffDto'
        shouldRegenerate:
          type: boolean
          description: Whether the model should be regenerated
          example: true
      required:
        - diffs
        - shouldRegenerate
    UpdateTrainingStatusDto:
      type: object
      properties:
        fineTunedModeId:
          type: string
          description: ID of the fine-tuned model
          example: finetuned_007
        isSuccess:
          type: boolean
          description: Indicates if the training was successful
          example: true
        bestInstruction:
          type: string
          description: Best instruction found during training
          example: You are an expert in providing helpful responses...
        bestTemperature:
          type: number
          description: Best temperature found during training
          example: 0.7
      required:
        - fineTunedModeId
        - isSuccess
    VersionDetailsDto:
      type: object
      properties:
        id:
          description: MongoDB ObjectId for the version details
          example: 507f1f77bcf86cd799439011
          allOf:
            - $ref: '#/components/schemas/ObjectId'
        title:
          type: string
          description: Title of this version
          example: Minor changes on policy_xxx
        description:
          type: string
          description: Description of this version
          example: Fixed mistakes and updated instructions.
        creator:
          description: Creator info for this version
          allOf:
            - $ref: '#/components/schemas/CreatorInfoDto'
        createdAt:
          format: date-time
          type: string
          description: When this version was created
          example: '2025-01-01T10:00:00Z'
      required:
        - id
        - title
        - description
        - creator
        - createdAt
    GuardrailVersionDto:
      type: object
      properties:
        policyId:
          description: Policy ID as a MongoDB ObjectId
          example: 507f1f77bcf86cd799439011
          allOf:
            - $ref: '#/components/schemas/ObjectId'
        diffs:
          description: Array of diffs for this guardrail version
          type: array
          items:
            $ref: '#/components/schemas/GuardrailDiffDto'
        versionInfo:
          description: Details about this version
          allOf:
            - $ref: '#/components/schemas/VersionDetailsDto'
      required:
        - policyId
        - diffs
        - versionInfo
    RestoreVersionDto:
      type: object
      properties:
        versionId:
          type: string
          description: ID of the version to revert to
          example: version_123
      required:
        - versionId
    UploadCsvResponseDto:
      type: object
      properties:
        datapointIds:
          description: >-
            Array of IDs of affected datapoints from the CSV upload. This
            includes: (1) newly added datapoints that did not match any existing
            entries, and (2) replaced datapoints when "Replace duplicates" is
            selected. Replaced datapoints are those where an uploaded entry
            matched an existing datapoint (based on prompt + response) and
            updated its isCompliant/rationale fields. 
          example:
            - 123e4567-e89b-12d3-a456-426614174000
            - 123e4567-e89b-12d3-a456-426614174001
          type: array
          items:
            type: string
      required:
        - datapointIds
    AugmentDatapointsDto:
      type: object
      properties:
        datapointIds:
          description: Array of datapoint IDs to augment (maximum 100)
          example:
            - 123e4567-e89b-12d3-a456-426614174000
            - 123e4567-e89b-12d3-a456-426614174001
          type: array
          items:
            type: string
      required:
        - datapointIds
    UpdateDeploymentStatusDto:
      type: object
      properties:
        deploymentStatus:
          type: string
          description: New status of the model deployment
          enum:
            - COMPLETED
            - FAILED
            - IN_PROGRESS
            - DEPLOYMENT_DOES_NOT_EXIST
            - UNKNOWN
          example: COMPLETED
        reason:
          type: string
          description: Reason of the model deployment
          example: DeploymentReady
      required:
        - deploymentStatus
    InClusterModelResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the in-cluster model
          example: '1'
        deploymentId:
          type: string
          description: Deployment ID of the in-cluster model
          example: deploy-123
        deploymentStatus:
          type: string
          description: Status of the model deployment
          enum:
            - COMPLETED
            - FAILED
            - IN_PROGRESS
            - DEPLOYMENT_DOES_NOT_EXIST
            - UNKNOWN
          example: IN_PROGRESS
        reason:
          type: string
          description: Reason for the deployment status
          example: DeploymentReady
          nullable: true
        createdAt:
          format: date-time
          type: string
          description: Timestamp when the model was created
          example: '2024-01-01T00:00:00.000Z'
        updatedAt:
          format: date-time
          type: string
          description: Timestamp when the model was last updated
          example: '2024-01-01T00:00:00.000Z'
      required:
        - id
        - deploymentId
        - deploymentStatus
        - createdAt
        - updatedAt
    ExtensionAnalyzeDto:
      type: object
      properties:
        messages:
          description: OpenAI style messages with optional RAG context to analyze
          type: array
          items:
            $ref: '#/components/schemas/AnalyzeMessage'
        textType:
          type: string
          description: Whether last message is a prompt or response
          enum: *ref_22
        inheritPolicies:
          type: boolean
          description: Whether to inherit policies from the modelId passed
          default: false
        modelId:
          type: string
          description: The model id of the LLM to associate inference with
        clientId:
          type: string
          description: The client id of the sender
        metadata:
          type: object
          description: Metadata to be attached to the request
        loggingControl:
          description: Logging control settings
          allOf:
            - $ref: '#/components/schemas/LoggingControlDto'
        multiturnMetadata:
          type: object
          description: Multi turn metadata to be attached to the request
        domain:
          type: string
          description: Domain of the chatbot the user is interacting with
      required:
        - messages
        - textType
        - domain
    CreateApplicationDto:
      type: object
      properties:
        name:
          type: string
          description: Name of the application
          example: Chat Application
        tag:
          type: string
          description: Tag/description of the application
          example: AI-powered chat application for customer support
        aiSystems:
          description: IDs of AI systems to associate with the application
          example:
            - 6078f9b8b328f40068b9fd1b
            - 6078f9b8b328f40068b9fd1c
          type: array
          items:
            type: string
      required:
        - name
    CreateApplicationResponseDto:
      type: object
      properties:
        id:
          type: string
          example: '123'
          description: The unique identifier of the application.
        name:
          type: string
          example: My Awesome App
          description: The name of the application.
        tag:
          type: object
          example: v1.0
          description: The tag for the application.
          nullable: true
        createdAt:
          format: date-time
          type: string
          description: The date and time the application was created.
        createdBy:
          type: object
          description: The user ID of the creator.
          nullable: true
        updatedAt:
          format: date-time
          type: string
          description: The date and time the application was last updated.
        metadata:
          type: object
          description: >-
            Optional metadata for the application. Can be any valid JSON value
            (object, array, string, number, boolean, or null).
          nullable: true
      required:
        - id
        - name
        - tag
        - createdAt
        - createdBy
        - updatedAt
        - metadata
    AllApplicationsDto:
      type: object
      properties: {}
    ApplicationDto:
      type: object
      properties: {}
    AllAiSystemsForApplicationDto:
      type: object
      properties: {}
    ApplicationLogEntryDto:
      type: object
      properties:
        timestamp:
          type: string
          description: UTC timestamp of interaction
        analyses:
          description: Analyses used during the interaction. Will be of length at most 2
          type: array
          items:
            $ref: '#/components/schemas/ReturnAnalysisWithFeedback'
        action:
          type: string
          description: Most severe action of the analyses
          enum: *ref_23
        metadata:
          type: object
          description: metadata
        multiturnMetadata:
          type: object
          description: Multi-Turn metadata
        applicationAiSystemId:
          type: string
          description: AI System MongoDB ID
          example: 507f1f77bcf86cd799439011
        applicationAiSystemName:
          type: string
          description: AI System Name
          nullable: true
          example: GPT-4 Content Moderator
        applicationAiSystemRemovedAt:
          type: string
          description: >-
            ISO 8601 date when AI system was removed from application, null if
            still active
          nullable: true
          example: '2024-01-15T10:30:00.000Z'
      required:
        - timestamp
        - analyses
        - action
        - applicationAiSystemId
        - applicationAiSystemName
        - applicationAiSystemRemovedAt
    ApplicationLogsResponseDto:
      type: object
      properties:
        logs:
          description: Array of log entries with application-specific fields
          type: array
          items:
            $ref: '#/components/schemas/ApplicationLogEntryDto'
        totalCount:
          type: number
          description: Total number of matching logs
          example: 150
        warnings:
          description: Warning the user should be aware of
          type: array
          items:
            $ref: '#/components/schemas/UserWarning'
      required:
        - logs
        - totalCount
        - warnings
    AssignAiSystemsDto:
      type: object
      properties:
        addAiSystems:
          description: Array of MongoDB MLModel IDs to add to the application.
          example:
            - 6078f9b8b328f40068b9fd1d
            - 6078f9b8b328f40068b9fd2e
          type: array
          items:
            type: string
        removeAiSystems:
          description: Array of MongoDB MLModel IDs to remove from the application.
          example:
            - 6078f9b8b328f40068b9fd1d
            - 6078f9b8b328f40068b9fd2e
          type: array
          items:
            type: string
    ProcessedAssignDetailDto:
      type: object
      properties:
        aiSystemId:
          type: string
          description: The ID of the AI System (MLModel) processed.
          example: 6078f9b8b328f40068b9fd1d
        operationType:
          type: string
          description: The operation type for this AI System.
          enum:
            - ADD
            - REMOVE
          example: ADD
        operationStatus:
          type: string
          description: The detailed processing status for this AI System.
          enum:
            - SUCCESS_ADDED_POLICIES_SYNCED
            - SUCCESS_REMOVED
            - SUCCESS_REMOVED_MONGO_SYNC_FAILED
            - SUCCESS_ADDED_POLICY_SYNC_FAILED_MONGO
            - SUCCESS_POLICIES_REPLACED
            - SUCCESS_REACTIVATED
            - SKIPPED_ALREADY_LINKED
            - SKIPPED_NOT_LINKED_TO_APP
            - SKIPPED_ALREADY_REMOVED
            - SKIPPED_INVALID_ID_FORMAT
            - SKIPPED_NOT_FOUND_IN_MLMODELS
            - SKIPPED_NOT_FOUND_IN_POLICIES
            - ERROR_ADD_PG_TRANSACTION_FAILED
            - ERROR_ADD_UNSPECIFIED
            - ERROR_REMOVE_FAILED
            - ERROR_REMOVE_MONGO_FAILED
            - ERROR_REMOVE_PG_FAILED
            - ERROR_VALIDATION_MUTUALLY_EXCLUSIVE
            - ERROR_AI_SYSTEM_NOT_FOUND
            - ERROR_MONGO_UPDATE_FAILED
            - ERROR_VALIDATION_FAILED
            - SKIPPED_ALREADY_LINKED_TO_ANOTHER_APP
        status:
          type: boolean
          description: Whether the operation was successful (true) or failed (false).
          example: true
        reason:
          type: string
          description: A human-readable message for the processing result.
        linkedAt:
          type: string
          description: Timestamp when the AI System was linked (if applicable).
          example: '2025-05-19T08:28:17.406Z'
        removedAt:
          type: string
          description: Timestamp when the AI System was removed (if applicable).
          example: '2025-05-19T08:28:17.406Z'
      required:
        - aiSystemId
        - operationType
        - operationStatus
        - status
        - reason
    AssignAiSystemsResponseDto:
      type: object
      properties:
        applicationId:
          type: string
          description: The application ID.
          example: '123'
        processedResults:
          description: Processing results for each AI System.
          type: array
          items:
            $ref: '#/components/schemas/ProcessedAssignDetailDto'
      required:
        - applicationId
        - processedResults
    AssignPoliciesDto:
      type: object
      properties:
        addPolicies:
          description: Array of MongoDB Policy IDs to add to the application.
          example:
            - 6078f9b8b328f40068b9fd1d
            - 6078f9b8b328f40068b9fd2e
          type: array
          items:
            type: string
        removePolicies:
          description: Array of MongoDB Policy IDs to remove from the application.
          example:
            - 6078f9b8b328f40068b9fd1d
            - 6078f9b8b328f40068b9fd2e
          type: array
          items:
            type: string
    ProcessedPolicyAssignDetailDto:
      type: object
      properties:
        policyId:
          type: string
          description: The ID of the Policy processed.
          example: 6078f9b8b328f40068b9fd1d
        operationType:
          type: string
          description: The operation type for this Policy.
          enum:
            - ADD
            - REMOVE
          example: ADD
        operationStatus:
          type: string
          description: The detailed processing status for this Policy.
          enum:
            - SUCCESS_ADDED_POLICIES_SYNCED
            - SUCCESS_REMOVED
            - SUCCESS_REMOVED_MONGO_SYNC_FAILED
            - SUCCESS_ADDED_POLICY_SYNC_FAILED_MONGO
            - SUCCESS_POLICIES_REPLACED
            - SUCCESS_REACTIVATED
            - SKIPPED_ALREADY_LINKED
            - SKIPPED_NOT_LINKED_TO_APP
            - SKIPPED_ALREADY_REMOVED
            - SKIPPED_INVALID_ID_FORMAT
            - SKIPPED_NOT_FOUND_IN_MLMODELS
            - SKIPPED_NOT_FOUND_IN_POLICIES
            - ERROR_ADD_PG_TRANSACTION_FAILED
            - ERROR_ADD_UNSPECIFIED
            - ERROR_REMOVE_FAILED
            - ERROR_REMOVE_MONGO_FAILED
            - ERROR_REMOVE_PG_FAILED
            - ERROR_VALIDATION_MUTUALLY_EXCLUSIVE
            - ERROR_AI_SYSTEM_NOT_FOUND
            - ERROR_MONGO_UPDATE_FAILED
            - ERROR_VALIDATION_FAILED
            - SKIPPED_ALREADY_LINKED_TO_ANOTHER_APP
          example: SUCCESS_ADDED_POLICIES_SYNCED
        status:
          type: boolean
          description: >-
            Boolean indicating overall success (true) or failure (false) of the
            operation.
          example: true
        reason:
          type: string
          description: A human-readable message for the processing result.
          example: Successfully linked and policies synchronized.
        linkedAt:
          type: string
          description: Timestamp when the Policy was linked (if applicable).
          example: '2025-05-19T08:28:17.406Z'
        removedAt:
          type: string
          description: Timestamp when the Policy was removed (if applicable).
          example: '2025-05-19T08:28:17.406Z'
      required:
        - policyId
        - operationType
        - operationStatus
        - status
        - reason
    AssignPoliciesResponseDto:
      type: object
      properties:
        applicationId:
          type: string
          description: The application ID.
          example: '123'
        processedResults:
          description: Processing results for each Policy.
          type: array
          items:
            $ref: '#/components/schemas/ProcessedPolicyAssignDetailDto'
      required:
        - applicationId
        - processedResults
    ManagePoliciesDto:
      type: object
      properties: {}
    ManagePoliciesResponseDto:
      type: object
      properties: {}
    UpdateApplicationDto:
      type: object
      properties:
        name:
          type: string
          description: The updated name of the application.
          example: Enhanced Chat Application
          minLength: 1
          maxLength: 255
        tag:
          type: string
          description: The updated tag or short description for the application.
          example: Updated customer support chat interface
        metadata:
          type: object
          description: Optional metadata for the application, as a JSON object.
          example:
            status: draft
            version: '2.0'
    DeleteApplicationResponseDto:
      type: object
      properties:
        deletedApplicationId:
          type: string
          description: The ID of the successfully deleted application.
          example: 6078f9b8b328f40068b9fd2a
      required:
        - deletedApplicationId
