Skip to main content
This page turns one Flask route into a mockup renderer. You upload a PSD template once, and every request to that route places new artwork on it and answers with the URL of the finished image.

Hand this to your coding agent before it writes a SudoMock call.

Open in Cursor

Prerequisites

Before you start, you will need:
  • An API key, beginning with sm_
  • A PSD with at least one smart object, prepared for rendering
  • Python 3.9 or newer, and Flask 2.2 or newer with room for one more route

Guide

1

Install

Add the official Python SDK to your project.
Put the key in the environment your app runs in.
2

Upload the mockup once

A template is parsed once and rendered forever, so this belongs in your setup rather than in the route. Run it as a one-off script and keep the two UUIDs it prints.
upload.py
The mockup UUID and the smart object UUID are the two values the route needs. Put them in the environment beside the key.
3

Render from a route

The route takes an artwork URL, places it on the stored template and answers with the rendered image. fit decides how the artwork meets the smart object area, and each value gives a different result.
app.py
One error handler covers every rejection the API answers with, because each one reaches your code as a SudoMockError carrying the status and the error code behind it.
4

Run it

Start the app and post an artwork URL to the route.
render.url is the first rendered file. A mockup that fills several smart objects returns one entry per object on render.print_files.

Next steps

Errors

What a failed render answers, and which failures are worth retrying.

Webhooks

Let a long render call your app back instead of holding the request open.