Dec 5, 20248 minSudoMock Team
Shopify Product Images at Scale: API Approach
Automate Shopify product image generation with mockup APIs. Bulk create variants for your entire catalog.
Running a Shopify store with hundreds of products? Learn how to automate product image generation using mockup APIs — creating professional visuals for your entire catalog in minutes.
500+
Products
Handled in one batch
<1s
Per image
Generation time
$1
Cost
Per 500 images
API
Integration
Shopify + SudoMock
The Shopify Image Problem
Every Shopify product needs multiple high-quality images. For POD stores, that means mockups showing your designs on actual products. Manual creation doesn't scale.
Multiple angles — Front, back, detail shots per product
Color variants — Same design, different product colors
Size consistency — Shopify expects uniform image dimensions
Fast updates — New designs need images immediately
Solution: API-Powered Pipeline
1
Upload Your Templates
Create mockup templates for each product type in your store. Upload them to SudoMock once.
Upload templatebash
curl -X POST "https://api.sudomock.com/api/v1/psd/upload" \
-H "X-API-KEY: YOUR_API_KEY" \
-d '{
"psd_file_url": "https://storage.com/tshirt-front.psd",
"psd_name": "T-Shirt Front View"
}'2
Generate Mockups on Product Create
Use Shopify's product webhook to trigger mockup generation whenever you add a new product.
Shopify product handlerjavascript
1// Express.js endpoint for Shopify webhook2app.post('/api/shopify/product-create', async (req, res) => {3 const product = req.body;4 5 // Get design URL from product metafield or description6 const designUrl = product.metafields?.design_url;7 8 if (!designUrl) {9 return res.status(200).send('No design URL');10 }11 12 // Generate mockups for all templates13 const templates = ['tshirt_front', 'tshirt_back', 'lifestyle'];14 const mockupUrls = [];15 16 for (const template of templates) {17 const response = await fetch('https://api.sudomock.com/api/v1/renders', {18 method: 'POST',19 headers: {20 'X-API-KEY': process.env.SUDOMOCK_API_KEY,21 'Content-Type': 'application/json'22 },23 body: JSON.stringify({24 mockup_uuid: TEMPLATE_IDS[template],25 smart_objects: [{26 uuid: SO_IDS[template],27 asset: { url: designUrl }28 }],29 export_options: {30 image_format: 'webp',31 image_size: 2048,32 quality: 9033 }34 })35 });36 37 const result = await response.json();38 mockupUrls.push(result.data.print_files[0].export_path);39 }40 41 // Add images to Shopify product42 await addImagesToProduct(product.id, mockupUrls);43 44 res.status(200).send('Mockups generated');45});3
Attach Images to Shopify
Use Shopify Admin API to attach the generated mockups to your product.
Add images to Shopifyjavascript
async function addImagesToProduct(productId, imageUrls) {
const shopify = new Shopify({
shopName: process.env.SHOPIFY_SHOP,
apiKey: process.env.SHOPIFY_API_KEY,
password: process.env.SHOPIFY_PASSWORD
});
for (const url of imageUrls) {
await shopify.productImage.create(productId, {
src: url,
position: imageUrls.indexOf(url) + 1
});
}
}Variant Images
For products with color variants, generate a mockup for each variant and use Shopify's variant image association to show the correct mockup when customers select different colors.
No-Code Alternative: Zapier
Not a developer? Use Zapier to connect Shopify and SudoMock without writing code.
Trigger — New Shopify Product
Action 1 — Webhooks by Zapier → SudoMock API
Action 2 — Shopify → Add Product Image
Batch Processing Existing Products
Have an existing catalog? Process all products at once:
Batch process catalogjavascript
const products = await shopify.product.list({ limit: 250 });
for (const product of products) {
const designUrl = getDesignUrl(product);
if (product.images.length === 0 && designUrl) {
const mockups = await generateMockups(designUrl);
await addImagesToProduct(product.id, mockups);
console.log(`Generated images for: ${product.title}`);
// Respect rate limits
await sleep(500);
}
}Result
A complete Shopify store with 500 products can have all mockup images generated in under 30 minutes — automatically.
Related Resources
Ready to Try SudoMock?
Start automating your mockups with 500 free API credits.