Holiday Sale 30% OFF sitewide on all WordPress & WooCommerce plugins — use code Shop Now →
Back to all articles
API Troubleshooting Nov 30, 2026 7 min read
TECHRBUN // API TROUBLESHOOTING

How to Authenticate with the PrestaShop API

Want to connect your store to an app, automate routine tasks, or manage products programmatically? The PrestaShop API makes it possible, and authentication is the first step. Once you understand how PrestaShop API authentication works, you can give approved tools secure access to the data and features they need.

This guide walks you through setting up your API credentials, choosing the right permissions, and making an authenticated request. Whether you’re new to PrestaShop or simply need a quick refresher, you’ll be ready to connect with confidence.

PrestaShop API Authentication Basics

Before an app can work with your store, it needs a credential that you control. I start by creating a dedicated key and checking that webservice access is enabled; those two steps help keep a connection both usable and limited to its intended purpose.

Find Your API Key

In the PrestaShop back office, open Advanced Parameters > Webservice, then choose the option to add a new webservice key. The exact button labels can vary slightly by PrestaShop version, but the key-management page is where you create and manage credentials.

When adding a key, you can generate one automatically or enter your own. I usually let PrestaShop generate it, then copy it somewhere secure before leaving the page. Treat the key like a password: anyone who obtains it may be able to access the resources you authorize.

Give each integration its own key and select only the permissions it needs. For example, a stock-sync tool may need to read products and update stock, but it does not need access to customer records. Before saving, review settings such as:

  • Key: the credential the connecting application will use.
  • Permissions: the specific resources and actions allowed for that key.
  • Enabled status: whether the key is active and available for requests.

Enable API Access

Creating a key alone may not be enough if webservice access is turned off for the store. In the same Advanced Parameters > Webservice area, find the setting to enable the PrestaShop webservice and switch it on, then save your changes.

Once enabled, the key can be used for PrestaShop API authentication. Most clients send it using HTTP Basic authentication as the username, with a blank password. Use an HTTPS connection so the credential is encrypted in transit, and avoid placing it in public code, browser scripts, or shared screenshots.

If a request still fails, I check these items first:

  • Webservice access is enabled and the key itself is active.
  • The key has permission for the requested resource and action.
  • The request uses the correct store URL and sends the key as the Basic-auth username.

With access enabled and permissions set narrowly, you have a safer starting point for testing an authenticated request.

Make an Authenticated Request

Your key is ready; now it’s time to see whether your store accepts it. I start with a simple read-only request, which checks the connection without changing store data.

The examples below use a placeholder key and store address. Replace them with your own values, and keep the real key out of code you share or publish.

Use Basic Authentication

PrestaShop’s webservice accepts the API key through HTTP Basic authentication. The key goes in the username field, and the password is left blank—so the credentials are sent as APIKEY:.

With curl, you can make that request like this:

  • curl -u YOURAPIKEY: "https://your-store.example/api/"

The trailing colon matters: it indicates an empty password. I use HTTPS for every request, since Basic authentication encodes credentials but does not encrypt them by itself. HTTPS protects them while they travel between your client and the store.

Test an API Endpoint

Once authentication is in place, try an endpoint your key is allowed to access. A read-only request to the products resource is a useful first check; it can confirm the URL, credentials, and permissions without editing anything.

For example, this request asks for a small selection of product data:

  • curl -u YOURAPI_KEY: "https://your-store.example/api/products?display=[id,name]&limit=1"

A successful response commonly returns XML. Check that the response contains the fields you requested, rather than relying on the status alone. If you prefer, add -i to the command to include the HTTP status and headers in the output.

If the test fails, I use the status code as a clue and check the matching setting:

  • 401 Unauthorized: confirm the key is copied correctly and sent as the username.
  • 403 Forbidden: review the key’s permission for that resource and action.
  • 404 Not Found: check the store URL, API path, and whether the resource is available.

After a successful test, use the same authentication method for other authorized endpoints, adding only the permissions and request methods your integration needs.

A successful test confirms the connection, but it also means a credential can now reach your store. I treat that key like a set of carefully controlled doors: each one should open only for the tools and tasks that need it.

Good habits make everyday integrations easier to maintain and help narrow down problems if a request is rejected. I start by keeping access limited, then troubleshoot errors by checking one cause at a time.

Small permission choices and a simple key-rotation routine can prevent an integration from having more access than it needs. The following steps help me keep credentials manageable as a store’s tools change.

Manage Permissions

I give each integration its own key rather than sharing one credential across several apps. That way, if a tool is retired or a key needs replacing, I can disable that access without interrupting other connections.

When setting permissions, I allow only the resources and actions required for the job. A reporting tool might need read access to orders, while a catalog sync may need permission to update products. I avoid granting access to customer or payment-related data unless the integration genuinely requires it.

I also review keys periodically, especially after changing vendors or staff access. If a key may have been exposed, I disable it and create a replacement, then update the integration securely. Where the hosting setup supports it, IP restrictions and access logs can add another layer of oversight.

Even with careful permissions, a request can fail for reasons unrelated to the key itself. A quick, consistent troubleshooting routine helps separate credential issues from URL, server, or configuration problems.

Troubleshoot Authentication Errors

I first compare the failing request with the read-only test that worked: same store address, API path, and authentication method. Then I check the response status and, when available, the server’s error details.

Use these clues to focus the next check:

  • 401 Unauthorized: verify that the key is current, active, and sent as the Basic-auth username with an empty password.
  • 403 Forbidden: check whether the key allows the requested resource and action; a read permission will not authorize an update.
  • 404 Not Found: confirm the domain and /api/ path, along with the resource name and store configuration.
  • 5xx server error: review server logs and ask your host about errors from a proxy, firewall, or PHP process.

If the response is unclear, I retry with a minimal read-only request and inspect the returned body and headers. I avoid posting credentials in support tickets; instead, I redact the key and share the status, endpoint, and relevant error message.

Connect with Confidence and Keep Access in Your Control

PrestaShop API authentication gives your integrations a practical way to work with store data, while permissions help ensure each connection can do only what it needs. A successful test is a useful starting point—not the end of the process.

Keep credentials protected, review access as your tools change, and use clear troubleshooting steps when a request fails. With these habits in place, PrestaShop API authentication can support reliable integrations without compromising control of your store.

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 *