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

# Create policy

> Creates a new router policy with model configuration, evaluators, retry settings, and limits.



## OpenAPI

````yaml post /v2/policies
openapi: 3.1.0
info:
  title: orq.ai API
  version: '2.0'
  description: orq.ai API documentation
servers:
  - url: https://api.orq.ai
security:
  - ApiKey: []
tags:
  - name: Guardrail Rules
  - name: Policies
  - name: Routing Rules
  - name: Files
    description: File upload and retrieval operations.
  - name: FilesService
  - name: Projects
    description: Projects organize resources within a workspace
  - name: ProjectsService
  - name: Skills
    description: >-
      Skills are modular instructions you can use to codify processes and
      conventions
  - name: SkillsService
  - name: Responses
  - description: >-
      Run agents on a cadence — cron, interval, or one-off. Minimum firing
      interval is 1 hour.
    name: Agent Schedules
  - name: Reporting
    description: >-
      GenAI reporting API over canonical analytics rollups. Accepts a metric
      name, time range, grain, group-by, and filters; returns a typed time
      series and optional totals.
  - name: ReportingService
    description: |-
      ReportingService exposes a single QueryReport RPC that maps allowlisted
       analytics payloads onto safe rollup queries. Callers never send SQL;
       the backend picks the rollup family and grain from the metric
       catalogue, the requested range, and the requested grouping.
externalDocs:
  url: https://docs.orq.ai
  description: orq.ai Documentation
paths:
  /v2/policies:
    post:
      tags:
        - Policies
      summary: Create policy
      description: >-
        Creates a new router policy with model configuration, evaluators, retry
        settings, and limits.
      operationId: PolicyCreate
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                description:
                  maxLength: 2048
                  type: string
                display_name:
                  maxLength: 256
                  minLength: 1
                  type: string
                enabled:
                  type: boolean
                evaluators:
                  items:
                    $ref: '#/components/schemas/EvaluatorRef'
                  type:
                    - array
                    - 'null'
                limits:
                  $ref: '#/components/schemas/Limits'
                models_config:
                  $ref: '#/components/schemas/ModelsConfig'
                project_id:
                  description: >-
                    Optional project ID. If null/omitted, the entity is global
                    (workspace-wide).
                  type: string
                retry_config:
                  $ref: '#/components/schemas/PolicyRetryConfig'
                timeout:
                  format: int64
                  minimum: 1000
                  type: integer
              required:
                - display_name
              type: object
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                additionalProperties: false
                properties:
                  _id:
                    type: string
                  created_at:
                    format: date-time
                    type: string
                  created_by_id:
                    type: string
                  description:
                    maxLength: 2048
                    type: string
                  display_name:
                    maxLength: 256
                    minLength: 1
                    type: string
                  enabled:
                    type: boolean
                  evaluators:
                    items:
                      $ref: '#/components/schemas/EvaluatorRef'
                    type:
                      - array
                      - 'null'
                  limits:
                    $ref: '#/components/schemas/Limits'
                  models_config:
                    $ref: '#/components/schemas/ModelsConfig'
                  project_id:
                    type: string
                  retry_config:
                    $ref: '#/components/schemas/PolicyRetryConfig'
                  slug:
                    type: string
                    minLength: 1
                  timeout:
                    format: int64
                    minimum: 1000
                    type: integer
                  updated_at:
                    format: date-time
                    type: string
                  updated_by_id:
                    type: string
                required:
                  - _id
                  - created_at
                  - updated_at
                  - created_by_id
                  - updated_by_id
                  - project_id
                  - display_name
                  - slug
                  - enabled
                  - timeout
                type: object
          description: Policy created successfully
        '400':
          description: Bad request
        '409':
          description: Slug conflict
components:
  schemas:
    EvaluatorRef:
      additionalProperties: false
      properties:
        execute_on:
          enum:
            - input
            - output
            - both
          type: string
        id:
          type: string
          minLength: 1
        is_guardrail:
          type: boolean
        sample_rate:
          format: double
          maximum: 1
          minimum: 0
          type: number
      required:
        - id
        - execute_on
      type: object
    Limits:
      additionalProperties: false
      properties:
        budget:
          $ref: '#/components/schemas/BudgetLimit'
        requests:
          $ref: '#/components/schemas/RequestLimit'
        tokens:
          $ref: '#/components/schemas/TokenLimit'
      type: object
    ModelsConfig:
      additionalProperties: false
      properties:
        mode:
          enum:
            - fallback
            - weighted
            - round_robin
          type: string
        models:
          items:
            $ref: '#/components/schemas/ModelRef'
          minItems: 1
          type:
            - array
            - 'null'
      required:
        - mode
        - models
      type: object
    PolicyRetryConfig:
      additionalProperties: false
      properties:
        count:
          format: int64
          maximum: 5
          minimum: 1
          type: integer
        on_codes:
          items:
            format: int64
            type: integer
          type:
            - array
            - 'null'
      required:
        - count
      type: object
    BudgetLimit:
      additionalProperties: false
      properties:
        amount:
          format: double
          maximum: 1000000
          minimum: 0.01
          type: number
        currency:
          enum:
            - usd
          type: string
        period:
          enum:
            - hour
            - day
            - week
            - month
          type: string
      required:
        - amount
        - period
        - currency
      type: object
    RequestLimit:
      additionalProperties: false
      properties:
        amount:
          format: int64
          maximum: 1000000000
          minimum: 1
          type: integer
        period:
          enum:
            - hour
            - day
            - week
            - month
          type: string
      required:
        - amount
        - period
      type: object
    TokenLimit:
      additionalProperties: false
      properties:
        amount:
          format: int64
          maximum: 1000000000
          minimum: 1
          type: integer
        period:
          enum:
            - hour
            - day
            - week
            - month
          type: string
      required:
        - amount
        - period
      type: object
    ModelRef:
      additionalProperties: false
      properties:
        integration_id:
          type: string
        model:
          type: string
          minLength: 1
        weight:
          format: double
          maximum: 1
          minimum: 0
          type: number
      required:
        - model
      type: object
  securitySchemes:
    ApiKey:
      type: http
      scheme: bearer
      bearerFormat: JWT

````