# Template Contents

Template Contents endpoints manage the actual content of email templates — the HTML,
MJML or plain text, along with headers like Subject and From. Content goes through
a lifecycle: Draft, Published and Autosave. Up to 5 versions per status are stored.
Use these endpoints to create, list, update, publish, lock and unlock template content.

## List all template content

 - [GET /v1/REST/templates/{id}/contents](https://dev.mailjet.com/openapi/openapi-passport/template-contents/get_v1_template_contents.md): Retrieve previous versions of your template's content. You can access the five most recent versions for each status (Draft, Published, Autosave). This is useful when looking to revert your template content to a previous version. To obtain a valid id, first call GET /v1/REST/templates to list your templates.

## Create template content

 - [POST /v1/REST/templates/{id}/contents](https://dev.mailjet.com/openapi/openapi-passport/template-contents/post_v1_template_contents.md): Add content to an existing template. You will need to specify the template ID and include either MJML, HTML or plain text. A locale is required in order to save and send your template. To obtain a valid id, first call GET /v1/REST/templates to list your templates.

## Get template content by status

 - [GET /v1/REST/templates/{id}/contents/types/{content_type}](https://dev.mailjet.com/openapi/openapi-passport/template-contents/get_v1_template_content_by_type.md): Retrieve the most recent content of your template based on its status. This endpoint allows you to access specific versions of your template content based on their status — Draft, Published, or Autosave. To obtain a valid id, first call GET /v1/REST/templates to list your templates.

## Update template content

 - [PUT /v1/REST/templates/{id}/contents/types/{content_type}](https://dev.mailjet.com/openapi/openapi-passport/template-contents/put_v1_template_content_by_type.md): Update draft template content. The endpoint takes the latest draft version, applies your changes, and creates a new draft version. If your template content is published, you should create new content and then publish it instead. To obtain a valid id, first call GET /v1/REST/templates to list your templates.

## Publish template content

 - [POST /v1/REST/templates/{id}/contents/publish](https://dev.mailjet.com/openapi/openapi-passport/template-contents/post_v1_template_contents_publish.md): Publish the content of your template to make it available for sending. When you publish, it is always the most recent draft content that is published. Verify that your most recent draft is the content you wish to publish. To obtain a valid id, first call GET /v1/REST/templates to list your templates.

## Lock template content

 - [POST /v1/REST/templates/{id}/contents/lock](https://dev.mailjet.com/openapi/openapi-passport/template-contents/post_v1_template_contents_lock.md): Lock the content of your template to prevent any further edits. This ensures that the current version remains unchanged until it is unlocked. To obtain a valid id, first call GET /v1/REST/templates to list your templates.

## Unlock template content

 - [POST /v1/REST/templates/{id}/contents/unlock](https://dev.mailjet.com/openapi/openapi-passport/template-contents/post_v1_template_contents_unlock.md): Unlock the content of your template to allow edits again after it has been locked. To obtain a valid id, first call GET /v1/REST/templates to list your templates.

