Test the product deletion endpoint with your own data.
Permanently remove a product from your inventory
The delete endpoint allows you to permanently remove a product and all its associated data from your inventory. You can identify the product using an EAN, ASIN, GTIN, MINSAN code or SKU.
This action is irreversible and will delete the product from all countries in your inventory.
DELETE https://api.commerceclarity.com/api/v1/products/delete
| Parameter | Type | Required | Description |
|---|---|---|---|
code |
string | Required | Product identifier. Can be an EAN, ASIN, GTIN, MINSAN code or SKU |
| Code | Status | Description |
|---|---|---|
| 200 | success | Product successfully deleted from inventory |
| 404 | error | Product not found with the provided identifier |
| 500 | error | Internal server error occurred during deletion |
{
"status": "success"
}
{
"message": "The product with the provided code could not be found."
}
{
"message": "An internal server error occurred during deletion."
}
<?php
require 'vendor/autoload.php';
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
$client = new Client([
'base_uri' => 'https://api.commerceclarity.com',
'timeout' => 10.0,
'headers' => [
'Authorization' => 'Bearer YOUR_API_TOKEN',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
]
]);
$productCode = '8004120057724'; // Product code to delete
try {
$response = $client->delete('/api/v1/products/delete', [
'json' => [
'code' => $productCode
]
]);
$result = json_decode($response->getBody()->getContents(), true);
if ($result['status'] === 'success') {
echo "Product successfully deleted: " . $productCode . "\n";
} else {
echo "Failed to delete product: " . ($result['message'] ?? 'Unknown error') . "\n";
}
} catch (RequestException $e) {
echo "Error: " . $e->getMessage() . "\n";
if ($e->hasResponse()) {
$errorResponse = json_decode($e->getResponse()->getBody()->getContents(), true);
echo "Error code: " . $e->getResponse()->getStatusCode() . "\n";
echo "Message: " . ($errorResponse['message'] ?? 'no message') . "\n";
}
}
?>
const productCode = '8004120057724'; // Product code to delete
const apiUrl = 'https://api.commerceclarity.com/api/v1/products/delete';
const token = 'YOUR_API_TOKEN';
// Make the delete API request
fetch(apiUrl, {
method: 'DELETE',
headers: {
'Authorization': `Bearer ${token}`,
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify({
code: productCode
})
})
.then(response => {
if (!response.ok) {
return response.json().then(errorData => {
throw new Error(errorData.message || `Status: ${response.status}`);
});
}
return response.json();
})
.then(data => {
if (data.status === 'success') {
console.log(`Product successfully deleted: ${productCode}`);
} else {
console.log(`Failed to delete product: ${data.message || 'Unknown error'}`);
}
})
.catch(error => {
console.error('Error deleting product:', error.message);
});
import requests
import json
# API Configuration
product_code = '8004120057724' # Product code to delete
api_url = 'https://api.commerceclarity.com/api/v1/products/delete'
token = 'YOUR_API_TOKEN'
headers = {
'Authorization': f'Bearer {token}',
'Accept': 'application/json',
'Content-Type': 'application/json'
}
data = {
'code': product_code
}
try:
# Make the delete request
response = requests.delete(api_url, headers=headers, json=data)
# Raise exception for HTTP errors
response.raise_for_status()
# Extract data from the response
result = response.json()
if result['status'] == 'success':
print(f"Product successfully deleted: {product_code}")
else:
print(f"Failed to delete product: {result.get('message', 'Unknown error')}")
except requests.exceptions.HTTPError as err:
print(f"HTTP Error: {err}")
if response.text:
try:
error_data = response.json()
print(f"Error message: {error_data.get('message', 'no message')}")
except json.JSONDecodeError:
print(f"Response text: {response.text}")
except requests.exceptions.RequestException as err:
print(f"Request error: {err}")
curl -X DELETE "https://api.commerceclarity.com/api/v1/products/delete" \
-H "Authorization: Bearer YOUR_API_TOKEN" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-d '{
"code": "8004120057724"
}'
Check the current status of a specific product in your inventory.
Go to Product Details