Skip to main content
This page puts a render behind one of your own routes. A caller posts a mockup id and an artwork URL, your FastAPI service calls SudoMock, and the answer is the URL of a finished image.

Hand this to a coding agent before it wires SudoMock into a FastAPI service.

Open in Cursor

Prerequisites

  • An API key. Issue one on the API keys page and copy it while it is on screen.
  • Python 3.9 or newer, which is the floor the client library supports.
  • One call already made by hand. The quickstart walks the two requests this page wraps in routes.

Guide

1

Install the client

The client reads SUDOMOCK_API_KEY from the environment when you pass no key, so local runs and deployed ones can share the same code.
2

Upload a template once

An upload registers a Photoshop file and reads back the UUID of every slot you can address later. Run it once per template, from a script rather than from a route.
scripts/upload_template.py
Store the two ids it prints next to the product they belong to. A render needs nothing else from the file.
3

Render from a route

One client serves the whole process. Build it in the lifespan, reach it through a dependency, and let pydantic reject a bad body before a credit is spent.
app/main.py
SudoMockError carries status_code, error_code and message, so one handler can answer a caller properly and still leave the code readable. Errors lists what each code means and which ones are worth retrying.
Use the async client inside async def. The blocking client holds the event loop for the length of a render, which stalls every other request the same worker is serving.
4

Hand a long render to the queue

A large export can outlive the patience of an HTTP client. Send it with is_async=True, answer 202 with the job id, and let the caller come back for the result.
app/main.py
Polling is the simple half. A webhook is the half that scales, because the finished render reaches your service on its own instead of being asked for.

Next steps

Render reference

Every field a render body accepts, with a live request panel.

Webhooks

Get called back when a queued render finishes.

Fit and blend modes

What fit does to artwork that is not the shape of the slot.