WooCommerce · Guide
How to Get WooCommerce API Key (Step by Step)

Short answer
Go to WooCommerce > Settings > Advanced > REST API and click Add key. Enter a description, choose the user and set permissions to Read, Write or Read/Write, then click Generate API key. Copy the consumer key and consumer secret right away, because the secret is shown only once.
Key takeaways
- API keys are created under WooCommerce > Settings > Advanced > REST API.
- Each key has a consumer key (ck_) and a consumer secret (cs_).
- The secret is shown once, so copy it immediately.
- Pick the lowest permission level the app needs.
- Use HTTPS and revoke keys you no longer use.
How do you get a WooCommerce API key?
Go to WooCommerce > Settings > Advanced > REST API, click Add key or Create an API key, choose a user and permission level, then click Generate API key and copy both keys.
WooCommerce gives you two values: a Consumer key that starts with ck_ and a Consumer secret that starts with cs_. Together they let an app read or change store data through the WooCommerce REST API.
You need these keys to connect tools such as inventory systems, accounting software, mobile apps, marketplaces or custom scripts. The official WooCommerce REST API documentation covers the same steps.
The secret is shown only once. Copy it straight away and store it somewhere safe.
What do you need before you create an API key?
You need an administrator or shop manager account, pretty permalinks turned on, and ideally an HTTPS site, because API requests carry sensitive store data.
Run through this list:
- You can log in as an Administrator or a user who can manage WooCommerce
- Settings > Permalinks is set to anything except Plain
- Your site loads over HTTPS with a valid SSL certificate
- You know what the connecting app needs to do, such as only read orders or also update stock
The REST API relies on the /wp-json/ route, which needs pretty permalinks. If that route is broken, Site Health often shows a warning. See our guide on fixing the REST API error in Site Health if you see one.
How do you generate the API key step by step?
Open the REST API screen under WooCommerce's Advanced settings, add a description, pick the user and permissions, generate the key, then copy the consumer key and secret.
- Go to WooCommerce > Settings
- Click the Advanced tab
- Click REST API
- Click Add key, or Create an API key if this is your first one
- Enter a description, such as the app's name
- Choose the User the key will act as
- Set Permissions to Read, Write or Read/Write
- Click Generate API key
- Copy the Consumer key and Consumer secret into your app or a password manager
WooCommerce also shows a QR code on that screen, which some mobile apps can scan to connect. If you lose the secret, you cannot view it again. You must revoke the key and create a new one.
Which permission level should you choose?
Choose Read for apps that only display or report on data, Write for apps that only push data in, and Read/Write only when the app genuinely needs to both read and change store data.
| Permission | What the app can do | Typical use |
|---|---|---|
| Read | View products, orders, customers and reports | Dashboards, analytics, accounting exports |
| Write | Create or update data without reading it back | Rare, some one-way import tools |
| Read/Write | View and change store data | Inventory sync, order management, marketplaces |
Least privilege is the safe rule. A reporting tool with Read/Write access is a needless risk if its credentials ever leak.
The key also inherits the capabilities of the user you pick. Tying a key to a dedicated user with only the access it needs limits the damage if something goes wrong.
How do you test that the API key works?
Send a GET request to your store's /wp-json/wc/v3/products endpoint with the consumer key and secret using Basic Authentication over HTTPS, and you should get a JSON list of products.
A simple test with curl looks like this, using your own domain and keys:
curl https://example.com/wp-json/wc/v3/products -u ck_yourkey:cs_yoursecret
If it works, you see product data in JSON. If you get a 401 error, the keys, permissions or authorization header are the usual suspects.
The WooCommerce REST API developer docs list every endpoint, including orders, customers, coupons and reports. API clients such as Postman make testing easier if you prefer a visual tool.
The curl documentation explains the -u flag used for Basic Authentication.
How does authentication work over HTTP and HTTPS?
Over HTTPS, apps send the consumer key and secret with HTTP Basic Authentication; over plain HTTP, WooCommerce requires OAuth 1.0a signatures, which is harder to set up and less safe.
Use HTTPS. Sending store credentials over an unencrypted connection exposes them to anyone who can see the traffic.
Some servers strip the Authorization header before it reaches PHP, which causes 401 errors even with correct keys. Over HTTPS, WooCommerce also accepts the key and secret as query string parameters as a fallback. The authentication guide explains both options.
MDN's page on HTTP authentication is a good primer if Basic Authentication is new to you.
How do you revoke or reset a WooCommerce API key?
Go back to WooCommerce > Settings > Advanced > REST API, hover over the key, click Revoke, then generate a new key and update the connected app with the new values.
Revoke keys when you stop using an app, when a developer or agency leaves the project, or if you think a key has leaked. Revoking takes effect immediately.
The list on that screen shows each key's description, the last characters of the consumer key, the user, permissions and when it was last accessed. Clear descriptions make it easy to spot keys you no longer need.
How is a WooCommerce API key different from an application password?
WooCommerce API keys authenticate against WooCommerce's own REST endpoints, while WordPress application passwords authenticate a user against the whole WordPress REST API, including posts, pages and users.
Many WooCommerce integrations ask specifically for a consumer key and secret. Some newer tools use application passwords instead, especially when they need WordPress data as well as store data.
Our guide on using application passwords in WordPress covers that method.
For the general WordPress API, see how to use the WordPress REST API.
Why might the API key not work?
API keys usually fail because of wrong permissions, a stripped Authorization header, plain permalinks, a security plugin or firewall blocking the REST API, or caching on the API route.
Check these in order:
- Confirm the key has the right permission level for the request
- Make sure permalinks are not set to Plain
- Check that your security plugin or firewall is not blocking /wp-json/
- Exclude /wp-json/ from page caching and CDN caching
- Try the query string method over HTTPS to rule out header stripping
Note that the old WooCommerce Legacy REST API is no longer part of core WooCommerce. Integrations built for it need updating, or the separate legacy extension, so check with the app's developer.
If the store itself misbehaves while testing, our guide on WooCommerce not working properly covers wider troubleshooting.
How do you keep WooCommerce API keys secure?
Give each app its own key, use the lowest permission it needs, store secrets in a password manager or environment variables, and revoke unused keys regularly.
- Never paste keys into public code repositories or support forums
- Avoid sharing one key across several tools
- Tie keys to a dedicated user with limited capabilities where possible
- Review the key list every few months and remove old ones
- Keep WooCommerce and WordPress updated
These habits matter because a Read/Write key can change prices, create orders and read customer details. Treat it with the same care as an admin password.
What can you do with a WooCommerce API key?
With an API key, external apps can list and update products, read and create orders, manage customers and coupons, and pull sales reports from your store without anyone logging in.
Common real-world uses include:
- Syncing stock levels between WooCommerce and a warehouse or point-of-sale system
- Sending new orders to fulfilment, shipping or accounting software
- Listing products on marketplaces and pulling marketplace orders back in
- Powering a mobile app or headless storefront
- Running scripts that bulk-update prices or product data
Before you hand a key to a third-party service, check its documentation for the exact permissions it needs. A reputable integration will tell you whether it needs Read or Read/Write access.
If you are building your own integration, start on a staging copy of the store. Writing test orders and price changes to a live store can confuse customers and reports.
For a bigger project, such as a decoupled storefront, our guide on building a headless WordPress site explains how the API fits into that setup.
Frequently asked questions
Where is the REST API option in WooCommerce?
Go to WooCommerce > Settings, click the Advanced tab, then click REST API. If you do not see the Advanced tab, your user role may lack permission to manage WooCommerce settings.
I lost my consumer secret. Can I see it again?
No. WooCommerce shows the secret only when the key is generated. Revoke the old key on the REST API screen, create a new one and update the connected app with the new consumer key and secret.
Do WooCommerce API keys expire?
No. Keys stay valid until you revoke them or delete the user they belong to. That is why it is worth reviewing the key list regularly and removing keys for apps you no longer use.
Why do I get a 401 error with correct keys?
Common causes are the server stripping the Authorization header, plain permalinks, a security plugin blocking the REST API, or insufficient key permissions. Over HTTPS, try passing the keys as query string parameters to test.
Can a shop manager create API keys?
Users who can manage WooCommerce settings can create keys, which usually includes administrators and shop managers. The key can only do what the selected user is allowed to do.
Sources
- WooCommerce REST API WooCommerce Documentation
- REST API documentation WooCommerce Developer
- REST API authentication WooCommerce Developer
- HTTP authentication MDN Web Docs
- curl man page curl
Is your product missing, or something out of date?
Tell us what to add or correct. We read every note and reply when we need a source. A message does not buy a ranking.
Thanks — we review requests within 3 business days.
Related guides
About the editors
Researched from the primary sources listed above and checked against our editorial rules before publishing.


