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

# Create Alert Rule



## OpenAPI

````yaml POST /alert-rules
openapi: 3.1.0
info:
  title: RevRing Voice AI API
  description: >-
    RevRing Voice AI platform API for managing AI voice agents, phone calls, SIP
    trunks, and analytics. Build intelligent voice applications that can handle
    inbound and outbound phone calls with AI-powered conversational agents.
  version: 1.0.0
  contact:
    name: RevRing Support
    url: https://revring.ai
servers:
  - url: https://api.revring.ai/v1
    description: Production API
security:
  - apiKeyAuth: []
tags:
  - name: Messaging Connections
    description: Connect messaging providers so agents can send text messages
  - name: Messages
    description: Send text messages and read your message log
  - name: Conversations
    description: List and clear managed conversation threads
  - name: SIP Trunks
    description: Manage SIP trunks for connecting agents to the phone network
  - name: Agents
    description: Manage AI voice agents and their configuration
  - name: Agent Folders
    description: Organize agents into folders for dashboard navigation
  - name: Calls
    description: Manage and query phone calls
  - name: Analytics
    description: Get analytics and metrics about your calls
  - name: Knowledge Bases
    description: >-
      Manage knowledge bases and sources for agent retrieval-augmented
      generation
  - name: Test Suites
    description: Manage test suites, test cases, and test runs for agent evaluation
  - name: Voices
    description: Browse the voices available to your organization for agent speech
  - name: Webhooks
    description: Webhook delivery settings for your organization
  - name: Alerts
    description: Alert rules on call metrics, delivered to a webhook or Slack
paths:
  /alert-rules:
    post:
      tags:
        - Alerts
      summary: Create Alert Rule
      operationId: createAlertRule
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AlertRuleCreate'
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/AlertRule'
        '400':
          description: Invalid settings, or 20 rules already (`limit_reached`)
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  message:
                    type: string
        '401':
          $ref: '#/components/responses/UnauthorizedError'
components:
  schemas:
    AlertRuleCreate:
      type: object
      description: Create an alert rule. Needs webhookUrl, slackWebhookUrl or both.
      properties:
        name:
          type: string
          maxLength: 100
        agentId:
          type: string
          nullable: true
          description: Only this agent's calls; null for all agents
        metric:
          type: string
          enum:
            - call_failure_rate
            - evaluation_fail_rate
            - negative_sentiment_rate
            - tool_error_rate
            - webhook_failure_rate
            - call_count
          description: What to watch. See [Alerts](/platform/alerts#what-you-can-watch).
        comparator:
          type: string
          enum:
            - above
            - below
          default: above
        threshold:
          type: number
          description: Percent (0-100) for rates; a number of calls for call_count
        windowMinutes:
          type: integer
          enum:
            - 15
            - 60
            - 240
            - 1440
          default: 60
        minCalls:
          type: integer
          minimum: 1
          default: 10
          description: Rates are only judged with at least this many calls in the window
        webhookUrl:
          type: string
          format: uri
          nullable: true
          description: >-
            https endpoint for JSON notifications (signed when you have a
            signing secret)
        slackWebhookUrl:
          type: string
          format: uri
          nullable: true
          description: Slack incoming webhook URL (https://hooks.slack.com/...)
        enabled:
          type: boolean
          default: true
      required:
        - name
        - metric
        - threshold
    AlertRule:
      type: object
      properties:
        name:
          type: string
          maxLength: 100
        agentId:
          type: string
          nullable: true
          description: Only this agent's calls; null for all agents
        metric:
          type: string
          enum:
            - call_failure_rate
            - evaluation_fail_rate
            - negative_sentiment_rate
            - tool_error_rate
            - webhook_failure_rate
            - call_count
          description: What to watch. See [Alerts](/platform/alerts#what-you-can-watch).
        comparator:
          type: string
          enum:
            - above
            - below
          default: above
        threshold:
          type: number
          description: Percent (0-100) for rates; a number of calls for call_count
        windowMinutes:
          type: integer
          enum:
            - 15
            - 60
            - 240
            - 1440
          default: 60
        minCalls:
          type: integer
          minimum: 1
          default: 10
          description: Rates are only judged with at least this many calls in the window
        webhookUrl:
          type: string
          format: uri
          nullable: true
          description: >-
            https endpoint for JSON notifications (signed when you have a
            signing secret)
        slackWebhookUrl:
          type: string
          format: uri
          nullable: true
          description: Slack incoming webhook URL (https://hooks.slack.com/...)
        enabled:
          type: boolean
          default: true
        id:
          type: string
        state:
          type: string
          enum:
            - ok
            - firing
        lastValue:
          type: number
          nullable: true
          description: Value at the last check
        lastSample:
          type: integer
          nullable: true
        lastEvaluatedAt:
          type: string
          format: date-time
          nullable: true
        lastTriggeredAt:
          type: string
          format: date-time
          nullable: true
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
  responses:
    UnauthorizedError:
      description: Authentication required or API key invalid
      content:
        application/json:
          schema:
            type: object
            properties:
              error:
                type: string
                example: unauthorized
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Generate API keys from the RevRing
        dashboard.

````

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