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

# Create Notification Rule

> Creates a new notification rule.



## OpenAPI

````yaml POST /apps/{appId}/notification-rules
openapi: 3.1.0
info:
  title: Vela API
  description: Event ingestion, schema management, and notification rules for Vela.
  version: 1.0.0
  contact:
    name: Vela Support
    email: support@vela.dev
servers:
  - url: https://api.vela.dev/v1
    description: Production
  - url: http://localhost:3000/v1
    description: Local development
security:
  - clientSecret: []
paths:
  /apps/{appId}/notification-rules:
    post:
      tags:
        - Notification Rules
      summary: Create Notification Rule
      description: Creates a new notification rule.
      operationId: create-notification-rule
      parameters:
        - $ref: '#/components/parameters/AppId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateNotificationRuleInput'
            example:
              name: Alert on large payment failure
              eventName: payment.failed
              enabled: true
              conditions:
                - id: cond-1
                  field: amountCents
                  operator: greater_than
                  value: 10000
              actions:
                - id: action-1
                  destinationId: dest-uuid
                  channel: slack
                  enabled: true
      responses:
        '201':
          description: Rule created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotificationRule'
              example:
                id: rule-uuid
                appId: app-uuid
                name: Alert on large payment failure
                eventName: payment.failed
                conditions:
                  - id: cond-1
                    field: amountCents
                    operator: greater_than
                    value: 10000
                actions:
                  - id: action-1
                    destinationId: dest-uuid
                    channel: slack
                    target: null
                    enabled: true
                enabled: true
                lastTriggeredAt: null
                triggerCount: 0
                createdAt: '2024-06-01T12:00:00.000Z'
      security:
        - clientSecret: []
components:
  parameters:
    AppId:
      name: appId
      in: path
      required: true
      description: App UUID or slug
      schema:
        type: string
      example: order-service
  schemas:
    CreateNotificationRuleInput:
      type: object
      required:
        - name
        - eventName
        - conditions
        - actions
      properties:
        name:
          type: string
          description: Rule display name
        eventName:
          type: string
          description: Event name to watch
        enabled:
          type: boolean
          default: true
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/RuleCondition'
          description: Array of conditions (empty array = trigger on all)
        actions:
          type: array
          items:
            $ref: '#/components/schemas/RuleAction'
          description: Array of delivery actions
    NotificationRule:
      type: object
      properties:
        id:
          type: string
          description: Rule identifier
        appId:
          type: string
          format: uuid
        name:
          type: string
          description: Rule display name
        eventName:
          type: string
          description: Event name to watch
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/RuleCondition'
          description: Conditions to evaluate (empty = trigger on all)
        actions:
          type: array
          items:
            $ref: '#/components/schemas/RuleAction'
          description: Delivery actions
        enabled:
          type: boolean
        lastTriggeredAt:
          type:
            - string
            - 'null'
          format: date-time
        triggerCount:
          type: integer
        createdAt:
          type: string
          format: date-time
    RuleCondition:
      type: object
      required:
        - id
        - field
        - operator
        - value
      properties:
        id:
          type: string
          description: Condition identifier
        field:
          type: string
          description: Event data field to evaluate
        operator:
          type: string
          enum:
            - equals
            - not_equals
            - greater_than
            - less_than
            - contains
            - starts_with
          description: Comparison operator
        value:
          description: Value to compare against
          oneOf:
            - type: string
            - type: number
    RuleAction:
      type: object
      required:
        - id
        - destinationId
        - channel
      properties:
        id:
          type: string
          description: Action identifier
        destinationId:
          type: string
          description: Destination identifier
        channel:
          type: string
          enum:
            - slack
            - discord
            - email
          description: Delivery channel
        target:
          type:
            - string
            - 'null'
          description: Channel-specific target
        enabled:
          type: boolean
          default: true
  securitySchemes:
    clientSecret:
      type: http
      scheme: bearer
      description: 'Client secret for management API access. Format: `vela_cs_...`'

````