curl.
Hand this to an AI coding agent that is adding SudoMock renders to a Python project.
Prerequisites
- Python 3.9 or newer.
- An API key from API keys, exported as
SUDOMOCK_API_KEY. Keys begin withsm_. - A PSD reachable at a public URL. Preparing a PSD covers what the file needs before you send it.
Guide
1
Install
2
Hold the key in the environment
The client sets the
x-api-key header for you. Give it the key from the
environment rather than from source, so a repository or a traceback never
carries it.SudoMock() with no argument reads SUDOMOCK_API_KEY itself, which is the
shorter form when a process already has it.3
Upload the template once
An upload parses the PSD and hands back the UUIDs you address in a render:
one for the mockup, one for each smart object inside it.
4
Render the artwork
renders.create places your image into a smart object and returns the
finished file. .url is the first rendered file, which is what a single
smart object render produces.fit decides how the artwork meets the printable area: fit keeps its
proportions inside the bounds, crop covers the area and cuts the overflow,
fill stretches it to the bounds. Fit and blend modes
shows what each one does to the result.Render in the background instead
Render in the background instead
A catalogue run does not need to hold a connection open per image. Submit the
render, keep the job id, and collect the result when it is done.Point a webhook endpoint at your service and the result
arrives without polling at all.
5
Handle the answers you will actually get
Each failure is its own exception, so a script can say something useful
instead of printing a traceback. The client already retries a rate limit and a
server error a couple of times, which means A successful render can still carry advisories on
RateLimitError reaching your code
is a signal to slow the whole run down.render.warnings, so print
them while you are building. Error codes lists every error_code
and which failures are safe to retry.Next steps
Render a product photo
The same client renders artwork onto a photograph, with no PSD involved.
Webhooks
Get called back when a background render finishes.