Back to Rest API

List Keys

The WC Key Manager plugin provides a REST API endpoint that allows you to retrieve and display a comprehensive list of all keys, along with detailed information. To access this data, you can use the GET method with the endpoint ‘/keys’.

https://example.com/wp-json/wc/v1/keys/?consumer_key={consumer_key}&consumer_secret={consumer_secret}

Parameters

ParameterDescription
consumer_keyThe corresponding secret key is used for authentication with the WooCommerce API.
consumer_secretThe corresponding secret key is used for authentication with the WooCommerce API.
product_idThe unique identifier for a specific product in WooCommerce.
order_idThe unique identifier for a specific order in WooCommerce.
customer_idThe unique identifier for a specific customer in WooCommerce.
statusThe consumer key is used for authentication with the WooCommerce API.

Example of API Response:

{
"id": 25,
"code": "AUBR-5KTE-IFXO-UZ33",
"valid_for": 0,
"activation_limit": 0,
"activation_count": 0,
"product_id": 78,
"customer_id": 0,
"order_id": 0,
"order_item_id": 0,
"subscription_id": 0,
"vendor_id": 0,
"email": "",
"price": 0,
"ordered_at": null,
"status": "available",
"created_at": "2024-07-03 11:57:44",
"updated_at": null
},

{
"id": 24,
"code": "1OST-GAU2-9Q8L-CY6I",
"valid_for": 0,
"activation_limit": 0,
"activation_count": 0,
"product_id": 78,
"customer_id": 0,
"order_id": 0,
"order_item_id": 0,
"subscription_id": 0,
"vendor_id": 0,
"email": "",
"price": 0,
"ordered_at": null,
"status": "available",
"created_at": "2024-07-03 11:57:44",
"updated_at": null
},

{
"id": 22,
"code": "FDJP-26CF-EB4D-SBRY",
"valid_for": 0,
"activation_limit": 0,
"activation_count": 0,
"product_id": 69,
"customer_id": 0,
"order_id": 0,
"order_item_id": 0,
"subscription_id": 0,
"vendor_id": 0,
"email": "",
"price": 0,
"ordered_at": null,
"status": "available",
"created_at": "2024-07-03 11:38:08",
"updated_at": null
}

If you need to retrieve responses based on a specific product ID, you can do so with the following API call:

Example of API Call:

https://example.com/wp-json/wc/v1/keys/?product_id=69&consumer_key=ck_f3db7b87befb91b50654a83d51a2fec9f28870b0&consumer_secret=cs_86832fa747333b0af7a28bdc4c504b122a0981cc

Additionally, you can filter the results by customer_id, order_id, and status, either individually or in combination. For instance, if you want to view only the active keys for a specific product, your API call would look like this:

Example of API Call:

https://example.com/wp-json/wc/v1/keys/?status=active&product_id=69&consumer_key=ck_f3db7b87befb91b50654a83d51a2fec9f28870b0&consumer_secret=cs_86832fa747333b0af7a28bdc4c504b122a0981cc

This flexibility allows you to tailor your API queries to retrieve exactly the information you need.

Fields in API Response:

The API will return a JSON response with the following parameters:

ParameterDescription
idThe unique identifier for the keys.
codeThe keys which is created.
valid_forDuration or validity period of the keys.
activation_limitMaximum number of times the keys can be activated.
activation_countNumber of times the key has been activated.
product_idThe unique identifier for a specific product in WooCommerce.
customer_idThe unique identifier for a specific customer in WooCommerce.
order_idThe unique identifier for a specific order in WooCommerce.
order_item_idThe unique identifier for a specific item within an order in WooCommerce.
subscription_idThe unique identifier for a specific subscription in WooCommerce.
vendor_idThe unique identifier for a specific vendor in WooCommerce, especially relevant in a multi-vendor marketplace setup where different vendors sell products through the same WooCommerce store.
emailThe email address associated with the keys.
pricePrice of the keys.
ordered_atDate and time when the key was ordered.
statusThe email address associated with the keys.
created_atCurrent status of the keys (e.g., active, available).
updated_atDate and time when the key was last updated.

Related Docs

Scroll to Top