Create a render (image or PDF)
Creating a render on Templated is achieved via this endpoint.
This endpoint responds with 202 Accepted
after which your render will be queued to generate. Renders are usually rendered within a few seconds. When completed, the status changes to completed
.
Sample Request
Here’s a sample request to create a render:
Parameters
template string
REQUIRED
The template id that you want to render.
templates array
This is only used for batch rendering from a list of templates.
If it’s provided, the template parameter will be ignored and will not be required.
Example: "templates": ["template-id-1", "template-id-2"]
format boolean
Render format (jpg
, png
, webp
or pdf
). Default is jpg
.
transparent boolean
Make the background transparent when the render format is png
. Default is false
.
background string
Background color in hex format e.g. “#FF0000”.
width number
A custom width for the render in pixels (minimum 100, maximum 5000).
height number
A custom height for the render in pixels (minimum 100, maximum 5000).
async boolean
If set to false
, the render will be created synchronously. Default is false
.
webhook_url string
A url to POST the full Render object to upon rendering completed.
layers object
REQUIRED
An object of layers that will be updated in the template.
The object key is the layer name and the value is an object with the following properties to override the template layers:
Layer Parameters
text string
Replacement text you want to use.
image_url string
Replacement image src for an image layer.
color string
Color in hex format e.g. “#FF0000”.
color_2 string
Secondary color in hex format. It will be applied to text surrounded by *
in the text layer.
background string
Background color in hex format e.g. “#FF0000”.
font_family string
Change the font family.
font_family_2 string
Secondary font family. It will be applied to text surrounded by *
in the text layer.
font_size string
Change the font size. Use a CSS value like (“24px” or “12pt”)
autofit string
Set to “width” or “height” to automatically fit the layer to the width or height of the box defined in the Editor.
border_width integer
Width of the object border.
border_color string
Border color in hex format e.g. “#FF0000”.
border_radius string
Border radius in px or percentage (e.g. “10px” or “10%”).
fill string
Shape fill color in hex format e.g. “#FF0000”.
stroke string
Shape stroke (border) color in hex format e.g. “#FF0000”.
hide boolean
Set to true to hide the layer.
link string
Add a link to the layer. It must start with http://
or https://
.
Links will only work on PDF renders.
x integer
Horizontal position of the layer (top left corner).
y integer
Vertical position of the layer (top left corner).
rotation integer
Rotation of the layer in degrees.
width integer
Width of the layer.
height integer
Height of the layer.
Response
The API returns a JSON object with the render details.