Adding Products
Add your products with detailed descriptions to help the AI understand and recommend them accurately. Include images, prices, and relevant tags for better results.
Warning
Include detailed product descriptions and attributes for better AI recommendations. The AI uses this information to match products with customer queries.
🔑 API Key Security
For server-side code, use your Private Key (sk_live_). Keep it secure and never commit it to version control.
Adding a Product
Add products to your store catalog. The AI will automatically index and learn about each product.
add-product.ts
typescript
import { AICommerce } from '@yassirbenmoussa/aicommerce-sdk';
const client = new AICommerce({
apiKey: 'YOUR_API_KEY',
storeId: 'YOUR_STORE_ID',
});
// Add a product to your store
const product = await client.products.create({
name: 'MacBook Pro 14"',
description: 'Powerful laptop for professionals with M3 Pro chip',
price: 1999.99,
currency: 'USD',
category: 'Electronics > Computers > Laptops',
attributes: {
brand: 'Apple',
processor: 'M3 Pro',
ram: '18GB',
storage: '512GB SSD'
},
images: ['https://example.com/macbook.jpg'],
inStock: true,
sku: 'MBP14-M3PRO-18-512'
});
console.log('Product ID:', product.id);Batch Import
Import multiple products at once for faster catalog setup.
batch-import.ts
typescript
// Batch import products
const result = await client.products.batchCreate([
{
name: 'iPhone 15 Pro',
price: 999.99,
category: 'Electronics > Phones',
description: 'Latest iPhone with A17 chip',
images: ['https://example.com/iphone.jpg']
},
{
name: 'AirPods Pro',
price: 249.99,
category: 'Electronics > Audio',
description: 'Noise-canceling wireless earbuds',
images: ['https://example.com/airpods.jpg']
}
]);
console.log(`Imported ${result.imported} products, ${result.failed} failed`);Tip
For large catalogs, consider using our CSV import feature in the dashboard or streaming API for real-time sync with your inventory system.
Product Fields
| Field | Required | Description |
|---|---|---|
| name | Yes | Product display name |
| description | Yes | Detailed product description |
| price | Yes | Product price as number |
| category | No | Category path (e.g., "Electronics > Phones") |
| attributes | No | Key-value pairs for product specs |
| productUrl | No | External URL to the product page |
| images | No | Array of image URLs |