API Batch Import

API batch import allows you to programmatically upload your entire product catalog to Youzu.ai using our API. This method is ideal for large catalogs and automated systems.

Benefits of API Batch Import

  • Automation - Easily integrate with your existing systems
  • Bulk processing - Upload thousands of products in a single operation
  • Scheduled updates - Implement regular synchronization on your schedule
  • Format flexibility - Support for CSV, JSON, and XML data formats via file URL

Authentication

All API endpoints require authentication using your API key:

x-client-secret: YOUR_CLIENT_SECRET

File URL Ingestion

Provide a URL to a file containing your product data:

Endpoint

POST https://platform.youzu.ai/api/v1/admin/catalogue/{catalogueId}/ingest

Supported Formats

  • JSON - JSON array of product objects
  • CSV - Comma-separated values with header row
  • XML - XML document with product elements

The file format is detected automatically from the URL - no need to specify it manually.

{
  "fileUrl": "https://your-cdn.com/products.csv"
}
{
  "success": true,
  "data": {
    "ingestionId": "ing_12345",
    "status": "PROCESSING"
  }
}
const ingestFromFile = async (catalogueId, fileUrl) => {
  const response = await fetch(`https://platform.youzu.ai/api/v1/admin/catalogue/${catalogueId}/ingest`, {
    method: 'POST',
    headers: {
      'x-client-secret': 'YOUR_CLIENT_SECRET',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      fileUrl: fileUrl
    })
  });

  if (response.ok) {
    return await response.json();
  } else {
    console.error('File ingestion failed:', await response.text());
  }
};

// Example usage
const result = await ingestFromFile('cat_abc123', 'https://your-cdn.com/products.csv');
console.log('Ingestion started:', result.data.ingestionId);
import requests

def ingest_from_file(catalogue_id, file_url):
    url = f'https://platform.youzu.ai/api/v1/admin/catalogue/{catalogue_id}/ingest'
    headers = {
        'x-client-secret': 'YOUR_CLIENT_SECRET',
        'Content-Type': 'application/json'
    }
    data = {
        'fileUrl': file_url
    }

    response = requests.post(url, headers=headers, json=data)

    if response.status_code == 200:
        result = response.json()
        print(f"Ingestion started: {result['data']['ingestionId']}")
        return result
    else:
        print(f"File ingestion failed: {response.status_code} - {response.text}")

# Example usage
ingest_from_file('cat_abc123', 'https://your-cdn.com/products.csv')
curl -X POST https://platform.youzu.ai/api/v1/admin/catalogue/cat_abc123/ingest \
  -H "x-client-secret: YOUR_CLIENT_SECRET" \
  -H "Content-Type: application/json" \
  -d '{
    "fileUrl": "https://your-cdn.com/products.csv"
  }'

File Format Examples

JSON Format

[
  {
    "name": {"en": "Ergonomic Office Chair", "es": "Silla de Oficina Ergonómica"},
    "description": {"en": "Premium office chair with lumbar support"},
    "sku": "CHAIR-001",
    "external_ref": "ACME:ECOMMERCE:V1:PRODUCT:12345",
    "url": "https://shop.example.com/products/chair",
    "price": {"USD": 299.99, "EUR": 259.99},
    "in_stock": true,
    "is_published": true,
    "images": [
      "https://example.com/images/chair_front.jpg",
      "https://example.com/images/chair_side.jpg"
    ],
    "categories": ["Furniture", "Office"],
    "brand": "ErgoDesigns",
    "dimensions": {"width": 60, "height": 120, "length": 70}
  }
]

CSV Format

name.en,name.es,sku,external_ref,url,price.USD,price.EUR,in_stock,is_published,images.0,images.1,categories.0,categories.1,brand,dimensions.width,dimensions.height,dimensions.length
Ergonomic Office Chair,Silla de Oficina Ergonómica,CHAIR-001,ACME:ECOMMERCE:V1:PRODUCT:12345,https://shop.example.com/products/chair,299.99,259.99,true,true,https://example.com/images/chair_front.jpg,https://example.com/images/chair_side.jpg,Furniture,Office,ErgoDesigns,60,120,70

XML Format

<?xml version="1.0" encoding="UTF-8"?>
<products>
  <product>
    <name>
      <en>Ergonomic Office Chair</en>
      <es>Silla de Oficina Ergonómica</es>
    </name>
    <description>
      <en>Premium office chair with lumbar support</en>
    </description>
    <sku>CHAIR-001</sku>
    <external_ref>ACME:ECOMMERCE:V1:PRODUCT:12345</external_ref>
    <url>https://shop.example.com/products/chair</url>
    <price>
      <USD>299.99</USD>
      <EUR>259.99</EUR>
    </price>
    <in_stock>true</in_stock>
    <is_published>true</is_published>
    <images>
      <image>https://example.com/images/chair_front.jpg</image>
      <image>https://example.com/images/chair_side.jpg</image>
    </images>
    <categories>
      <category>Furniture</category>
      <category>Office</category>
    </categories>
    <brand>ErgoDesigns</brand>
    <dimensions>
      <width>60</width>
      <height>120</height>
      <length>70</length>
    </dimensions>
  </product>
</products>