Skip to content

This endpoint allows you to update an existing template by modifying its layers, properties, or content.
You can update specific layers without affecting the rest of the template, making it efficient for partial updates.

Key features:

  • Update only the layers/pages you need to change
  • Modify template properties like name, dimensions, and descriptions
  • Add new layers to existing pages
  • Update text, images, shapes, and other layer properties
  • Unchanged layers and pages remain intact

After updating the template, the changes will be reflected in the Editor and any future renders created from this template.

id string REQUIRED
The template ID of the template you want to update (passed in the URL path).

replaceLayers boolean OPTIONAL
When set to true, layers not included in the request will be removed from the template.
Default is false (partial update mode - existing layers not in the request remain unchanged).
Use this when you want to completely replace the template’s layers rather than just updating specific ones.

name string OPTIONAL
The name of the template.

width number OPTIONAL
The width of the template in pixels (max 5000).

height number OPTIONAL
The height of the template in pixels (max 5000).

description string OPTIONAL
A description of the template.

layers array OPTIONAL
An array of layer objects to update.
Only include the layers you want to modify or add.
Each layer must specify the layer property (layer name identifier) and the layer type (image, text, shape).

pages array OPTIONAL
For multi-page templates, an array of page objects containing the layers to update.
Only include the pages and layers you want to modify.

For all the available layer properties, see the Layer Parameters section.

Here’s a sample request to update only specific layers:

ENDPOINT
PUT /v1/template/{id}
UPDATE SPECIFIC LAYERS
fetch(`https://api.templated.io/v1/template/${template_id}`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"layers": [
{
"layer": "event-name",
"type": "text",
"text": "UPDATED EVENT NAME",
"color": "#ff0000"
},
{
"layer": "background-image",
"type": "image",
"image_url": "https://images.unsplash.com/photo-new-image-id"
}
]
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

You can also update template metadata along with layers:

UPDATE PROPERTIES AND LAYERS
fetch(`https://api.templated.io/v1/template/${template_id}`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Updated Template Name",
"description": "This template has been updated",
"width": 1920,
"height": 1080,
"layers": [
{
"layer": "title",
"type": "text",
"text": "New Title Text",
"font_size": "64px",
"color": "#ffffff"
}
]
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

For multi-page templates, use the pages array:

UPDATE MULTI-PAGE TEMPLATE
fetch(`https://api.templated.io/v1/template/${template_id}`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"pages": [
{
"page": "page-1",
"layers": {
"title": {
"layer": "title",
"type": "text",
"text": "Updated Page 1 Title"
}
}
},
{
"page": "page-2",
"layers": {
"subtitle": {
"layer": "subtitle",
"type": "text",
"text": "Updated Page 2 Subtitle"
}
}
}
]
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

Use replaceLayers=true when you want to completely replace the template’s layers. Any layers not included in your request will be removed:

ENDPOINT
PUT /v1/template/{id}?replaceLayers=true
REPLACE ALL LAYERS
// This will replace ALL layers in the template with only the layers specified below
// Any existing layers not in this array will be REMOVED
fetch(`https://api.templated.io/v1/template/${template_id}?replaceLayers=true`, {
method: 'PUT',
headers: {
'Authorization': `Bearer ${API_KEY}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"layers": [
{
"layer": "new-title",
"type": "text",
"text": "My New Title",
"x": 100,
"y": 100,
"width": 400,
"height": 50,
"font_size": "48px",
"color": "#000000"
},
{
"layer": "new-image",
"type": "image",
"image_url": "https://images.unsplash.com/photo-example",
"x": 100,
"y": 200,
"width": 400,
"height": 300
}
]
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));

The API returns a JSON object with the updated template details:

{
"id": "template-id-123",
"name": "Updated Template Name",
"description": "This template has been updated",
"width": 1920,
"height": 1080,
"layersCount": 15,
"pagesCount": 1,
"updatedAt": "2024-01-15T10:30:00Z",
"createdAt": "2024-01-01T08:00:00Z"
}
Status CodeDescription
401Not authorized - Invalid or missing API key
403Forbidden - You don’t have permission to update this template or account is blocked
404Not Found - Template not found
500Internal Server Error - An unexpected error occurred