Template Management

Our platform provides two flexible options for managing templates. You can either design and store templates on our servers using the template manager, or manage them locally in your own database.

Unlayer Template Manager (Easy)

Unlayer provides a template manager where your team members can easily collaborate, create and modify templates. This is available in Library > Templates section of the developer console. Each template is given a unique ID which can be used during initialization or any time after that.

Here's an example on how you can do it during initialization by passing a templateId.

unlayer.init({
  projectId: 1,
  templateId: 123
});

Or, you can do it after initialization by calling the following function.

unlayer.loadTemplate(1); // 1 is the templateId

You can also use our REST API to fetch the templates from your server at any time.


On Your Own Servers (Advanced)

If you want to save the templates on your own servers, that can be easily done. Templates are exactly like regular designs created using our editor. So they can be saved and loaded using the same API.

Once you create the template in Unlayer's template manager, switch to the JSON tab to get its' JSON. You can save this JSON in your database.

After the editor is initialized, you have to pass the template JSON to the loadDesign method.

var template = {...}; // template JSON
unlayer.loadDesign(template);

Which Option to Choose?

  • Unlayer Template Manager if you prefer to offload the complexity of template storage and focus solely on loading templates. This is ideal for those who want quick integration without managing backend infrastructure.
  • On Your Own Servers if you need more control over template storage, want to integrate templates with other internal systems, or prefer to maintain full ownership of template data.