> ## 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.

# Create Notification Channel

> Create a notification channel. The `config` shape depends on `type`. Newly created channels are unverified; call the verify endpoint before attaching them to a schedule. Channel types available depend on your plan.



## OpenAPI

````yaml POST /notification-channels
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:
  /notification-channels:
    post:
      tags:
        - Notification Channels
      summary: Create Notification Channel
      description: >-
        Create a notification channel. The `config` shape depends on `type`.
        Newly created channels are unverified; call the verify endpoint before
        attaching them to a schedule. Channel types available depend on your
        plan.
      operationId: createNotificationChannel
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateNotificationChannelRequest'
            examples:
              email:
                summary: Email channel
                value:
                  type: email
                  label: On-call inbox
                  config:
                    to: oncall@example.com
              slack:
                summary: Slack channel
                value:
                  type: slack
                  label: Ops alerts
                  config:
                    webhookUrl: https://hooks.slack.com/services/T000/B000/XXXX
              telegram:
                summary: Telegram channel
                value:
                  type: telegram
                  label: Telegram bot
                  config:
                    botToken: 123456:ABC-DEF
      responses:
        '201':
          description: Channel created
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    $ref: '#/components/schemas/NotificationChannel'
                  success:
                    type: boolean
                    example: true
                required:
                  - data
                  - success
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/UnauthorizedError'
        '403':
          $ref: '#/components/responses/PlanLimitError'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    CreateNotificationChannelRequest:
      oneOf:
        - type: object
          required:
            - type
            - label
            - config
          properties:
            type:
              type: string
              enum:
                - email
            label:
              type: string
              minLength: 1
              maxLength: 100
            config:
              type: object
              required:
                - to
              properties:
                to:
                  type: string
                  format: email
                  description: Recipient email address
        - type: object
          required:
            - type
            - label
            - config
          properties:
            type:
              type: string
              enum:
                - slack
                - discord
            label:
              type: string
              minLength: 1
              maxLength: 100
            config:
              type: object
              required:
                - webhookUrl
              properties:
                webhookUrl:
                  type: string
                  format: uri
                  description: Incoming webhook URL (must be https)
        - type: object
          required:
            - type
            - label
            - config
          properties:
            type:
              type: string
              enum:
                - telegram
            label:
              type: string
              minLength: 1
              maxLength: 100
            config:
              type: object
              required:
                - botToken
              properties:
                botToken:
                  type: string
                  description: >-
                    Telegram bot token. The chat id is discovered during
                    verification.
                chatId:
                  type: string
                  description: Optional chat id; auto-discovered on verify if omitted.
    NotificationChannel:
      type: object
      required:
        - id
        - type
        - verified
        - label
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          description: Unique channel identifier
          example: channel_123
        type:
          type: string
          enum:
            - email
            - slack
            - discord
            - telegram
          description: Channel delivery type
          example: slack
        verified:
          type: boolean
          description: >-
            Whether the channel has passed verification. Only verified channels
            can be attached to a schedule.
          example: true
        label:
          type: string
          description: Display label (1-100 chars)
          example: Ops alerts
        createdAt:
          type: string
          format: date-time
          example: '2024-01-01T12:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          example: '2024-01-02T12:00:00.000Z'
    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
    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).

````