> ## Documentation Index
> Fetch the complete documentation index at: https://sudomock.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The base URL is https://api.sudomock.com.
> Authenticate every request with the x-api-key header. Keys begin with sm_.
> A render returns the finished image at data.print_files[0].export_path. A request sent with is_async true returns a job_id to poll at GET /api/v1/jobs/{job_id}.
> Prefer the official SDKs over hand-written HTTP calls: npm install sudomock for Node, pip install sudomock for Python.

# Render mockups with Zapier and SudoMock

> Call the SudoMock render API from Webhooks by Zapier.

[Zapier](https://zapier.com) links the apps your store already runs on. The
**Webhooks by Zapier** action calls the SudoMock render endpoint directly, so
any trigger Zapier offers can produce a finished product image. There is
nothing to install.

## Before you start

* An API key from your [dashboard](https://sudomock.com/dashboard/api-keys).
* A template. [Upload a PSD](/docs/psd-mockups/upload-a-psd) if you do not have one.
* Artwork at a URL that loads without signing in, because SudoMock fetches it.

Two ids go into every render: the mockup uuid, and the uuid of the layer you
fill. Both arrive together from
[List PSD mockups](/docs/api-reference/psd-mockups/retrieve-a-list-of-psd-mockups),
where each entry carries its own `uuid` and a `smart_objects` array holding the
`uuid` of every layer you can fill. That page has the call ready to copy in
eight languages. Read the pair once and keep it.

## Guide

<Steps>
  <Step title="Pick a trigger">
    Create a Zap and choose the app that holds the design: a new store order, a
    new spreadsheet row, a new database record.
  </Step>

  <Step title="Add Webhooks by Zapier">
    Choose **Webhooks by Zapier** as the action and the **Custom Request**
    event. Set the method to `POST` and the URL to
    `https://api.sudomock.com/api/v1/renders`.
  </Step>

  <Step title="Add the headers">
    Enter two headers. The first is named `x-api-key` and holds your key. The
    second is named `Content-Type` and holds `application/json`.
  </Step>

  <Step title="Write the body">
    Paste the body into **Data**, then replace the artwork URL with the field
    from your trigger using Zapier's field picker. Keep the surrounding quotes.

    ```json theme={"theme":{"light":"github-light","dark":"vesper"}}
    {
      "mockup_uuid": "YOUR_MOCKUP_UUID",
      "smart_objects": [
        {
          "uuid": "YOUR_SMART_OBJECT_UUID",
          "asset": {
            "url": "https://example.com/artwork.png",
            "fit": "crop"
          }
        }
      ],
      "export_options": {
        "image_format": "webp",
        "image_size": 1920
      }
    }
    ```

    <Warning>
      A Custom Request sends **Data** as the raw body, so it has to be valid
      JSON. Do not also fill the query string fields, and do not turn on data
      pass through.
    </Warning>
  </Step>

  <Step title="Test it">
    Run the test. Zapier shows the response body, and the finished image URL
    sits at `data.print_files[0].export_path`. Add whatever action should
    receive it: write it back to the row, attach it to the order, send it to
    the customer.
  </Step>
</Steps>

## What comes back

The finished image URL arrives at `data.print_files[0].export_path`, and the
whole response, field by field, is on
[Render a PSD mockup](/docs/api-reference/psd-mockups/render-a-psd-mockup).

Zapier usually exposes `data print_files 0 export_path` in the field picker of
the next step. When it does not, add a **Code by Zapier** step that parses
`inputData.response` and returns that one string as a named field.

## An example Zap

1. **Shopify** fires on a new order that carries a custom design.
2. **Filter by Zapier** stops the run when the order has no design URL.
3. **Webhooks by Zapier** renders the mockup.
4. **Gmail** sends the finished image to the customer for approval.

The same shape works from a form, a spreadsheet, or a database. Swap the first
and last steps and the middle stays identical.

## When a render fails

A `401` means the `x-api-key` header is missing or incomplete. A `422` names the
field it rejected, and is almost always an empty trigger field arriving as an
empty string. A download failure means the design URL asks for a login. Every
status is listed in [Errors](/docs/errors).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.