Holiday Sale 30% OFF sitewide on all WordPress & WooCommerce plugins — use code Shop Now →
Back to all articles
E-commerce & Business Software Nov 30, 2026 8 min read
TECHRBUN // E-COMMERCE & BUSINESS SOFTWARE

How to Retrieve PrestaShop Orders Using the API

Need to access order data from your PrestaShop store? The API makes it easy to retrieve orders and use them in reports, integrations, or custom applications.

In this guide, you’ll learn how to use the PrestaShop API to retrieve orders, including how to connect to your store, request order data, and narrow results with filters. Whether you’re building your first integration or streamlining an existing workflow, you’ll have a clear starting point for working with orders through the PrestaShop API.

Prepare API Access for Order Retrieval

Before sending your first request, make sure your store is ready to share order data safely. I start by checking the API key and limiting access to only the resources the integration needs.

Your API key identifies your connection, so it’s worth confirming where it lives and how it will be stored. These steps help you avoid sharing broader access than necessary.

Find Your PrestaShop API Credentials

In your store’s back office, open Advanced Parameters > Webservice and check whether the web service is enabled. Menu labels can vary slightly between PrestaShop versions. From there, create or select a webservice key for your integration.

Copy the key and keep it in a secure location, such as an environment variable or a secrets manager—not in public code or a browser-based application. PrestaShop’s web service commonly uses HTTP Basic Authentication: provide the key as the username and leave the password blank. I recommend testing with a private development store before connecting a live workflow.

Once you have a key, decide what it can access and which resource to request. A focused permission setup makes it easier to troubleshoot and reduces the impact of an accidentally exposed credential.

Set Permissions and Choose an Endpoint

When creating or editing the key, enable only the permissions your task requires. For a basic order lookup, allow GET access to the orders resource; add other resources only if your integration needs related records, such as customer details.

  • GET lets your integration read order records.
  • Avoid enabling create, update, or delete permissions unless the workflow must change store data.
  • Use a separate key for each integration so access can be revoked independently.

The standard order endpoint follows this pattern: https://your-store.example/api/orders. Replace the domain with your store’s address. PrestaShop’s web service often returns XML by default; where supported, you can request JSON with an output-format parameter. In the next request, you can build on this endpoint to select fields or narrow the results rather than retrieving more data than you need.

Retrieve Orders with the PrestaShop API

With access configured, the next step is to shape each request around the task at hand. I usually begin with a small set of fields, then add filters or pages as the workflow requires.

A first request can confirm that the endpoint is returning the records and fields you expect. Here’s how I build that request before narrowing the results.

Make a PrestaShop API Retrieve Orders Request

Send a GET request to the orders endpoint and use the display parameter to select fields. For example:

https://your-store.example/api/orders?display=[id,reference,dateadd,totalpaid]

This keeps the response focused on the order ID, reference, creation date, and paid total. I find it easier to validate a compact response than to work through every available field at once. If you need the full record, use display=full.

For an integration that depends on specific values, check the response format and field names in your own store. PrestaShop versions and installed modules can affect what data is available, so I test with a known order before using the request in a scheduled job.

Once the basic request works, filters help you retrieve only the orders relevant to a report or customer workflow. You can combine compatible filters in the same URL.

Filter Orders by Date, Status, or Customer

PrestaShop supports filters using the filter[field] pattern. For example, a date range can look like filter[dateadd]=[2026-01-01,2026-01-31]&date=1; the date=1 parameter indicates that the filter values are dates.

To narrow the results further, use an order’s current state or customer ID. For example, filter[currentstate]=2 selects orders in state 2, while filter[idcustomer]=15 selects orders belonging to customer 15. State IDs can differ between stores, so I verify the relevant ID in the shop rather than assuming that a particular number means “paid” or “shipped.”

  • Use a date range for daily or monthly exports.
  • Combine date and state filters to retrieve, for example, recently shipped orders.
  • Check the returned records to confirm the filters behave as intended.

Filtered requests can still return many records, especially for older stores. Pagination lets you process those results in manageable batches instead of relying on one large response.

Handle Pagination and Large Results

Use the limit parameter to set a starting offset and batch size. For example, limit=0,50 requests the first 50 records; the next batch can start at offset 50 with limit=50,50.

I recommend choosing a consistent sort order, such as ascending order ID, and saving the last processed ID or date between runs. This makes it easier to resume after an interruption and helps avoid fetching the entire order history repeatedly. For large exports, keep batches modest and retry failed requests rather than restarting the whole job.

Process and Troubleshoot Order Data

A successful response is only the first step. How you interpret, protect, and update the records determines whether your integration stays reliable as the store changes.

Order fields can be simple to read, but related information may require a separate request. I check the response structure before building any assumptions into the integration.

Each order record includes fields such as its ID, reference, dates, customer ID, and current state. With display=full, inspect the response to see which fields and associations your shop actually returns; available data can vary by PrestaShop version and modules.

When you need line items or customer details, retrieve the relevant resource using the order’s ID or customer ID. For example, you can query /api/orderdetails with a filter for the order ID. I keep these requests targeted, then match related records using their IDs rather than assuming every field is included in the order response.

If a request fails, the response often gives a useful clue. I first check the status code and error body, then confirm the credentials, permissions, and URL before changing the request itself.

Manage Authentication and Response Errors

A 401 response usually points to an authentication issue, such as a missing or incorrectly supplied webservice key. A 403 commonly means the key is recognized but lacks permission for the requested resource or method. Confirm that the key is sent as the Basic Auth username and that it has GET access to the resource.

For a 404, check the store domain and endpoint path. If the server returns an XML error, read its message rather than treating the response as an empty result. I also log the request URL, status code, and timestamp—but never the API key—and retry temporary server errors with a short delay.

Once records are readable, a careful sync prevents duplicates and makes later changes easier to handle. I treat each run as an update process, not just a one-time download.

Store and Sync Retrieved Orders Safely

Use the PrestaShop order ID as a stable identifier in your local system. An upsert—insert the record if it is new, or update it if it already exists—lets a scheduled job run again without creating duplicate orders.

Save the last successful sync point and request newer or changed records in manageable batches. Order states can change after checkout, so periodically refresh recent records instead of assuming an order is final. Store only the fields your workflow needs, protect customer data, and avoid retaining sensitive payment details that the integration does not require.

Build a Reliable PrestaShop Order Retrieval Workflow

The PrestaShop API gives you a flexible way to bring order data into reports, integrations, and custom applications. A reliable workflow starts with secure, narrowly scoped access, then uses focused requests, relevant filters, and pagination to retrieve only what you need.

From there, validate the response, handle errors thoughtfully, and sync records using stable order IDs so repeated runs don’t create duplicates. Because order details and states can vary across stores and change over time, test your requests and refresh recent records as your process evolves.

With these practices in place, you can retrieve PrestaShop orders confidently and keep your connected workflows accurate, secure, and ready to grow.

Discussion

0 Comments

Leave a comment ↓

No comments yet. Share your thoughts or questions below.

Leave a Comment

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