SudoMock
Mockups
DocsPricing
Request a demo
Get Started

Start rendering mockups in minutes

From PSD to product mockup in one API call.

Get Free API Key→Browse Templates
Public status pagePublished API pricingProduct mockup API500 one-time API credits

Site Navigation

SudoMock

Turn reusable PSD templates, artwork, and editable text into production-ready product images through REST API, no-code workflows, native storefront apps, or AI.

SudoMock is a registered DBA
1209 Mountain Rd Pl NE, Ste N
Albuquerque, NM 87110, USA

Product

  • Pricing
  • Dashboard
  • Playground
  • Changelog
  • Start Free

Developers

  • API Overview
  • MCP Server
  • Quick Start
  • Render API
  • Upload PSD API
  • Authentication
  • Error Handling
  • PSD Preparation
  • Integrations

Mockups & Tools

  • All Mockups
  • Apparel Mockups
  • Drinkware Mockups
  • Wall Art Mockups
  • Home & Living
  • By Platform
  • Search Mockups
  • Background Remover
  • Free Tools

Resources

  • All Use Cases
  • T-Shirt Mockup Generator for Print on Demand
  • Tote Bag Mockup Generator for Sustainable Brands
  • Automate Mug at Scale with SudoMock
  • Blog
  • Roadmap
  • All Alternatives
  • vs Placeit
  • vs DynamicMockups
  • vs Adobe Photoshop API
  • vs Static Mockup Generators

Company

  • About
  • Contact
  • Brand Assets
  • System Status (opens in new tab)
  • Feature Requests (opens in new tab)
Blog

Latest Articles

View all →
  • 01Renderforest API Pricing 2026: Templates vs Your PSD
  • 02Printful Mockup Generator API: Fidelity, Limits, Cost
  • 03Printify Mockup API vs Your Own Brand PSD (2026)
  • 04Mediamodifier API Pricing 2026: Per-Render Cost Compared

© 2026 SudoMock. All rights reserved.

PrivacyTermsRefundsCookies[email protected]
Back to Blog
TechnicalDec 5, 20254 min readSudoMock Team

Understanding Mockup API Data Models: A Technical Guide

Deep dive into mockup API response structures. Learn how smart object data is organized, what each field means, and how to build robust integrations.

API data model structure diagram for mockup responses

TL;DR

Understand the API response structure: uuid for identification, size for design resolution, position for canvas placement, and quad for transformed corners. Build robust integrations by understanding these data models.

Key Takeaways:

  • •size = embedded Smart Object dimensions (design at this resolution)
  • •position = where it renders on the mockup canvas
  • •quad = corner coordinates for warped/transformed objects
  • •uuid = unique identifier for API calls

Understanding how mockup APIs structure their data is crucial for building robust integrations. This guide covers the de-facto standard data model used across the industry, what each field means, and how to use them effectively in your code.

size vs position - Visual Explanation
size
3951 x 4800
Your design canvas
4800px
3951px
Design Resolution
Upload assets at this size
→
scales to
position
507 x 620
x: 771, y: 886
Mockup Canvas
Rendered Position
Where it appears on mockup
size = Original design dimensions
position = Rendered bounds on canvas

The De-Facto Standard: Rect + Transform

Every major design tool and mockup API uses the same fundamental data model: a rectangle with position coordinates and optional transforms. This pattern comes from decades of graphics programming, from Photoshop to Canvas2D to WebGL.

x, y
Position
Top-left corner coordinates
w, h
Size
Width and height dimensions
deg
Rotation
Optional rotation angle
quad
Transform
4-point perspective

This model is universal because it's deterministic, minimal, and fast. Whether you're working with Photoshop layers, Figma frames, or mockup APIs, the core concept remains the same: define a bounding box and optionally transform it.


Anatomy of a Smart Object Response

When you upload a PSD to SudoMock, each smart object layer returns detailed metadata. Let's break down what each field means and how to use it:

Smart Object Response Structure
json
1{
2 "uuid": "73957ff7-82c4-4c14-947a-a6f841944d1c",
3 "name": "print_area",
4 "size": {
5 "width": 3951,
6 "height": 4800
7 },
8 "position": {
9 "x": 771,
10 "y": 886,
11 "width": 507,
12 "height": 620
13 },
14 "quad": [
15 [771, 886],
16 [1278, 886],
17 [1278, 1506],
18 [771, 1506]
19 ],
20 "blend_mode": "BlendMode.NORMAL",
21 "layer_name": "print_area"
22}

Understanding Each Field

size (width, height) - The original dimensions of the embedded smart object content. This is your design canvas size - upload assets at this resolution for best quality. The render API works in these coordinates.
position.x, position.y - Top-left corner placement coordinates on the mockup canvas. Useful for client-side canvas preview overlays.
position.width, position.height - Display dimensions after transforms. Primary use: drawing design previews on thumbnail images in browser. Not used in render API requests.
quad (4 points) - Pre-calculated corner coordinates for perspective rendering. Useful for canvas-based rendering or custom transform implementations.
blend_mode - How this layer blends with layers below. Important for color overlays (multiply) or special effects (screen, overlay).

size vs position: The Key Distinction

The most important concept to understand is the difference between size and position. They represent two different things:

FieldRepresentsUse Case
size.widthEmbedded content width (3951px)Render API coordinates, design canvas
size.heightEmbedded content height (4800px)Render API coordinates, design canvas
position.xLeft edge on mockup (771px)Client-side canvas preview
position.yTop edge on mockup (886px)Client-side canvas preview
position.widthDisplay width (507px)Thumbnail overlay drawing
position.heightDisplay height (620px)Thumbnail overlay drawing

Think of it this way

size = "Upload your design at this resolution, send coordinates in render API"
position = "Use this for drawing previews on thumbnail images in browser"

In the example above, a 3951x4800 design gets scaled down to 507x620 when rendered on the mockup canvas. The scale factor is approximately 0.128x (507/3951).


Working with Quad Coordinates

The quad array contains four [x, y] coordinate pairs representing the corners of the smart object's bounding box. This is especially useful for:

Canvas rendering - Draw directly using canvas 2D context with precise coordinates
Perspective transforms - Handle non-rectangular smart objects (skewed, rotated)
Hit testing - Determine if a point is inside the smart object area
Custom overlays - Position UI elements or annotations accurately
Using quad coordinates in JavaScript
javascript
1// Draw smart object bounds on canvas
2function drawSmartObjectBounds(ctx, smartObject) {
3 const [topLeft, topRight, bottomRight, bottomLeft] = smartObject.quad;
4
5 ctx.beginPath();
6 ctx.moveTo(topLeft[0], topLeft[1]);
7 ctx.lineTo(topRight[0], topRight[1]);
8 ctx.lineTo(bottomRight[0], bottomRight[1]);
9 ctx.lineTo(bottomLeft[0], bottomLeft[1]);
10 ctx.closePath();
11 ctx.strokeStyle = '#00ff00';
12 ctx.stroke();
13}
14
15// Check if a point is inside the smart object
16function isPointInQuad(point, quad) {
17 const [tl, tr, br, bl] = quad;
18 // Simple bounding box check (for rectangular quads)
19 return point.x >= tl[0] && point.x <= tr[0] &&
20 point.y >= tl[1] && point.y <= bl[1];
21}

Integration Patterns

Integration Flow
📤
Upload PSD
/psd/upload
→
📋
Get Metadata
size, position, quad
→
🎨
Render
/renders
→
🖼️
Result
WebP/PNG URL

Pattern 1: Basic Render Request

The most common pattern is uploading a PSD, storing the smart object metadata, then using it to render variations:

Complete integration flow
javascript
1// Step 1: Upload PSD and store metadata
2const uploadResponse = await fetch('https://api.sudomock.com/api/v1/psd/upload', {
3 method: 'POST',
4 headers: {
5 'X-API-KEY': API_KEY,
6 'Content-Type': 'application/json'
7 },
8 body: JSON.stringify({
9 psd_file_url: 'https://storage.example.com/tshirt-mockup.psd',
10 psd_name: 'T-Shirt Front'
11 })
12});
13
14const { data: mockup } = await uploadResponse.json();
15
16// Store the mockup metadata for later use
17const mockupId = mockup.uuid;
18const smartObjects = mockup.smart_objects;
19
20// Find the main design area
21const designArea = smartObjects.find(so => so.name === 'print_area');
22console.log('Design canvas size:', designArea.size); // { width: 3951, height: 4800 }
23console.log('Rendered position:', designArea.position); // { x: 771, y: 886, width: 507, height: 620 }
24
25// Step 2: Render with a design
26const renderResponse = await fetch('https://api.sudomock.com/api/v1/renders', {
27 method: 'POST',
28 headers: {
29 'X-API-KEY': API_KEY,
30 'Content-Type': 'application/json'
31 },
32 body: JSON.stringify({
33 mockup_uuid: mockupId,
34 smart_objects: [{
35 uuid: designArea.uuid,
36 asset: {
37 url: 'https://storage.example.com/my-design.png',
38 fit: 'cover' // cover, contain, or fill
39 }
40 }],
41 export_options: {
42 image_format: 'webp',
43 image_size: 1920,
44 quality: 95
45 }
46 })
47});
48
49const { data: render } = await renderResponse.json();
50console.log('Rendered mockup:', render.print_files[0].export_path);

Pattern 2: Using Position Data for Custom Rendering

If you're building a custom preview or need to render locally, the position data tells you exactly where to place the design:

Custom canvas preview
javascript
1async function createPreview(mockupImage, designImage, smartObject) {
2 const canvas = document.createElement('canvas');
3 const ctx = canvas.getContext('2d');
4
5 // Set canvas to mockup dimensions
6 canvas.width = mockupImage.width;
7 canvas.height = mockupImage.height;
8
9 // Draw the mockup background
10 ctx.drawImage(mockupImage, 0, 0);
11
12 // Get position data from API response
13 const { x, y, width, height } = smartObject.position;
14
15 // Draw the design at the correct position and size
16 ctx.drawImage(designImage, x, y, width, height);
17
18 return canvas.toDataURL('image/png');
19}
20
21// Usage
22const preview = await createPreview(
23 await loadImage(mockupThumbnail),
24 await loadImage(myDesign),
25 designArea
26);

Design Resolution

For best quality, prepare your design at the size dimensions (e.g., 3951x4800), not the position dimensions. The API handles scaling automatically.


Working with Blend Modes

The blend_mode field indicates how the smart object layer blends with layers below it in the PSD. Common modes include:

Blend ModeEffectCommon Use
NORMALStandard opacity blendingRegular design placement
MULTIPLYDarkens, whites become transparentColor overlays, fabric textures
SCREENLightens, blacks become transparentLight effects, glows
OVERLAYCombines multiply and screenContrast enhancement

For color smart objects (used to change product colors), MULTIPLY is typically used so the design texture shows through the color overlay — common in drinkware mockups and apparel templates.


Next.js Integration Examples

Here are practical examples for integrating SudoMock into your Next.js application. You can use any template from SudoMock's mockup library as a starting point. These examples show how to use the smart object metadata in real frontend code.

SudoMock Client Utility

First, create a reusable client for making API calls to SudoMock:

lib/sudomock.ts
typescript
1// SudoMock API Client for Next.js
2// Store your API key in .env.local as SUDOMOCK_API_KEY
3
4const API_KEY = process.env.SUDOMOCK_API_KEY!
5const BASE_URL = 'https://api.sudomock.com/api/v1'
6
7export interface SmartObject {
8 uuid: string
9 name: string
10 size: { width: number; height: number }
11 position: { x: number; y: number; width: number; height: number }
12 quad: [number, number][]
13 blend_mode: string
14}
15
16export interface MockupData {
17 uuid: string
18 name: string
19 thumbnail: string
20 width?: number // Original PSD width
21 height?: number // Original PSD height
22 smart_objects: SmartObject[]
23}
24
25// Upload a PSD and get smart object metadata
26export async function uploadPsd(psdUrl: string, name: string): Promise<MockupData> {
27 const response = await fetch(`\${BASE_URL}/psd/upload`, {
28 method: 'POST',
29 headers: {
30 'X-API-KEY': API_KEY,
31 'Content-Type': 'application/json',
32 },
33 body: JSON.stringify({
34 psd_file_url: psdUrl,
35 psd_name: name,
36 }),
37 })
38
39 const data = await response.json()
40 if (!data.success) throw new Error(data.detail)
41 return data.data
42}
43
44// Render a mockup with a design
45export async function renderMockup(
46 mockupId: string,
47 smartObjectId: string,
48 designUrl: string
49): Promise<string> {
50 const response = await fetch(`\${BASE_URL}/renders`, {
51 method: 'POST',
52 headers: {
53 'X-API-KEY': API_KEY,
54 'Content-Type': 'application/json',
55 },
56 body: JSON.stringify({
57 mockup_uuid: mockupId,
58 smart_objects: [{
59 uuid: smartObjectId,
60 asset: { url: designUrl, fit: 'cover' }
61 }],
62 export_options: {
63 image_format: 'webp',
64 image_size: 1920,
65 quality: 95
66 }
67 }),
68 })
69
70 const data = await response.json()
71 if (!data.success) throw new Error(data.detail)
72 return data.data.print_files[0].export_path
73}

React Hook for Managing Mockups

A custom hook that manages mockup state and provides useful computed values from the smart object metadata:

hooks/useMockupEditor.ts
typescript
1export function useMockupEditor(initialMockup?: MockupData) {
2 const [mockup, setMockup] = useState<MockupData | null>(initialMockup ?? null)
3 const [selectedDesign, setSelectedDesign] = useState<string | null>(null)
4
5 // Find the main print area smart object
6 const printArea = useMemo(() => {
7 return mockup?.smart_objects.find(
8 so => so.name.toLowerCase().includes('print') ||
9 so.name.toLowerCase().includes('design')
10 )
11 }, [mockup])
12
13 // Calculate design requirements from size field
14 const designRequirements = useMemo(() => {
15 if (!printArea) return null
16
17 const { width, height } = printArea.size
18 return {
19 width,
20 height,
21 aspectRatio: width / height,
22 megapixels: (width * height) / 1000000,
23 recommendation: width >= 3000
24 ? 'High resolution - perfect for print'
25 : 'Medium resolution - good for web'
26 }
27 }, [printArea])
28
29 // Get render position info from position field
30 const renderPosition = useMemo(() => {
31 if (!printArea) return null
32
33 const { x, y, width, height } = printArea.position
34 const originalSize = printArea.size
35
36 return {
37 x,
38 y,
39 width,
40 height,
41 scaleFactor: width / originalSize.width,
42 // Useful for canvas preview
43 bounds: { left: x, top: y, right: x + width, bottom: y + height }
44 }
45 }, [printArea])
46
47 return {
48 mockup,
49 setMockup,
50 printArea,
51 designRequirements,
52 renderPosition,
53 selectedDesign,
54 setSelectedDesign,
55 }
56}

Live Preview with Canvas

Use the position data to create a real-time preview before rendering:

components/MockupPreview.tsx
typescript
1interface PreviewProps {
2 mockupThumbnailUrl: string
3 designImageUrl: string | null
4 // From smart_object.position in API response
5 position: { x: number; y: number; width: number; height: number }
6}
7
8export function MockupPreview({ mockupThumbnailUrl, designImageUrl, position }: PreviewProps) {
9 const canvasRef = useRef<HTMLCanvasElement>(null)
10 const [previewDataUrl, setPreviewDataUrl] = useState<string | null>(null)
11
12 useEffect(() => {
13 if (!designImageUrl || !canvasRef.current) return
14
15 const canvas = canvasRef.current
16 const ctx = canvas.getContext('2d')
17 if (!ctx) return
18
19 // Load both images
20 const mockupImg = new Image()
21 const designImg = new Image()
22 mockupImg.crossOrigin = 'anonymous'
23 designImg.crossOrigin = 'anonymous'
24
25 Promise.all([
26 new Promise<void>(resolve => { mockupImg.onload = () => resolve(); mockupImg.src = mockupThumbnailUrl }),
27 new Promise<void>(resolve => { designImg.onload = () => resolve(); designImg.src = designImageUrl }),
28 ]).then(() => {
29 // Set canvas to mockup size
30 canvas.width = mockupImg.width
31 canvas.height = mockupImg.height
32
33 // Draw mockup background
34 ctx.drawImage(mockupImg, 0, 0)
35
36 // Draw design at the exact position from API
37 // The position object tells us exactly where to place it!
38 ctx.drawImage(
39 designImg,
40 position.x, // x coordinate from API
41 position.y, // y coordinate from API
42 position.width, // rendered width from API
43 position.height // rendered height from API
44 )
45
46 setPreviewDataUrl(canvas.toDataURL('image/png'))
47 })
48 }, [mockupThumbnailUrl, designImageUrl, position])
49
50 return (
51 <div className="relative aspect-square bg-slate-800 rounded-lg overflow-hidden">
52 <canvas ref={canvasRef} className="hidden" />
53 {previewDataUrl && (
54 <img src={previewDataUrl} alt="Preview" className="w-full h-full object-contain" />
55 )}
56 </div>
57 )
58}

Server Action for Batch Rendering

Process multiple designs in parallel using Next.js Server Actions:

actions/batch-render.ts
typescript
1'use server'
2
3interface BatchResult {
4 designUrl: string
5 renderUrl: string | null
6 success: boolean
7 error?: string
8}
9
10export async function batchRenderMockups(
11 mockupId: string,
12 smartObjectId: string,
13 designUrls: string[]
14): Promise<BatchResult[]> {
15 // Process 5 at a time to respect rate limits
16 const CONCURRENCY = 5
17 const results: BatchResult[] = []
18
19 for (let i = 0; i < designUrls.length; i += CONCURRENCY) {
20 const batch = designUrls.slice(i, i + CONCURRENCY)
21
22 const batchResults = await Promise.all(
23 batch.map(async (designUrl): Promise<BatchResult> => {
24 try {
25 const renderUrl = await renderMockup(mockupId, smartObjectId, designUrl)
26 return { designUrl, renderUrl, success: true }
27 } catch (error) {
28 return {
29 designUrl,
30 renderUrl: null,
31 success: false,
32 error: error instanceof Error ? error.message : 'Unknown error'
33 }
34 }
35 })
36 )
37
38 results.push(...batchResults)
39 }
40
41 return results
42}

Environment Variables

Store your SudoMock API key in .env.local as SUDOMOCK_API_KEY. Never expose it in client-side code - always call SudoMock from Server Components, Server Actions, or API routes.


Key Takeaways

size is your design canvas AND API coordinates - Prepare designs at size dimensions. Send size/position values in render API requests. Backend handles embedded→display scaling automatically.
position is for client-side preview only - Use position.x/y/width/height when drawing design overlays on thumbnail images in browser. Not needed for API render requests.
quad enables advanced transforms - For perspective mockups or canvas-based rendering, quad coordinates give you precise control.
blend_mode matters for colors - Understanding blend modes helps you work with color-changing smart objects correctly.

Related Resources

Upload PSD API Reference

Complete documentation for the upload endpoint

Render API Reference

All render options and parameters

Smart Objects Guide

Best practices for preparing PSD templates

API Best Practices

Error handling and parallel processing

Frequently Asked Questions

SudoMock Team
SudoMock Team
View profile →

Related Articles

SudoMock Now Works with Claude, Cursor, ChatGPT, and Any MCP-Compatible AI Tool
Technical5 min read

SudoMock Now Works with Claude, Cursor, ChatGPT, and Any MCP-Compatible AI Tool

Render product mockups directly from any AI assistant that supports MCP. Claude, Cursor, VS Code, ChatGPT, Windsurf, and more.

Mar 23, 2026Read
API integration best practices code example
Technical2 min read

API Integration Best Practices

Build robust API integrations. Implement parallel processing, retry logic, and error handling.

Nov 5, 2025Read

Explore by Use Case

See SudoMock in action for your specific product category

Bulk Mockup Generation API for Enterprise ScalePrint on Demand Mockup Automation for POD SellersAutomate Shopify Product Mockups at ScaleT-Shirt Mockup Generator API for Print on DemandHoodie Mockup Generator APIAutomate Mug Mockups at Scale with SudoMock API

Your own PSD, rendered via API

Render your own PSD through the API. Start with 500 one-time credits, no card.

Start Free View Docs

Render your own PSD via API with 500 one-time credits.

Start Free · 500 credits, no card