Activate a license
POST/products/{product_id}/licenses/activate.json
Activate a license and if needed, create an install with the given properties.
No Authorization header is required. If the provided license doesn't have an associated user, the endpoint will require the
first_name,last_name, anduser_emailparameters to create a new user and associate it with the license.
This endpoint can return the following error codes:
license_expired: License has already expired.invalid_license_key: License key is invalid (e.g., does not match any record).license_error: General error while validating the license.license_utilized: License quota has reached maximum capacity.license_activated: License is already activated on the given install. This usually indicates your app is out of sync with Freemius. You may accept the license and grant premium features. If needed, re-establish the connection by calling the deactivation endpoint and activating again.
All errors include a descriptive message from the API, which you may choose to display to the user. For example:
license_expired: Your license has expired on 2025-01-01 (id = 12345).invalid_license_key: Invalid license key.license_error: License activation is not authorized for the site(s) listed below. Please follow the provided link to whitelist the site(s) from the User Dashboard.license_activated: License is already activated on install 12345.license_utilized: Your license quota of 1234 production site(s) has been reached. If you believe this is a mistake, please contact support at [email protected].
You can get the error code from the response.error.code. For example
fetch(activationEndpoint).then((response) => {
return response.json();
}).then((data) => {
if (data.error) {
// Error detected
const errorCode = data.error.code;
const errorMessage = data.error.message;
// handleError(errorCode, errorMessage);
} else {
// Operation successful
}
}).catch((error) => {
// Handle network error
});
Request
Responses
- 200
- 400
- 402
- 404
License activated successfully.
Bad request. The request could not be understood by the server due to malformed syntax or arguments.
The request is missing the specified argument.
The requested resource was not found.