in

How to Easily Retrieve WooCommerce Orders Using the REST API

Learn how to retrieve WooCommerce orders using the REST API, from creating secure API keys to making your first request. Explore filters, sorting, and pagination, then see how to read order data, troubleshoot common errors, and protect customer information.

Need a quick way to access your store’s order data? The WooCommerce REST API makes it easy to retrieve orders and use them in custom apps, reports, or integrations. With a few API requests, you can fetch recent orders or filter results to find exactly what you need.

In this guide, we’ll walk through how to use the WooCommerce REST API to retrieve orders, including the key setup steps and useful options for refining your requests. Whether you’re building an integration or just getting familiar with the API, you’ll be ready to get started.

Set Up Your WooCommerce REST API Access

Before you can request order details, your store needs to recognize and authorize the application making the call. A little preparation now helps prevent authentication errors—and keeps sensitive customer and order data protected.

Create API keys and choose a secure authentication method

In your WordPress dashboard, go to WooCommerce > Settings > Advanced > REST API, then select Add key. Give the key a descriptive name so you can identify its purpose later, choose the WordPress user it should be associated with, and set its permission to Read if the integration only needs to retrieve orders.

WooCommerce generates a consumer key and consumer secret. Copy and store both securely when they appear; the secret may not be shown again. For a store using HTTPS, many clients authenticate by sending the key and secret with HTTP Basic Authentication. Some server configurations or integrations may require another supported method, so check the WooCommerce REST API documentation if authentication fails.

  • Use HTTPS for API requests to protect credentials in transit.
  • Keep secrets in server-side environment variables or a secrets manager—not in browser code or a public repository.
  • Revoke and replace a key if it is exposed or no longer needed.

Confirm your store’s API endpoint and permissions

With credentials ready, verify the address your application will call. For a standard WooCommerce installation, the orders endpoint is https://your-store.com/wp-json/wc/v3/orders; replace your-store.com with your store’s domain. If WordPress is installed in a subdirectory or your site uses custom routing, confirm the correct REST API base URL before building requests.

Next, make sure the key’s access level matches the task. A Read-only key is generally sufficient to retrieve orders and is safer than granting write access unnecessarily. The associated WordPress user must also be able to access the relevant data, and security plugins, firewalls, or hosting rules should not block REST requests.

Once the endpoint and permissions are confirmed, you’re ready to make a request to retrieve orders. Starting with a small test call can help distinguish an incorrect URL or credential from a filter issue later on.

WooCommerce REST API Retrieve Orders: Make Your First Request

With your endpoint and access credentials in place, you can move from setup to seeing actual order data. Start with a small request, then add filters or pagination as your needs grow.

A basic call confirms that your application can reach the store and that the response contains the fields you expect. The examples below use cURL, but the same endpoint and parameters work with other HTTP clients.

Use the orders endpoint with a simple request

Send a GET request to /wp-json/wc/v3/orders on your store’s domain. For example, replace the placeholders below with your consumer key and secret, and your store URL:

curl -u "ckyourconsumerkey:csyourconsumersecret" 
  "https://your-store.com/wp-json/wc/v3/orders"

A successful response is JSON: typically an array of order objects containing details such as the order ID, status, date, totals, and line items. Check the HTTP status code as well—200 indicates a successful request, while a 401 or 403 usually points to an authentication or permission issue.

Once the first response looks right, query parameters let you narrow down the results rather than fetching every order. They’re especially useful for reports and integrations that need a particular time range or status.

Add query parameters to filter and sort results

Add parameters after a question mark in the URL, separating multiple options with ampersands. For instance, this request returns processing orders and sorts them from newest to oldest:

https://your-store.com/wp-json/wc/v3/orders?status=processing&orderby=date&order=desc

You can also filter by dates or customer ID. For example, after=2026-01-01T00:00:00 limits results to orders created after that date. Common options include:

  • status to request orders in a specific state, such as completed or processing.
  • orderby and order to choose a sort field and direction.
  • customer, after, and before to target a customer or date range.

For supported values and parameter details, consult the WooCommerce orders endpoint documentation.

If a filtered request still returns more records than your application can process at once, retrieve them in manageable batches. WooCommerce uses page-based pagination, so your code can request each page in sequence.

Handle pagination when retrieving larger order lists

Set perpage to control the batch size and page to select a batch. For example, ?per

page=50&page=1 requests the first 50 orders; change the page to 2 for the next batch. The WordPress REST API permits up to 100 items per page.

Check the response headers X-WP-Total and X-WP-TotalPages to learn how many matching records and pages are available. Continue until you reach the final page, and keep the same filters on every request so the batches belong to one consistent result set.

A successful response is only the starting point: the useful work comes from identifying the fields your integration needs and handling the data responsibly. A quick check of the response and a few troubleshooting habits can save time as you build on your requests.

WooCommerce REST API Retrieve Orders: Work with and Troubleshoot Results

Order objects can contain more detail than a report or integration needs. Knowing where to look—and what to do when a request fails—makes it easier to turn retrieved records into reliable results.

First, focus on the structure of an order object and the fields that are most useful for common tasks. This helps you parse the response without relying on assumptions about what every order contains.

Read useful order details from the response

Each order object includes top-level fields such as id, status, datecreated, currency, and total. Customer and delivery details are grouped in objects such as billing and shipping, while purchased products appear in the lineitems array.

When processing results, check whether optional values are empty or absent before using them. For example, guest orders may not have a customer ID, and an order can contain multiple line items. If your integration needs custom fields, inspect meta_data and select only the keys it actually uses. The WooCommerce order properties reference describes the available fields.

If the response is empty, incomplete, or unexpected, test the request in small steps. The HTTP status and response body often point to the cause more quickly than changing several parameters at once.

Test requests and resolve common errors

Try the endpoint with a simple request first, then add filters one at a time. A 401 commonly indicates missing or invalid credentials; a 403 can mean the key or associated user lacks permission. A 404 may indicate an incorrect API path, while a 400 often points to an invalid parameter or value.

For a failed call, review the response body, URL encoding, and server logs, then test again with a known order or a narrow date range. If you receive a 429 or server error, reduce request frequency and retry with a short delay rather than repeatedly sending the same call.

Because order responses may include personal information, troubleshooting should not expose customer details or API secrets. A few safeguards help keep both your integration and store data protected.

Keep credentials and customer data secure

Keep consumer secrets on a trusted server, and avoid placing them in browser scripts, screenshots, or shared logs. Use a Read-only key when retrieval is the only task, and revoke keys that are no longer needed.

Store only the order fields required for your workflow, restrict access to saved exports, and redact names, addresses, and payment-related details from debug output. These habits let you use the WooCommerce REST API to retrieve orders while limiting unnecessary exposure of sensitive data.

Turn WooCommerce Order Data into Useful Insights

The WooCommerce REST API makes it straightforward to retrieve the order data your apps, reports, and integrations need. With secure access, the right filters, and pagination for larger result sets, you can collect relevant orders and work with their details more reliably.

As you build, test requests incrementally, handle errors thoughtfully, and protect both credentials and customer information. With these practices in place, you’re ready to make order retrieval a dependable part of your WooCommerce workflow.

Leave a Reply

Your email address will not be published. Required fields are marked *

      Written by Maeve Rodriguez

      Maeve is a Business Content Writer and Front-End Developer. She's a versatile professional with a talent for captivating writing and eye-catching design.