Skip to content

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:

ENDPOINT
POST /v1/render;
fetch('https://api.templated.io/v1/render', {
method: 'POST',
body: JSON.stringify(
{
"template" : TEMPLATE_ID,
"layers" : {
"text-1" : {
"text" : "This is my text to be rendered",
"color" : "#FFFFFF",
"background" : "#0000FF"
},
"image-1": {
"image_url" : "https://pathtomyphoto.com/123.jpg"
}
}
}
),
headers: {
'Content-Type' : 'application/json',
'Authorization' : `Bearer ${API_KEY}`
}
})

Parameters

template string REQUIRED
The template id that you want to use.

webhook_url string
A url to POST the full Render object to upon rendering completed.

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.

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”.

background string
Background color in hex format e.g. “#FF0000”.

font_family string
Change the font family.

font_size string
Change the font size. Use a CSS value like (“24px” or “12pt”)

border_width integer
Width of the object border.

border_color string
Border color in hex format e.g. “#FF0000”.

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.