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

# Set Schedule Notifications

> Set (replacing any prior) a schedule's notification preference. When `notifyOn` is not `none`, at least one verified channel id is required. `success` and `both` require at least one webhook channel (Slack, Discord, or Telegram). Some outcomes are gated by plan.



## OpenAPI

````yaml PUT /schedules/{id}/notifications
openapi: 3.1.0
info:
  title: Cronhost API
  description: >-
    Schedule HTTP requests with cron expressions. Cronhost allows you to
    automate HTTP requests on a schedule using familiar cron syntax.
  license:
    name: MIT
  version: 1.0.0
  contact:
    name: Cronhost Support
    email: help@cronho.st
    url: https://cronho.st
servers:
  - url: https://cronho.st/api/v1
    description: Production API
security:
  - apiKeyAuth: []
tags:
  - name: Schedules
    description: Create, manage, and control scheduled HTTP requests
  - name: Jobs
    description: Monitor and retrieve job execution details
  - name: Notification Channels
    description: Manage the destinations that receive schedule alerts
  - name: Schedule Notifications
    description: Configure which outcomes notify you per schedule
paths:
  /schedules/{id}/notifications:
    put:
      tags:
        - Schedule Notifications
      summary: Set Schedule Notifications
      description: >-
        Set (replacing any prior) a schedule's notification preference. When
        `notifyOn` is not `none`, at least one verified channel id is required.
        `success` and `both` require at least one webhook channel (Slack,
        Discord, or Telegram). Some outcomes are gated by plan.
      operationId: setScheduleNotifications
      parameters:
        - name: id
          in: path
          required: true
          description: Unique schedule identifier
          schema:
            type: string
            example: schedule_123
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SetScheduleNotificationRequest'
            examples:
              notifyOnFailure:
                summary: Alert on failures
                value:
                  notifyOn: failure
                  channelIds:
                    - channel_123
              disable:
                summary: Disable notifications
                value:
                  notifyOn: none
                  channelIds: []
      responses:
        '200':
          description: Notification preference updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/ScheduleNotificationPreference'
                  success:
                    type: boolean
                    example: true
                required:
                  - data
                  - success
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/PlanLimitError'
        '404':
          $ref: '#/components/responses/NotFoundError'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    SetScheduleNotificationRequest:
      type: object
      required:
        - notifyOn
      properties:
        notifyOn:
          type: string
          enum:
            - none
            - success
            - failure
            - both
          description: >-
            Which outcomes trigger a notification. Some values are gated by
            plan.
          example: failure
        channelIds:
          type: array
          items:
            type: string
          description: >-
            Verified channel ids to attach. Required (non-empty) when notifyOn
            is not "none". success/both require at least one webhook channel
            (Slack, Discord, or Telegram).
          example:
            - channel_123
    ScheduleNotificationPreference:
      type: object
      required:
        - scheduleId
        - notifyOn
        - channels
      properties:
        scheduleId:
          type: string
          example: schedule_123
        notifyOn:
          type: string
          enum:
            - none
            - success
            - failure
            - both
          description: Which outcomes trigger a notification
          example: failure
        channels:
          type: array
          description: Verified channels attached to this schedule
          items:
            type: object
            required:
              - channelId
              - type
              - label
              - verified
            properties:
              channelId:
                type: string
                example: channel_123
              type:
                type: string
                enum:
                  - email
                  - slack
                  - discord
                  - telegram
              label:
                type: string
                example: Ops alerts
              verified:
                type: boolean
                example: true
        warning:
          type: string
          nullable: true
          description: Non-blocking advisory (e.g. high-frequency success notifications).
          example: null
    ApiError:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - message
            - code
          properties:
            message:
              type: string
              description: Human-readable error message
            code:
              type: string
              description: Error code for programmatic handling
            details:
              description: Additional error details
  responses:
    ValidationError:
      description: Validation error occurred
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            error:
              message: Validation error
              code: VALIDATION_ERROR
              details:
                fieldErrors:
                  cronExpression:
                    - Invalid cron expression
                  endpoint:
                    - Must be a valid URL
    UnauthorizedError:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            missingApiKey:
              summary: Missing API key
              value:
                error:
                  message: Missing x-api-key header
                  code: UNAUTHORIZED
            invalidApiKey:
              summary: Invalid API key
              value:
                error:
                  message: Invalid API key
                  code: UNAUTHORIZED
    PlanLimitError:
      description: >-
        The request exceeds a plan limit or uses a feature not available on the
        current plan
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            error:
              message: Your plan does not allow this notification option.
              code: PLAN_LIMIT_EXCEEDED
    NotFoundError:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            scheduleNotFound:
              summary: Schedule not found
              value:
                error:
                  message: Schedule not found
                  code: NOT_FOUND
            jobNotFound:
              summary: Job not found
              value:
                error:
                  message: Job not found
                  code: NOT_FOUND
    InternalServerError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          example:
            error:
              message: Internal server error
              code: INTERNAL_ERROR
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        API key for authentication. Get your API key from the [Cronhost
        dashboard](https://cronho.st/settings).

````