API Playground

Test the product regeneration endpoint with your data.

Authentication Required

You need to Login to test the API playground

Product Regenerate Endpoint

Regenerate specific product fields with updated data

POST

The regenerate endpoint allows you to update specific fields of an existing product without recreating it entirely. You can specify which fields to regenerate and provide custom notes for the regeneration process.

This is useful when you want to update product information based on new data or user feedback, or when you need to refresh specific attributes.

Note: This endpoint consumes credits based on the complexity of the analysis. See the credit consumption details below.
Endpoint URL
POST https://api.commerceclarity.com/api/v1/products/regenerate/{id}

Request Parameters

Parameter Type Required Description
id string Required Product ID or code to regenerate
notes string Optional Additional notes for product generation
fields object Optional Object specifying which fields to regenerate. Keys are field names (e.g., "title", "description", "global_attr.color") and values are the new content or instructions.
agent_model string Optional Agent model to use (v1 or v2, default: v2)

Credit Consumption

Each API call to the analysis endpoint will consume credits from your account based on the requested services and the selected agent model.

Component Credits Used Description
Agent Model v2 5 Content Credits Product import with the alternative model
Agent Model v1 1 content credit Product import with the basic model
Credit Calculation Example
Regenerating product fields with v2: 5 credits (same cost regardless of number of fields).

Request Examples

cURL - Basic Analysis
curl -X POST https://api.commerceclarity.com/api/v1/products/regenerate/product-id-123 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "notes": "Update product description with new marketing copy",
    "fields": {
      "description": "New product description"
    },
    "agent_model": "v2"
  }'
cURL - Multiple Fields
curl -X POST https://api.commerceclarity.com/api/v1/products/regenerate/product-id-123 \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "notes": "Update multiple fields based on new product information",
    "fields": {
      "title": "Updated Product Title",
      "description": "Updated product description",
      "key_features": "New key features list",
      "global_attr.color": "Blue"
    },
    "agent_model": "v2"
  }'
PHP (Guzzle)
$client = new \GuzzleHttp\Client();

$response = $client->post('https://api.commerceclarity.com/api/v1/products/regenerate/product-id-123', [
    'headers' => [
        'Authorization' => 'Bearer ' . $apiToken,
        'Content-Type' => 'application/json',
    ],
    'json' => [
        'notes' => 'Update product description',
        'fields' => [
            'description' => 'New product description'
        ],
        'agent_model' => 'v2'
    ]
]);

$data = json_decode($response->getBody(), true);
JavaScript (Fetch)
const response = await fetch('https://api.commerceclarity.com/api/v1/products/regenerate/product-id-123', {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${apiToken}`,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    notes: 'Update product description',
    fields: {
      description: 'New product description'
    },
    agent_model: 'v2'
  })
});

const data = await response.json();

Response Examples

Success Response

Success Response (200)
{
  "status": "success",
  "message": "Product regeneration queued successfully",
  "data": {
    "product_id": "507f1f77bcf86cd799439011",
    "status": "queued",
    "fields_to_regenerate": [
      "description",
      "global_attr.color"
    ]
  }
}

Error - Product Not Found

Error Response - Validation (404)
{
  "status": "error",
  "code": "product_not_found",
  "message": "The specified product does not exist"
}

Error - Validation Failed

Error Response - Validation (422)
{
  "status": "error",
  "code": "validation_failed",
  "errors": {
    "fields": [
      "At least one field must be specified for regeneration"
    ]
  }
}