Skip to content

Update Template

<brEndpoint: PUT https://api.mailjet.com/v1/REST/templates/:id/

You can easily update a template using this endpoint. Add new labels, modify the name, add it as a favorite and more.

URL Parameters:

id = The ID of the template

Body Parameters:

NameTypeDescription
NamestringRequired. A unique identifier for the template.
EditModeintegerSpecifies the mode in which the template can be edited. Default value: 2. Learn more about edit modes.
LabelIDsarray of integersLabels associated with the template. See how to retrieve a list of labels here.
Purposesarray of stringsThe category or categories of the template in the UI. Accepted values: marketing, transactional, automation, and opt-in.
Descriptionstring or nullA brief description of the template.
IsStarredbooleanIndicates whether the template is marked as a favorite. True = favorite.
IsTextPartGenerationEnabledbooleanDetermines if text part generation functionality is enabled for this template. True = enabled

Example

curl --request PUT \
  --url https://api.mailjet.com/v1/rest/templates/27 / \
  --header 'Authorization: Bearer 612d5125131d406081abb9cd2afdc4e3' \
  --header 'Content-Type: application/json' \
  --data '{
    "Name": "New version",
    "EditMode": 2,
    "IsStarred": false,
    "Purposes": ["marketing"],
}'

Status Code 200

Response Data Field Structure

NameTypeDescription
IDintegerThe ID of the template
NamestringThe name of the template.
EditModeintegerSpecifies the mode in which the template can be edited.
LabelIDsarray of integersAn array of IDs representing labels associated with the template.
Purposesarray of stringsThe type of template. Learn more about template purposes
ExternalIDstring or nullThe ID that must be used to send the template.
Descriptionstring or nullA brief description of the template.
IsPublishedbooleanIndicates whether the template is published.
IsStarredbooleanIndicates whether the template is marked as a favorite.
IsTextPartGenerationEnabledbooleanDetermines if text part generation functionality is enabled for this template.
CreatedAtDate RFC3339The date and time when the template was created.
UpdatedAtDate RFC3339The date and time when the template was last updated.

Example API Response

{
    "Count": 1,
    "Total": 1,
    "Data": [
        {
            "ID": 27,
            "OrganisationID": 2,
            "Name": "New version.",
            "EditMode": 2,
            "LabelIDs": [],
            "LastContentType": null,
            "PartialIDs": [],
            "Purposes": [
                "marketing"
            ],
            "Categories": [
                "e-commerce"
            ],
            "Presets": null,
            "ExternalID": "123",
            "Description": null,
            "IsPublished": false,
            "IsStarred": false,
            "SoftDeleted": false,
            "IsTextPartGenerationEnabled": false,
            "CreatedAt": "2024-05-23T09:05:22.21546Z",
            "UpdatedAt": "2024-05-23T09:11:28.779525Z"
        }
    ]
}