Product Catalog Pipeline

Parse supplier catalogs, enhance product images, and generate listing graphics — all in one automated flow.

Who this is for

Marketplace operators and e-commerce teams use this pipeline to process supplier catalogs end-to-end. Extract product data from a catalog PDF, optimize the product images, and generate listing cards with pricing — all automated in three API calls.

# Step 1: Extract catalog data from supplier PDF
curl -X POST https://api.iterationlayer.com/document-extraction/v1/extract \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "files": [
      {
        "type": "url",
        "name": "catalog.pdf",
        "url": "https://example.com/supplier-catalog.pdf"
      }
    ],
    "schema": {
      "fields": [
        { "name": "products", "type": "ARRAY", "description": "List of products in the catalog", "fields": [
          { "name": "name", "type": "TEXT", "description": "Product name" },
          { "name": "sku", "type": "TEXT", "description": "Product SKU" },
          { "name": "price", "type": "CURRENCY_AMOUNT", "description": "Product price" },
          { "name": "image_url", "type": "TEXT", "description": "URL of the product image" }
        ]}
      ]
    }
  }'

# The response JSON contains extracted product data.
# Use the first product's imageUrl for the next step.

# Step 2: Optimize the product image (resize, enhance, convert to WebP)
TRANSFORM_RESULT=$(curl -s -X POST https://api.iterationlayer.com/image-transformation/v1/transform \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "file": {
      "type": "url",
      "name": "product-photo.jpg",
      "url": "https://example.com/products/photo-001.jpg"
    },
    "operations": [
      { "type": "resize", "width_in_px": 800, "height_in_px": 800, "fit": "contain" },
      { "type": "auto_contrast" },
      { "type": "convert", "format": "webp", "quality": 85 }
    ]
  }')

OPTIMIZED_IMAGE_BASE64=$(echo "$TRANSFORM_RESULT" | jq -r '.data.buffer')

# Step 3: Generate a listing card with the optimized photo and pricing
curl -X POST https://api.iterationlayer.com/image-generation/v1/generate \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "dimensions": { "width": 800, "height": 1000 },
    "output_format": "png",
    "layers": [
      {
        "index": 0,
        "type": "solid-color-background",
        "hex_color": "#FFFFFF"
      },
      {
        "index": 1,
        "type": "static-image",
        "buffer": "<base64-encoded-optimized-product-image>",
        "position": { "x": 50.0, "y": 50.0 },
        "dimensions": { "width": 700, "height": 700 }
      },
      {
        "index": 2,
        "type": "rectangle",
        "hex_color": "#E53935",
        "position": { "x": 560.0, "y": 50.0 },
        "dimensions": { "width": 190, "height": 60 }
      },
      {
        "index": 3,
        "type": "text",
        "text": "$29.99",
        "font_name": "Roboto",
        "font_size_in_px": 32,
        "text_color": "#FFFFFF",
        "font_weight": "Bold",
        "text_align": "center",
        "position": { "x": 560.0, "y": 55.0 },
        "dimensions": { "width": 190, "height": 50 }
      },
      {
        "index": 4,
        "type": "text",
        "text": "Ergonomic Wireless Mouse",
        "font_name": "Inter",
        "font_size_in_px": 28,
        "text_color": "#1a1a1a",
        "font_weight": "Bold",
        "text_align": "center",
        "position": { "x": 50.0, "y": 800.0 },
        "dimensions": { "width": 700, "height": 50 }
      }
    ]
  }'
import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });

// Step 1: Extract catalog data from supplier PDF
const catalogResult = await client.extract({
  files: [
    {
      type: "url",
      name: "catalog.pdf",
      url: "https://example.com/supplier-catalog.pdf",
    },
  ],
  schema: {
    fields: [
      { name: "products", type: "ARRAY", description: "List of products in the catalog", fields: [
        { name: "name", type: "TEXT", description: "Product name" },
        { name: "sku", type: "TEXT", description: "Product SKU" },
        { name: "price", type: "CURRENCY_AMOUNT", description: "Product price" },
        { name: "image_url", type: "TEXT", description: "URL of the product image" },
      ]},
    ],
  },
});

const firstProduct = catalogResult.results[0].products[0];

// Step 2: Optimize the product image (resize, enhance, convert to WebP)
const transformResult = await client.transform({
  file: {
    type: "url",
    name: "product-photo.jpg",
    url: firstProduct.image_url,
  },
  operations: [
    { type: "resize", width_in_px: 800, height_in_px: 800, fit: "contain" },
    { type: "auto_contrast" },
    { type: "convert", format: "webp", quality: 85 },
  ],
});

const optimizedImageBase64 = transformResult.data.buffer;

// Step 3: Generate a listing card with the optimized photo and pricing
const cardResult = await client.generateImage({
  dimensions: { width_in_px: 800, height_in_px: 1000 },
  output_format: "png",
  layers: [
    {
      index: 0,
      type: "solid-color-background",
      hex_color: "#FFFFFF",
    },
    {
      index: 1,
      type: "static-image",
      buffer: optimizedImageBase64,
      position: { x_in_px: 50, y_in_px: 50 },
      dimensions: { width_in_px: 700, height_in_px: 700 },
    },
    {
      index: 2,
      type: "rectangle",
      hex_color: "#E53935",
      position: { x_in_px: 560, y_in_px: 50 },
      dimensions: { width_in_px: 190, height_in_px: 60 },
    },
    {
      index: 3,
      type: "text",
      text: `${firstProduct.price}`,
      font_name: "Roboto",
      font_size_in_px: 32,
      text_color: "#FFFFFF",
      font_weight: "Bold",
      text_align: "center",
      position: { x_in_px: 560, y_in_px: 55 },
      dimensions: { width_in_px: 190, height_in_px: 50 },
    },
    {
      index: 4,
      type: "text",
      text: firstProduct.name,
      font_name: "Inter",
      font_size_in_px: 28,
      text_color: "#1a1a1a",
      font_weight: "Bold",
      text_align: "center",
      position: { x_in_px: 50, y_in_px: 800 },
      dimensions: { width_in_px: 700, height_in_px: 50 },
    },
  ],
});

const listingCardBuffer = Buffer.from(cardResult.data.buffer, "base64");
import base64

from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")

# Step 1: Extract catalog data from supplier PDF
catalog_result = client.extract(
    files=[
        {
            "type": "url",
            "name": "catalog.pdf",
            "url": "https://example.com/supplier-catalog.pdf",
        }
    ],
    schema={
        "fields": [
            {"name": "products", "type": "ARRAY", "description": "List of products in the catalog", "fields": [
                {"name": "name", "type": "TEXT", "description": "Product name"},
                {"name": "sku", "type": "TEXT", "description": "Product SKU"},
                {"name": "price", "type": "CURRENCY_AMOUNT", "description": "Product price"},
                {"name": "image_url", "type": "TEXT", "description": "URL of the product image"},
            ]},
        ]
    },
)

first_product = catalog_result["results"][0]["products"][0]

# Step 2: Optimize the product image (resize, enhance, convert to WebP)
transform_result = client.transform(
    file={
        "type": "url",
        "name": "product-photo.jpg",
        "url": first_product["image_url"],
    },
    operations=[
        {"type": "resize", "width_in_px": 800, "height_in_px": 800, "fit": "contain"},
        {"type": "auto_contrast"},
        {"type": "convert", "format": "webp", "quality": 85},
    ],
)

optimized_image_base64 = transform_result["data"]["buffer"]

# Step 3: Generate a listing card with the optimized photo and pricing
card_result = client.generate_image(
    dimensions={"width_in_px": 800, "height_in_px": 1000},
    output_format="png",
    layers=[
        {
            "index": 0,
            "type": "solid-color-background",
            "hex_color": "#FFFFFF",
        },
        {
            "index": 1,
            "type": "static-image",
            "buffer": optimized_image_base64,
            "position": {"x_in_px": 50, "y_in_px": 50},
            "dimensions": {"width_in_px": 700, "height_in_px": 700},
        },
        {
            "index": 2,
            "type": "rectangle",
            "hex_color": "#E53935",
            "position": {"x_in_px": 560, "y_in_px": 50},
            "dimensions": {"width_in_px": 190, "height_in_px": 60},
        },
        {
            "index": 3,
            "type": "text",
            "text": str(first_product["price"]),
            "font_name": "Roboto",
            "font_size_in_px": 32,
            "text_color": "#FFFFFF",
            "font_weight": "Bold",
            "text_align": "center",
            "position": {"x_in_px": 560, "y_in_px": 55},
            "dimensions": {"width_in_px": 190, "height_in_px": 50},
        },
        {
            "index": 4,
            "type": "text",
            "text": first_product["name"],
            "font_name": "Inter",
            "font_size_in_px": 28,
            "text_color": "#1a1a1a",
            "font_weight": "Bold",
            "text_align": "center",
            "position": {"x_in_px": 50, "y_in_px": 800},
            "dimensions": {"width_in_px": 700, "height_in_px": 50},
        },
    ],
)

with open("listing-card.png", "wb") as f:
    f.write(base64.b64decode(card_result["data"]["buffer"]))
package main

import il "github.com/iterationlayer/sdk-go"

client := il.NewClient("YOUR_API_KEY")

// Step 1: Extract catalog data from supplier PDF
catalogResult, err := client.Extract(il.ExtractRequest{
    Files: []il.FileInput{
        il.NewFileFromURL("catalog.pdf", "https://example.com/supplier-catalog.pdf"),
    },
    Schema: il.ExtractionSchema{
        "products": il.NewArrayFieldConfig("products", "List of products in the catalog", []il.FieldConfig{
            il.NewTextFieldConfig("name", "Product name"),
            il.NewTextFieldConfig("sku", "Product SKU"),
            il.NewCurrencyAmountFieldConfig("price", "Product price"),
            il.NewTextFieldConfig("image_url", "URL of the product image"),
        }),
    },
})

// Step 2: Optimize the product image (resize, enhance, convert to WebP)
transformResult, err := client.Transform(il.TransformRequest{
    File: il.NewFileFromURL("product-photo.jpg", "https://example.com/products/photo-001.jpg"),
    Operations: []il.TransformOperation{
        il.NewResizeOperation(800, 800, "contain"),
        {Type: "auto_contrast"},
        il.NewConvertOperation("webp"),
    },
})

// Step 3: Generate a listing card with the optimized photo and pricing
cardResult, err := client.GenerateImage(il.GenerateImageRequest{
    Dimensions:   il.Dimensions{WidthInPx: 800, HeightInPx: 1000},
    OutputFormat: "png",
    Layers: []il.Layer{
        il.NewSolidColorBackgroundLayer(0, "#FFFFFF"),
        il.NewStaticImageLayer(1, il.FileInput{Buffer: transformResult.Data.Buffer},
            il.Position{XInPx: 50, YInPx: 50},
            il.Dimensions{WidthInPx: 700, HeightInPx: 700}),
        il.NewRectangleLayer(2, "#E53935",
            il.Position{XInPx: 560, YInPx: 50},
            il.Dimensions{WidthInPx: 190, HeightInPx: 60}),
        il.NewTextLayer(3, "$29.99", "Roboto", 32, "#FFFFFF",
            il.Position{XInPx: 560, YInPx: 55},
            il.Dimensions{WidthInPx: 190, HeightInPx: 50}),
        il.NewTextLayer(4, "Ergonomic Wireless Mouse", "Inter", 28, "#1a1a1a",
            il.Position{XInPx: 50, YInPx: 800},
            il.Dimensions{WidthInPx: 700, HeightInPx: 50}),
    },
})

Related Recipes

Start building in minutes

Free trial credits included. No credit card required.