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

# Cancel Subscription

> Cancel a subscription or bill associated with a linked merchant account.



## OpenAPI

````yaml POST /subscriptions/{id}/cancel
openapi: 3.1.0
info:
  title: Knot API
  description: An API to interact with the Knot merchant connectivity platform.
  version: 1.0.0
servers:
  - url: https://development.knotapi.com
    description: Development server
security:
  - basicAuth: []
paths:
  /subscriptions/{id}/cancel:
    post:
      description: Cancel a subscription or bill associated with a linked merchant account.
      operationId: subscription_cancel
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            example: ka8sdf0asdfm10as0a0sdfja7ssa8
          description: The subscription ID from the subscription object.
      responses:
        '202':
          description: Cancellation request accepted.
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                    example: Success
        '400':
          description: Bad request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                SubscriptionIdRequired:
                  summary: Subscription ID is required
                  value:
                    error_type: INVALID_REQUEST
                    error_code: INVALID_FIELD
                    error_message: The subscription ID field is required.
                SubscriptionNotFound:
                  summary: Subscription not found
                  value:
                    error_type: SUBSCRIPTION_ERROR
                    error_code: SUBSCRIPTION_NOT_FOUND
                    error_message: >-
                      The subscription was not found. Please check the ID
                      provided.
                MerchantUnavailable:
                  summary: Merchant unavailable
                  value:
                    error_type: MERCHANT_ERROR
                    error_code: MERCHANT_UNAVAILABLE
                    error_message: >-
                      The merchant is unavailable. Please check the merchant_id
                      provided.
                MerchantAccountDisconnected:
                  summary: Merchant account disconnected
                  value:
                    error_type: MERCHANT_ACCOUNT_ERROR
                    error_code: MERCHANT_ACCOUNT_DISCONNECTED
                    error_message: >-
                      The merchant account is disconnected. Please check the
                      merchant_id provided.
                OngoingOperation:
                  summary: Ongoing operation
                  value:
                    error_type: MERCHANT_ACCOUNT_ERROR
                    error_code: ONGOING_OPERATION
                    error_message: An existing operation is in progress.
        '401':
          description: Unauthorized request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                AuthFailed:
                  summary: Auth failed
                  value:
                    error_type: INVALID_INPUT
                    error_code: INVALID_API_KEYS
                    error_message: Invalid client_id or secret provided.
        '403':
          description: Forbidden request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                NoAccess:
                  summary: No access
                  value:
                    error_type: INVALID_REQUEST
                    error_code: NO_ACCESS
                    error_message: Please contact Knot for access to this endpoint.
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                InternalServerError:
                  summary: Unexpected server error
                  value:
                    message: Server Error
components:
  schemas:
    Error:
      type: object
      properties:
        error_type:
          type: string
          description: Type of error.
          enum:
            - INVALID_INPUT
            - INVALID_REQUEST
            - USER_ERROR
            - SESSION_ERROR
            - MERCHANT_ACCOUNT_ERROR
            - MERCHANT_ERROR
            - SUBSCRIPTION_ERROR
            - TRANSACTION_ERROR
            - CART_ERROR
          example: INVALID_REQUEST
        error_code:
          type: string
          description: Error code.
          enum:
            - INVALID_API_KEYS
            - INVALID_FIELD
            - INVALID_JWE
            - INVALID_CURSOR_FORMAT
            - USER_NOT_FOUND
            - MERCHANT_ACCOUNT_NOT_FOUND
            - MERCHANT_ACCOUNT_DISCONNECTED
            - SESSION_NOT_FOUND
            - EXTEND_NOT_SUPPORTED
            - MERCHANT_UNAVAILABLE
            - NO_ACCESS
            - TRANSACTION_NOT_FOUND
            - NO_TRANSACTIONS
            - SUBSCRIPTION_NOT_FOUND
            - ONGOING_OPERATION
            - CART_NOT_FOUND
            - FULFILLMENT_NOT_FOUND
          example: INVALID_FIELD
        error_message:
          type: string
          description: Detailed error message.
          example: The limit may not be greater than 10.
  securitySchemes:
    basicAuth:
      type: http
      scheme: basic
      description: >-
        Basic authentication header of the form `Basic <encoded-value>`, where
        `<encoded-value>` is the base64-encoded string `username:password`. Use
        your `client_id` as the `username` and your `secret` as the `password`
        value.

````