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

# Cancel subscription



## OpenAPI

````yaml POST /api/v1/subscriptions/{subscription_id}/cancel
openapi: 3.1.0
info:
  title: Paypulse
  description: Subscription billing platform with Nomba payment integration
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/subscriptions/{subscription_id}/cancel:
    post:
      tags:
        - subscriptions
      summary: Cancel Subscription
      operationId: cancel_subscription_api_v1_subscriptions__subscription_id__cancel_post
      parameters:
        - name: subscription_id
          in: path
          required: true
          schema:
            type: string
            title: Subscription Id
        - name: x-api-key
          in: header
          required: true
          schema:
            type: string
            title: X-Api-Key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CancelRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CancelResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    CancelRequest:
      properties:
        cancel_at_period_end:
          type: boolean
          title: Cancel At Period End
          default: false
      type: object
      title: CancelRequest
    CancelResponse:
      properties:
        subscription_id:
          type: string
          format: uuid
          title: Subscription Id
        status:
          type: string
          title: Status
        cancelled_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Cancelled At
        cancel_at_period_end:
          type: boolean
          title: Cancel At Period End
        refund:
          anyOf:
            - $ref: '#/components/schemas/RefundInfo'
            - type: 'null'
      type: object
      required:
        - subscription_id
        - status
        - cancelled_at
        - cancel_at_period_end
      title: CancelResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    RefundInfo:
      properties:
        refund_amount:
          type: number
          title: Refund Amount
        reason:
          type: string
          title: Reason
          default: ''
        policy_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Policy Name
        refund_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Refund Type
        remaining_ratio:
          anyOf:
            - type: number
            - type: 'null'
          title: Remaining Ratio
        period_start:
          anyOf:
            - type: string
            - type: 'null'
          title: Period Start
        period_end:
          anyOf:
            - type: string
            - type: 'null'
          title: Period End
        cancellation_fee:
          anyOf:
            - type: number
            - type: 'null'
          title: Cancellation Fee
      type: object
      required:
        - refund_amount
      title: RefundInfo
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````