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

# Add Policy

> Create a new Code of Conduct policy with the rules generated from the atomizer



## OpenAPI

````yaml POST /code-of-conduct/add-policy
openapi: 3.0.0
info:
  title: Enkrypt AI APIs
  version: 2.0.0
servers:
  - url: https://api.enkryptai.com
security:
  - apiKeyAuth: []
tags:
  - name: Guardrails
  - name: Code of Conduct
  - name: Endpoints
  - name: Redteam
    description: >-
      Red Team API: submit red-team / threat-modeling / playground / eval runs,
      then poll run status, records, results and compliance. Also two-phase
      threat modeling (categories + data), dataset retrieval, model health,
      findings and risk mitigation. The previous task-based Red Team API is
      under **Archived**.
  - name: Deployments
  - name: AI Proxy
  - name: Leaderboard
  - name: Archived
  - name: MCP Hub
    description: >-
      MCP Hub vulnerability scanning APIs. Submitting scans (the POST endpoints)
      is open to all authenticated callers. The scan **retrieval** APIs — Get
      Scan Job Status, Get Complete Scan Results, List Scans, and Get MCP Hub
      Scan Statistics (the GET endpoints) — are an **enterprise data-license
      feature**: they require your organization to have MCP Hub API access
      enabled by Enkrypt, otherwise they return `403`. Contact us at
      support@enkryptai.com to enable access.
  - name: MCP Registry Servers
  - name: MCP Gateways
  - name: MCP Playground
  - name: Skill Scanner
    description: >-
      Skill Scanner APIs: submit an agent skill (a directory inside a git
      repository) for security scanning, then read the verdict, the risk level
      and the full report. Scanning is asynchronous — a scan takes roughly 30–90
      seconds, so `POST /skill-hub/scan` returns a `scan_id` you poll.


      You see your organization's scans and nobody else's. The identity comes
      from your API key, never from your request — sending `user_email` is a
      `400`.


      For an organization or project API key, scans are filed under the
      **organization**, so every member sees every scan the organization has
      run, whichever project or member submitted it. For an individual account
      it is simply your own scans. Either way List Skill Scans needs no
      parameter to say who you are.
  - name: Compliance
    description: >-
      Compliance APIs: connect a ChatGPT Enterprise workspace, then keep reading
      its compliance logs and scanning every message through one of your saved
      guardrails.


      Every endpoint here — reads as well as writes — requires the **governance
      officer** role on the project your API key belongs to. The organization
      owner is **not** exempt: an owner who has not been granted the role gets
      `403` like anyone else. An individual (non-organization) account cannot
      hold the role at all, so compliance is an organization-only feature today.


      A scan is addressed by name in the `X-Enkrypt-Scan` header, within the
      project its API key belongs to. Message text is never stored: Get
      Compliance Message fetches it live from the provider, and only while the
      provider still holds it.
paths:
  /code-of-conduct/add-policy:
    post:
      tags:
        - Code of Conduct
      summary: Create CoC Policy
      description: >-
        Create a new Code of Conduct policy. The request's Content-Type only
        picks which body parser is used (`multipart/form-data` vs
        `application/json`) — it does not by itself decide legacy (v1) vs Policy
        Wizard (v2) format. An `application/json` body (see
        `CoCPolicyV2RequestBody`) is unambiguously v2 — the legacy format has
        never been JSON. A `multipart/form-data` body (see
        `CoCPolicyRequestFormData`) can be either format: if a
        `v2_questionnaire` field is present, the submission is treated as v2
        (with `v2_config` also required, both sent as JSON-stringified form
        fields, the same convention `policy_rules` already uses); if absent,
        it's the legacy v1 format (`policy_rules`+`total_rules`, plus one of
        `policy_file`/`policy_text`). `policy_file` (an archived source PDF) is
        optional and valid for either format when submitted via multipart — it's
        not v1-specific. There is no header or out-of-band flag involved; the
        server determines the format purely from the parsed body. The stored
        policy's format is reflected in the response's `is_v2` field.
      operationId: create_coc_policy
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/CoCPolicyRequestFormData'
          application/json:
            schema:
              $ref: '#/components/schemas/CoCPolicyV2RequestBody'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddCoCPolicyResponseObject'
components:
  schemas:
    CoCPolicyRequestFormData:
      type: object
      description: >-
        Either the legacy trio (`policy_rules` + `total_rules`, plus one of
        `policy_file`/`policy_text`) OR the v2 pair (`v2_questionnaire` +
        `v2_config`) must be provided. `policy_file` is optional in EITHER case
        — an archived source PDF is not v1-specific.
      required:
        - name
      properties:
        name:
          type: string
          description: Name of the policy
          example: Healthcare Guidelines
        policy_rules:
          type: string
          description: JSON string containing the policy rules
          example: >-
            1. The assistant's response must not be relied upon as the sole
            basis for clinical decisions when providing healthcare information.

            2. Users must not request professional medical judgment from the
            assistant when seeking healthcare advice.

            3. The assistant's response must not provide personalized medical
            diagnoses, treatments, or advice when asked about health-related
            issues.

            4. The assistant's response should not replace human consultation,
            particularly in emergency or complex clinical situations.

            5. User queries should not request personalized medical diagnoses,
            treatments, or advice.

            6. Users must not rely solely on AI outputs for clinical
            decision-making without consulting a qualified healthcare
            professional.

            7. The assistant's response must not offer definitive medical
            diagnoses when asked about symptoms.

            8. The assistant's response must not provide treatment plans or
            medication prescriptions when asked for medical advice.

            9. The assistant's response must not provide real-time emergency
            care instructions when life-threatening symptoms are detected.

            10. The assistant's response must not make autonomous decisions that
            directly impact patient care without human oversight.

            11. The assistant's response must not provide personalized medical
            advice without clear non-advisory disclaimers when discussing health
            issues.

            12. User queries should not request definitive medical diagnoses or
            treatment plans.

            13. Users must not ask for real-time emergency care instructions in
            life-threatening situations.

            14. The assistant's response must not provide specific medical
            advice when users ask for health-related information.

            15. Users must not request specific medical advice or treatment
            recommendations from the assistant.

            16. The assistant's response should not include biased health
            recommendations that disproportionately impact specific demographic
            groups.

            17. Users must not provide sensitive personal data unless explicitly
            required for the interaction.

            18. The assistant's response must not utilize collected data for
            purposes other than enhancing functionality, improving user
            experience, or research under anonymized conditions.

            19. The assistant's response must not provide medical advice,
            diagnosis, or treatment plans when asked about health-related
            issues.

            20. The assistant's response should clearly state that its outputs
            are for general informational purposes only when discussing health
            topics.

            21. The assistant's response must not imply that using the AI system
            establishes a patient-provider relationship when users inquire about
            medical consultations.

            22. Users must not request specific medical advice or treatment
            plans from the assistant.
        total_rules:
          type: integer
          description: Total number of rules in the policy
          example: 22
          minimum: 1
        policy_file:
          type: string
          format: binary
          description: >-
            Optional archived PDF of the policy document. Valid alongside either
            the legacy `policy_rules`/`total_rules`/`policy_text` trio or the v2
            `v2_questionnaire`/`v2_config` pair — this field is not v1-specific.
        policy_text:
          type: string
          description: >-
            Optional policy text content if not provided in the file. Legacy
            (v1) field only.
          nullable: true
          default: '""'
        v2_questionnaire:
          allOf:
            - $ref: '#/components/schemas/WizardProfile'
          description: >-
            The Policy Wizard questionnaire this policy was generated from. Sent
            as a JSON-stringified form field (parsed server-side), the same
            convention `policy_rules` already uses. Presence of this field is
            what marks a multipart submission as v2 — required together with
            `v2_config` in that case; omit both to submit the legacy v1 format
            instead.
        v2_config:
          allOf:
            - $ref: '#/components/schemas/PolicyWizardGenerateRulesResponse'
          description: >-
            The full generate-rules response (enabled/disabled rules + stats)
            this policy stores, verbatim. Sent as a JSON-stringified form field
            (parsed server-side), the same convention `policy_rules` already
            uses. Required together with `v2_questionnaire` to submit a Policy
            Wizard (v2) policy via multipart.
    CoCPolicyV2RequestBody:
      title: CoCPolicyV2RequestBody
      description: >-
        Policy Wizard (v2) request body for add-policy/modify-policy, sent as
        application/json (as opposed to the legacy multipart/form-data body
        described by CoCPolicyRequestFormData). v2_questionnaire is the
        WizardProfile produced by /guardrails/policy-wizard/infer-document (or
        authored directly), and v2_config is the full response of
        /guardrails/policy-wizard/generate-rules, stored verbatim.
      type: object
      properties:
        name:
          type: string
          description: Name of the policy
          example: Retail Bank CoC v2
        v2_questionnaire:
          allOf:
            - $ref: '#/components/schemas/WizardProfile'
          description: The Policy Wizard questionnaire this policy was generated from.
        v2_config:
          allOf:
            - $ref: '#/components/schemas/PolicyWizardGenerateRulesResponse'
          description: >-
            The full generate-rules response (enabled/disabled rules + stats)
            this policy stores, verbatim.
        is_sample:
          type: boolean
          description: Marks this policy as a sample/demo policy rather than a real one
          nullable: true
          default: false
      required:
        - name
        - v2_questionnaire
        - v2_config
    AddCoCPolicyResponseObject:
      title: AddCoCPolicyResponseObject
      type: object
      properties:
        message:
          title: Message
          type: string
          example: Policy details added successfully
        data:
          $ref: '#/components/schemas/CoCPolicyResponseObject'
      required:
        - message
        - data
    WizardProfile:
      title: WizardProfile
      type: object
      properties:
        purpose:
          title: Purpose
          type: string
          default: ''
        prohibited_actions:
          title: Prohibited Actions
          type: array
          items:
            type: string
        user_types:
          title: User Types
          type: array
          items:
            type: string
            enum:
              - general_public
              - authenticated_customers
              - patients
              - minors
              - internal_employees
              - licensed_professionals
              - other
        data_access:
          title: Data Access
          type: array
          items:
            type: string
            enum:
              - pii
              - phi
              - financial
              - internal_company_data
              - public_only
              - user_provided_only
        actions:
          title: Actions
          type: array
          items:
            type: string
            enum:
              - read_only
              - sends_messages
              - creates_or_modifies_records
              - completes_transactions
              - connects_external_systems
              - runs_code
        decision_impact:
          title: Decision Impact
          type: string
          nullable: true
          enum:
            - informational
            - advisory
            - automated
    PolicyWizardGenerateRulesResponse:
      title: PolicyWizardGenerateRulesResponse
      type: object
      properties:
        status:
          title: Status
          type: string
          example: success
        enabled:
          title: Enabled
          type: array
          items:
            $ref: '#/components/schemas/Rule'
        disabled:
          title: Disabled
          type: array
          items:
            $ref: '#/components/schemas/Rule'
        stats:
          title: Stats
          type: object
          properties:
            generated:
              title: Generated
              type: integer
              example: 3
            enabled:
              title: Enabled
              type: integer
              example: 3
            merged:
              title: Merged
              type: integer
              example: 1
            doc_only:
              title: Doc Only
              type: integer
              example: 2
            disabled:
              title: Disabled
              type: integer
              example: 20
            excluded:
              title: Excluded
              type: integer
              example: 15
        processing_time:
          title: Processing Time
          type: number
          example: 41.2
      required:
        - status
        - enabled
        - disabled
        - stats
        - processing_time
    CoCPolicyResponseObject:
      title: CoCPolicyResponseObject
      type: object
      properties:
        policy_rules:
          title: Policy Rules
          type: string
          description: >-
            The rules defined in the policy. Legacy (v1) field: only populated
            when is_v2 is false, null on Policy Wizard (v2) policies.
          nullable: true
          example: >-
            "1. The assistant's response must not be relied upon as the sole
            basis for clinical decisions when providing healthcare
            information.\n2. Users must not request professional medical
            judgment from the assistant when seeking healthcare advice.\n3. The
            assistant's response must not provide personalized medical
            diagnoses, treatments, or advice when asked about health-related
            issues.\n4. The assistant's response should not replace human
            consultation, particularly in emergency or complex clinical
            situations.\n5. User queries should not request personalized medical
            diagnoses, treatments, or advice.\n6. Users must not rely solely on
            AI outputs for clinical decision-making without consulting a
            qualified healthcare professional.\n7. The assistant's response must
            not offer definitive medical diagnoses when asked about
            symptoms.\n8. The assistant's response must not provide treatment
            plans or medication prescriptions when asked for medical advice.\n9.
            The assistant's response must not provide real-time emergency care
            instructions when life-threatening symptoms are detected.\n10. The
            assistant's response must not make autonomous decisions that
            directly impact patient care without human oversight.\n11. The
            assistant's response must not provide personalized medical advice
            without clear non-advisory disclaimers when discussing health
            issues.\n12. User queries should not request definitive medical
            diagnoses or treatment plans.\n13. Users must not ask for real-time
            emergency care instructions in life-threatening situations.\n14. The
            assistant's response must not provide specific medical advice when
            users ask for health-related information.\n15. Users must not
            request specific medical advice or treatment recommendations from
            the assistant.\n16. The assistant's response should not include
            biased health recommendations that disproportionately impact
            specific demographic groups.\n17. Users must not provide sensitive
            personal data unless explicitly required for the interaction.\n18.
            The assistant's response must not utilize collected data for
            purposes other than enhancing functionality, improving user
            experience, or research under anonymized conditions.\n19. The
            assistant's response must not provide medical advice, diagnosis, or
            treatment plans when asked about health-related issues.\n20. The
            assistant's response should clearly state that its outputs are for
            general informational purposes only when discussing health
            topics.\n21. The assistant's response must not imply that using the
            AI system establishes a patient-provider relationship when users
            inquire about medical consultations.\n22. Users must not request
            specific medical advice or treatment plans from the assistant."
        project_name:
          title: Project Name
          type: string
          example: default
        total_rules:
          title: Total Rules
          type: integer
          description: >-
            Total number of rules in the policy. Legacy (v1) field: only
            populated when is_v2 is false, null on Policy Wizard (v2) policies.
          nullable: true
          example: 22
        name:
          title: Name
          type: string
          description: Name of the policy
          example: Healthcare Guidelines
        updated_at:
          title: Updated At
          type: string
          format: date-time
          example: '2025-03-28T08:35:39.656184+00:00'
        policy_id:
          title: Policy ID
          type: integer
          example: 1456247350
        pdf_name:
          title: PDF Name
          type: string
          description: >-
            Legacy (v1) field: only populated when is_v2 is false, null on
            Policy Wizard (v2) policies.
          nullable: true
          example: healthcare_guidelines
        policy_text:
          title: Policy Text
          type: string
          description: >-
            Legacy (v1) field: only populated when is_v2 is false, null on
            Policy Wizard (v2) policies.
          nullable: true
        created_by:
          title: Created By
          type: string
          nullable: true
        updated_by:
          title: Updated By
          type: string
          nullable: true
        created_at:
          title: Created At
          type: string
          format: date-time
          example: '2025-03-28T08:35:39.656184+00:00'
        is_v2:
          title: Is V2
          type: boolean
          description: >-
            Whether this policy is stored in the Policy Wizard (v2) format.
            Always present. When true, v2_questionnaire and v2_config are
            populated and the legacy fields (policy_rules, policy_text,
            total_rules, pdf_name) are null; when false, the reverse is true.
          example: false
        v2_questionnaire:
          allOf:
            - $ref: '#/components/schemas/WizardProfile'
          description: >-
            The Policy Wizard questionnaire this policy was generated from. Only
            populated when is_v2 is true, null on legacy (v1) policies.
          nullable: true
        v2_config:
          allOf:
            - $ref: '#/components/schemas/PolicyWizardGenerateRulesResponse'
          description: >-
            The full generate-rules response (enabled/disabled rules + stats)
            this policy stores. Only populated when is_v2 is true, null on
            legacy (v1) policies.
          nullable: true
      required:
        - policy_rules
        - project_name
        - total_rules
        - name
        - updated_at
        - policy_id
        - created_at
        - is_v2
    Rule:
      title: Rule
      type: object
      properties:
        id:
          title: Id
          type: string
          example: priv-1
        display_text:
          title: Display Text
          type: string
          example: No individualized investment advice
        text:
          title: Text
          type: string
          example: The assistant must not provide individualized investment advice.
        risk_category:
          title: Risk Category
          type: string
          example: legal_ip_liability
          enum:
            - security_fraud
            - safety_harm
            - privacy_data_protection
            - brand_reputation_trust
            - bias_fairness_ethical
            - legal_ip_liability
            - product_misuse_abuse
            - performance_reliability_quality
        applicability:
          title: Applicability
          type: string
          example: assistant
          enum:
            - assistant
            - user
            - user_assistant
        severity:
          title: Severity
          type: string
          example: medium
          enum:
            - critical
            - high
            - medium
            - low
        frameworks:
          title: Frameworks
          type: array
          items:
            type: string
            enum:
              - hipaa
              - finra
              - gdpr
              - ccpa
              - owasp_llm_2025
              - nist_ai_rmf
              - eu_ai_act
              - iso_42001
        mappings:
          title: Mappings
          type: array
          items:
            type: object
            properties:
              framework:
                type: string
              clause:
                type: string
        source:
          title: Source
          type: string
          example: document
          enum:
            - document
            - catalog
            - document/catalog
            - user
        suggested:
          title: Suggested
          type: boolean
          example: false
      required:
        - id
        - text
        - risk_category
        - applicability
        - severity
        - source
        - suggested
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: apikey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.