# Generate upgrade link

```
POST 
https://api.freemius.com/v1/products/{product_id}/licenses/{license_id}/checkout/link.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.

***

Generate an upgrade link for a license. The API accepts a variety of parameters with which you can specify new plans or quota or billing cycles. If you skip all those, then a manual renewal link will be generated instead. The link will be valid for 24 hours.

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

### Path Parameters

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

  The ID of the product.

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

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

  **license\_id**
  <!-- -->
  integer\<int64>[](#param-property-licenses-generate-upgrade-link-param-path-license-id "Direct link to license_id")required

  The ID of the License.

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

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

application/json

### Body**required**

* **plan\_id**string\<int64>[](#schema-property-licenses-generate-upgrade-link-request-body-plan-id-string-int64 "Direct link to plan_id")

  The plan ID to upgrade to.

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

  **billing\_cycle**string[](#schema-property-licenses-generate-upgrade-link-request-body-billing-cycle-string "Direct link to billing_cycle")

  The billing cycle or period of a plan.

  **Possible values:** \[`monthly`, `annual`, `lifetime`]

  **quota** <!-- -->object

  The quota to use. Can be a number or the string 'unlimited'.

  oneOf
  * integer
  * string
  ****integer[](#schema-property-licenses-generate-upgrade-link-request-body-integer "Direct link to schema-property-licenses-generate-upgrade-link-request-body-integer")

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

  **is\_payment\_method\_update**boolean[](#schema-property-licenses-generate-upgrade-link-request-body-is-payment-method-update-boolean "Direct link to is_payment_method_update")

  **Default value:<!-- -->&#x20;**`false`

  Whether to update the payment method. If true, the link will be generated for the current plan and billing cycle of the license and other parameters will be ignored. If the license is not associated with a subscription, or is lifetime, an exception will be thrown.

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

* 201
* 400
* 402
* 404

Upgrade link generated successfully.

application/json

**Schema**

**url**string\<uri>[](#schema-property-licenses-generate-upgrade-link-response-schema-url-string-uri "Direct link to url")

The URL to the checkout page.

**settings** <!-- -->object

The settings used to generate the link. This can be fed as-is to the [Freemius Checkout JS SDK](https://github.com/Freemius/freemius-checkout-js) if you're using modals in your website.

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

The settings used to generate the link. This can be fed as-is to the [Freemius Checkout JS SDK](https://github.com/Freemius/freemius-checkout-js) if you're using modals in your website.

**Example:<!-- -->&#x20;**`{"plugin_id":1,"plan_id":2,"licenses":"unlimited"}`

**expires**string\<date-time>[](#schema-property-licenses-generate-upgrade-link-response-schema-expires-string-date-time "Direct link to expires")

The expiration date of the link.

Bad request. The request could not be understood by the server due to malformed syntax or arguments.

application/json

**Schema**

**path**string[](#schema-property-licenses-generate-upgrade-link-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-licenses-generate-upgrade-link-response-schema-type-string "Direct link to type")

The type of the error encountered by the server.

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

**message**string[](#schema-property-licenses-generate-upgrade-link-response-schema-message-string "Direct link to message")

The descriptive error message.

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

**code**string[](#schema-property-licenses-generate-upgrade-link-response-schema-code-string "Direct link to code")

The error code.

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

**http**integer[](#schema-property-licenses-generate-upgrade-link-response-schema-http-integer "Direct link to http")

The HTTP status code returned by the server.

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

**timestamp**string[](#schema-property-licenses-generate-upgrade-link-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-licenses-generate-upgrade-link-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-licenses-generate-upgrade-link-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-licenses-generate-upgrade-link-response-schema-type-string "Direct link to type")

The type of the error encountered by the server.

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

**message**string[](#schema-property-licenses-generate-upgrade-link-response-schema-message-string "Direct link to message")

The descriptive error message.

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

**code**string[](#schema-property-licenses-generate-upgrade-link-response-schema-code-string "Direct link to code")

The error code.

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

**http**integer[](#schema-property-licenses-generate-upgrade-link-response-schema-http-integer "Direct link to http")

The HTTP status code returned by the server.

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

**timestamp**string[](#schema-property-licenses-generate-upgrade-link-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-licenses-generate-upgrade-link-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-licenses-generate-upgrade-link-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-licenses-generate-upgrade-link-response-schema-type-string "Direct link to type")

The type of the error encountered by the server.

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

**message**string[](#schema-property-licenses-generate-upgrade-link-response-schema-message-string "Direct link to message")

The descriptive error message.

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

**code**string[](#schema-property-licenses-generate-upgrade-link-response-schema-code-string "Direct link to code")

The error code.

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

**http**integer[](#schema-property-licenses-generate-upgrade-link-response-schema-http-integer "Direct link to http")

The HTTP status code returned by the server.

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

**timestamp**string[](#schema-property-licenses-generate-upgrade-link-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-licenses-generate-upgrade-link-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"}`
