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

# Update a Subscription

> Updates a subscription. Can be used to cancel, resume, or swap plans.

Update a subscription's status or swap to a different plan.

### Actions

* **`cancel`**: Cancels the subscription at the end of the current billing period.
* **`cancel_immediately`**: Cancels the subscription immediately.
* **`resume`**: Resumes a subscription that was previously scheduled to cancel at period end.
* **`swap`**: Instantly swaps the subscription to a new `variant_id` or `product_id`. Prorated charges will be applied automatically to the customer's next invoice.


## OpenAPI

````yaml PATCH /subscriptions/{id}
openapi: 3.0.0
info:
  title: Blink API
  description: Comprehensive API documentation for Blink.
  version: 1.0.0
servers:
  - url: https://api.blink.store/v1
security:
  - storeIdHeader: []
tags:
  - name: Invoices
    description: Unified merchant of record invoices for products and subscriptions.
  - name: Geo Pricing
    description: Resolve Purchasing Power Parity (PPP) localized pricing.
paths:
  /subscriptions/{id}:
    patch:
      summary: Update a Subscription
      description: Updates a subscription. Can be used to cancel, resume, or swap plans.
      operationId: updateSubscription
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The ID of the subscription
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - action
              properties:
                action:
                  type: string
                  enum:
                    - cancel
                    - cancel_immediately
                    - resume
                    - swap
                  description: The action to perform on the subscription.
                variant_id:
                  type: string
                  description: >-
                    The ID of the target variant (required if action is swap,
                    unless product_id is provided).
                product_id:
                  type: string
                  description: >-
                    The ID of the target product (required if action is swap,
                    unless variant_id is provided).
      responses:
        '200':
          description: Subscription updated successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                      status:
                        type: string
                      cancel_at_period_end:
                        type: boolean
                      current_period_end:
                        type: string
                      updated_at:
                        type: string
      security:
        - bearerAuth: []
components:
  securitySchemes:
    storeIdHeader:
      type: apiKey
      in: header
      name: x-store-id
    bearerAuth:
      type: http
      scheme: bearer

````