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

# Cancel Subscription

> Cancel Subscription



## OpenAPI

````yaml openapi/v1-en.yaml POST /api/v1/subscription/{subscription_id}/cancel
openapi: 3.0.3
info:
  title: Subotiz API
  description: Subotiz OpenAPI
  version: 1.0.0
servers:
  - url: https://{api}.subotiz.com
    variables:
      api:
        default: api
security:
  - sec0: []
tags:
  - name: Subscription
    description: Subscription
  - name: Price
    description: Price
  - name: Trade
    description: Trade
  - name: Payment
    description: Payment
  - name: Checkout Session
    description: Checkout Session
  - name: Customer
    description: Customer
  - name: Customer Portal
    description: Customer Portal
paths:
  /api/v1/subscription/{subscription_id}/cancel:
    post:
      tags:
        - Subscription
      summary: Cancel Subscription
      description: Cancel Subscription
      operationId: v1-subscription-cancel-subscription
      parameters:
        - name: subscription_id
          in: path
          description: Subscription ID
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/HeaderRequestID'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelSubscriptionRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelSubscriptionResponse'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseResponse'
              example:
                code: system_error
                message: Internal server error.
components:
  parameters:
    HeaderRequestID:
      name: Request-Id
      in: header
      description: The unique identifier of the request
      required: true
      schema:
        type: string
        default: 008e3967-a1b5-48bb-be14-d5bff5092e61
  schemas:
    CancelSubscriptionRequest:
      required:
        - cancel_type
        - refund_type
      type: object
      properties:
        merchant_id:
          type: string
          description: Merchant unique identifier
        cancel_type:
          type: string
          description: |-
            Cancel subscription type:
             - end_of_period: Terminate at end of period
             - immediate: Terminate immediately
        refund_type:
          type: string
          description: >-
            Required, refund type: none-no refund, full-full refund,
            partial-prorated refund based on usage time, required only when
            terminating immediately
        cancel_reason:
          type: string
          description: Cancel subscription reason
      description: Cancel subscription request
    CancelSubscriptionResponse:
      type: object
      properties:
        code:
          type: string
          description: error code
        message:
          type: string
          description: error message
        data:
          $ref: '#/components/schemas/CancelSubscriptionResponse_Data'
      description: Cancel subscription response
    BaseResponse:
      type: object
      properties:
        code:
          type: string
          description: error code
        message:
          type: string
          description: error message
    CancelSubscriptionResponse_Data:
      type: object
      properties:
        subscription_id:
          type: string
          description: Subscription unique identifier
        biz_status:
          type: string
          description: Subscription business status
        expected_cancel_at:
          type: string
          description: >-
            Subscription end time returned when canceling subscription with "end
            of period" method
        refund_amount:
          type: string
          description: Refund amount, returned when refund is generated
        refund_currency:
          type: string
          description: Refund currency, returned when refund is generated
      description: Cancel subscription response
  securitySchemes:
    sec0:
      type: http
      description: >-
        Bearer API Key authentication. Format: Authorization: Bearer
        {your_api_key}
      scheme: bearer

````