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

# Delete channel

> Permanently delete a channel via API

## Overview

Permanently removes a channel and all its data. Deletion is irreversible — the channel is physically removed from the system.

<Warning>
  This endpoint requires the **ENTERPRISE** role on your account.
</Warning>

### Conditions for deletion

Deletion is only allowed when the channel has no active subscription. The table below describes the behavior by status:

| Status                   | Deletion allowed | Notes                                                           |
| ------------------------ | ---------------- | --------------------------------------------------------------- |
| Trial                    | Yes              | —                                                               |
| Pending                  | Yes              | If there is an open invoice, it will be automatically cancelled |
| Paid                     | No               | The channel must be cancelled before it can be deleted          |
| Cancellation in progress | No               | The channel must be cancelled before it can be deleted          |
| Cancelled                | Yes              | —                                                               |

<Warning>
  Deletion is permanent and irreversible. To delete a channel with an active subscription, first cancel the subscription via [Cancel subscription](/en/channels/cancel-subscription) and wait for the `CANCELED` status.
</Warning>

<Note>
  The `channelId` is obtained from the [Create channel](/en/channels/create-channel) endpoint.
</Note>


## OpenAPI

````yaml en/channels/openapi-delete.json DELETE /v1/channels/{channelId}
openapi: 3.1.0
info:
  title: 'Hub Message - Partner: Delete Channel'
  version: 1.0.0
servers:
  - url: https://api.hubmessage.io
security:
  - bearerAuth: []
paths:
  /v1/channels/{channelId}:
    delete:
      tags:
        - Partners
      summary: Delete channel (Partner)
      description: >-
        Permanently removes a channel and all its data. Deletion is only allowed
        when the channel has no active subscription (status `CANCELED`, `TRIAL`,
        or `PENDING`). Requires ENTERPRISE role.
      operationId: partnerDeleteChannel
      parameters:
        - name: channelId
          in: path
          required: true
          description: Channel ID (obtained via Create channel)
          schema:
            type: string
            example: 019E4C54B1B375A28970B605CA9B03C3
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DeleteRequest'
            examples:
              withReason:
                summary: With deletion reason
                value:
                  cancelReason: Customer closed the company
              withoutReason:
                summary: Without reason (body omitted)
                value: {}
      responses:
        '204':
          description: Channel deleted successfully. No content returned.
        '400':
          description: Invalid or missing authorization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: 400
                message: Authorization invalid
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Channel not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: 404
                message: Instance not found
        '422':
          description: Business rule violation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                enterpriseRequired:
                  summary: Account does not have ENTERPRISE role
                  value:
                    error: 422
                    message: Channel deletion requires ENTERPRISE role
                channelConnected:
                  summary: Channel is still connected
                  value:
                    error: 422
                    message: INSTANCE_STILL_CONNECTED
                activeSubscription:
                  summary: >-
                    Channel has an active subscription (PAID or
                    CANCELLATION_PROCESS)
                  value:
                    error: 422
                    message: INSTANCE_HAS_ACTIVE_SUBSCRIPTION
        '502':
          description: Internal service integration failure
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: 502
                message: Hermitage deleteChannel failed
components:
  schemas:
    DeleteRequest:
      type: object
      properties:
        cancelReason:
          type: string
          description: Reason for deletion (optional, but recommended for auditing)
          example: Customer closed the company
    Error:
      type: object
      properties:
        error:
          type: integer
        message:
          type: string
  responses:
    Unauthorized:
      description: Invalid or missing token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error: 401
            message: Unauthorized
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: Secret Key generated in the Hub Message Security panel

````