---
title: "Switch subscription"
method: POST
path: "/subscription_switches"
---

# Switch subscription

`POST /subscription_switches`

This endpoint is used to upgrade or downgrade a subscription to another subscription plan. Use either `subscriptionId` OR `customerId` and `fromOfferId` together (`customerId` and `fromOfferId` can only be used with Cleeng-managed subscriptions where the whole lifecycle is under the control of Cleeng). As these last two parameters are deprecated, `subscriptionId` is going to be the only option to use this endpoint. <br> <br> **Important** <br>Subscription upgrade and downgrade feature requires compatibility of the payment connector and payment gateway. Currently the feature is fully supported for the following:  [Adyen](https://publisher.support.cleeng.com/hc/en-us/articles/4406573398930), [PayPal](https://publisher.support.cleeng.com/hc/en-us/articles/4406573425042). Please contact [Cleeng Support Team](https://publisher.support.cleeng.com/hc/en-us/requests/new) if you wish to use other payment connectors/gateways.

## Headers

- `Content-Type` string
- `X-Publisher-Token` string, required

## Request body

- object
  - `subscriptionId` integer — Subscription identifier at Cleeng. This is the ID of the subscription the customer is switching from. **Required conditionally** when `customerId` and `fromOfferId` not provided.
  - `toOfferId` string, required — ID of the subscription offer to which a customer wants to upgrade
  - `switchDirection` string, required — Supported: `upgrade`, `downgrade`, `unspecified`. **Note:** `unspecified` is only supported for externally-managed subscriptions (subscriptions whose life cycle is managed outside of Cleeng).
  - `algorithm` string — Supported: DEFERRED, IMMEDIATE_WITHOUT_PRORATION. **Required conditionally** if the subscription is externally-managed (<<glossary:externally-managed subscriptions>>, e.g. managed in an app store, outside of Cleeng).
  - `customerId` integer — Cleeng ID of a customer. **Deprecated**.
  - `fromOfferId` string — Offer ID of a customer’s subscription that will be upgraded. **Deprecated**.

## Response `200`

200

- object
  - `success` boolean
  - `data` object
    - `id` string
    - `customerId` integer
    - `direction` string
    - `algorithm` string
    - `fromOfferId` string
    - `toOfferId` string
    - `subscriptionId` string
    - `status` string
    - `createdAt` integer
    - `updatedAt` integer
  - `message` string

## Other responses

- `400` — 400
- `422` — 422

---

[API](https://skmtc.net/cleeng/apis/mediastore-api.md) · [All operations](https://skmtc.net/cleeng/apis/mediastore-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/cleeng/mediastore-api/versions/00cbfe7998a4/schema)
