# Cancel a subscription

```
DELETE 
https://api.freemius.com/v1/products/{product_id}/subscriptions/{subscription_id}.json
```

#### Auth:Bearer TokenSCOPE: <!-- -->PRODUCT

Product-scoped API tokens allow you to operate on the product itself. This token usually allows read-only access to the product configuration and write access to several operations on subscriptions, customers, payments, and more. For most SaaS or app integrations, this is the token you will need.

1. Go to the [Freemius Developer Dashboard](https://dashboard.freemius.com/).
2. Open the Settings page of the relevant product.
3. Click the API & Keys tab.
4. Copy the API Bearer Authorization Token from the UI.

***

Use this endpoint to **cancel the subscription**. If the subscription is currently in a **trialing state**, this will also cancel the trial.

This is useful when you want to programmatically offer a cancellation feature from within your SaaS or custom dashboards. If you're integrating Freemius with your SaaS, please see our [guide here](https://freemius.com/help/documentation/selling-with-freemius/saas-integration/).

> ⚠️ This action is irreversible and will immediately cancel the subscription or trial.

Cancelling an already cancelled subscription will not have any effect and the endpoint will return the same subscription details as before.

## Request[​](#request "Direct link to request")

### Path Parameters

* **product\_id**
  <!-- -->
  integer\<int64>[](#param-property-subscriptions-cancel-param-path-product-id "Direct link to product_id")required

  The ID of the product.

  **Possible values:** `>= 1`

  **Example:<!-- -->&#x20;**`1234`

  **subscription\_id**
  <!-- -->
  integer\<int64>[](#param-property-subscriptions-cancel-param-path-subscription-id "Direct link to subscription_id")required

  The ID of the Subscription.

  **Possible values:** `>= 1`

  **Example:<!-- -->&#x20;**`1234`

### Query Parameters

* **reason\_ids**
  <!-- -->
  integer\[][](#param-property-subscriptions-cancel-param-query-reason-ids "Direct link to reason_ids")

  Optional cancellation reason IDs.

  **Possible values:** \[`1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`, `12`, `13`, `14`, `15`]

  **reason**
  <!-- -->
  string[](#param-property-subscriptions-cancel-param-query-reason "Direct link to reason")

<!-- -->

## Responses[​](#responses "Direct link to Responses")

* 200
* 401
* 402
* 404

Subscription retrieved.

application/json

**Schema**

**user\_id**string\<int64>[](#schema-property-subscriptions-cancel-response-schema-user-id-string-int64 "Direct link to user_id")

The ID of the user the entity belongs to.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**install\_id**string\<int64>[](#schema-property-subscriptions-cancel-response-schema-install-id-string-int64 "Direct link to install_id")nullable

The ID of the installation or site the entity is associated with, a `null` value means it has not been associated with an installation yet.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**plan\_id**string\<int64>[](#schema-property-subscriptions-cancel-response-schema-plan-id-string-int64 "Direct link to plan_id")

The ID of the plan associated with the entity.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**pricing\_id**string\<int64>[](#schema-property-subscriptions-cancel-response-schema-pricing-id-string-int64 "Direct link to pricing_id")

The ID of the pricing associated with the entity.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**license\_id**string\<int64>[](#schema-property-subscriptions-cancel-response-schema-license-id-string-int64 "Direct link to license_id")

The ID of the license associated with the entity.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**ip**string\<ipv4|ipv6>[](#schema-property-subscriptions-cancel-response-schema-ip-string-ipv4-ipv6 "Direct link to ip")nullable

The IP address associated with the entity.

**Example:<!-- -->&#x20;**`0.0.0.0`

**country\_code**string[](#schema-property-subscriptions-cancel-response-schema-country-code-string "Direct link to country_code")

The [ISO 3166-1 alpha 2](http://www.wikiwand.com/en/ISO_3166-1_alpha-2) two-letter country code associated with the entity.

**Example:<!-- -->&#x20;**`us`

**zip\_postal\_code**string[](#schema-property-subscriptions-cancel-response-schema-zip-postal-code-string "Direct link to zip_postal_code")nullable

The postal/zip code of the location.

**Example:<!-- -->&#x20;**`92710`

**vat\_id**string[](#schema-property-subscriptions-cancel-response-schema-vat-id-string "Direct link to vat_id")nullable

The business VAT number (EU or UK territories) or other tax ID (for example Sales Tax ID for the US).

**Example:<!-- -->&#x20;**`GB12345678`

**coupon\_id**string\<int64>[](#schema-property-subscriptions-cancel-response-schema-coupon-id-string-int64 "Direct link to coupon_id")nullable

The ID of the coupon associated with the entity.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**user\_card\_id**string\<int64>[](#schema-property-subscriptions-cancel-response-schema-user-card-id-string-int64 "Direct link to user_card_id")

The ID of the user card that was used for this payment.

**Example:<!-- -->&#x20;**`12345`

**source**number[](#schema-property-subscriptions-cancel-response-schema-source-number "Direct link to source")

The source of the migration data. To get support migrating from other platform please see our [documentation](https://freemius.com/help/documentation/migration/).

* `0` - Freemius
* `1` - Other
* `2` - Easy Digital Downloads (EDD)
* `3` - WooCommerce (WC)
* `4` - Rating Widget
* `5` - Gumroad
* `6` - CodeCanyon
* `7` - ThemeForest
* `8` - AppSumo
* `9` - SendOwl
* `10` - WHMCS
* `11` - Lemon Squeezy

**Possible values:** \[`0`, `1`, `2`, `3`, `4`, `5`, `6`, `7`, `8`, `9`, `10`, `11`]

**plugin\_id**string\<int64>[](#schema-property-subscriptions-cancel-response-schema-plugin-id-string-int64 "Direct link to plugin_id")

The ID of the product the entity belongs to.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**external\_id**string[](#schema-property-subscriptions-cancel-response-schema-external-id-string "Direct link to external_id")

The external ID of the gateway entity.

**Example:<!-- -->&#x20;**`abcde12345`

**gateway**string[](#schema-property-subscriptions-cancel-response-schema-gateway-string "Direct link to gateway")nullable

The gateway used for the purchase. The gateway will be set to `null` when purchasing a product with a 100% discount.

**environment**number[](#schema-property-subscriptions-cancel-response-schema-environment-number "Direct link to environment")

The environment the entity belongs to. 0 means it belongs to the production environment, 1 means it belongs to the sandbox environment.

**Possible values:** \[`1`, `0`]

**Example:<!-- -->&#x20;**`0`

**id**string\<int64>[](#schema-property-subscriptions-cancel-response-schema-id-string-int64 "Direct link to id")

The unique identifier of the entity.

**Possible values:** `>= 1`

**Example:<!-- -->&#x20;**`123456`

**created**string\<date-time>[](#schema-property-subscriptions-cancel-response-schema-created-string-date-time "Direct link to created")

The date and time the entity was created, under UTC timezone.

**Example:<!-- -->&#x20;**`2025-01-01 00:00:00`

**updated**string\<date-time>[](#schema-property-subscriptions-cancel-response-schema-updated-string-date-time "Direct link to updated")nullable

The date and time the entity was updated, under UTC timezone. If `null` then the entity was never updated since its creation.

**Example:<!-- -->&#x20;**`2025-01-01 00:00:00`

**currency**string[](#schema-property-subscriptions-cancel-response-schema-currency-string "Direct link to currency")

3-char currency code.

**Possible values:** `>= 3 characters` and `<= 3 characters`, \[`usd`, `eur`, `gbp`]

**tax\_rate**number\<float>[](#schema-property-subscriptions-cancel-response-schema-tax-rate-number-float "Direct link to tax_rate")

The tax rate as a fraction. It will either be US sales tax or VAT.

**Possible values:** `>= 0`

**Example:<!-- -->&#x20;**`1.00`

**total\_gross**number\<float>[](#schema-property-subscriptions-cancel-response-schema-total-gross-number-float "Direct link to total_gross")

The total gross amount of the subscription, including taxes.

**Possible values:** `>= 0`

**Example:<!-- -->&#x20;**`1.21`

**amount\_per\_cycle**number\<float>[](#schema-property-subscriptions-cancel-response-schema-amount-per-cycle-number-float "Direct link to amount_per_cycle")

The plan's original amount per cycle (not including taxes).

**Possible values:** `>= 0`

**Example:<!-- -->&#x20;**`1.00`

**initial\_amount**number\<float>[](#schema-property-subscriptions-cancel-response-schema-initial-amount-number-float "Direct link to initial_amount")

The initial payment amount (not including taxes).

**Possible values:** `>= 0`

**Example:<!-- -->&#x20;**`1.00`

**renewal\_amount**number\<float>[](#schema-property-subscriptions-cancel-response-schema-renewal-amount-number-float "Direct link to renewal_amount")

The renewals amount (not including taxes).

**Possible values:** `>= 0`

**Example:<!-- -->&#x20;**`1.00`

**renewals\_discount**integer[](#schema-property-subscriptions-cancel-response-schema-renewals-discount-integer "Direct link to renewals_discount")

The renewals discount that will be applied to the chosen plan.

**Possible values:** `>= 0`

**Example:<!-- -->&#x20;**`1`

**renewals\_discount\_type**string[](#schema-property-subscriptions-cancel-response-schema-renewals-discount-type-string "Direct link to renewals_discount_type")

The type of renewals discount, percentage or dollar.

**Possible values:** \[`percentage`, `dollar`]

**billing\_cycle**number[](#schema-property-subscriptions-cancel-response-schema-billing-cycle-number "Direct link to billing_cycle")

The billing cycle of the subscription in number of months. 1 means monthly, 12 means annually, 0 means lifetime usually when subscriptions are created for lifetime trials.

**Possible values:** \[`1`, `12`, `0`]

**outstanding\_balance**number\<float>[](#schema-property-subscriptions-cancel-response-schema-outstanding-balance-number-float "Direct link to outstanding_balance")

Any outstanding balance that the user has for this subscription.

**Possible values:** `>= 0`

**Example:<!-- -->&#x20;**`1.00`

**failed\_payments**integer[](#schema-property-subscriptions-cancel-response-schema-failed-payments-integer "Direct link to failed_payments")

Number of failed payments associated with the subscription.

**Possible values:** `>= 0`

**Example:<!-- -->&#x20;**`1`

**trial\_ends**string\<date-time>[](#schema-property-subscriptions-cancel-response-schema-trial-ends-string-date-time "Direct link to trial_ends")nullable

The date time when the trial period ends. If `null` the subscription is not associated with a trial.

**Example:<!-- -->&#x20;**`2025-01-01 00:00:00`

**next\_payment**string\<date-time>[](#schema-property-subscriptions-cancel-response-schema-next-payment-string-date-time "Direct link to next_payment")nullable

Datetime of the next payment, or `null` if cancelled.

**Example:<!-- -->&#x20;**`2025-01-01 00:00:00`

**canceled\_at**string\<date-time>[](#schema-property-subscriptions-cancel-response-schema-canceled-at-string-date-time "Direct link to canceled_at")nullable

Datetime of the cancellation.

**Example:<!-- -->&#x20;**`2025-01-01 00:00:00`

Unauthorized access error. The request requires [authentication](https://freemius.com/help/api/#bearer-token-authentication) but was not provided or the provided authentication does not satisfy the required permissions.

application/json

**Schema**

**path**string[](#schema-property-subscriptions-cancel-response-schema-path-string "Direct link to path")

The API request path.

**Example:<!-- -->&#x20;**`:/products/product_id/users.json`

**error** <!-- -->object

This object contains the error details.

**type**string[](#schema-property-subscriptions-cancel-response-schema-type-string "Direct link to type")

The type of the error encountered by the server.

**Example:<!-- -->&#x20;**`UnauthorizedAccess`

**message**string[](#schema-property-subscriptions-cancel-response-schema-message-string "Direct link to message")

The descriptive error message.

**Example:<!-- -->&#x20;**`Some error has occured.`

**code**string[](#schema-property-subscriptions-cancel-response-schema-code-string "Direct link to code")

The error code.

**Example:<!-- -->&#x20;**`unauthorized_access`

**http**integer[](#schema-property-subscriptions-cancel-response-schema-http-integer "Direct link to http")

The HTTP status code returned by the server.

**Example:<!-- -->&#x20;**`401`

**timestamp**string[](#schema-property-subscriptions-cancel-response-schema-timestamp-string "Direct link to timestamp")

Current timestamp.

**Example:<!-- -->&#x20;**`Thu, 11 May 2023 11:45:30 +0000`

**request** <!-- -->object

This object sends back the request payload as received by the server (both from path and from body or query).

**property name\***&#x61;ny[](#schema-property-subscriptions-cancel-response-schema-property-name-any "Direct link to property name*")

This object sends back the request payload as received by the server (both from path and from body or query).

**Example:<!-- -->&#x20;**`{"beautify":true,"format":"json"}`

The request is missing the specified argument.

application/json

**Schema**

**path**string[](#schema-property-subscriptions-cancel-response-schema-path-string "Direct link to path")

The API request path.

**Example:<!-- -->&#x20;**`:/products/product_id/users.json`

**error** <!-- -->object

This object contains the error details.

**type**string[](#schema-property-subscriptions-cancel-response-schema-type-string "Direct link to type")

The type of the error encountered by the server.

**Example:<!-- -->&#x20;**`UnauthorizedAccess`

**message**string[](#schema-property-subscriptions-cancel-response-schema-message-string "Direct link to message")

The descriptive error message.

**Example:<!-- -->&#x20;**`Some error has occured.`

**code**string[](#schema-property-subscriptions-cancel-response-schema-code-string "Direct link to code")

The error code.

**Example:<!-- -->&#x20;**`unauthorized_access`

**http**integer[](#schema-property-subscriptions-cancel-response-schema-http-integer "Direct link to http")

The HTTP status code returned by the server.

**Example:<!-- -->&#x20;**`401`

**timestamp**string[](#schema-property-subscriptions-cancel-response-schema-timestamp-string "Direct link to timestamp")

Current timestamp.

**Example:<!-- -->&#x20;**`Thu, 11 May 2023 11:45:30 +0000`

**request** <!-- -->object

This object sends back the request payload as received by the server (both from path and from body or query).

**property name\***&#x61;ny[](#schema-property-subscriptions-cancel-response-schema-property-name-any "Direct link to property name*")

This object sends back the request payload as received by the server (both from path and from body or query).

**Example:<!-- -->&#x20;**`{"beautify":true,"format":"json"}`

The requested resource was not found.

application/json

**Schema**

**path**string[](#schema-property-subscriptions-cancel-response-schema-path-string "Direct link to path")

The API request path.

**Example:<!-- -->&#x20;**`:/products/product_id/users.json`

**error** <!-- -->object

This object contains the error details.

**type**string[](#schema-property-subscriptions-cancel-response-schema-type-string "Direct link to type")

The type of the error encountered by the server.

**Example:<!-- -->&#x20;**`UnauthorizedAccess`

**message**string[](#schema-property-subscriptions-cancel-response-schema-message-string "Direct link to message")

The descriptive error message.

**Example:<!-- -->&#x20;**`Some error has occured.`

**code**string[](#schema-property-subscriptions-cancel-response-schema-code-string "Direct link to code")

The error code.

**Example:<!-- -->&#x20;**`unauthorized_access`

**http**integer[](#schema-property-subscriptions-cancel-response-schema-http-integer "Direct link to http")

The HTTP status code returned by the server.

**Example:<!-- -->&#x20;**`401`

**timestamp**string[](#schema-property-subscriptions-cancel-response-schema-timestamp-string "Direct link to timestamp")

Current timestamp.

**Example:<!-- -->&#x20;**`Thu, 11 May 2023 11:45:30 +0000`

**request** <!-- -->object

This object sends back the request payload as received by the server (both from path and from body or query).

**property name\***&#x61;ny[](#schema-property-subscriptions-cancel-response-schema-property-name-any "Direct link to property name*")

This object sends back the request payload as received by the server (both from path and from body or query).

**Example:<!-- -->&#x20;**`{"beautify":true,"format":"json"}`
