# Create a license

```
POST 
https://api.freemius.com/v1/products/{product_id}/plans/{plan_id}/pricing/{pricing_id}/licenses.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.

***

Create a new license for the plan and pricing. Please note that:

1. Either `period` or `expires_at` or `is_block_features` must be set.
2. If you create a license with `is_block_features` set to `false` and do not specify `period` and `expires_at`, the license will never expire or block features and will continue to work for lifetime.
3. If you specify an email address, the user must have already activated a license or installed your product before. If your user has not activated a license, then please don't use the field and when they activate the license we will collect their email and register the user with Freemius.
4. Use the `source` parameter only when creating migrated licenses from a legacy system.

More information about every other parameters can be found below.

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

### Path Parameters

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

  The ID of the product.

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

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

  **plan\_id**
  <!-- -->
  integer\<int64>[](#param-property-plans-create-license-param-path-plan-id "Direct link to plan_id")required

  The ID of the plan.

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

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

  **pricing\_id**
  <!-- -->
  integer\<int64>[](#param-property-plans-create-license-param-path-pricing-id "Direct link to pricing_id")required

  The ID of the Pricing.

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

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

application/json

### Body**required**

* **is\_whitelabeled**boolean[](#schema-property-plans-create-license-request-body-is-whitelabeled-boolean "Direct link to is_whitelabeled")

  Guide the [Freemius WP SDK](https://github.com/Freemius/wordpress-sdk) when the product should be running in a [white-label](https://freemius.com/help/documentation/users-account-management/license-security/#white_label_mode) mode.

  **period**number[](#schema-property-plans-create-license-request-body-period-number "Direct link to period")

  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`]

  **is\_block\_features**boolean[](#schema-property-plans-create-license-request-body-is-block-features-boolean "Direct link to is_block_features")

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

  Whether to block features after expiration of the license. If set to `false`, this would not block features, would only block updates.

  **expires\_at**string\<date-time>[](#schema-property-plans-create-license-request-body-expires-at-string-date-time "Direct link to expires_at")nullable

  The expiration date of the license. If `null` then it's a lifetime license.

  **Example:<!-- -->&#x20;**`2025-12-31 23:59:59`

  **email**string[](#schema-property-plans-create-license-request-body-email-string "Direct link to email")

  (optional) License owner email.

  **existing\_install\_id**string[](#schema-property-plans-create-license-request-body-existing-install-id-string "Direct link to existing_install_id")

  (optional) If the module type is `bundle` and `existing_install_id` is a valid ID of an install that is using a product of the bundle, a child license will automatically be created and activated for the install.

  **send\_email**boolean[](#schema-property-plans-create-license-request-body-send-email-boolean "Direct link to send_email")

  (optional) Whether to email the license key and download link to the user.

  **source**number[](#schema-property-plans-create-license-request-body-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`]

  **license\_key**string[](#schema-property-plans-create-license-request-body-license-key-string "Direct link to license_key")

  (optional) Predefined license key - this can be used when duplicating a license of another product into another product.

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

* 200

The license created successfully.

application/json

**Schema**

**license** <!-- -->object

A license represents authorization to use available features of the product.

**id**string\<int64>[](#schema-property-plans-create-license-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-plans-create-license-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-plans-create-license-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`

**plugin\_id**string\<int64>[](#schema-property-plans-create-license-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`

**user\_id**string\<int64>[](#schema-property-plans-create-license-response-schema-user-id-string-int64 "Direct link to user_id")nullable

The ID of the user the entity belongs to. If NULL then still not associated to any user.

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

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

**plan\_id**string\<int64>[](#schema-property-plans-create-license-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-plans-create-license-response-schema-pricing-id-string-int64 "Direct link to pricing_id")nullable

The ID of the pricing associated with the entity.

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

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

**quota**integer[](#schema-property-plans-create-license-response-schema-quota-integer "Direct link to quota")nullable

The maximum number of license activations. If `null` then the license will support unlimited activations.

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

**activated**integer[](#schema-property-plans-create-license-response-schema-activated-integer "Direct link to activated")

The total number of production activation the license has. This does not count local or staging environment activations.

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

**activated\_local**integer[](#schema-property-plans-create-license-response-schema-activated-local-integer "Direct link to activated_local")nullable

The number of times the license is activated on local or staging environments.

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

**expiration**string\<date-time>[](#schema-property-plans-create-license-response-schema-expiration-string-date-time "Direct link to expiration")nullable

The expiration date of the license. If `null` then it's a lifetime license.

**Example:<!-- -->&#x20;**`2025-12-31 23:59:59`

**secret\_key**string[](#schema-property-plans-create-license-response-schema-secret-key-string "Direct link to secret_key")

The license key. This is used for activating the license on the user's site.

**Example:<!-- -->&#x20;**`sk_123FGqM456Pa786WtOp%^+67Y+;sXXz`

**is\_free\_localhost**boolean[](#schema-property-plans-create-license-response-schema-is-free-localhost-boolean "Direct link to is_free_localhost")

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

Whether the license offers unlimited local or staging environment activations.

**is\_block\_features**boolean[](#schema-property-plans-create-license-response-schema-is-block-features-boolean "Direct link to is_block_features")

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

Whether to block features after expiration of the license. If set to `false`, this would not block features, would only block updates.

**is\_cancelled**boolean[](#schema-property-plans-create-license-response-schema-is-cancelled-boolean "Direct link to is_cancelled")

If the license is canceled from the Developer Dashboard.

**is\_whitelabeled**boolean[](#schema-property-plans-create-license-response-schema-is-whitelabeled-boolean "Direct link to is_whitelabeled")

Guide the [Freemius WP SDK](https://github.com/Freemius/wordpress-sdk) when the product should be running in a [white-label](https://freemius.com/help/documentation/users-account-management/license-security/#white_label_mode) mode.

**environment**number[](#schema-property-plans-create-license-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`

**source**number[](#schema-property-plans-create-license-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`]
