1. Home
  2. Docs
  3. WooCommerce License Keys
  4. API
  5. Handler: WordPress REST API

Handler: WordPress REST API

Using this handler will allow the License Keys API endpoints to be mounted on WordPress’ REST API, which was introduced in version 4.7.0.

Since the REST API is not running over WordPress’ admin layer, it may improve the duration of the response calls in compare to “WP Ajax”.


Set this handler at “Dashboard” -> “WooCommerce” -> “Settings” -> “Advanced” -> “License Keys API”:

NOTE: Other settings, such as HTTP headers (CORS), will have no effect using this handler because these are handled by WordPress REST.

Route namespace

The namespace “woo-license-keys/v1” will be added to WordPress REST API.

You can verify if the License Keys API has been mounted successfully by calling the route namespace and API URL on any browse, like:


Replace “yourdomain.com” with your domain. Use Postman or any other application that allows testing API endpoints, to verify the response, it should return a JSON response indicating the endpoints available at the namespace, with the available request methods to use and parameters. Example:

"/woo-license-keys/v1/activate": {
            "namespace": "woo-license-keys/v1",
            "methods": [
            "endpoints": [
                    "methods": [
                    "args": {
                        "store_code": {
                            "required": true
                        "sku": {
                            "required": true
                        "license_key": {
                            "required": true
                        "domain": {
                            "required": false,
                            "default": "localhost"
            "_links": {
                "self": "http://yourdomain.com/wp-json/woo-license-keys/v1/activate"



Added as route “/woo-license-keys/v1/activate”, POST method, URL to use:


Read more the activation endpoint documentation.


Added as route “/woo-license-keys/v1/validate”, POST method, URL to use:


Read more the validation endpoint documentation.


Added as route “/woo-license-keys/v1/deactivate”, POST method, URL to use:


Read more the deactivation endpoint documentation.

REST API Responses

WordPress will return their standard REST API responses whenever a required parameter is missing or invalid data types for a parameter has been provided.

These responses are specific to and when using WordPress REST API.

The following example shows a response when the store code is missing:

    "code": "rest_missing_callback_param",
    "message": "Missing parameter(s): store_code",
    "data": {
        "status": 400,
        "params": [

WordPress REST API error code.

Error message.

Data related to the error.

Was this article helpful to you? Yes No