> ## Documentation Index
> Fetch the complete documentation index at: https://axiom-support-improvements-2025-10-20.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create monitor

> Create monitor



## OpenAPI

````yaml v2 post /monitors
openapi: 3.0.0
info:
  description: A public and stable API for interacting with axiom services
  title: Axiom
  termsOfService: http://axiom.co/terms
  contact:
    name: Axiom support team
    url: https://axiom.co
    email: hello@axiom.co
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: 2.0.0
servers:
  - url: https://api.axiom.co/v2/
security: []
paths:
  /monitors:
    post:
      tags:
        - Monitors
      description: Create monitor
      operationId: createMonitor
      requestBody:
        $ref: '#/components/requestBodies/Monitor'
      responses:
        '200':
          description: Monitor
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/MonitorWithId'
      security:
        - Auth:
            - monitors|create
components:
  requestBodies:
    Monitor:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Monitor'
      required: true
  schemas:
    MonitorWithId:
      description: Monitor configuration with its unique identifier
      allOf:
        - $ref: '#/components/schemas/Monitor'
        - type: object
          required:
            - id
          properties:
            id:
              description: Unique identifier for the monitor
              type: string
              example: mon_xyz789
    Monitor:
      description: >
        Configuration for a monitoring rule. Monitors can be configured to:

        - Check threshold values (e.g., CPU usage > 90%)

        - Match specific events in logs

        - Detect anomalies based on historical patterns

        Each monitor runs on a specified interval and can trigger notifications
        through configured notifiers.
      type: object
      required:
        - name
        - type
        - aplQuery
      properties:
        alertOnNoData:
          description: Whether to alert when no data is received
          type: boolean
          example: true
        aplQuery:
          description: |
            APL (Axiom Processing Language) query string used for monitoring.
            This query defines what data to analyze and how to process it.
          type: string
          example: '| where severity = ''error'' | count() > 100'
        columnName:
          description: Name of the column to monitor
          type: string
          example: cpu_usage
        compareDays:
          description: Number of days to compare for anomaly detection
          type: number
          format: int64
          maximum: 7
          example: 7
        createdAt:
          description: Timestamp when the monitor was created
          type: string
          format: date-time
          example: '2024-03-20T10:00:00Z'
        createdBy:
          description: ID of the user who created the monitor
          type: string
          example: usr_789xyz
        description:
          description: Detailed description of the monitor's purpose
          type: string
          example: Monitors CPU usage and alerts when it exceeds 90%
        disabled:
          description: Whether the monitor is currently disabled
          type: boolean
          example: false
        disabledUntil:
          description: Timestamp until when the monitor should remain disabled
          type: string
          format: date-time
          example: '2024-04-01T00:00:00Z'
          nullable: true
        intervalMinutes:
          description: |
            How frequently the monitor should run, in minutes.
            Minimum value is 1 minute.
          type: integer
          format: int64
          minimum: 1
          example: 5
        name:
          description: Name of the monitor
          type: string
          example: Production CPU Monitor
        notifierIds:
          description: |
            List of notifier IDs that will receive alerts.
            Notifiers can be email, Slack, webhook endpoints, etc.
          type: array
          items:
            type: string
          example:
            - notify_slack_prod
            - notify_email_oncall
        notifyByGroup:
          description: Whether to group notifications
          type: boolean
          example: false
        notifyEveryRun:
          description: Whether to send notifications on every check
          type: boolean
          example: false
        operator:
          description: |
            Comparison operator for threshold checks:
            - Below: Trigger when value < threshold
            - BelowOrEqual: Trigger when value <= threshold
            - Above: Trigger when value > threshold
            - AboveOrEqual: Trigger when value >= threshold
            - AboveOrBelow: Trigger when value is outside a range
          type: string
          enum:
            - Below
            - BelowOrEqual
            - Above
            - AboveOrEqual
            - AboveOrBelow
          example: Above
        rangeMinutes:
          description: |
            Time window to evaluate in each check, in minutes.
            For example, "last 5 minutes of data"
          type: integer
          format: int64
          minimum: 1
          example: 5
        resolvable:
          description: Whether the alert can be manually resolved
          type: boolean
          example: true
        secondDelay:
          description: Delay in seconds before triggering the alert
          type: number
          format: int64
          maximum: 86400
          example: 300
        skipResolved:
          description: Whether to skip resolved alerts
          type: boolean
          example: false
        threshold:
          description: Threshold value for triggering the alert
          type: number
          format: double
          x-omitempty: false
          example: 90
        tolerance:
          description: Tolerance percentage for anomaly detection
          type: number
          maximum: 100
          example: 10
        triggerAfterNPositiveResults:
          description: Number of positive results needed before triggering
          type: number
          format: int64
          example: 2
        triggerFromNRuns:
          description: >
            Number of consecutive check runs that must fail before triggering an
            alert.

            Use this to avoid alerting on temporary spikes.
          type: number
          format: int64
          example: 3
        type:
          description: >
            Type of monitoring check to perform:

            - Threshold: Compares a numeric value against a threshold

            - MatchEvent: Looks for specific events or patterns

            - AnomalyDetection: Identifies unusual patterns based on historical
            data
          type: string
          enum:
            - Threshold
            - MatchEvent
            - AnomalyDetection
          example: Threshold
  securitySchemes:
    Auth:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.google.com/o/oauth2/v2/auth
          tokenUrl: https://www.googleapis.com/oauth2/v4/token
          scopes: {}

````