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

# Cancel subscription

> Cancel a channel subscription programmatically

## Overview

Requests the cancellation of a channel subscription. Cancellation is not immediate — the channel enters `CANCELLATION_PROCESS` status and remains active until the end of the already-paid period. After that period, the status changes to `CANCELED`.

The `cancel=true` query parameter is required as an explicit cancellation confirmation.

The `cancelReason` field in the body is optional, but recommended for auditing purposes.

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

### Status after cancellation

| Status                 | Description                                                      |
| ---------------------- | ---------------------------------------------------------------- |
| `CANCELLATION_PROCESS` | Cancellation requested, channel still active until end of period |
| `CANCELED`             | Channel effectively cancelled and deactivated                    |

<Warning>
  Cancellation cannot be undone via API. To reactivate the channel, a new subscription must be initiated via [Subscribe channel](/en/channels/subscribe-channel).
</Warning>

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


## OpenAPI

````yaml en/channels/openapi-cancel.json DELETE /v1/channels/{channelId}/cancel
openapi: 3.1.0
info:
  title: 'Hub Message - Partner: Cancel Subscription'
  version: 1.0.0
servers:
  - url: https://api.hubmessage.io
security:
  - bearerAuth: []
paths:
  /v1/channels/{channelId}/cancel:
    delete:
      tags:
        - Partners
      summary: Cancel subscription (Partner)
      description: >-
        Requests cancellation of the channel subscription. The channel enters
        `CANCELLATION_PROCESS` and remains active until the end of the paid
        period. Requires ENTERPRISE role.
      operationId: partnerCancelSubscription
      parameters:
        - name: channelId
          in: path
          required: true
          description: Channel ID (obtained via Create channel)
          schema:
            type: string
            example: 019E4C54B1B375A28970B605CA9B03C3
        - name: cancel
          in: query
          required: true
          description: Must be `true` to confirm the cancellation
          schema:
            type: boolean
            example: true
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelRequest'
            examples:
              withReason:
                summary: With cancellation reason
                value:
                  cancelReason: Customer closed the company
              withoutReason:
                summary: Without reason (body omitted)
                value: {}
      responses:
        '204':
          description: Cancellation requested successfully. No content returned.
        '400':
          description: Invalid request — `cancel=true` query parameter missing
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: 400
                message: cancel query param is required
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Channel not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: 404
                message: Channel not found
        '422':
          description: Business rule violation — account does not have ENTERPRISE role
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error: 422
                message: This action requires ENTERPRISE role
components:
  schemas:
    CancelRequest:
      type: object
      properties:
        cancelReason:
          type: string
          description: Cancellation reason (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

````