Back to Docs

Getting Started with Legacy API

WooCommerce has officially stopped support for the Legacy API in its latest updates. This change encourages users to switch to the more secure and robust WooCommerce REST API for most operations.

However, if your project requires the Legacy API for specific tasks, such as integrating with the WC Serial Numbers Plugin, you can roll back WooCommerce to an earlier version that still supports the Legacy API. Additionally, our plugin fully supports the Legacy API in older WooCommerce versions, allowing you to continue managing serial keys as needed.

To use the legacy API, you’ll need to activate WC Serial Numbers Legacy API an extension plugin.

Click here to download the WC Serial Numbers Legacy API plugin

Below is the detailed documentation for using the Legacy API with the WC Serial Numbers Plugin.

By Legacy API for managing serial numbers for your products via external websites or software. With this API, you can perform actions like activating, deactivating, validating, and checking serial keys.

API Endpoint

To make API requests, send a POST request to the following URL:

https://your-domain.test/?wc-api=serial-numbers-api

Required Parameters

Each API request must include the following parameters:

  • product_id: The product ID for which the serial key is valid.
  • serial_key: The serial key to validate, activate, or deactivate.
  • request: The type of request. Available options are:
    • "activate": To activate a serial key.
    • "deactivate": To deactivate a serial key.
  • instance: A unique identifier for the installation, such as the domain name where the serial key is being activated or deactivated.
  • email: (Optional) The email address associated with the serial key, used for verification purposes.
  • platform: (Optional) The platform where the serial key is used (e.g., "Windows" or "Mac").

API Request Examples

1. Activate Serial Key

Activates the serial key for the provided instance and email.

https://your-domain.test/?wc-api=serial-numbers-api&request=activate&product_id=123&serial_key=123456789&instance=example.com&[email protected]

2. Deactivate Serial Key

Deactivates the serial key for the provided instance and email.

https://your-domain.test/?wc-api=serial-numbers-api&request=deactivate&product_id=123&serial_key=123456789&instance=example.com&[email protected]

3. Validate Serial Key

Validates whether the serial key is active and correct for the provided product.

https://your-domain.test/?wc-api=serial-numbers-api&request=validate&product_id=123&serial_key=123456789&instance=example.com&[email protected]

4. Check Serial Key Status

Check the status of the serial key, including its activation count and expiration date.

https://your-domain.test/?wc-api=serial-numbers-api&request=check&product_id=123&serial_key=123456789&instance=example.com&[email protected]

5. Version Check

Verifies the version of the Legacy API.

https://your-domain.test/?wc-api=serial-numbers-api&request=version_check&product_id=123&serial_key=123456789&instance=example.com&[email protected]

API Response

All API requests will return a JSON response containing the following parameters:

  • code: The response code, such as "key_activated", "key_deactivated", "invalid_key", or "invalid_request".
  • message: A descriptive message, such as “Serial key is valid.”
  • activated or deactivated: Indicates whether the serial key was successfully activated or deactivated.
  • activation_limit: The maximum number of activations allowed for the serial key.
  • activation_count: The current number of activations for the serial key.
  • activations_left: The number of activations remaining for the serial key.
  • expire_date: The expiration date of the serial key in human-readable format.
  • expires_at: The expiration date in Unix timestamp format.
  • product_id: The ID of the product associated with the serial key.
  • product: The product name associated with the serial key.
  • activations: A list of activations for the serial key.

Response Example

Here is a typical JSON response for a successful activation:

{
"code": "key_activated",
"message": "Serial key is valid",
"activated": true,
"activation_limit": 3,
"activation_count": 1,
"activations_left": 2,
"expire_date": "2025-12-31",
"expires_at": 1767215999,
"product_id": 123,
"product": "Pro Software License",
"activations": [
{
"instance": "example.com",
"activated_at": "2024-08-10"
}
]
}

Conclusion

While WooCommerce has stopped supporting the Legacy API, you can still use it by rolling back to an earlier version of WooCommerce that supports the Legacy API. Our plugin continues to fully support this functionality. If you need assistance with rolling back WooCommerce or further details about the API, feel free to contact us.

By using the Legacy API, you can still automate serial key activation, deactivation, and validation, ensuring smooth management of your products.