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

# Cancel subscription

> Cancels an active subscription by id.



## OpenAPI

````yaml /openapi.yaml delete /v1/subscriptions/{id}
openapi: 3.0.3
info:
  title: Quentli REST API
  version: 1.0.0
  description: OpenAPI spec for Quentli REST endpoints.
servers:
  - url: https://api.quentli.com
    description: Production API
  - url: https://api.staging.quentli.com
    description: Staging API for production-like validation
  - url: https://api.demo.quentli.com
    description: Demo API hostname served by staging
security:
  - organizationApiKey: []
tags:
  - name: Auth
  - name: Billing
  - name: Catalog
  - name: Customers
  - name: Invoices
  - name: Payment Methods
  - name: Payment Sessions
  - name: Payments
  - name: Subscriptions
  - name: Tax Invoices
  - name: Webhooks
paths:
  /v1/subscriptions/{id}:
    delete:
      tags:
        - Subscriptions
      summary: Cancel subscription
      description: Cancels an active subscription by id.
      operationId: subscriptions_cancel
      parameters:
        - schema:
            type: string
            description: Identifier of the subscription.
          required: true
          description: Identifier of the subscription.
          name: id
          in: path
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelSubscriptionArgs'
      responses:
        '200':
          description: Subscription canceled
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelSubscriptionPayload'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
        '404':
          description: Subscription not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
components:
  schemas:
    CancelSubscriptionArgs:
      type: object
      properties:
        input:
          type: object
          properties:
            customCancelReason:
              type: string
      required:
        - input
      description: Optional body for canceling a subscription (id is in the URL path).
    CancelSubscriptionPayload:
      type: object
      properties:
        subscription:
          $ref: '#/components/schemas/Subscription'
      required:
        - subscription
      description: Successful subscription cancellation response.
    UserError:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
          required:
            - message
      required:
        - error
      additionalProperties: false
      description: Standard user-facing error response envelope.
    Subscription:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the subscription.
          example: sub_1234567890abcdefghij
        createdAt:
          anyOf:
            - type: string
              description: Date string
            - type: string
              format: date-time
              description: Date object
          description: Date and time when the subscription was created.
          example: '2025-01-01T06:00:00.000Z'
        updatedAt:
          anyOf:
            - type: string
              description: Date string
            - type: string
              format: date-time
              description: Date object
          description: Date and time when the subscription was last updated.
          example: '2025-01-01T06:00:00.000Z'
        description:
          type: string
          nullable: true
          description: Human-readable description of the subscription.
          example: Colegiatura mensual
        customerId:
          type: string
          description: Identifier of the customer this subscription belongs to.
          example: cus_1234567890abcdefghij
        status:
          type: string
          nullable: true
          enum:
            - INACTIVE
            - ACTIVE
            - CANCELED
            - COMPLETED
            - null
          description: 'Current status: INACTIVE, ACTIVE, CANCELED, or COMPLETED.'
          example: ACTIVE
        collectionMethod:
          type: string
          enum:
            - AUTOMATIC
            - SEND_REMINDER
            - NONE
          description: 'How payment is collected: AUTOMATIC, SEND_REMINDER, or NONE.'
          example: AUTOMATIC
        paymentMethodId:
          type: string
          nullable: true
          description: Identifier of the payment method used for automatic collection.
          example: pm_1234567890abcdefghij
        taxProfileId:
          type: string
          nullable: true
          description: Identifier of the tax profile used for invoice generation.
          example: null
        nextCollectionDate:
          anyOf:
            - type: string
              description: Date string
            - type: string
              format: date-time
              description: Date object
            - nullable: true
          description: Date and time of the next scheduled collection.
          example: '2025-02-01T06:00:00.000Z'
        firstCollectionDate:
          anyOf:
            - type: string
              description: Date string
            - type: string
              format: date-time
              description: Date object
          description: Date and time of the first collection.
          example: '2025-01-01T06:00:00.000Z'
        lastCollectionDate:
          anyOf:
            - type: string
              description: Date string
            - type: string
              format: date-time
              description: Date object
            - nullable: true
          description: Date and time of the last collection, if set.
          example: '2025-12-01T06:00:00.000Z'
        generationMode:
          type: string
          enum:
            - MANUAL
            - AUTO
          description: Whether invoices are generated manually or automatically.
          example: AUTO
        metadata:
          type: object
          nullable: true
          additionalProperties:
            type: string
          description: Flattened metadata map where each key maps to a string value.
          example:
            Nivel: Preparatoria
        onlyAutomaticCollection:
          type: boolean
          description: Whether only automatic collection is allowed.
          example: false
        customCancelReason:
          type: string
          nullable: true
          description: Custom cancellation reason provided by the user.
          example: null
        canceledAt:
          anyOf:
            - type: string
              description: Date string
            - type: string
              format: date-time
              description: Date object
            - nullable: true
          description: Date and time when the subscription was canceled.
          example: null
        canceledById:
          type: string
          nullable: true
          description: Identifier of the user who canceled the subscription.
          example: null
        isActive:
          type: boolean
          description: Whether the subscription is currently active.
          example: true
        isCompleted:
          type: boolean
          description: Whether the subscription has completed all scheduled collections.
          example: false
      required:
        - id
        - createdAt
        - updatedAt
        - description
        - customerId
        - collectionMethod
        - paymentMethodId
        - taxProfileId
        - nextCollectionDate
        - firstCollectionDate
        - lastCollectionDate
        - generationMode
        - onlyAutomaticCollection
        - customCancelReason
        - canceledAt
        - canceledById
        - isActive
        - isCompleted
      description: Recurring billing subscription tied to a customer.
  securitySchemes:
    organizationApiKey:
      type: http
      scheme: bearer
      description: 'Organization API key using `Authorization: Bearer sk_...`.'

````