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

# Criar canal

> Crie um novo canal via API

## Conceituação

Cria um novo canal. Após a criação, o canal precisa ser conectado (via painel ou SDK) para começar a enviar e receber mensagens.

O `id` retornado é o `channelId` usado em todas as chamadas de API.

### Tipos disponíveis

| Tipo            | Plataforma                  |
| --------------- | --------------------------- |
| `META_WHATSAPP` | WhatsApp (API Oficial Meta) |


## OpenAPI

````yaml pt/channels/openapi-create.json POST /v1/channels
openapi: 3.1.0
info:
  title: Hub Message - Criar Canal
  version: 1.0.0
servers:
  - url: https://api.hubmessage.io
security:
  - bearerAuth: []
paths:
  /v1/channels:
    post:
      tags:
        - Canais
      summary: Criar canal
      description: Cria um novo canal.
      operationId: createChannel
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateChannelRequest'
            example:
              name: Meu canal WhatsApp
              type: META_WHATSAPP
      responses:
        '200':
          description: Canal criado com sucesso
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateChannelResponse'
              example:
                id: a1b2c3d4-e5f6-7890-abcd-ef1234567890
        '401':
          $ref: '#/components/responses/Unauthorized'
components:
  schemas:
    CreateChannelRequest:
      type: object
      required:
        - name
        - type
      properties:
        name:
          type: string
          description: Nome do canal
        type:
          type: string
          description: Tipo do canal (plataforma)
          enum:
            - META_WHATSAPP
    CreateChannelResponse:
      type: object
      properties:
        id:
          type: string
          description: ID do canal criado (channelId)
    Error:
      type: object
      properties:
        error:
          type: integer
        message:
          type: string
  responses:
    Unauthorized:
      description: Token inválido ou ausente.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 401
            message: Unauthorized
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Secret Key gerada no painel de Segurança do Hub Message

````