Skip to main content

Use this pre-built prompt to get an agent writing SudoMock HTTP calls correctly.

Open in Cursor

Prerequisites

Before you start, you’ll need:

Guide

1

Set your API key

The Http client ships with the framework, so there is nothing to install. Put the key in the environment and read it through a config entry. The two UUIDs stay empty until the next step fills them.
One macro gives every call the same base URL, header and timeout.
app/Providers/AppServiceProvider.php
Read the key with config() rather than env(). Once the config is cached in production, env() answers null and every request comes back 401.
2

Upload the template once

The upload returns every layer you can address later, each with its own UUID. An Artisan command keeps that out of the request path.
app/Console/Commands/ImportMockup.php
Copy the mockup UUID and the UUID of the smart object you want to fill into .env. A template is uploaded once and rendered as often as you like.
3

Render from a route

The route takes an artwork URL and answers with the finished image. On Laravel 11 and newer, php artisan install:api creates routes/api.php if the application does not have one yet.
routes/api.php
app/Http/Controllers/RenderMockupController.php

Examples

Create a mockup from a PSD

Every field of the upload call

Render a PSD mockup

Every field of the render call

Retrieve a single job

Collect an async render

Create a webhook endpoint

Get called back instead of polling

Fit and blend modes

How artwork meets a print area

Errors

Every code, and which ones are worth retrying