[Alpha] Templating mode
Warning: Templating mode is available as an alpha feature.
This means that the feature (or parts of it) might be deprecated with two week warning.
Templating Mode enables the scalable generation of personalized and visually consistent images by connecting predefined design templates with dynamic content.
By creating a reusable image layout (a template) in the Photoroom editor and assigning unique identifiers to each customizable layer, developers can programmatically inject content—like text, product images, or branding elements—through API calls.
This approach is ideal for automating image creation for use cases such as product listings, ads, social media creatives, and more.
Step 1: Create your template
Start a design from an image or from a Photoroom template. For example, open or upload an image in the Design tab.
Turn the design into a template to access the templating features (click on the ellipsis
...
button in the top menu bar, then on theTurn into template
option).You can now add your image and text layers.
On any text (or image) layer you can toggle on the
Replaceable Text
toggle (respectively theReplaceable Subject
toggle). You can then edit theUnique ID
field to give each of your layer a clear name.Make the template public to enable the API to access it: select
Public link
from the sharing settings. This means the template is public only to the people who know about this specific template ID. It enables the API to have access to your template.Click on the
Preview
tab, and click on the template ID at the bottom of this tab. This copies the template ID in your clipboard.
Step 2: Create images through the API
The key is to keep track of the Unique ID
s defined in your template for each layer, as they will be reused in your API calls.
Here is an example API call:

The first attribute needed is templateId
, which allows you to connect the API to your template.
All layer attributes are set using layers.UNIQUE_ID.image.ATTRIBUTE
or layers.UNIQUE_ID.text.ATTRIBUTE
(with UNIQUE_ID
replaced by the actual layer unique id, and ATTRIBUTE
being replaced by the attribute you want to target).
Here is a list of all attributes:
text layer
content
(string): replaces the text contentforegroundColor
(hexadecimal color string): replaces the text colorbackgroundColor
(hexadecimal color string): replaces the background colorfont
(string): replaces the font of the text (refer to the Photoroom editor for the full list of available fonts)
image layer
imageFile
(binary): replaces the image (can only specify one ofimageFile
andimageUrl
)imageUrl
(url string): replaces the image (can only specify one ofimageFile
andimageUrl
)removeBackground
(auto
ornever
): choose whether to remove the background of this image (defaults toauto
)useForAIBackground
(auto
ornever
): choose whether the image is taken into account when building the AI background (defaults toauto
), this is only useful if you have defined an AI background in your template or API call.horizontalAlignment
(left
,center
orright
): defines the horizontal alignment of the image within its box (defaults toauto
)verticalAlignment
(top
,center
orbottom
): defines the vertical alignment of the image within its box (defaults toauto
)margin
(percentage string like10%
or decimal number like0.1
): defines margins around the objectyou can use
marginTop
,marginRight
,marginBottom
,marginLeft
if you want to specify different margins
padding
(percentage string like10%
or decimal number like0.1
): defines padding around the object, the padding will be ignored on each side where the segmented object is croppedyou can use
paddingTop
,paddingRight
,paddingBottom
,paddingLeft
if you want to specify different paddings
Note: the removeBackground=never
and useForAIBackground=never
are great when used with logos, so that only your products have their background removed and does not affect the AI background.
Here is an example of a more complex API call:

Frequently Asked Questions (FAQ)
How many images can I replace (in the same row)?
There is a maximum of 10 replaceable images at the moment.
Last updated
Was this helpful?