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

# Create Policy

Create a new policy and attach it to one or more deployments.

<Info>
  This endpoint is available only for API version <code>2025-12-01</code>. Send the <code>whitecircle-version: 2025-12-01</code> header.
</Info>

<Tip>
  To create a metric instead of a policy, use the [`/api/metric/create`](/2025-12-01/metric/create-metric) endpoint.
</Tip>


## OpenAPI

````yaml 2025-12-01/openapi.json POST /api/policy/create
openapi: 3.1.0
info:
  title: WhiteCircle API Backend
  description: 'Authentication: Bearer API Key Required'
  license:
    name: ''
  version: '2025-12-01'
servers:
  - url: https://eu.whitecircle.com
  - url: https://us.whitecircle.com
security: []
tags:
  - name: Session
    description: Session-based content checking and moderation
  - name: User
    description: User risk assessment and scoring
  - name: Policy
    description: Policy management CRUD
  - name: Metric
    description: Metric management CRUD
  - name: Artifact
    description: Standalone artifact moderation
paths:
  /api/policy/create:
    post:
      tags:
        - Policy
      operationId: create_v1
      parameters:
        - name: whitecircle-version
          in: header
          description: API Version
          required: true
          schema:
            type: string
          example: '2025-12-01'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePolicyRequest'
        required: true
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PublicPolicy'
        '400':
          description: Bad Request
      security:
        - bearerAuth: []
components:
  schemas:
    CreatePolicyRequest:
      type: object
      required:
        - name
        - flagged_content
      properties:
        name:
          type: string
        allowed_content:
          type:
            - string
            - 'null'
        flagged_content:
          type: string
        applies_to:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/PublicAppliesTo'
        content_type:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/PublicContentType'
        mode:
          oneOf:
            - type: 'null'
            - $ref: '#/components/schemas/PublicPolicyMode'
        deployment_ids:
          type:
            - array
            - 'null'
          items:
            type: string
        severity_level_id:
          type:
            - string
            - 'null'
          format: uuid
        country_codes:
          type:
            - array
            - 'null'
          items:
            type: string
        rollout_percentage:
          type:
            - integer
            - 'null'
          format: int32
    PublicPolicy:
      type: object
      required:
        - id
        - name
        - flagged_content
        - content_type
        - applies_to
        - mode
        - rollout_percentage
        - revision_id
        - created_at
        - deployment_ids
        - country_codes
      properties:
        id:
          type: string
        name:
          type: string
        allowed_content:
          type:
            - string
            - 'null'
        flagged_content:
          type: string
        applies_to:
          $ref: '#/components/schemas/PublicAppliesTo'
        content_type:
          $ref: '#/components/schemas/PublicContentType'
        mode:
          $ref: '#/components/schemas/PublicPolicyMode'
        severity_level_id:
          type:
            - string
            - 'null'
          format: uuid
        deployment_ids:
          type: array
          items:
            type: string
        country_codes:
          type: array
          items:
            type: string
        rollout_percentage:
          type: integer
          format: int32
          minimum: 0
        revision_id:
          type: string
        created_at:
          type: string
          format: date-time
        deleted_at:
          type:
            - string
            - 'null'
          format: date-time
    PublicAppliesTo:
      type: string
      enum:
        - input
        - output
        - any
      example: input
    PublicContentType:
      type: string
      enum:
        - session
        - artifact
        - any
      example: session
    PublicPolicyMode:
      type: string
      enum:
        - prod
        - shadow
      example: prod
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key
      description: 'API Key required. Format: Bearer wc-your-api-key'

````