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

# Update rule

> Update a rule's title, content, filters or sort order. Pass null on a filter field to clear it.



## OpenAPI

````yaml /api-reference/api.json patch /v1/rules/{ruleId}
openapi: 3.0.0
info:
  title: QA.tech API
  version: 1.0.0
  contact:
    name: QA.tech
    url: https://qa.tech
    email: support@qa.tech
  description: API for triggering and managing AI-powered test runs
servers:
  - url: https://api.qa.tech
    description: Production
    variables: {}
security:
  - BearerAuth: []
tags:
  - name: Runs
  - name: Infrastructure
  - name: Test Cases
  - name: Application Builds
  - name: Status badge
  - name: Remote Tunnels
  - name: Chat
  - name: Applications
  - name: Features
  - name: Metrics
  - name: Release Checks
  - name: Projects
  - name: Knowledge
  - name: Rules
paths:
  /v1/rules/{ruleId}:
    patch:
      tags:
        - Rules
      summary: Update rule
      description: >-
        Update a rule's title, content, filters or sort order. Pass null on a
        filter field to clear it.
      operationId: UpdateRule
      parameters:
        - name: ruleId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateRuleRequest'
      responses:
        '200':
          description: The request has succeeded.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateRuleResponse'
components:
  schemas:
    UpdateRuleRequest:
      type: object
      properties:
        title:
          type: string
          minLength: 1
          maxLength: 200
        content:
          type: string
          minLength: 1
          maxLength: 10000
        applicationShortId:
          type: string
          allOf:
            - $ref: '#/components/schemas/ApplicationShortId'
          nullable: true
          description: >-
            Set to an application short id to scope the rule, or null to clear
            the filter
        labelFilter:
          type: string
          nullable: true
          description: Set to a label to scope the rule, or null to clear the filter
        scenarioShortIds:
          type: array
          items:
            $ref: '#/components/schemas/ScenarioShortId'
          nullable: true
          description: >-
            Set to scenario short ids to scope the rule, or null to clear the
            filter
        urlPathFilter:
          type: string
          nullable: true
          description: >-
            Set to a URL path substring to scope the rule, or null to clear the
            filter
        sortOrder:
          type: integer
          format: int32
          description: Rules are applied in ascending sort order
        projectShortId:
          allOf:
            - $ref: '#/components/schemas/ProjectShortId'
          description: >-
            Target a specific project by its prefixed short ID
            (proj-slug_shortId or proj_shortId), as returned by the projects
            API. Required for organization-scoped API keys; project-scoped keys
            may only pass their own project's short ID.
    UpdateRuleResponse:
      type: object
      required:
        - success
        - rule
      properties:
        success:
          type: boolean
        rule:
          $ref: '#/components/schemas/ProjectRule'
    ApplicationShortId:
      type: string
      pattern: ^app(-.+_.+|_.+)$
    ScenarioShortId:
      type: string
      pattern: ^scenario(-.+_.+|_.+)$
    ProjectShortId:
      type: string
      pattern: ^proj(-.+_.+|_.+)$
    ProjectRule:
      type: object
      required:
        - id
        - consumer
        - title
        - content
        - applicationShortId
        - labelFilter
        - scenarioShortIds
        - urlPathFilter
        - sortOrder
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
        consumer:
          $ref: '#/components/schemas/RuleConsumer'
        title:
          type: string
        content:
          type: string
        applicationShortId:
          type: string
          allOf:
            - $ref: '#/components/schemas/ApplicationShortId'
          nullable: true
          description: >-
            When set, the rule only applies to tests running against this
            application
        labelFilter:
          type: string
          nullable: true
          description: When set, the rule only applies to test cases carrying this label
        scenarioShortIds:
          type: array
          items:
            $ref: '#/components/schemas/ScenarioShortId'
          nullable: true
          description: When set, the rule only applies to test cases in these scenarios
        urlPathFilter:
          type: string
          nullable: true
          description: >-
            When set, the rule only applies to tests whose start URL path
            contains this substring
        sortOrder:
          type: integer
          format: int32
          description: Rules are applied in ascending sort order
        createdAt:
          type: string
        updatedAt:
          type: string
    RuleConsumer:
      type: string
      enum:
        - chat
        - agent
        - pr_review
      description: >-
        Which QA.tech agent the rule applies to: `chat` steers the AI chat
        assistant, `agent` steers the test agent during runs, `pr_review` steers
        PR review checks.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: Bearer

````