1. Home
  2. Docs
  3. WooCommerce License Keys
  4. API
  5. Endpoint: Validation

Endpoint: Validation

Before continuing, please read the basics article.

Endpoint used to remotely validate an activation (activated product).

This endpoint can be used to frequently check the validity of an activated license key to deactivate expired licenses and add a layer of security in a product.

Try not to use this endpoint too frequently to cause a less stress possible to the server hosting the API service.

Request parameters

action
string
This identifies the endpoint wanted. Should always be `license_key_validate`for this endpoint.

store_code
string
Store code provided in the License Keys API settings page. This is a security code used to validate the store.

sku
string
Product SKU.

license_key
string
Customer’s license key code.

domain
string
Domain. (optional) This parameter is not required for desktop products.

activation_id
string
The Activation ID returned when license key was activated (see activation endpoint).

Request example

 the following piece of code (at Code Pen) as example:

Responses

All responses are returned in JSON format.

Successful response

{
    "error": false,
    "status": 200,
    "message": "License Key is valid.",
    "data": {
        "expire": 1582657054,
        "activation_id": 1519628117,
        "expire_date": "2020-02-25 18:57",
        "timezone": "UTC",
        "the_key": "Cqu62al903ICv40am9nM68Y7o9-32",
        "url": "http://domain/my-account/view-license-key/?key=test-32",
        "has_expired": false,
        "status": "active",
        "allow_offline": true,
        "offline_interval": "days",
        "offline_value": 1,
        "downloadable": {
            "name": "v1.1.5",
            "url": "https://domain/product-1.1.5.zip"
        },
        "ctoken": "dsfejk8989"
    }
}

When the validation is successful, the response above will be returned. Data information:

expire
long
Expire date as a time value (Unix timestamp).

activation_id
long
Activation identifier. It also holds the date in which the activation was activated (Unix timestamp).

expire_date
string
Expire date formatted with selected WordPress date format.

timezone
string
Server’s timezone in which dates have been calculated.

the_key
string
Customers license key.

url
string
License Key url at WooCommerce’s “My Account” page.

has_expired
bool
Flag indicating if license key has expired.

status
string
Status tag. ‘active’ or ‘inactive’ based on expiration.

allow_offline
bool
Flag that indicates if product should be allowed on an offline environment.

offline_interval
string
Offline interval. (i.e. hours, days, months)

offline_value
string
Offline interval value. (i.e. 4 hours, 5 days, 1 months)

downloadable
object
Only available on paid extension. Contains the information of the downloadable product, this can be used for automatic updates.

ctoken
string
Only available on paid extension. The cart token used to create renewal or extension links in the product.

Failed response

{
    "error": true,
    "status": 500,
    "errors": {
        "license_key": [
            "Invalid license key."
        ],
        "activation_id": [
            "Invalid activation."
        ]
    }
}

View this article to change the way errors are returned.

Was this article helpful to you? Yes 1 No 1