PrestaShop API is basically how you let external apps talk to your PrestaShop store — read data, create orders, update products, customers, etc., without touching the back-office UI.
Here’s a clean, practical rundown 👇
What is PrestaShop Webservice API?
It’s a REST-like API built into PrestaShop that uses:
- HTTP
- XML (default) or JSON (newer versions)
- API key authentication
You can manage:
- Products
- Categories
- Customers
- Orders
- Carts
- Stock
- Carriers
- Employees (limited)
- And more
How to Enable PrestaShop API
- Go to Back Office
- Advanced Parameters → Webservice
- Turn Enable PrestaShop Webservice → YES
- Click Add new webservice key
- Set permissions (GET / POST / PUT / DELETE)
- Save → copy the API key 🔑
Authentication (Important)
PrestaShop uses Basic Auth
- Username → API KEY
- Password → empty
Example:
Authorization: Basic base64(API_KEY:)
Base API URL
https://yourstore.com/api/
Example resources:
/api/products
/api/categories
/api/orders
/api/customers
/api/stock_availables
Quick Test (Browser)
Open:
https://API_KEY@yourstore.com/api/products
If enabled correctly → you’ll see XML output.
CURL Example (GET products)
curl -X GET "https://yourstore.com/api/products" \
-u API_KEY:
PHP Example (Get Products)
$apiKey = 'YOUR_API_KEY';
$url = 'https://yourstore.com/api/products';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERPWD, $apiKey . ':');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Accept: application/xml'
]);
$response = curl_exec($ch);
curl_close($ch);
echo $response;
Create a Product (POST – XML)
PrestaShop requires full XML structure.
<prestashop>
<product>
<name>
<language id="1">Test Product</language>
</name>
<price>999</price>
<active>1</active>
</product>
</prestashop>
POST to:
/api/products
JSON Support (PrestaShop 1.7.8+)
Add header:
Accept: application/json
Content-Type: application/json
But ⚠️ XML is still more stable for POST/PUT.
Common API Errors
| Error | Meaning |
|---|---|
| 401 | Wrong API key / permissions |
| 403 | Webservice disabled |
| 404 | Resource doesn’t exist |
| 500 | Invalid XML structure |
When API is Best Used
✔ Mobile apps
✔ ERP / CRM integration
✔ Auto product sync
✔ Stock & order sync
✔ Marketplace integration
