{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/content-api/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition"]},"type":"markdown"},"seo":{"title":"Update Template Content","siteUrl":"https://dev.mailjet.com/","projectTitle":"Mailjet Developer Documentation","description":"Update draft content via PUT .../templates/:id/contents/types/D in the Mailjet Content API. Creates a new draft version of HTMLPart, MJMLPart, or TextPart.","image":"https://dev.mailjet.com/og-image.png","lang":"en-US","keywords":["Mailjet API","Email API","Content API","SMTP Relay","transactional email","email delivery","Send API","email templates","developer documentation"],"meta":[{"name":"og:type","content":"website"},{"name":"og:site_name","content":"Mailjet Developer Documentation"},{"name":"twitter:card","content":"summary_large_image"},{"name":"robots","content":"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"},{"name":"googlebot","content":"index, follow, max-snippet:-1, max-image-preview:large"}],"jsonLd":{"@context":"https://schema.org","@graph":[{"@type":"Organization","@id":"https://dev.mailjet.com/#organization","name":"Mailjet","alternateName":"Sinch Mailjet","url":"https://www.mailjet.com","logo":"https://assets.mailjet.com/lib/images/mailjetLogo/mj_logo_with_text_color.png","parentOrganization":{"@type":"Organization","name":"Sinch","url":"https://www.sinch.com"}},{"@type":"WebSite","@id":"https://dev.mailjet.com/#website","name":"Mailjet Developer Documentation","description":"Official developer documentation for the Mailjet Email API, Content API and SMTP Relay.","url":"https://dev.mailjet.com/","inLanguage":"en-US","publisher":{"@id":"https://dev.mailjet.com/#organization"},"potentialAction":{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https://dev.mailjet.com/search?q={search_term_string}"},"query-input":"required name=search_term_string"}}]},"llmstxt":{"hide":false,"title":"Mailjet Developer Documentation","description":"Developer documentation for the Mailjet Email API, Content API and SMTP Relay - guides, API references and code samples for sending, templating and tracking email at scale.","details":{"content":"Mailjet (part of Sinch) provides APIs for sending and managing email.\n\nThis documentation covers four main areas:\n\n- **Email API** - the Send API (v3 and v3.1) for transactional and marketing email,\n  plus contact management, segmentation, campaigns, statistics, webhooks, the Parse API\n  and the Mailjet Templating Language.\n- **Content API** - programmatic management of email templates, template contents,\n  images, labels and authentication tokens (v1).\n- **SMTP Relay** - sending through Mailjet's SMTP servers, including custom headers.\n- **API Reference** - the complete, generated reference for every endpoint, built directly\n  from the OpenAPI specifications.\n\nBase URL for all REST APIs: `https://api.mailjet.com`.\nAuthentication uses HTTP Basic auth with an API key and secret key.\n\n## Machine-readable entry points\n\nPrefer these when you need the API surface in as few requests as possible:\n\n- `/openapi/openapi-mailjet.md` - the **complete** Email API reference (every endpoint,\n  grouped by resource) as a single Markdown document.\n- `/openapi/openapi-passport.md` - the **complete** Content API reference as a single\n  Markdown document.\n- `/_bundle/openapi/openapi-mailjet.yaml` - the raw, fully bundled OpenAPI 3 description\n  of the Email API.\n- `/_bundle/openapi/openapi-passport.yaml` - the raw, fully bundled OpenAPI 3 description\n  of the Content API.\n- `/sitemap.xml` - every indexable URL on this site.\n\nEvery page on this site is also available as clean Markdown by appending `.md` to its URL."},"sections":[{"title":"Email API","description":"Sending, contacts, campaigns, statistics, webhooks and templating.","includeFiles":["docs/email-api/**/*.md"],"excludeFiles":[]},{"title":"Content API","description":"Manage templates, template contents, images, labels and tokens.","includeFiles":["docs/content-api/**/*.md","docs/content-api.md"],"excludeFiles":[]},{"title":"SMTP Relay","description":"Send email through Mailjet's SMTP servers.","includeFiles":["docs/smtp-relay/**/*.md"],"excludeFiles":[]},{"title":"API Reference","description":"Complete generated reference for every Mailjet API endpoint.","includeFiles":["openapi/openapi-mailjet.yaml","openapi/openapi-passport.yaml","docs/api-reference/**/*.md"],"excludeFiles":[]},{"title":"Migrating from Mandrill","description":"Guides for switching from Mandrill to Mailjet.","includeFiles":["docs/mandrill/**/*.md"],"excludeFiles":[]}],"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"update-template-content","__idx":0},"children":["Update Template Content"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["Endpoint"]},": ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUT https://api.mailjet.com/v1/REST/templates/:id/contents/types/:content_type"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can use this endpoint to update draft template content. When you make updates, the endpoint takes the latest draft version, applies your changes, and creates a new draft version. This enables you to modify various elements of the template, such as the text, HTML, and headers."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If your template content is published, you will can create template content at the following endpoint: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST https://api.mailjet.com/v1/REST/templates/:id/contents."]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Once it is created, you can publish it using this endpoint: ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST https://api.mailjet.com/v1/REST/templates/:id/contents/publish."]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["URL Parameters:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["id"]}," = The ID of the template."," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["content_type"]}," = The content status that you wish to update. Accepted value: D (Draft)."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"body-parameters","__idx":1},"children":["Body Parameters"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Author"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The name of the person or entity creating the template content."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Name"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The name of the template content."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Locale"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Specifies the locale (language and region) for the template content. See the full list of accepted locales."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MJMLPart"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string or null"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The MJML code for the template."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["HTMLPart"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string or null"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The HTML code for the template."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TextPart"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string or null"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The plain text version of the template content."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Headers"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["json string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Additional headers for the template in JSON format."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"example-request","__idx":2},"children":["Example Request"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"curl --request PUT \\\n  --url https://api.mailjet.com//v1/rest/templates/27/contents/types/D \\\n  --header 'Authorization: Bearer 612d5125131d406081abb9cd2afdc4e3' \\\n  --header 'Content-Type: application/json' \\\n  --data '{\n      \"Locale\": \"fr_FR\",\n      \"Headers\": {\n          \"Subject\": \"Welcome to Mailjet\",\n          \"From\": \"MyCompany <info@mycompany.com>\",\n          \"Reply-To\": \"\",\n          \"SenderName\": \"My Company\",\n          \"SenderEmail\": \"info@mycompany.com\"\n      },\n      \"HTMLPart\": \"<!doctype html><html><body><p>May the delivery force be with you!</p></body></html>\",\n      \"TextPart\": \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\",\n      \"Name\": \"New Name\",\n      \"Author\": \"John Doe\"\n}'\n"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"b","attributes":{},"children":["Status Code"]}," ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["200"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"response-data-field-structure","__idx":3},"children":["Response Data Field Structure"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Name"},"children":["Name"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Type"},"children":["Type"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Description"},"children":["Description"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ID"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ID of the content version."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TemplateID"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["integer"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The ID of the template."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["ContentType"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["\"D\", \"P\" or \"A\". Always \"D\" when created."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Author"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string or null"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The name of the person or entity creating the template content."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Name"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The name of the template content."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["IsLocked"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["boolean"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["If this field is true (locked), the template content cannot be edited."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Locale"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Specifies the locale (language and region) for the template content."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["MJMLPart"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string or null"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The MJML code for the template."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["HTMLPart"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string or null"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The HTML code for the template."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["TextPart"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["string or null"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The plain text version of the template content."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Headers"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["json string"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Additional headers for the template in JSON format."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["CreatedAt"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Date RFC3339"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The date and time when the template was created."]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["UpdatedAt"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Date RFC3339"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The date and time when the template was last updated."]}]}]}]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"api-response","__idx":4},"children":["API Response"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"header":{"controls":{"copy":{}}},"source":"{\n\t\"Count\": 1,\n\t\"Total\": 1,\n\t\"Data\": [\n\t\t{\n\t\t\t\"ID\": 23,\n\t\t\t\"OrganisationID\": 2,\n\t\t\t\"UserID\": 2,\n\t\t\t\"TemplateID\": 27,\n\t\t\t\"ContentType\": \"D\",\n\t\t\t\"Author\": \"John Doe\",\n\t\t\t\"Name\": \"New Name\",\n\t\t\t\"IsLocked\": false,\n\t\t\t\"Locale\": \"fr_FR\",\n\t\t\t\"Headers\": {\n\t\t\t\t\"Subject\": \"Welcome to Mailjet\",\n\t\t\t\t\"From\": \"MyCompany <info@mycompany.com>\",\n\t\t\t\t\"Reply-To\": \"\",\n\t\t\t\t\"SenderName\": \"My Company\",\n\t\t\t\t\"SenderEmail\": \"info@mycompany.com\"\n\t\t\t},\n\t\t\t\"HTMLPart\": \"<!doctype html><html><body><p>May the delivery force be with you!</p></body></html>\",\n\t\t\t\"TextPart\": \"Dear passenger, welcome to Mailjet! May the delivery force be with you!\",\n\t\t\t\"CreatedAt\": \"2024-05-23T09:54:37.300091Z\",\n\t\t\t\"UpdatedAt\": \"2024-05-23T09:54:37.300091Z\"\n    }\n\t]\n}\n"},"children":[]}]},"headings":[{"value":"Update Template Content","id":"update-template-content","depth":1},{"value":"Body Parameters","id":"body-parameters","depth":3},{"value":"Example Request","id":"example-request","depth":3},{"value":"Response Data Field Structure","id":"response-data-field-structure","depth":3},{"value":"API Response","id":"api-response","depth":3}],"frontmatter":{"title":"Mailjet Content API","seo":{"description":"Update draft content via PUT .../templates/:id/contents/types/D in the Mailjet Content API. Creates a new draft version of HTMLPart, MJMLPart, or TextPart.","title":"Update Template Content"}},"lastModified":"2026-08-26T10:53:57.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/content-api/email-templates/update-template-content","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}