---
title: "Create AI Rule"
method: POST
path: "/auto-remediation-rule"
tags: ["AI Rule"]
---

# Create AI Rule

`POST /auto-remediation-rule`

## Request

- Base URL: `https://oneuptime.com/api`
- URL: `https://oneuptime.com/api/auto-remediation-rule`
- Auth: API key in header `APIKey`
- TypeScript: <https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification/docs/auto-remediation-rule/post.ts> (a function with typed inputs; its response is checked against the schema)

Endpoint to create a new AI Rule

## Request body

- object
  - `data` AutoRemediationRuleCreateSchema, required: Create schema for AutoRemediationRule model. Create
    - `criteria` object: Versioned conditions that determine whether this rule matches a resource. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `projectId` string, uuid: ID of your OneUptime Project in which this object belongs. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [No access - you don't have permission for this operation]
    - `name` string, required: Name of this AI rule. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `description` string: Description of this AI rule. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `isEnabled` boolean: Whether this rule is enabled. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `triggerEntityType` 'Incident' | 'Alert' | 'Profile' | 'Trace' | 'Exception' | 'Log' | 'Metric', required: Which kind of signal this rule decides about: Incident or Alert - or Profile, the slow code OneUptime finds in a service's profiles, or Trace, the slow and failing operations OneUptime finds in a service's traces, or Exception, the new and rising exceptions OneUptime finds in a service, or Log, the error, missing and noisy logs OneUptime finds in a service's logs, or Metric, the problems OneUptime finds in a service's metrics. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [No access - you don't have permission for this operation]
    - `investigates` boolean: Whether OneUptime AI investigates the incidents or alerts this rule matches. With enabled rules that investigate, only their matches are investigated. Off, the rule only fixes, and does not change which incidents are investigated. The dashboard turns it on for every rule; left out of an API write, it is off. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `onlyIfOpenAfterMinutes` number: Investigate only incidents or alerts still open this many minutes after they were created: OneUptime AI waits that long, then investigates if it is still open. Leave empty to investigate right away. When several rules match, the shortest wait decides. At most 1440 minutes (a day). Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `fixes` boolean: Whether OneUptime AI fixes the incidents or alerts this rule matches, the way its Execution Mode says. Off, the rule only investigates them. With enabled rules, an incident is fixed only when a rule that fixes matches it. On by default. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `executionMode` 'Suggest' | 'FullAuto': How a rule that fixes asks. Suggest asks before fixing: every fix the rule starts waits for one-click human approval. FullAuto fixes without asking: OneUptime AI fixes on its own where the cluster's or resource's AI agent page allows, a runbook it picks from the ones the rule names starts right away (one it picks from all of the project's runbooks still waits for approval), a change through an MCP server the rule names is made right away (through any of the project's MCP servers, it still waits for approval), and a rule that runs its runbooks every time starts them immediately. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `remediationAction` 'OneUptimeAI' | 'Runbooks': OneUptimeAI (the default): OneUptime AI fixes the matched incident or alert - on the Kubernetes clusters and infrastructure it is linked to, the way each one's AI agent page allows, with the project's runbooks (only the rule's Runbooks when it names some) and with commands on the rule's Runner when it picks one. Runbooks: the rule starts every one of its Runbooks for every match, without OneUptime AI deciding. Whether a person approves first is the rule's Execution Mode. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `aiSelectsRunbook` boolean: Kept for rules saved before rules were simplified: an AI planning run reads the incident/alert context and picks the most applicable runbook (from the attached candidates, or all enabled runbooks when none are attached), always proposing it for approval, and the rule does nothing else. Every OneUptime AI rule now lets AI pick a runbook on its own, so new rules leave this off. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `aiComposesCommands` boolean: Kept for rules saved before rules were simplified: the AI investigates the incident/alert and composes Bash commands for the rule's Runner and Command Runners, and the rule does nothing else. Suggest mode proposes a command plan for one-click approval; FullAuto mode may execute commands inline, but only ones matching the command allowlist. A OneUptime AI rule now composes commands on its Runner when it picks one, so new rules leave this off. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `commandAllowlist` object: Glob patterns for commands the AI may execute WITHOUT human approval under FullAuto (for example: systemctl restart *). Commands that do not match are proposed for one-click approval instead. Destructive commands are always refused by the built-in policy. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `commandRunners` object[]: Kept for rules saved before rules were simplified: more Runners the AI may target with composed commands, besides the rule's Runner. A Runner runs a rule's commands only when the rule names it. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `monitors` object[]: Only trigger for incidents/alerts from these monitors. Leave empty to match any monitor. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `incidentSeverities` object[]: Only trigger for incidents with these severities (incident rules only). Leave empty to match any severity. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `alertSeverities` object[]: Only trigger for alerts with these severities (alert rules only). Leave empty to match any severity. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `labels` object[]: Only trigger for incidents/alerts that carry at least one of these labels. Leave empty to match any label. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `monitorLabels` object[]: Only trigger when the incident/alert's monitor carries at least one of these labels — the natural way to scope rules to environments (e.g. staging vs production). Leave empty to match any monitor label. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `titlePattern` string: Case-insensitive regex matched against the entity's title. Leave empty to match any title. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `descriptionPattern` string: Case-insensitive regex matched against the entity's description. Leave empty to match any description. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `services` object[]: Profile, Trace, Exception, Log and Metric AI rules only: match what OneUptime found in one of these services. Leave empty to match any service. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `serviceLabels` object[]: Profile, Trace, Exception, Log and Metric AI rules only: match what OneUptime found in a service that carries at least one of these labels. Leave empty to match any label. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `serviceNamePattern` string: Profile, Trace, Exception, Log and Metric AI rules only: case-insensitive regex matched against the name of the service OneUptime found the problem in. Leave empty to match any name. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `runbooks` object[]: The runbooks OneUptime AI may pick and run for this rule. Leave empty to let it pick any of the project's runbooks. A rule whose Fix With is Runbooks starts every one of them for every match instead. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `externalMcpServers` object[]: The external MCP servers OneUptime AI may use while it investigates and fixes what this rule matches (an investigation uses only their tools that read). Leave empty to let it use all of the project's MCP servers; changes through them are then always proposed for approval first. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `runnerId` string, uuid: ID of the Runner OneUptime AI runs this rule's Bash commands on: one of the project's own Runners. Empty means none: OneUptime AI runs no commands of its own for the rule. Commands on the affected Kubernetes cluster or host always go through its AI agent. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `codeRepositories` object[]: The code repositories OneUptime AI may read while it investigates and fixes what this rule matches, and open the rule's pull requests in. Leave empty to let it use every repository the project has connected. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `llmProviderId` string, uuid: ID of the LLM provider OneUptime AI uses for everything this rule starts. Empty: the project's default provider, else the global one. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `aiContext` string: Notes OneUptime AI reads after the project's AI context when it investigates or fixes what this rule matches. Markdown, at most 5,000 characters. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `openCodeFixPullRequests` boolean: When an investigation of an incident or alert this rule matches finds the cause in your code, OneUptime AI opens a pull request with the fix, for review. Nothing is merged. Acts only while fixing new incidents (or alerts) automatically is on. On by default. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `openTelemetryPullRequests` boolean: When missing logs, traces or metrics stop an investigation of an incident or alert this rule matches, OneUptime AI opens a pull request that adds them, for review. Nothing is merged. Acts only while fixing new incidents (or alerts) automatically is on. On by default. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `verificationWindowMinutes` number: How long after the runbook starts the subject's monitors get to recover before verification fails. Defaults to 15 minutes. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `autoResolveOnVerifiedRecovery` boolean: When verification confirms the monitors recovered inside the window, automatically resolve the incident/alert. Off by default — the timeline note is posted either way. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]

## Response `201`

Created successfully

- object
  - `data` AutoRemediationRuleReadSchema: Read schema for AutoRemediationRule model. Read
    - `_id` string, uuid: ID of this object. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `createdAt` object: Date and Time when the object was created. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `updatedAt` object: Date and Time when the object was updated. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `deletedAt` object: Date and Time when the object was deleted. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `criteria` object: Versioned conditions that determine whether this rule matches a resource. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `projectId` string, uuid: ID of your OneUptime Project in which this object belongs. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [No access - you don't have permission for this operation]
    - `name` string, required: Name of this AI rule. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `description` string: Description of this AI rule. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `isEnabled` boolean: Whether this rule is enabled. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `triggerEntityType` 'Incident' | 'Alert' | 'Profile' | 'Trace' | 'Exception' | 'Log' | 'Metric', required: Which kind of signal this rule decides about: Incident or Alert - or Profile, the slow code OneUptime finds in a service's profiles, or Trace, the slow and failing operations OneUptime finds in a service's traces, or Exception, the new and rising exceptions OneUptime finds in a service, or Log, the error, missing and noisy logs OneUptime finds in a service's logs, or Metric, the problems OneUptime finds in a service's metrics. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [No access - you don't have permission for this operation]
    - `investigates` boolean: Whether OneUptime AI investigates the incidents or alerts this rule matches. With enabled rules that investigate, only their matches are investigated. Off, the rule only fixes, and does not change which incidents are investigated. The dashboard turns it on for every rule; left out of an API write, it is off. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `onlyIfOpenAfterMinutes` number: Investigate only incidents or alerts still open this many minutes after they were created: OneUptime AI waits that long, then investigates if it is still open. Leave empty to investigate right away. When several rules match, the shortest wait decides. At most 1440 minutes (a day). Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `fixes` boolean: Whether OneUptime AI fixes the incidents or alerts this rule matches, the way its Execution Mode says. Off, the rule only investigates them. With enabled rules, an incident is fixed only when a rule that fixes matches it. On by default. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `executionMode` 'Suggest' | 'FullAuto': How a rule that fixes asks. Suggest asks before fixing: every fix the rule starts waits for one-click human approval. FullAuto fixes without asking: OneUptime AI fixes on its own where the cluster's or resource's AI agent page allows, a runbook it picks from the ones the rule names starts right away (one it picks from all of the project's runbooks still waits for approval), a change through an MCP server the rule names is made right away (through any of the project's MCP servers, it still waits for approval), and a rule that runs its runbooks every time starts them immediately. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `remediationAction` 'OneUptimeAI' | 'Runbooks': OneUptimeAI (the default): OneUptime AI fixes the matched incident or alert - on the Kubernetes clusters and infrastructure it is linked to, the way each one's AI agent page allows, with the project's runbooks (only the rule's Runbooks when it names some) and with commands on the rule's Runner when it picks one. Runbooks: the rule starts every one of its Runbooks for every match, without OneUptime AI deciding. Whether a person approves first is the rule's Execution Mode. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `aiSelectsRunbook` boolean: Kept for rules saved before rules were simplified: an AI planning run reads the incident/alert context and picks the most applicable runbook (from the attached candidates, or all enabled runbooks when none are attached), always proposing it for approval, and the rule does nothing else. Every OneUptime AI rule now lets AI pick a runbook on its own, so new rules leave this off. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `aiComposesCommands` boolean: Kept for rules saved before rules were simplified: the AI investigates the incident/alert and composes Bash commands for the rule's Runner and Command Runners, and the rule does nothing else. Suggest mode proposes a command plan for one-click approval; FullAuto mode may execute commands inline, but only ones matching the command allowlist. A OneUptime AI rule now composes commands on its Runner when it picks one, so new rules leave this off. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `commandAllowlist` object: Glob patterns for commands the AI may execute WITHOUT human approval under FullAuto (for example: systemctl restart *). Commands that do not match are proposed for one-click approval instead. Destructive commands are always refused by the built-in policy. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `commandRunners` object[]: Kept for rules saved before rules were simplified: more Runners the AI may target with composed commands, besides the rule's Runner. A Runner runs a rule's commands only when the rule names it. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `monitors` object[]: Only trigger for incidents/alerts from these monitors. Leave empty to match any monitor. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `incidentSeverities` object[]: Only trigger for incidents with these severities (incident rules only). Leave empty to match any severity. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `alertSeverities` object[]: Only trigger for alerts with these severities (alert rules only). Leave empty to match any severity. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `labels` object[]: Only trigger for incidents/alerts that carry at least one of these labels. Leave empty to match any label. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `monitorLabels` object[]: Only trigger when the incident/alert's monitor carries at least one of these labels — the natural way to scope rules to environments (e.g. staging vs production). Leave empty to match any monitor label. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `titlePattern` string: Case-insensitive regex matched against the entity's title. Leave empty to match any title. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `descriptionPattern` string: Case-insensitive regex matched against the entity's description. Leave empty to match any description. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `services` object[]: Profile, Trace, Exception, Log and Metric AI rules only: match what OneUptime found in one of these services. Leave empty to match any service. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `serviceLabels` object[]: Profile, Trace, Exception, Log and Metric AI rules only: match what OneUptime found in a service that carries at least one of these labels. Leave empty to match any label. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `serviceNamePattern` string: Profile, Trace, Exception, Log and Metric AI rules only: case-insensitive regex matched against the name of the service OneUptime found the problem in. Leave empty to match any name. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `runbooks` object[]: The runbooks OneUptime AI may pick and run for this rule. Leave empty to let it pick any of the project's runbooks. A rule whose Fix With is Runbooks starts every one of them for every match instead. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `externalMcpServers` object[]: The external MCP servers OneUptime AI may use while it investigates and fixes what this rule matches (an investigation uses only their tools that read). Leave empty to let it use all of the project's MCP servers; changes through them are then always proposed for approval first. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `runnerId` string, uuid: ID of the Runner OneUptime AI runs this rule's Bash commands on: one of the project's own Runners. Empty means none: OneUptime AI runs no commands of its own for the rule. Commands on the affected Kubernetes cluster or host always go through its AI agent. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `codeRepositories` object[]: The code repositories OneUptime AI may read while it investigates and fixes what this rule matches, and open the rule's pull requests in. Leave empty to let it use every repository the project has connected. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
      - `id` string
    - `llmProviderId` string, uuid: ID of the LLM provider OneUptime AI uses for everything this rule starts. Empty: the project's default provider, else the global one. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `aiContext` string: Notes OneUptime AI reads after the project's AI context when it investigates or fixes what this rule matches. Markdown, at most 5,000 characters. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `openCodeFixPullRequests` boolean: When an investigation of an incident or alert this rule matches finds the cause in your code, OneUptime AI opens a pull request with the fix, for review. Nothing is merged. Acts only while fixing new incidents (or alerts) automatically is on. On by default. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `openTelemetryPullRequests` boolean: When missing logs, traces or metrics stop an investigation of an incident or alert this rule matches, OneUptime AI opens a pull request that adds them, for review. Nothing is merged. Acts only while fixing new incidents (or alerts) automatically is on. On by default. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `verificationWindowMinutes` number: How long after the runbook starts the subject's monitors get to recover before verification fails. Defaults to 15 minutes. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `autoResolveOnVerifiedRecovery` boolean: When verification confirms the monitors recovered inside the window, automatically resolve the incident/alert. Off by default — the timeline note is posted either way. Permissions - Create: [Project Owner, Project Admin, Create AI Rule], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [Project Owner, Project Admin, Edit AI Rule]
    - `createdByUserId` string, uuid: User ID who created this object. Permissions - Create: [No access - you don't have permission for this operation], Read: [Project Owner, Project Admin, Project Member, Viewer, Read AI Rule], Update: [No access - you don't have permission for this operation]

## Other responses

- `400`: Bad request. This response indicates that the request was malformed or contained invalid data.
- `401`: Unauthorized. This response indicates that the request requires user authentication.
- `402`: Payment Required. This response indicates that the request requires payment or a valid subscription.
- `403`: Forbidden. This response indicates that the server understood the request, but refuses to authorize it.
- `405`: Project not found. This response indicates that the requested project does not exist or is not accessible.
- `408`: Request Timeout. This response indicates that the server timed out waiting for the request.
- `415`: Unable to reach server. This response indicates that the server is currently unreachable or down.
- `422`: Not authorized. This response indicates that the user does not have permission to access the requested resource.
- `500`: Internal Server Error. This response indicates that the server encountered an unexpected condition that prevented it from fulfilling the request.

---

[API](https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification.md) - [All operations](https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification/llms.txt) - [OpenAPI document](https://skmtc.dev/oneuptime/apis/oneuptime-openapi-specification/revisions/ba3307d00304?raw)
