Not every integration can rely on CSV files or manual data entry. If you run a headless WooCommerce store, sync products from an ERP, or build custom dashboards for compliance teams, you need an API. Our GPSR Compliance for WooCommerce plugin exposes a REST API that lets you manage manufacturer data programmatically. Here is how to use it.
API Overview
The GPSR Compliance plugin extends the WooCommerce REST API with endpoints for manufacturers and authorized representatives. The base URL follows the standard WooCommerce pattern:
https://yourstore.com/wp-json/gpsr/v1/manufacturers
All endpoints return JSON and support standard HTTP methods: GET for reading, POST for creating, PUT for updating, and DELETE for removing records. If you have worked with the WooCommerce Products or Orders API before, this will feel familiar.
Authentication
The API uses WooCommerce’s built-in authentication. You will need a set of API keys, which you can generate from WooCommerce, then Settings, then Advanced, then REST API. Create a key with Read/Write permissions.
For server-to-server calls, use HTTP Basic Auth with the consumer key and secret:
curl https://yourstore.com/wp-json/gpsr/v1/manufacturers
-u ck_your_consumer_key:cs_your_consumer_secret
For JavaScript-based frontends (headless setups), you can also use the WooCommerce OAuth 1.0a flow or application passwords, depending on your WordPress version and preference. Just make sure you never expose API keys in client-side code.
CRUD Operations for Manufacturers
Here are the core operations you will use most often:
Create a Manufacturer
POST /wp-json/gpsr/v1/manufacturers
{
"name": "Acme GmbH",
"trade_name": "Acme",
"street": "Industriestraße 42",
"city": "Berlin",
"postal_code": "10115",
"country": "DE",
"email": "safety@acme.example.com",
"phone": "+49 30 1234567"
}
The response includes the new manufacturer’s ID, which you will use when assigning it to products.
List All Manufacturers
GET /wp-json/gpsr/v1/manufacturers
Returns a paginated list. Use the per_page and page parameters to handle through large sets. The response headers include X-WP-Total and X-WP-TotalPages for pagination info.
Update a Manufacturer
PUT /wp-json/gpsr/v1/manufacturers/15
{
"street": "Neue Straße 7",
"city": "Munich",
"postal_code": "80331"
}
You only need to include the fields you want to change. Everything else stays as is.
Delete a Manufacturer
DELETE /wp-json/gpsr/v1/manufacturers/15
This removes the manufacturer record. Products that referenced it will lose their GPSR association, so reassign them before deleting.
Assigning Manufacturers to Products
To link a manufacturer to a product, use the standard WooCommerce Products API with the GPSR meta fields:
PUT /wp-json/wc/v3/products/1234
{
"meta_data": [
{
"key": "_gpsr_manufacturer_id",
"value": "15"
}
]
}
This works for both simple and variable products. For individual variations, use the variations endpoint instead:
PUT /wp-json/wc/v3/products/1234/variations/5678
{
"meta_data": [
{
"key": "_gpsr_manufacturer_id",
"value": "22"
}
]
}
Practical Use Cases
The API becomes really valuable in a few specific scenarios:
- Headless WooCommerce stores. If your frontend is a React or Next.js app, you fetch product data via the API anyway. Adding manufacturer data to that flow means your headless store displays GPSR info just like a traditional theme would.
- ERP and PIM sync. When your product data lives in an external system, the API lets you push manufacturer assignments automatically every time a product is created or updated in the source system.
- Custom compliance dashboards. Build an internal tool that lists all products, their assigned manufacturers, and flags any products missing GPSR data. A simple script that calls GET /manufacturers and cross-references with GET /products can generate this report in seconds.
- Multi-store setups. If you run several WooCommerce stores sharing the same manufacturer database, use the API to sync manufacturer records across all of them. Create once, push everywhere.
- Automated auditing. Schedule a cron job that checks all published products for complete GPSR data and sends an alert if anything is missing. This catches gaps before a customer or regulator does.
Error Handling and Best Practices
A few things to keep in mind when building integrations:
- Rate limiting. WooCommerce does not enforce rate limits by default, but your hosting might. Keep API calls reasonable, especially during bulk operations. Batch updates where possible.
- Validation errors. The API returns descriptive error messages with HTTP 400 status codes. Common issues: missing required fields (name, country), invalid country codes, or duplicate manufacturer names.
- Permissions. Make sure your API keys have the right scope. Read-only keys cannot create or update manufacturers. If you get 403 errors, check key permissions first.
- Caching. If you cache API responses on the client side, remember to invalidate when manufacturer data changes. Stale GPSR data is a compliance risk.
The GPSR Compliance plugin documentation includes a full endpoint reference with all supported parameters and example responses. For most integrations, the four operations above (create, list, update, delete) plus the product assignment call will cover everything you need.