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

# Add a notification channel

> Adds a channel that receives the notification types you choose.

- **SMS or email:** first send a code with
  `POST /v1/channels/send-phone-token` or
  `POST /v1/channels/send-email-token`, then send it here as
  `metaData.token` (SMS codes are valid for 2 minutes, email codes for
  3).

- **Telegram:** send your numeric Telegram chat ID as
  `metaData.chatID`.


Your subscription plan limits how many channels of each type you can have. Your account must be verified. With `teamID`, this needs the `team.manage` permission.



## OpenAPI

````yaml /spec/platform-support.yaml post /v1/channels
openapi: 3.0.1
info:
  title: Support & Notifications
  version: 1.0.0
  description: |
    Open and follow support tickets, read your notifications, and choose
    where notifications are delivered (SMS, email or Telegram).

    With `teamID`, these endpoints work on the team's tickets, notifications
    and channels. The description of each endpoint says which permission it
    needs in the team.
servers:
  - url: https://api.liara.ir
security:
  - bearerAuth: []
tags:
  - name: Tickets
    description: Open, reply to and close support tickets.
  - name: Attachments
    description: Upload files to attach to tickets, and download them.
  - name: Notifications
    description: Read notifications and set the low-credit alert threshold.
  - name: Notification Channels
    description: Choose which notifications are sent by SMS, email or Telegram.
paths:
  /v1/channels:
    post:
      tags:
        - Notification Channels
      summary: Add a notification channel
      description: >-
        Adds a channel that receives the notification types you choose.


        - **SMS or email:** first send a code with
          `POST /v1/channels/send-phone-token` or
          `POST /v1/channels/send-email-token`, then send it here as
          `metaData.token` (SMS codes are valid for 2 minutes, email codes for
          3).

        - **Telegram:** send your numeric Telegram chat ID as
          `metaData.chatID`.


        Your subscription plan limits how many channels of each type you can
        have. Your account must be verified. With `teamID`, this needs the
        `team.manage` permission.
      operationId: createChannel
      parameters:
        - $ref: '#/components/parameters/TeamID'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - type
                - interestedNotifications
                - metaData
              properties:
                type:
                  $ref: '#/components/schemas/ChannelType'
                interestedNotifications:
                  type: array
                  minItems: 1
                  description: >-
                    Notification types to send to this channel. For `sms`, use
                    values from `SMSNotificationType`; for `email` and
                    `telegram`, values from `EmailNotificationType`.
                  items:
                    type: string
                metaData:
                  oneOf:
                    - $ref: '#/components/schemas/SMSChannelMetaData'
                    - $ref: '#/components/schemas/EmailChannelMetaData'
                    - $ref: '#/components/schemas/TelegramChannelMetaData'
            examples:
              sms:
                summary: SMS channel
                value:
                  type: sms
                  interestedNotifications:
                    - LowCredit
                    - ServicesHaveBeenFrozen
                  metaData:
                    phone: '09120000000'
                    token: '123456'
              email:
                summary: Email channel
                value:
                  type: email
                  interestedNotifications:
                    - SSLRenewFailed
                    - DiskBackupFailed
                  metaData:
                    email: ops@example.com
                    token: '123456'
              telegram:
                summary: Telegram channel
                value:
                  type: telegram
                  interestedNotifications:
                    - LowCredit
                  metaData:
                    chatID: '100000000'
      responses:
        '201':
          description: The channel was added. The response body is empty.
        '400':
          description: >-
            The body or `teamID` is invalid, or you've reached the maximum
            number of channels of this type for your plan.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 400
                error: Bad Request
                message: You have reached your maximum number of allowed channels.
                data: null
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          description: >-
            The verification code is wrong or has expired, the notification type
            isn't available for SMS, your account isn't verified
            (`account_verification_required`), or, with `teamID`, you aren't a
            member (`team_not_found`) or lack `team.manage` (`no_permission`).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                statusCode: 403
                error: Forbidden
                message: Invalid token.
                data: null
components:
  parameters:
    TeamID:
      name: teamID
      in: query
      required: false
      description: >-
        Run the request in the context of a team you belong to, instead of your
        personal account.
      schema:
        $ref: '#/components/schemas/ObjectID'
      example: '000000000000000000000002'
  schemas:
    ChannelType:
      type: string
      enum:
        - sms
        - email
        - telegram
    SMSChannelMetaData:
      type: object
      title: SMS
      required:
        - phone
        - token
      properties:
        phone:
          $ref: '#/components/schemas/PhoneNumber'
        token:
          type: string
          description: Code from `POST /v1/channels/send-phone-token`.
    EmailChannelMetaData:
      type: object
      title: Email
      required:
        - email
        - token
      properties:
        email:
          type: string
          format: email
        token:
          type: string
          description: Code from `POST /v1/channels/send-email-token`.
    TelegramChannelMetaData:
      type: object
      title: Telegram
      required:
        - chatID
      properties:
        chatID:
          type: string
          pattern: ^\d+$
          description: Your numeric Telegram chat ID.
    Error:
      type: object
      description: Standard error body.
      properties:
        statusCode:
          type: integer
        error:
          type: string
          description: HTTP status text.
        message:
          type: string
          description: What went wrong.
        data:
          type: object
          nullable: true
          description: >-
            Extra details. When present, `code` is a stable, machine-readable
            error code.
          properties:
            code:
              type: string
    ObjectID:
      type: string
      pattern: ^[0-9a-fA-F]{24}$
      description: 24-character hexadecimal ID.
    PhoneNumber:
      type: string
      pattern: ^09\d{9}$
      description: Iranian mobile number in the form `09XXXXXXXXX`.
    AuthError:
      type: object
      description: Error body returned when the API token is rejected.
      properties:
        error:
          type: string
  responses:
    Unauthorized:
      description: The API token is missing, invalid or expired.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/AuthError'
          example:
            error: Unauthorized.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: 'Send your API token as `Authorization: Bearer <api-token>`.'

````

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