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

# Update Policy Rule

> Manually create a compliance rule for a policy document. Rules are immutable; updates require delete + recreate.



## OpenAPI

````yaml POST /policies/{policyId}/rules
openapi: 3.0.1
info:
  title: Indora Labs API
  description: >-
    Comprehensive API for search, ingestion, file ops, redaction, detections,
    audit trail, and case management. All endpoints return strongly-typed JSON
    with explicit field descriptions and examples.
  version: 1.0.0
  license:
    name: Proprietary
servers:
  - url: https://api.indoralabs.com
security:
  - apiKeyAuth: []
tags:
  - name: Search
  - name: Uploads
  - name: Files
  - name: Redactions
  - name: Detections
  - name: Cases
  - name: Audit
  - name: Auth
  - name: Embeddings
  - name: Policy
paths:
  /policies/{policyId}/rules:
    post:
      tags:
        - Policies
      summary: Create policy rule
      description: >-
        Manually create a compliance rule for a policy document. Rules are
        immutable; updates require delete + recreate.
      parameters:
        - name: policyId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreatePolicyRuleRequest'
      responses:
        '201':
          description: Rule created
          content:
            application/json:
              schema:
                type: object
                properties:
                  rule:
                    $ref: '#/components/schemas/PolicyRule'
        '400':
          description: Invalid request payload
        '401':
          description: Unauthorized
        '404':
          description: Policy not found
        '500':
          description: Internal server error
components:
  schemas:
    CreatePolicyRuleRequest:
      type: object
      properties:
        type:
          type: string
          enum:
            - REDACT
            - DETECT
            - EXCLUDE
          description: Rule behavior.
        target:
          type: string
          description: Target category or phrase this rule applies to.
        sourceText:
          type: string
          description: Exact source text from the policy document.
        sourcePage:
          type: integer
          minimum: 1
          description: Page number in the policy document.
        offsetStart:
          type: integer
          minimum: 0
          description: Start character offset of the source text.
        offsetEnd:
          type: integer
          minimum: 1
          description: End character offset of the source text.
      required:
        - type
        - target
        - sourceText
        - sourcePage
        - offsetStart
        - offsetEnd
    PolicyRule:
      type: object
      properties:
        id:
          type: string
          format: uuid
          example: b87e2a3c-6ef9-4f9b-8e1b-9f9c2c1eab23
          description: Unique identifier for the policy rule.
        doc_id:
          type: string
          format: uuid
          example: f1c8e8b0-7a1b-4f34-9b5b-0d99a3c9b77d
          description: Policy document ID this rule belongs to.
        type:
          type: string
          enum:
            - REDACT
            - DETECT
            - EXCLUDE
          example: REDACT
          description: Rule behavior.
        target:
          type: string
          example: all police contact information
          description: Normalized target this rule applies to.
        source_text:
          type: string
          example: All personal contact information of officers must be redacted
          description: Exact source text from the policy document that produced this rule.
        source_page:
          type: integer
          example: 3
          description: Page number within the policy document where the rule originated.
        offset_start:
          type: integer
          example: 120
          description: Character offset where the source text begins.
        offset_end:
          type: integer
          example: 182
          description: Character offset where the source text ends.
        created_at:
          type: string
          example: 2026-01-22 14:31:09.123 -0600
          description: Timestamp when the rule was created.
      additionalProperties: false
      description: Immutable compliance rule derived from a policy document.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key

````