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

# Create a control rule

> Creates a rule with a client-generated UUID. Setting enabled applies it immediately. Zero-day retention or ZDR may permanently delete files; a 409 warning requires explicit confirm_file_deletion acknowledgement. Read rules again to inspect effective policy. Requires the `controls:write` scope.



## OpenAPI

````yaml post /management/v1/controls/rules
openapi: 3.1.0
info:
  description: Schema-driven generative API that orchestrates LLM-powered workflows.
  title: Task API
  version: 3.0.0
servers:
  - description: Production
    url: https://api.opper.ai
  - description: Local development
    url: http://localhost:8080
security:
  - BearerAuth: []
tags:
  - description: Schema-driven function management and execution
    name: Functions
  - description: OpenAI-compatible chat completions
    name: Chat
  - description: OpenAI Responses API compatible endpoint
    name: Responses
  - description: Google-compatible interactions endpoint
    name: Interactions
  - description: Model registry and capabilities
    name: Models
  - description: Synchronous image generation
    name: Images
  - description: Text-to-speech and speech-to-text
    name: Audio
  - description: Asynchronous video generation
    name: Videos
  - description: Reusable file storage for media inputs and generated outputs
    name: Files
  - description: Async generation status and downloads
    name: Artifacts
  - description: OpenAI-compatible embeddings
    name: Embeddings
  - description: Recorded HTTP request/response generations
    name: Generations
  - description: System health and status
    name: System
  - description: Roundtable endpoint — fan out a query to multiple LLMs and combine results
    name: Roundtable
  - description: Web search, fetch, and other utility tools
    name: Tools
  - description: Caller identity, credits, and usage
    name: Account
  - description: >-
      Programmatic project and API-key management. Authenticates with an
      `op-mak-…` management token; available on the control_plane and enterprise
      plans.
    name: Management
paths:
  /management/v1/controls/rules:
    post:
      tags:
        - Management
      summary: Create a control rule
      description: >-
        Creates a rule with a client-generated UUID. Setting enabled applies it
        immediately. Zero-day retention or ZDR may permanently delete files; a
        409 warning requires explicit confirm_file_deletion acknowledgement.
        Read rules again to inspect effective policy. Requires the
        `controls:write` scope.
      operationId: createManagementControlRule
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                config:
                  anyOf:
                    - additionalProperties: false
                      description: >-
                        Spending cap that resets per period (day, week or month)
                        or holds in total. At most one enabled budget per
                        target; a project, role or member cap cannot exceed an
                        organization cap of the same period. The server enforces
                        cross-rule constraints when saving.
                      properties:
                        alerts_enabled:
                          description: Alert preference stored with the budget rule.
                          type:
                            - boolean
                            - 'null'
                        counted_from:
                          description: >-
                            Where a total cap counts spend from; omitted means
                            the rule's creation. Set it to now to reset a total
                            cap.
                          format: date-time
                          type: string
                        monthly_limit_cents:
                          description: >-
                            Cap per period in integer USD cents: 100 cents = $1;
                            1000 = $10; 10000 = $100. Zero is a zero-dollar cap,
                            not unlimited. Named for the monthly period it once
                            always was; it is the cap for whichever period is
                            set.
                          minimum: 0
                          type: integer
                          x-currency: USD
                          x-unit: cents
                        period:
                          description: >-
                            When the cap resets: day (00:00 UTC), week (Monday
                            00:00 UTC), month (with the billing period), or
                            total (never; counts from counted_from). Omitted
                            means month.
                          enum:
                            - day
                            - week
                            - month
                            - total
                          type: string
                        soft_limit_pct:
                          description: >-
                            Warning threshold as a percentage of the cap; 80
                            means 80%. Zero or omission means unset.
                          maximum: 100
                          minimum: 0
                          type:
                            - integer
                            - 'null'
                        type:
                          const: budget
                          type: string
                      required:
                        - type
                        - monthly_limit_cents
                      title: comply.budget
                      type: object
                    - additionalProperties: false
                      description: >-
                        Constrain models, provider companies/routes, locations,
                        makers, and upstream data handling. Omitted/empty
                        categories impose no restriction; configured categories
                        combine with AND. Child scopes may only narrow parents;
                        exclusions accumulate and win. Use schema_version=2 and
                        inspect get_allowed_models/inherited policy before
                        applying. Model/provider examples illustrate syntax; use
                        the current catalog to select values.
                      properties:
                        allowlist:
                          additionalProperties: false
                          properties:
                            handling:
                              additionalProperties: false
                              properties:
                                cache_scopes:
                                  items:
                                    enum:
                                      - api_key
                                      - organization
                                      - shared
                                    type: string
                                  type: array
                                  uniqueItems: true
                                caching:
                                  items:
                                    enum:
                                      - explicit
                                      - implicit
                                      - none
                                    type: string
                                  type: array
                                  uniqueItems: true
                                human_review:
                                  items:
                                    enum:
                                      - human_can_view
                                      - none
                                      - signals_only
                                    type: string
                                  type: array
                                  uniqueItems: true
                                logging:
                                  items:
                                    enum:
                                      - abuse_monitoring
                                      - limited_debug
                                      - none
                                      - other
                                    type: string
                                  type: array
                                  uniqueItems: true
                                max_retention_days:
                                  description: >-
                                    Maximum upstream provider content-retention
                                    days, separate from Opper storage retention.
                                    Zero requires no upstream retention;
                                    null/omission imposes no cap.
                                  minimum: 0
                                  type:
                                    - integer
                                    - 'null'
                                  x-unit: days
                                moderation:
                                  items:
                                    enum:
                                      - default_on
                                      - mandatory
                                      - none
                                      - optional
                                    type: string
                                  type: array
                                  uniqueItems: true
                                subprocessors_read_content:
                                  description: >-
                                    False requires that subprocessors do not
                                    read content; null/omission does not consult
                                    the category.
                                  type:
                                    - boolean
                                    - 'null'
                                training:
                                  items:
                                    enum:
                                      - 'no'
                                      - opt_in
                                      - opt_out
                                      - 'yes'
                                    type: string
                                  type: array
                                  uniqueItems: true
                              type: object
                            maker:
                              additionalProperties: false
                              properties:
                                jurisdiction:
                                  items:
                                    description: >-
                                      Uppercase ISO 3166-1 alpha-2 country code
                                      or EU/EEA/GLOBAL area. See locations for
                                      labels and containment.
                                    enum:
                                      - AE
                                      - AR
                                      - AT
                                      - AU
                                      - BE
                                      - BG
                                      - BH
                                      - BR
                                      - CA
                                      - CH
                                      - CL
                                      - CN
                                      - CY
                                      - CZ
                                      - DE
                                      - DK
                                      - EE
                                      - EEA
                                      - EG
                                      - ES
                                      - EU
                                      - FI
                                      - FR
                                      - GB
                                      - GLOBAL
                                      - GR
                                      - HK
                                      - HR
                                      - HU
                                      - ID
                                      - IE
                                      - IL
                                      - IN
                                      - IS
                                      - IT
                                      - JP
                                      - KE
                                      - KR
                                      - KW
                                      - LI
                                      - LT
                                      - LU
                                      - LV
                                      - MT
                                      - MX
                                      - MY
                                      - NG
                                      - NL
                                      - 'NO'
                                      - NZ
                                      - PH
                                      - PL
                                      - PT
                                      - QA
                                      - RO
                                      - RS
                                      - SA
                                      - SE
                                      - SG
                                      - SI
                                      - SK
                                      - TH
                                      - TR
                                      - TW
                                      - UA
                                      - US
                                      - VN
                                      - ZA
                                    type: string
                                  type: array
                                  uniqueItems: true
                                name:
                                  items:
                                    description: >-
                                      Slug of the company that trained the
                                      weights.
                                    minLength: 1
                                    pattern: ^\S(?:.*\S)?$
                                    type: string
                                  type: array
                                  uniqueItems: true
                              type: object
                            models:
                              items:
                                description: >-
                                  Endpoint name without its first provider
                                  prefix: from list_models id
                                  gemini/gemma-4-26b-moe, use gemma-4-26b-moe.
                                  Do not use model/model_id: those name
                                  underlying weights and may differ from the
                                  endpoint. Verify the resulting callable ids
                                  with get_allowed_models.
                                minLength: 1
                                pattern: ^\S(?:.*\S)?$
                                type: string
                              type: array
                              uniqueItems: true
                            provider:
                              additionalProperties: false
                              properties:
                                locations:
                                  additionalProperties: false
                                  properties:
                                    inference:
                                      additionalProperties: false
                                      description: >-
                                        Where inference runs. Codes match by
                                        containment: EU includes SE. Exclude
                                        cannot contain GLOBAL. Do not list an
                                        area and its member in the same
                                        direction.
                                      properties:
                                        exclude:
                                          items:
                                            description: >-
                                              Uppercase ISO 3166-1 alpha-2 country
                                              code or EU/EEA/GLOBAL area. See
                                              locations for labels and containment.
                                            enum:
                                              - AE
                                              - AR
                                              - AT
                                              - AU
                                              - BE
                                              - BG
                                              - BH
                                              - BR
                                              - CA
                                              - CH
                                              - CL
                                              - CN
                                              - CY
                                              - CZ
                                              - DE
                                              - DK
                                              - EE
                                              - EEA
                                              - EG
                                              - ES
                                              - EU
                                              - FI
                                              - FR
                                              - GB
                                              - GLOBAL
                                              - GR
                                              - HK
                                              - HR
                                              - HU
                                              - ID
                                              - IE
                                              - IL
                                              - IN
                                              - IS
                                              - IT
                                              - JP
                                              - KE
                                              - KR
                                              - KW
                                              - LI
                                              - LT
                                              - LU
                                              - LV
                                              - MT
                                              - MX
                                              - MY
                                              - NG
                                              - NL
                                              - 'NO'
                                              - NZ
                                              - PH
                                              - PL
                                              - PT
                                              - QA
                                              - RO
                                              - RS
                                              - SA
                                              - SE
                                              - SG
                                              - SI
                                              - SK
                                              - TH
                                              - TR
                                              - TW
                                              - UA
                                              - US
                                              - VN
                                              - ZA
                                            not:
                                              const: GLOBAL
                                            type: string
                                          type: array
                                          uniqueItems: true
                                        include:
                                          items:
                                            description: >-
                                              Uppercase ISO 3166-1 alpha-2 country
                                              code or EU/EEA/GLOBAL area. See
                                              locations for labels and containment.
                                            enum:
                                              - AE
                                              - AR
                                              - AT
                                              - AU
                                              - BE
                                              - BG
                                              - BH
                                              - BR
                                              - CA
                                              - CH
                                              - CL
                                              - CN
                                              - CY
                                              - CZ
                                              - DE
                                              - DK
                                              - EE
                                              - EEA
                                              - EG
                                              - ES
                                              - EU
                                              - FI
                                              - FR
                                              - GB
                                              - GLOBAL
                                              - GR
                                              - HK
                                              - HR
                                              - HU
                                              - ID
                                              - IE
                                              - IL
                                              - IN
                                              - IS
                                              - IT
                                              - JP
                                              - KE
                                              - KR
                                              - KW
                                              - LI
                                              - LT
                                              - LU
                                              - LV
                                              - MT
                                              - MX
                                              - MY
                                              - NG
                                              - NL
                                              - 'NO'
                                              - NZ
                                              - PH
                                              - PL
                                              - PT
                                              - QA
                                              - RO
                                              - RS
                                              - SA
                                              - SE
                                              - SG
                                              - SI
                                              - SK
                                              - TH
                                              - TR
                                              - TW
                                              - UA
                                              - US
                                              - VN
                                              - ZA
                                            type: string
                                          type: array
                                          uniqueItems: true
                                      type: object
                                    jurisdiction:
                                      additionalProperties: false
                                      description: >-
                                        The provider's ultimate parent's legal
                                        home, separate from inference/storage
                                        residency. Codes match by containment:
                                        EU includes SE. Exclude cannot contain
                                        GLOBAL. Do not list an area and its
                                        member in the same direction.
                                      properties:
                                        exclude:
                                          items:
                                            description: >-
                                              Uppercase ISO 3166-1 alpha-2 country
                                              code or EU/EEA/GLOBAL area. See
                                              locations for labels and containment.
                                            enum:
                                              - AE
                                              - AR
                                              - AT
                                              - AU
                                              - BE
                                              - BG
                                              - BH
                                              - BR
                                              - CA
                                              - CH
                                              - CL
                                              - CN
                                              - CY
                                              - CZ
                                              - DE
                                              - DK
                                              - EE
                                              - EEA
                                              - EG
                                              - ES
                                              - EU
                                              - FI
                                              - FR
                                              - GB
                                              - GLOBAL
                                              - GR
                                              - HK
                                              - HR
                                              - HU
                                              - ID
                                              - IE
                                              - IL
                                              - IN
                                              - IS
                                              - IT
                                              - JP
                                              - KE
                                              - KR
                                              - KW
                                              - LI
                                              - LT
                                              - LU
                                              - LV
                                              - MT
                                              - MX
                                              - MY
                                              - NG
                                              - NL
                                              - 'NO'
                                              - NZ
                                              - PH
                                              - PL
                                              - PT
                                              - QA
                                              - RO
                                              - RS
                                              - SA
                                              - SE
                                              - SG
                                              - SI
                                              - SK
                                              - TH
                                              - TR
                                              - TW
                                              - UA
                                              - US
                                              - VN
                                              - ZA
                                            not:
                                              const: GLOBAL
                                            type: string
                                          type: array
                                          uniqueItems: true
                                        include:
                                          items:
                                            description: >-
                                              Uppercase ISO 3166-1 alpha-2 country
                                              code or EU/EEA/GLOBAL area. See
                                              locations for labels and containment.
                                            enum:
                                              - AE
                                              - AR
                                              - AT
                                              - AU
                                              - BE
                                              - BG
                                              - BH
                                              - BR
                                              - CA
                                              - CH
                                              - CL
                                              - CN
                                              - CY
                                              - CZ
                                              - DE
                                              - DK
                                              - EE
                                              - EEA
                                              - EG
                                              - ES
                                              - EU
                                              - FI
                                              - FR
                                              - GB
                                              - GLOBAL
                                              - GR
                                              - HK
                                              - HR
                                              - HU
                                              - ID
                                              - IE
                                              - IL
                                              - IN
                                              - IS
                                              - IT
                                              - JP
                                              - KE
                                              - KR
                                              - KW
                                              - LI
                                              - LT
                                              - LU
                                              - LV
                                              - MT
                                              - MX
                                              - MY
                                              - NG
                                              - NL
                                              - 'NO'
                                              - NZ
                                              - PH
                                              - PL
                                              - PT
                                              - QA
                                              - RO
                                              - RS
                                              - SA
                                              - SE
                                              - SG
                                              - SI
                                              - SK
                                              - TH
                                              - TR
                                              - TW
                                              - UA
                                              - US
                                              - VN
                                              - ZA
                                            type: string
                                          type: array
                                          uniqueItems: true
                                      type: object
                                    storage:
                                      additionalProperties: false
                                      description: >-
                                        Where upstream retained content is
                                        stored. A route retaining no content
                                        satisfies storage residency. Codes match
                                        by containment: EU includes SE. Exclude
                                        cannot contain GLOBAL. Do not list an
                                        area and its member in the same
                                        direction.
                                      properties:
                                        exclude:
                                          items:
                                            description: >-
                                              Uppercase ISO 3166-1 alpha-2 country
                                              code or EU/EEA/GLOBAL area. See
                                              locations for labels and containment.
                                            enum:
                                              - AE
                                              - AR
                                              - AT
                                              - AU
                                              - BE
                                              - BG
                                              - BH
                                              - BR
                                              - CA
                                              - CH
                                              - CL
                                              - CN
                                              - CY
                                              - CZ
                                              - DE
                                              - DK
                                              - EE
                                              - EEA
                                              - EG
                                              - ES
                                              - EU
                                              - FI
                                              - FR
                                              - GB
                                              - GLOBAL
                                              - GR
                                              - HK
                                              - HR
                                              - HU
                                              - ID
                                              - IE
                                              - IL
                                              - IN
                                              - IS
                                              - IT
                                              - JP
                                              - KE
                                              - KR
                                              - KW
                                              - LI
                                              - LT
                                              - LU
                                              - LV
                                              - MT
                                              - MX
                                              - MY
                                              - NG
                                              - NL
                                              - 'NO'
                                              - NZ
                                              - PH
                                              - PL
                                              - PT
                                              - QA
                                              - RO
                                              - RS
                                              - SA
                                              - SE
                                              - SG
                                              - SI
                                              - SK
                                              - TH
                                              - TR
                                              - TW
                                              - UA
                                              - US
                                              - VN
                                              - ZA
                                            not:
                                              const: GLOBAL
                                            type: string
                                          type: array
                                          uniqueItems: true
                                        include:
                                          items:
                                            description: >-
                                              Uppercase ISO 3166-1 alpha-2 country
                                              code or EU/EEA/GLOBAL area. See
                                              locations for labels and containment.
                                            enum:
                                              - AE
                                              - AR
                                              - AT
                                              - AU
                                              - BE
                                              - BG
                                              - BH
                                              - BR
                                              - CA
                                              - CH
                                              - CL
                                              - CN
                                              - CY
                                              - CZ
                                              - DE
                                              - DK
                                              - EE
                                              - EEA
                                              - EG
                                              - ES
                                              - EU
                                              - FI
                                              - FR
                                              - GB
                                              - GLOBAL
                                              - GR
                                              - HK
                                              - HR
                                              - HU
                                              - ID
                                              - IE
                                              - IL
                                              - IN
                                              - IS
                                              - IT
                                              - JP
                                              - KE
                                              - KR
                                              - KW
                                              - LI
                                              - LT
                                              - LU
                                              - LV
                                              - MT
                                              - MX
                                              - MY
                                              - NG
                                              - NL
                                              - 'NO'
                                              - NZ
                                              - PH
                                              - PL
                                              - PT
                                              - QA
                                              - RO
                                              - RS
                                              - SA
                                              - SE
                                              - SG
                                              - SI
                                              - SK
                                              - TH
                                              - TR
                                              - TW
                                              - UA
                                              - US
                                              - VN
                                              - ZA
                                            type: string
                                          type: array
                                          uniqueItems: true
                                      type: object
                                  type: object
                                name:
                                  additionalProperties: false
                                  description: >-
                                    Provider company public slugs, not adapter
                                    keys. Do not include and exclude the same
                                    company.
                                  properties:
                                    exclude:
                                      items:
                                        description: Provider company slug.
                                        minLength: 1
                                        pattern: ^\S(?:.*\S)?$
                                        type: string
                                      type: array
                                      uniqueItems: true
                                    include:
                                      items:
                                        description: Provider company slug.
                                        minLength: 1
                                        pattern: ^\S(?:.*\S)?$
                                        type: string
                                      type: array
                                      uniqueItems: true
                                  type: object
                                route:
                                  additionalProperties: false
                                  description: >-
                                    Individual catalog service-route IDs. Do not
                                    include and exclude the same route.
                                  properties:
                                    exclude:
                                      items:
                                        description: Catalog service-route ID.
                                        minLength: 1
                                        pattern: ^\S(?:.*\S)?$
                                        type: string
                                      type: array
                                      uniqueItems: true
                                    include:
                                      items:
                                        description: Catalog service-route ID.
                                        minLength: 1
                                        pattern: ^\S(?:.*\S)?$
                                        type: string
                                      type: array
                                      uniqueItems: true
                                  type: object
                              type: object
                          type: object
                        type:
                          const: allowlist
                          type: string
                      required:
                        - type
                        - allowlist
                      title: comply.allowlist
                      type: object
                    - additionalProperties: false
                      description: >-
                        Opper storage retention, separate from upstream provider
                        retention in allowlist.handling.max_retention_days. The
                        strictest enabled org/project retention wins. Enabling
                        zero days can permanently delete stored files; a 409
                        reports the count and requires
                        confirm_file_deletion=true on the outer rule request.
                      properties:
                        retention_days:
                          description: >-
                            0–30 days. Zero enables zero-day storage retention.
                            Null/omission contributes no retention cap.
                          maximum: 30
                          minimum: 0
                          type:
                            - integer
                            - 'null'
                          x-unit: days
                        type:
                          const: retention
                          type: string
                      required:
                        - type
                      title: comply.retention
                      type: object
                    - additionalProperties: false
                      description: >-
                        Server-managed Zero Data Retention: eligible upstream
                        routes and zero-day Opper retention. No custom fields
                        accepted. Existing entitlement checks apply. Conflicts
                        with response caching. If stored files would be deleted,
                        a 409 reports their count and requires
                        confirm_file_deletion=true on the outer rule request.
                      properties:
                        type:
                          const: zdr
                          type: string
                      required:
                        - type
                      title: comply.zdr
                      type: object
                    - additionalProperties: false
                      description: >-
                        Default model for the scope. Choose a current callable
                        identifier from list_models/get_allowed_models. Examples
                        illustrate syntax, not current availability.
                      properties:
                        default_model:
                          description: >-
                            Callable model identifier, or null for an explicit
                            no-default setting.
                          minLength: 1
                          type:
                            - string
                            - 'null'
                        type:
                          const: default_model
                          type: string
                      required:
                        - type
                        - default_model
                      title: route.default_model
                      type: object
                    - additionalProperties: false
                      description: >-
                        Response caching is switched by the outer rule's enabled
                        flag. Conflicts with an enabled ZDR rule in the same
                        effective scope.
                      properties:
                        ttl_seconds:
                          default: 3600
                          description: >-
                            Cache lifetime in seconds. Null/omission uses the
                            server default; zero is invalid.
                          maximum: 3600
                          minimum: 60
                          type:
                            - integer
                            - 'null'
                          x-unit: seconds
                        type:
                          const: cache
                          type: string
                      required:
                        - type
                      title: route.cache
                      type: object
                    - additionalProperties: false
                      description: >-
                        Order a bare model's provider pool. Custom CEL keys are
                        compiled on save and sort ascending over model.cost,
                        model.ttft and model.throughput. Presets need no
                        expression.
                      else:
                        not:
                          required:
                            - expression
                      if:
                        properties:
                          order:
                            const: custom
                            type: string
                        required:
                          - order
                      properties:
                        expression:
                          description: CEL sort key; only valid when order=custom.
                          minLength: 1
                          pattern: \S
                          type: string
                        order:
                          enum:
                            - round_robin
                            - cost
                            - latency
                            - throughput
                            - weighted
                            - custom
                          type: string
                        type:
                          const: pool_order
                          type: string
                      required:
                        - type
                        - order
                      then:
                        required:
                          - expression
                      title: route.pool_order
                      type: object
                    - additionalProperties: false
                      description: >-
                        Match with Go regular expressions, compiled on save. Use
                        the outer rule scope, not embedded scope or identity. An
                        empty patterns list is an inert draft.
                      properties:
                        action:
                          default: flag
                          enum:
                            - flag
                            - block
                            - redact
                          type: string
                        applies_to:
                          default: input
                          enum:
                            - input
                            - output
                            - both
                          type: string
                        engine:
                          const: regex
                          type: string
                        handle:
                          description: >-
                            What a call names the guard by in X-Opper-Guards.
                            Unique per organization. Omit to derive one from the
                            rule name on first save; kept when the rule is
                            renamed or its config is replaced without it.
                          maxLength: 63
                          pattern: ^[a-z0-9]+(-[a-z0-9]+)*$
                          type: string
                        invoke:
                          default: always
                          description: >-
                            always: runs on every call in the rule's scope.
                            on_request: runs only on calls that name the rule
                            (its handle or id) in the X-Opper-Guards header.
                          enum:
                            - always
                            - on_request
                          type: string
                        kind:
                          const: guard
                          type: string
                        name:
                          type: string
                        patterns:
                          items:
                            additionalProperties: false
                            properties:
                              name:
                                type: string
                              regex:
                                description: Go regular expression, compiled on save.
                                minLength: 1
                                pattern: \S
                                type: string
                            required:
                              - regex
                            type: object
                          type: array
                          uniqueItems: true
                        replacement:
                          description: Replacement text when action=redact.
                          type: string
                      required:
                        - engine
                        - patterns
                      title: guard.regex
                      type: object
                    - additionalProperties: false
                      description: >-
                        Evaluate a natural-language guard prompt. Use the outer
                        rule scope, not embedded scope or identity.
                      properties:
                        action:
                          default: flag
                          enum:
                            - flag
                            - block
                            - redact
                          type: string
                        applies_to:
                          default: input
                          enum:
                            - input
                            - output
                            - both
                          type: string
                        engine:
                          const: llm
                          type: string
                        handle:
                          description: >-
                            What a call names the guard by in X-Opper-Guards.
                            Unique per organization. Omit to derive one from the
                            rule name on first save; kept when the rule is
                            renamed or its config is replaced without it.
                          maxLength: 63
                          pattern: ^[a-z0-9]+(-[a-z0-9]+)*$
                          type: string
                        invoke:
                          default: always
                          description: >-
                            always: runs on every call in the rule's scope.
                            on_request: runs only on calls that name the rule
                            (its handle or id) in the X-Opper-Guards header.
                          enum:
                            - always
                            - on_request
                          type: string
                        kind:
                          const: guard
                          type: string
                        name:
                          type: string
                        prompt:
                          description: Natural-language check performed by the guard.
                          minLength: 1
                          pattern: \S
                          type: string
                      required:
                        - engine
                        - prompt
                      title: guard.llm
                      type: object
                    - additionalProperties: false
                      description: >-
                        Score the text against categories with a decision model
                        (catalog type evaluation): one true-or-false question
                        per category, fired when a category's probability
                        reaches its threshold. Fast and cheap; flags or blocks
                        but cannot redact. Use the outer rule scope, not
                        embedded scope or identity.
                      properties:
                        action:
                          default: flag
                          enum:
                            - flag
                            - block
                          type: string
                        applies_to:
                          default: input
                          enum:
                            - input
                            - output
                            - both
                          type: string
                        categories:
                          items:
                            additionalProperties: false
                            properties:
                              name:
                                description: Custom category name, reported in findings.
                                pattern: ^[a-z][a-z0-9_]{0,63}$
                                type: string
                              preset:
                                description: >-
                                  A category Opper maintains. Takes no name or
                                  statement.
                                enum:
                                  - jailbreak
                                  - prompt_injection
                                  - toxicity
                                type: string
                              statement:
                                description: >-
                                  Custom category: a sentence that is true when
                                  the text should be caught.
                                maxLength: 1000
                                type: string
                              threshold:
                                exclusiveMinimum: 0
                                maximum: 1
                                type: number
                            type: object
                          maxItems: 16
                          minItems: 1
                          type: array
                        engine:
                          const: decision
                          type: string
                        handle:
                          description: >-
                            What a call names the guard by in X-Opper-Guards.
                            Unique per organization. Omit to derive one from the
                            rule name on first save; kept when the rule is
                            renamed or its config is replaced without it.
                          maxLength: 63
                          pattern: ^[a-z0-9]+(-[a-z0-9]+)*$
                          type: string
                        invoke:
                          default: always
                          description: >-
                            always: runs on every call in the rule's scope.
                            on_request: runs only on calls that name the rule
                            (its handle or id) in the X-Opper-Guards header.
                          enum:
                            - always
                            - on_request
                          type: string
                        kind:
                          const: guard
                          type: string
                        model:
                          description: >-
                            Decision model (catalog type evaluation). Omit for
                            the server's default ladder.
                          minLength: 1
                          pattern: \S
                          type: string
                        name:
                          type: string
                        on_error:
                          default: allow
                          description: What the guard does when no model answers.
                          enum:
                            - allow
                            - block
                          type: string
                        threshold:
                          description: >-
                            Default threshold for categories without their own;
                            omit to use each preset's.
                          exclusiveMinimum: 0
                          maximum: 1
                          type: number
                      required:
                        - engine
                        - categories
                      title: guard.decision
                      type: object
                    - additionalProperties: false
                      description: >-
                        Evaluate sampled generations with the server's Controls
                        judge. Sampling rate is one in N, not a percentage. Each
                        matching rule produces an independent evaluation. Use
                        the outer rule's enabled flag and scope.
                      if:
                        properties:
                          score_type:
                            const: binary
                            type: string
                        required:
                          - score_type
                      properties:
                        criteria:
                          description: >-
                            Evaluation rubric. Required for binary scoring; omit
                            for the default score rubric.
                          minLength: 1
                          pattern: \S
                          type: string
                        evaluators:
                          description: >-
                            Uses the server's Controls judge; client model tiers
                            are not configurable.
                          items:
                            additionalProperties: false
                            properties:
                              type:
                                const: judge
                                type: string
                            required:
                              - type
                            type: object
                          maxItems: 1
                          minItems: 1
                          type: array
                        sampling:
                          oneOf:
                            - additionalProperties: false
                              properties:
                                strategy:
                                  const: all
                                  type: string
                              required:
                                - strategy
                              type: object
                            - additionalProperties: false
                              properties:
                                rate:
                                  default: 10
                                  description: >-
                                    Evaluate 1 in N generations. rate=10 is
                                    about 10%; rate=100 is about 1%.
                                  minimum: 1
                                  type: integer
                                strategy:
                                  const: rate
                                  type: string
                              required:
                                - strategy
                              type: object
                            - additionalProperties: false
                              properties:
                                base_rate:
                                  default: 100
                                  description: >-
                                    Evaluations per window before adaptive
                                    throttling.
                                  minimum: 1
                                  type: integer
                                strategy:
                                  const: adaptive
                                  type: string
                                window:
                                  default: 1h
                                  enum:
                                    - 1h
                                    - 24h
                                  type: string
                              required:
                                - strategy
                              type: object
                        score_type:
                          default: score
                          enum:
                            - score
                            - binary
                          type: string
                        threshold:
                          default: 0.5
                          description: >-
                            Scores below this value are flagged. Omission or
                            zero uses 0.5. Binary scoring flags a zero verdict.
                          maximum: 1
                          minimum: 0
                          type: number
                      required:
                        - evaluators
                      then:
                        required:
                          - criteria
                      title: observe
                      type: object
                  description: >-
                    Config for the rule kind. Replaces the full config on
                    update. Read existing rules and get_rule_vocabulary before
                    changing it; organization constraints remain in force. Use
                    schema_version=2 for provider company allowlists. Opper
                    retention_days and upstream handling.max_retention_days are
                    separate controls.
                confirm_file_deletion:
                  description: >-
                    Explicit acknowledgement after a 409 warning: enabling
                    zero-day retention or ZDR permanently deletes existing files
                    in scope. Never set speculatively.
                  type: boolean
                enabled:
                  description: Whether the rule is enforced. Omitted on create means false.
                  type: boolean
                id:
                  description: Client-generated UUID for this new rule.
                  format: uuid
                  type: string
                idempotency_key:
                  description: >-
                    Optional operation identifier. Reuse it with the same rule
                    id and create payload when retrying an uncertain response. A
                    changed payload or a deleted original rule returns 409;
                    successful replay returns the existing rule without
                    recreating it.
                  maxLength: 128
                  minLength: 1
                  pattern: ^[A-Za-z0-9._:-]{1,128}$
                  type: string
                kind:
                  enum:
                    - guard
                    - observe
                    - route
                    - comply
                  type: string
                name:
                  description: Display name; null clears it.
                  type:
                    - string
                    - 'null'
                schema_version:
                  description: >-
                    Config schema version. Omit on create for version 1. Version
                    2 comply allowlists identify providers by company slug.
                  maximum: 2
                  minimum: 1
                  type: integer
                scope:
                  additionalProperties: false
                  description: >-
                    Use org for organization-wide scope; projects requires
                    project_uuids, functions requires function_uuids. IDs must
                    belong to the caller's organization. Some rule kinds do not
                    support functions. roles (role_names) and members
                    (member_uuids) are only for comply budget rules: a monthly
                    cap on each member's personal-key spend, where a member's
                    own cap wins over their role's.
                  properties:
                    function_uuids:
                      items:
                        format: uuid
                        type: string
                      type: array
                    member_uuids:
                      description: User UUIDs of organization members for a members scope.
                      items:
                        format: uuid
                        type: string
                      type: array
                    project_uuids:
                      items:
                        format: uuid
                        type: string
                      type: array
                    role_names:
                      description: >-
                        Role names (built-in or the organization's custom roles)
                        for a roles scope.
                      items:
                        type: string
                      type: array
                    type:
                      enum:
                        - org
                        - projects
                        - functions
                        - roles
                        - members
                      type: string
                  required:
                    - type
                  type: object
              required:
                - id
                - kind
                - scope
                - config
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/ManagementControlRule'
                  meta:
                    description: >-
                      Empty for a single resource. Endpoint-specific context
                      appears here rather than as a sibling of `data`.
                    type: object
                type: object
          description: 'Idempotent replay: current state of the previously created rule.'
        '201':
          content:
            application/json:
              schema:
                properties:
                  data:
                    $ref: '#/components/schemas/ManagementControlRule'
                  meta:
                    description: >-
                      Empty for a single resource. Endpoint-specific context
                      appears here rather than as a sibling of `data`.
                    type: object
                type: object
          description: Successful response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad request
        '401':
          description: Unauthorized - missing or invalid API key
        '402':
          content:
            application/json:
              schema:
                properties:
                  error:
                    properties:
                      code:
                        enum:
                          - plan_required
                        type: string
                      message:
                        type: string
                      type:
                        enum:
                          - payment_required
                        type: string
                    type: object
                type: object
          description: >-
            The rule's kind is a Control Plane feature (`observe`, `route`,
            `guard`, `comply`) and the organization's plan does not include it.
            The message names the kind and the current plan. Reading and
            deleting rules is not plan gated.
        '403':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                  required_scope:
                    description: Present on the scope refusal.
                    type: string
                type: object
          description: >-
            The token lacks the scope this endpoint requires (`required_scope`
            is returned). Presenting a runtime `op-…` key instead of a
            management `op-mak-…` token also lands here.
        '404':
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                type: object
          description: >-
            No such resource in the calling organization. A resource belonging
            to another organization is indistinguishable from one that does not
            exist.
        '409':
          content:
            application/json:
              schema:
                properties:
                  code:
                    description: Present on the file-deletion refusal.
                    type: string
                  error:
                    type: string
                  file_count:
                    description: Present on the file-deletion refusal.
                    type: integer
                type: object
          description: >-
            Conflicting rule, changed idempotency payload, deleted original
            rule, policy invariant, or explicit file-deletion acknowledgement
            required.
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal server error
      security:
        - ManagementBearer: []
components:
  schemas:
    ManagementControlRule:
      properties:
        allowed_model_ids:
          items:
            type: string
          type: array
        config:
          description: >-
            The rule's configuration; its shape depends on kind. comply and
            route rules carry a type discriminator (comply: allowlist |
            retention | budget | zdr; route: cache | pool_order | absent for a
            default-model rule); guard and observe rules carry their
            configuration inline.
          type: object
        confirm_file_deletion:
          type: boolean
        created_at:
          format: date-time
          type: string
        effective_count:
          type: integer
        enabled:
          type: boolean
        health:
          properties:
            reason:
              type: string
            skipped_at:
              format: date-time
              type: string
          required:
            - skipped_at
            - reason
          type: object
        id:
          type: string
        idempotency_key:
          type: string
        kind:
          type: string
        name:
          type: string
        parent_allowlist:
          properties:
            countries:
              items:
                type: string
              type: array
            deny_all:
              type: boolean
            exclude_providers:
              items:
                type: string
              type: array
            exclude_service_routes:
              items:
                type: string
              type: array
            handling:
              properties:
                cache_scopes:
                  items:
                    type: string
                  type: array
                caching:
                  items:
                    type: string
                  type: array
                human_review:
                  items:
                    type: string
                  type: array
                logging:
                  items:
                    type: string
                  type: array
                max_retention_days:
                  type: integer
                moderation:
                  items:
                    type: string
                  type: array
                subprocessors_read_content:
                  type: boolean
                training:
                  items:
                    type: string
                  type: array
              type: object
            maker:
              properties:
                jurisdiction:
                  items:
                    type: string
                  type: array
                name:
                  items:
                    type: string
                  type: array
              type: object
            models:
              items:
                type: string
              type: array
            provider:
              properties:
                locations:
                  properties:
                    inference:
                      properties:
                        exclude:
                          items:
                            type: string
                          type: array
                        include:
                          items:
                            type: string
                          type: array
                      type: object
                    jurisdiction:
                      properties:
                        exclude:
                          items:
                            type: string
                          type: array
                        include:
                          items:
                            type: string
                          type: array
                      type: object
                    storage:
                      properties:
                        exclude:
                          items:
                            type: string
                          type: array
                        include:
                          items:
                            type: string
                          type: array
                      type: object
                  type: object
                name:
                  properties:
                    exclude:
                      items:
                        type: string
                      type: array
                    include:
                      items:
                        type: string
                      type: array
                  type: object
                route:
                  properties:
                    exclude:
                      items:
                        type: string
                      type: array
                    include:
                      items:
                        type: string
                      type: array
                  type: object
              type: object
            providers:
              items:
                type: string
              type: array
            regions:
              items:
                type: string
              type: array
            service_routes:
              items:
                type: string
              type: array
          required:
            - providers
            - regions
            - countries
            - models
          type: object
        schema_version:
          type: integer
        scope:
          properties:
            function_uuids:
              items:
                type: string
              type: array
            member_uuids:
              items:
                type: string
              type: array
            project_uuids:
              items:
                type: string
              type: array
            role_names:
              items:
                type: string
              type: array
            type:
              type: string
          required:
            - type
          type: object
        updated_at:
          format: date-time
          type: string
      required:
        - id
        - kind
        - enabled
        - scope
        - schema_version
        - config
        - created_at
        - updated_at
      type: object
    ErrorResponse:
      properties:
        error:
          properties:
            code:
              type: string
            details:
              description: Any value
            message:
              type: string
          required:
            - code
            - message
          type: object
        meta:
          type: object
      required:
        - error
      type: object
  securitySchemes:
    BearerAuth:
      bearerFormat: API Key
      description: API key authentication. Pass your API key as a Bearer token.
      scheme: bearer
      type: http
    ManagementBearer:
      bearerFormat: Management API Key
      description: >-
        Management API authentication. Pass an `op-mak-…` management token as a
        Bearer token. Runtime `op-…` API keys are rejected with 403 — they
        belong on the data-plane endpoints. Mint a management key from the
        platform UI under Settings → API keys.
      scheme: bearer
      type: http

````

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