1. Documentation /
  2. WooCommerce REST API

WooCommerce REST API

The WooCommerce REST API is a powerful tool for connecting your WooCommerce shop to external systems and resources. Unless you’re a developer, in most cases the integration you’re working with will only require you to generate API keys for you to enter in their system, and you’ll be connected to the external service!

This document covers the basics of using the REST API from a merchant perspective. With links to developer documentation for more advanced topics.


↑ Back to top

WordPress permalinks must be set to something that is easily human readable at: Settings > Permalinks.

Day and name is a great default, but anything aside from Plain should work


Generate API keys

↑ Back to top

The WooCommerce REST API works on a key system to control access. These keys are linked to WordPress users on your website.

To create or manage keys for a specific WordPress user:

  1. Go to: WooCommerce > Settings > Advanced > REST API.
    Note: Keys/Apps was found at WooCommerce > Settings > API > Key/Apps prior to WooCommerce 3.4.
  2. Select Add Key. You’ll be taken to the Key Details screen.
  3. Add a Description.
  4. Select the User you would like to generate a key for in the dropdown.
  5. Select a level of access for this API key:
    • Read access,
    • Write access, or;
    • Read/Write access.
  6. Select Generate API Key, and WooCommerce creates API keys for that user.
  7. Now that keys have been generated, you should see Consumer Key and Consumer Secret keys, a QRCode, and a “Revoke Key” button.
  8. The Consumer Key and Consumer Secret may be entered in the application you’ll be connecting to using the WooCommerce REST API. The the app should also request your URL.

Test if the API is working

↑ Back to top

Use this step-by-step guide to test whether the REST API on your site is working.

Enable legacy REST API

↑ Back to top

NOTE: The Legacy REST API will move to a dedicated extension in WooCommerce 9.0. Webhooks configured to use the Legacy REST API will also stop working starting with WooCommerce 9.0 unless the dedicated extension is installed.

To enable the legacy REST API within WooCommerce, go to WooCommerce > Settings > Advanced > Legacy API and tick the Enable the legacy REST API checkbox.

Note: legacy REST API was found at WooCommerce > Settings > API prior to WooCommerce 3.4.

Legacy REST API is deprecated and should be removed from WooCommerce soon, as an alternative there’s a new REST API that integrates the WordPress REST API, this is the WooCommerce current REST API and it’s also enabled by default.

Developer documentation

↑ Back to top

Find the REST API documentation at: WooCommerce REST API Docs.


↑ Back to top

Frequently Asked Questions

↑ Back to top

Why am I getting “woocommerce_rest_cannot_view” or 401 error while making a request?

↑ Back to top

As the first step, make sure that you are using the correct API keys.

If the keys are correct, make sure that the keys have correct permissions (If you are reading and writing data, then make sure the permission is set to “Read/Write”)

If the above is set correctly, then make sure your server is passing the auth headers to WordPress. You can test this by passing in the consumer key and secret via URL rather than headers to confirm the issue. Eg:


If you have access to .htaccess file then add the below lines temporarily for the test

SetEnvIf Authorization .+ HTTP_AUTHORIZATION=$0
RewriteRule ^wp-json/.* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

Questions and Support

↑ Back to top

Do you still have questions and need assistance? 

This documentation is about the free, core WooCommerce plugin for which support is provided in our community forums on WordPress.org. Searching there you’ll often find that your question has been asked and answered before.

If you haven’t created a WordPress.org account to use the forums, here’s how.

  • If you’re looking to extend the core functionality shown here, we recommend reviewing available extensions in the Woo Marketplace.
  • Need ongoing advanced support, or a customization built for WooCommerce? Hire a WooExpert agency.
  • Are you a developer building your own WooCommerce integration or extension? Check our Developer Resources.

If you weren’t able to find the information you need, please use the feedback thumbs below to let us know! 🙏