Skip to content

Create a render

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.

Parameters

These attributes are populated by Templated. All other attributes of the object are set by the user at the time of creation.

Attributes

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:

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.

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.

Sample Request

Here’s a sample request to create a render:

ENDPOINT
POST /v1/render
REQUEST
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}`
}
})