Skip to content

Update a template

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.

Parameters

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

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.

Sample Requests

Update specific layers in a template

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));

Update template properties and layers

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));

Update multi-page template

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));

Response

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"
}

Error Responses

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

Important Notes