{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/mandrill/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["admonition","tabs","tab"]},"type":"markdown"},"seo":{"title":"Templates Calls","siteUrl":"https://dev.mailjet.com/","projectTitle":"Mailjet Developer Documentation","description":"Replace Mandrill template calls with Mailjet’s /template and /template/$id/detailcontent. Covers create, update, info, publish, list, and delete operations.","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":[]},"priority":0.3},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"templates-calls","__idx":0},"children":["Templates Calls"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"introduction","__idx":1},"children":["Introduction"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In the Mailjet API, Templates are handled with the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[/template](/docs/api-reference/email-api/categories/templates/)"]}," resource and it's sub-resource ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["[/template/$id/detailcontent](/docs/api-reference/email-api/categories/templates/)"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/template"]}," is the definition of the basic template information."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["/template/$id/detailcontent"]}," stores the content of the template."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["For more information, visit ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/email-api/template_language/template_lang_overview/"},"children":["Transactional templating"]}," guide."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"add","__idx":2},"children":["Add"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Maps to /templates/add.json"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Adding a template is done in 2 steps:"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["creating the template"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["updating the content"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"creating-the-template","__idx":3},"children":["Creating the template"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"PHP","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"<?php\nrequire 'vendor/autoload.php';\nuse \\Mailjet\\Resources;\n$mj = new \\Mailjet\\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));\n$body = [\n    'Name' => \"First Template\"\n];\n$response = $mj->post(Resources::$Template, ['body' => $body]);\n$response->success() && var_dump($response->getData());\n?>\n","lang":"php"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Bash","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Create :\ncurl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t\t\"Name\":\"First Template\"\n\t}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"/**\n *\n * Create :\n *\n */\nvar mailjet = require('node-mailjet').connect(\n  process.env.MJ_APIKEY_PUBLIC,\n  process.env.MJ_APIKEY_PRIVATE\n)\nvar request = mailjet.post('template').request({\n  Name: 'First Template',\n})\nrequest\n  .on('success', function(response, body) {\n    console.log(response.statusCode, body)\n  })\n  .on('error', function(err, response) {\n    console.log(response.statusCode, err)\n  })\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Ruby","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ruby","header":{"controls":{"copy":{}}},"source":"# Create :\nMailjet.configure do |config|\n  config.api_key = ENV['MJ_APIKEY_PUBLIC']\n  config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n  config.default_from = 'your default sending address'\nend\nvariable = Mailjet::Template.create(name: \"First Template\")\n","lang":"ruby"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"\"\"\"\nCreate :\n\"\"\"\nfrom mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret))\ndata = {\n  'Name': 'First Template'\n}\nresult = mailjet.template.create(data=data)\nprint result.status_code\nprint result.json()\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Go","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"go","header":{"controls":{"copy":{}}},"source":"/*\nCreate :\n*/\npackage main\nimport (\n\t\"fmt\"\n\t. \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n\t\"os\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Template\n\tmr := &MailjetRequest{\n\t  Resource: \"template\",\n\t}\n\tfmr := &FullMailjetRequest{\n\t  Info: mr,\n\t  Payload: &resources.Template {\n      Name: \"First Template\",\n    },\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t  fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}\n","lang":"go"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.resource.Template;\npublic class MyClass {\n    /**\n     * Create :\n     */\n    public static void main(String[] args) throws MailjetException {\n      MailjetClient client;\n      MailjetRequest request;\n      MailjetResponse response;\n      client = new MailjetClient(\"api key\", \"api secret\");\n      request = new MailjetRequest(Template.resource)\n\t\t\t\t\t\t.property(Template.NAME, \"First Template\");\n      response = client.post(request);\n      System.out.println(response.getStatus());\n      System.out.println(response.getData());\n    }\n}\n","lang":"java"},"children":[]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"Count\": 1,\n  \"Data\": [\n    {\n      \"Author\": \"\",\n      \"Categories\": \"\",\n      \"Copyright\": \"\",\n      \"Description\": \"\",\n      \"EditMode\": \"\",\n      \"ID\": \"\",\n      \"IsStarred\": \"false\",\n      \"Name\": \"First Template\",\n      \"OwnerId\": \"5\",\n      \"OwnerType\": \"\",\n      \"Presets\": \"\",\n      \"Previews\": \"\",\n      \"Purposes\": \"\"\n    }\n  ],\n  \"Total\": 1\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Issue a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]}," request to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"updating-the-content","__idx":4},"children":["Updating the content"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"PHP","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"<?php\nrequire 'vendor/autoload.php';\nuse \\Mailjet\\Resources;\n$mj = new \\Mailjet\\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));\n$body = [\n    'Html-part' => \"Hello <strong>world</strong>!\",\n    'Text-part' => \"Hello world!\"\n];\n$response = $mj->post(Resources::$TemplateDetailcontent, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>\n","lang":"php"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Bash","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Create : Template content\ncurl -s \\\n\t-X POST \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template/$ID/detailcontent \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t\t\"Html-part\":\"Hello <strong>world</strong>!\",\n\t\t\"Text-part\":\"Hello world!\"\n\t}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"/**\n *\n * Create : Template content\n *\n */\nvar mailjet = require('node-mailjet').connect(\n  process.env.MJ_APIKEY_PUBLIC,\n  process.env.MJ_APIKEY_PRIVATE\n)\nvar request = mailjet\n  .post('template')\n  .id($ID)\n  .action('detailcontent')\n  .request({\n    'Html-part': 'Hello <strong>world</strong>!',\n    'Text-part': 'Hello world!',\n  })\nrequest\n  .on('success', function(response, body) {\n    console.log(response.statusCode, body)\n  })\n  .on('error', function(err, response) {\n    console.log(response.statusCode, err)\n  })\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Ruby","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ruby","header":{"controls":{"copy":{}}},"source":"# Create : Template content\nMailjet.configure do |config|\n  config.api_key = ENV['MJ_APIKEY_PUBLIC']\n  config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n  config.default_from = 'your default sending address'\nend\nvariable = Mailjet::Template_detailcontent.create(id: $ID, , html_part: \"Hello <strong>world</strong>!\",text_part: \"Hello world!\")\n","lang":"ruby"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"\"\"\"\nCreate : Template content\n\"\"\"\nfrom mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret))\nid = '$ID'\ndata = {\n  'Html-part': 'Hello <strong>world</strong>!',\n  'Text-part': 'Hello world!'\n}\nresult = mailjet.template_detailcontent.create(id=id, data=data)\nprint result.status_code\nprint result.json()\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Go","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"go","header":{"controls":{"copy":{}}},"source":"/*\nCreate : Template content\n*/\npackage main\nimport (\n\t\"fmt\"\n\t. \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n\t\"os\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.TemplateDetailcontent\n\tmr := &MailjetRequest{\n\t  Resource: \"template\",\n\t  ID: RESOURCE_ID,\n\t  Action: \"detailcontent\",\n\t}\n\tfmr := &FullMailjetRequest{\n\t  Info: mr,\n\t  Payload: &resources.TemplateDetailcontent {\n      HtmlPart: \"Hello <strong>world</strong>!\",\n      TextPart: \"Hello world!\",\n    },\n\t}\n\terr := mailjetClient.Post(fmr, &data)\n\tif err != nil {\n\t  fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}\n","lang":"go"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.resource.TemplateDetailcontent;\npublic class MyClass {\n    /**\n     * Create : Template content\n     */\n    public static void main(String[] args) throws MailjetException {\n      MailjetClient client;\n      MailjetRequest request;\n      MailjetResponse response;\n      client = new MailjetClient(\"api key\", \"api secret\");\n      request = new MailjetRequest(TemplateDetailcontent.resource, ID)\n\t\t\t\t\t\t.property(TemplateDetailcontent.HTMLPART, \"Hello <strong>world</strong>!\")\n\t\t\t\t\t\t.property(TemplateDetailcontent.TEXTPART, \"Hello world!\");\n      response = client.post(request);\n      System.out.println(response.getStatus());\n      System.out.println(response.getData());\n    }\n}\n","lang":"java"},"children":[]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"Count\": 1,\n  \"Data\": [\n    {\n      \"Html-part\": \"Hello <strong>world</strong>!\",\n      \"Text-part\": \"Hello world!\"\n    }\n  ],\n  \"Total\": 1\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Issue a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST"]}," request to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template/$ID/detailcontent"]}," with the ID to set your content"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"info","__idx":5},"children":["Info"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["/templates/info.json"]}]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"PHP","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"<?php\nrequire 'vendor/autoload.php';\nuse \\Mailjet\\Resources;\n$mj = new \\Mailjet\\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));\n$response = $mj->get(Resources::$Template, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>\n","lang":"php"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Bash","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# View :\ncurl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template/$ID\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"/**\n *\n * View :\n *\n */\nvar mailjet = require('node-mailjet').connect(\n  process.env.MJ_APIKEY_PUBLIC,\n  process.env.MJ_APIKEY_PRIVATE\n)\nvar request = mailjet\n  .get('template')\n  .id($ID)\n  .request()\nrequest\n  .on('success', function(response, body) {\n    console.log(response.statusCode, body)\n  })\n  .on('error', function(err, response) {\n    console.log(response.statusCode, err)\n  })\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Ruby","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ruby","header":{"controls":{"copy":{}}},"source":"# View :\nMailjet.configure do |config|\n  config.api_key = ENV['MJ_APIKEY_PUBLIC']\n  config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n  config.default_from = 'your default sending address'\nend\nvariable = Mailjet::Template.find($ID)\n","lang":"ruby"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"\"\"\"\nView :\n\"\"\"\nfrom mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret))\nid = '$ID'\nresult = mailjet.template.get(id=id)\nprint result.status_code\nprint result.json()\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Go","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"go","header":{"controls":{"copy":{}}},"source":"/*\nView :\n*/\npackage main\nimport (\n\t\"fmt\"\n\t. \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n\t\"os\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Template\n\tmr := &MailjetRequest{\n\t  Resource: \"template\",\n\t  ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t  fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}\n","lang":"go"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.resource.Template;\npublic class MyClass {\n    /**\n     * View :\n     */\n    public static void main(String[] args) throws MailjetException {\n      MailjetClient client;\n      MailjetRequest request;\n      MailjetResponse response;\n      client = new MailjetClient(\"api key\", \"api secret\");\n      request = new MailjetRequest(Template.resource, ID);\n      response = client.get(request);\n      System.out.println(response.getStatus());\n      System.out.println(response.getData());\n    }\n}\n","lang":"java"},"children":[]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"Count\": 1,\n  \"Data\": [\n    {\n      \"Author\": \"\",\n      \"Categories\": \"\",\n      \"Copyright\": \"\",\n      \"Description\": \"\",\n      \"EditMode\": \"\",\n      \"ID\": \"\",\n      \"IsStarred\": \"false\",\n      \"Name\": \"First Template\",\n      \"OwnerId\": \"5\",\n      \"OwnerType\": \"\",\n      \"Presets\": \"\",\n      \"Previews\": \"\",\n      \"Purposes\": \"\"\n    }\n  ],\n  \"Total\": 1\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Issue a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]}," request to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template"]}," with the ID to get specific template"]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"PHP","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"<?php\nrequire 'vendor/autoload.php';\nuse \\Mailjet\\Resources;\n$mj = new \\Mailjet\\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));\n$response = $mj->get(Resources::$TemplateDetailcontent, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>\n","lang":"php"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Bash","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# View :\ncurl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template/$ID/detailcontent\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"/**\n *\n * View :\n *\n */\nvar mailjet = require('node-mailjet').connect(\n  process.env.MJ_APIKEY_PUBLIC,\n  process.env.MJ_APIKEY_PRIVATE\n)\nvar request = mailjet\n  .get('template')\n  .id($ID)\n  .action('detailcontent')\n  .request()\nrequest\n  .on('success', function(response, body) {\n    console.log(response.statusCode, body)\n  })\n  .on('error', function(err, response) {\n    console.log(response.statusCode, err)\n  })\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Ruby","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ruby","header":{"controls":{"copy":{}}},"source":"# View :\nMailjet.configure do |config|\n  config.api_key = ENV['MJ_APIKEY_PUBLIC']\n  config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n  config.default_from = 'your default sending address'\nend\nvariable = Mailjet::Template_detailcontent.find($ID)\n","lang":"ruby"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"\"\"\"\nView :\n\"\"\"\nfrom mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret))\nid = '$ID'\nresult = mailjet.template_detailcontent.get(id=id)\nprint result.status_code\nprint result.json()\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Go","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"go","header":{"controls":{"copy":{}}},"source":"/*\nView :\n*/\npackage main\nimport (\n\t\"fmt\"\n\t. \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n\t\"os\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.TemplateDetailcontent\n\tmr := &MailjetRequest{\n\t  Resource: \"template\",\n\t  ID: RESOURCE_ID,\n\t  Action: \"detailcontent\",\n\t}\n\terr := mailjetClient.Get(mr, &data)\n\tif err != nil {\n\t  fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}\n","lang":"go"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.resource.TemplateDetailcontent;\npublic class MyClass {\n    /**\n     * View :\n     */\n    public static void main(String[] args) throws MailjetException {\n      MailjetClient client;\n      MailjetRequest request;\n      MailjetResponse response;\n      client = new MailjetClient(\"api key\", \"api secret\");\n      request = new MailjetRequest(TemplateDetailcontent.resource, ID);\n      response = client.get(request);\n      System.out.println(response.getStatus());\n      System.out.println(response.getData());\n    }\n}\n","lang":"java"},"children":[]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"Count\": 1,\n  \"Data\": [\n    {\n      \"Html-part\": \"Hello <strong>world</strong>!\",\n      \"Text-part\": \"Hello world!\"\n    }\n  ],\n  \"Total\": 1\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Issue a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]}," request to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template/$ID/detailcontent"]}," with the ID to get specific template content"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"update","__idx":6},"children":["Update"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["/templates/update.json"]}]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Bash","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Modify :\ncurl -s \\\n\t-X PUT \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template/$ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t\t\"Author\":\"\",\n\t\t\"Categories\":\"\",\n\t\t\"Copyright\":\"\",\n\t\t\"Description\":\"\",\n\t\t\"EditMode\":\"\",\n\t\t\"IsStarred\":\"false\",\n\t\t\"Presets\":\"\",\n\t\t\"Purposes\":\"\"\n\t}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"/**\n *\n * Modify :\n *\n */\nvar mailjet = require('node-mailjet').connect(\n  process.env.MJ_APIKEY_PUBLIC,\n  process.env.MJ_APIKEY_PRIVATE\n)\nvar request = mailjet\n  .put('template')\n  .id($ID)\n  .request({\n    Author: '',\n    Categories: '',\n    Copyright: '',\n    Description: '',\n    EditMode: '',\n    IsStarred: 'false',\n    Presets: '',\n    Purposes: '',\n  })\nrequest\n  .on('success', function(response, body) {\n    console.log(response.statusCode, body)\n  })\n  .on('error', function(err, response) {\n    console.log(response.statusCode, err)\n  })\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"PHP","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"<?php\nrequire 'vendor/autoload.php';\nuse \\Mailjet\\Resources;\n$mj = new \\Mailjet\\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));\n$body = [\n    'Author' => \"\",\n    'Categories' => \"\",\n    'Copyright' => \"\",\n    'Description' => \"\",\n    'EditMode' => \"\",\n    'IsStarred' => \"false\",\n    'Presets' => \"\",\n    'Purposes' => \"\"\n];\n$response = $mj->put(Resources::$Template, ['id' => $id, 'body' => $body]);\n$response->success() && var_dump($response->getData());\n?>\n","lang":"php"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Ruby","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ruby","header":{"controls":{"copy":{}}},"source":"# Modify :\nMailjet.configure do |config|\n  config.api_key = ENV['MJ_APIKEY_PUBLIC']\n  config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n  config.default_from = 'your default sending address'\nend\ntarget = Mailjet::Template.find($ID)\ntarget.update_attributes(author: \"\",categories: \"\",copyright: \"\",description: \"\",edit_mode: \"\",is_starred: \"false\",presets: \"\",purposes: \"\")\n","lang":"ruby"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"\"\"\"\nModify :\n\"\"\"\nfrom mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret))\nid = '$ID'\ndata = {\n  'Author': '',\n  'Categories': '',\n  'Copyright': '',\n  'Description': '',\n  'EditMode': '',\n  'IsStarred': 'false',\n  'Presets': '',\n  'Purposes': ''\n}\nresult = mailjet.template.update(id=id, data=data)\nprint result.status_code\nprint result.json()\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Go","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"go","header":{"controls":{"copy":{}}},"source":"/*\nModify :\n*/\npackage main\nimport (\n\t\"fmt\"\n\t. \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n\t\"os\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &MailjetRequest{\n\t  Resource: \"template\",\n\t  ID: RESOURCE_ID,\n\t}\n\tfmr := &FullMailjetRequest{\n\t  Info: mr,\n\t  Payload: &resources.Template {\n      Author: ,\n      Categories: ,\n      Copyright: ,\n      Description: ,\n      EditMode: ,\n      IsStarred: \"false\",\n      Presets: ,\n      Purposes: ,\n    },\n\t}\n\terr := mailjetClient.Put(fmr)\n\tif err != nil {\n\t  fmt.Println(err)\n\t}\n}\n","lang":"go"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.resource.Template;\npublic class MyClass {\n    /**\n     * Modify :\n     */\n    public static void main(String[] args) throws MailjetException {\n      MailjetClient client;\n      MailjetRequest request;\n      MailjetResponse response;\n      client = new MailjetClient(\"api key\", \"api secret\");\n      request = new MailjetRequest(Template.resource, ID)\n\t\t\t\t\t\t.property(Template.AUTHOR, )\n\t\t\t\t\t\t.property(Template.CATEGORIES, )\n\t\t\t\t\t\t.property(Template.COPYRIGHT, )\n\t\t\t\t\t\t.property(Template.DESCRIPTION, )\n\t\t\t\t\t\t.property(Template.EDITMODE, )\n\t\t\t\t\t\t.property(Template.ISSTARRED, \"false\")\n\t\t\t\t\t\t.property(Template.PRESETS, )\n\t\t\t\t\t\t.property(Template.PURPOSES, );\n      response = client.put(request);\n      System.out.println(response.getStatus());\n      System.out.println(response.getData());\n    }\n}\n","lang":"java"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Issue a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PUT"]}," request to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template"]}," with the ID to get specific template"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"delete","__idx":7},"children":["Delete"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["/templates/delete.json"]}]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"PHP","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"<?php\nrequire 'vendor/autoload.php';\nuse \\Mailjet\\Resources;\n$mj = new \\Mailjet\\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));\n$response = $mj->delete(Resources::$Template, ['id' => $id]);\n$response->success() && var_dump($response->getData());\n?>\n","lang":"php"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Bash","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# Delete :\ncurl -s \\\n\t-X DELETE \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template/$ID \\\n\t-H 'Content-Type: application/json' \\\n\t-d '{\n\t}'\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"/**\n *\n * Delete :\n *\n */\nvar mailjet = require('node-mailjet').connect(\n  process.env.MJ_APIKEY_PUBLIC,\n  process.env.MJ_APIKEY_PRIVATE\n)\nvar request = mailjet\n  .delete('template')\n  .id($ID)\n  .request()\nrequest\n  .on('success', function(response, body) {\n    console.log(response.statusCode, body)\n  })\n  .on('error', function(err, response) {\n    console.log(response.statusCode, err)\n  })\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Ruby","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ruby","header":{"controls":{"copy":{}}},"source":"# Delete :\nMailjet.configure do |config|\n  config.api_key = ENV['MJ_APIKEY_PUBLIC']\n  config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n  config.default_from = 'your default sending address'\nend\ntarget = Mailjet::Template.find($ID)\ntarget.delete()\n","lang":"ruby"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"\"\"\"\nDelete :\n\"\"\"\nfrom mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret))\nid = '$ID'\nresult = mailjet.template.delete(id=id)\nprint result.status_code\nprint result.json()\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Go","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"go","header":{"controls":{"copy":{}}},"source":"/*\nDelete :\n*/\npackage main\nimport (\n\t\"fmt\"\n\t. \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n\t\"os\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tmr := &MailjetRequest{\n\t  Resource: \"template\",\n\t  ID: RESOURCE_ID,\n\t}\n\terr := mailjetClient.Delete(mr)\n\tif err != nil {\n\t  fmt.Println(err)\n\t}\n}\n","lang":"go"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.resource.Template;\npublic class MyClass {\n    /**\n     * Delete :\n     */\n    public static void main(String[] args) throws MailjetException {\n      MailjetClient client;\n      MailjetRequest request;\n      MailjetResponse response;\n      client = new MailjetClient(\"api key\", \"api secret\");\n      request = new MailjetRequest(Template.resource, ID);\n      response = client.delete(request);\n      System.out.println(response.getStatus());\n      System.out.println(response.getData());\n    }\n}\n","lang":"java"},"children":[]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Issue a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["DELETE"]}," request to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template"]}," with the ID to get specific template"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"list","__idx":8},"children":["List"]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info","name":"Info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["/templates/list.json"]}]},{"$$mdtype":"Tag","name":"Tabs","attributes":{"size":"medium"},"children":[{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"PHP","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"php","header":{"controls":{"copy":{}}},"source":"<?php\nrequire 'vendor/autoload.php';\nuse \\Mailjet\\Resources;\n$mj = new \\Mailjet\\Client(getenv('MJ_APIKEY_PUBLIC'), getenv('MJ_APIKEY_PRIVATE'));\n$response = $mj->get(Resources::$Template);\n$response->success() && var_dump($response->getData());\n?>\n","lang":"php"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Bash","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"bash","header":{"controls":{"copy":{}}},"source":"# View :\ncurl -s \\\n\t-X GET \\\n\t--user \"$MJ_APIKEY_PUBLIC:$MJ_APIKEY_PRIVATE\" \\\n\thttps://api.mailjet.com/v3/REST/template\n","lang":"bash"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Node.js","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"javascript","header":{"controls":{"copy":{}}},"source":"/**\n *\n * View :\n *\n */\nvar mailjet = require('node-mailjet').connect(\n  process.env.MJ_APIKEY_PUBLIC,\n  process.env.MJ_APIKEY_PRIVATE\n)\nvar request = mailjet.get('template').request()\nrequest\n  .on('success', function(response, body) {\n    console.log(response.statusCode, body)\n  })\n  .on('error', function(err, response) {\n    console.log(response.statusCode, err)\n  })\n","lang":"javascript"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Ruby","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"ruby","header":{"controls":{"copy":{}}},"source":"# View :\nMailjet.configure do |config|\n  config.api_key = ENV['MJ_APIKEY_PUBLIC']\n  config.secret_key = ENV['MJ_APIKEY_PRIVATE']\n  config.default_from = 'your default sending address'\nend\nvariable = Mailjet::Template.all()\n","lang":"ruby"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Python","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"\"\"\"\nView :\n\"\"\"\nfrom mailjet_rest import Client\nimport os\napi_key = os.environ['MJ_APIKEY_PUBLIC']\napi_secret = os.environ['MJ_APIKEY_PRIVATE']\nmailjet = Client(auth=(api_key, api_secret))\nresult = mailjet.template.get()\nprint result.status_code\nprint result.json()\n","lang":"python"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Go","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"go","header":{"controls":{"copy":{}}},"source":"/*\nView :\n*/\npackage main\nimport (\n\t\"fmt\"\n\t. \"github.com/mailjet/mailjet-apiv3-go\"\n\t\"github.com/mailjet/mailjet-apiv3-go/resources\"\n\t\"os\"\n)\nfunc main () {\n\tmailjetClient := NewMailjetClient(os.Getenv(\"MJ_APIKEY_PUBLIC\"), os.Getenv(\"MJ_APIKEY_PRIVATE\"))\n\tvar data []resources.Template\n\t_, _, err := mailjetClient.List(\"template\", &data)\n\tif err != nil {\n\t  fmt.Println(err)\n\t}\n\tfmt.Printf(\"Data array: %+v\\n\", data)\n}\n","lang":"go"},"children":[]}]},{"$$mdtype":"Tag","name":"TabItemFragment","attributes":{"label":"Java","disable":false},"children":[{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"java","header":{"controls":{"copy":{}}},"source":"package com.my.project;\nimport com.mailjet.client.errors.MailjetException;\nimport com.mailjet.client.MailjetClient;\nimport com.mailjet.client.MailjetRequest;\nimport com.mailjet.client.MailjetResponse;\nimport com.mailjet.client.resource.Template;\npublic class MyClass {\n    /**\n     * View :\n     */\n    public static void main(String[] args) throws MailjetException {\n      MailjetClient client;\n      MailjetRequest request;\n      MailjetResponse response;\n      client = new MailjetClient(\"api key\", \"api secret\");\n      request = new MailjetRequest(Template.resource);\n      response = client.get(request);\n      System.out.println(response.getStatus());\n      System.out.println(response.getData());\n    }\n}\n","lang":"java"},"children":[]}]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n  \"Count\": 1,\n  \"Data\": [\n    {\n      \"Author\": \"\",\n      \"Categories\": \"\",\n      \"Copyright\": \"\",\n      \"Description\": \"\",\n      \"EditMode\": \"\",\n      \"ID\": \"\",\n      \"IsStarred\": \"false\",\n      \"Name\": \"First Template\",\n      \"OwnerId\": \"5\",\n      \"OwnerType\": \"\",\n      \"Presets\": \"\",\n      \"Previews\": \"\",\n      \"Purposes\": \"\"\n    }\n  ],\n  \"Total\": 1\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Issue a ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["GET"]}," request to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["template"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"migrate-your-templates","__idx":9},"children":["Migrate your templates"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/email-api/template_language/template_lang_overview/"},"children":["Mailjet Templating Language"]}," uses a syntax closer to templating language like ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://jinja.pocoo.org/docs/dev/"},"children":["Jinja2"]}," (Python) or ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"http://twig.sensiolabs.org/"},"children":["Twig"]}," (PHP)."]},{"$$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":"Feature"},"children":["Feature"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Mandrill syntax"},"children":["Mandrill syntax"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Mailjet syntax"},"children":["Mailjet syntax"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Comments"},"children":["Comments"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Conditions"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{#if condition}}...{/if}}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["{% if condition %}...{% endif %}"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Loops"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{#each list}}...{{this}}...{{/each}}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["{% for foo in bar %}{{foo}}{% endfor %}"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Nested Variables"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{foo.bar}}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{foo.bar}}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Variables"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{foobar}}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{data:foobar}}"]}," or ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["{{var:foobar}}"]}]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Transactional messages can contain both contact properties or message variables"]}]}]}]}]}]},"headings":[{"value":"Templates Calls","id":"templates-calls","depth":1},{"value":"Introduction","id":"introduction","depth":2},{"value":"Add","id":"add","depth":2},{"value":"Creating the template","id":"creating-the-template","depth":3},{"value":"Updating the content","id":"updating-the-content","depth":3},{"value":"Info","id":"info","depth":2},{"value":"Update","id":"update","depth":2},{"value":"Delete","id":"delete","depth":2},{"value":"List","id":"list","depth":2},{"value":"Migrate your templates","id":"migrate-your-templates","depth":2}],"frontmatter":{"title":"Templates Calls","seo":{"description":"Replace Mandrill template calls with Mailjet’s /template and /template/$id/detailcontent. Covers create, update, info, publish, list, and delete operations.","priority":0.3,"title":"Templates Calls"}},"lastModified":"2026-08-26T10:53:57.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/mandrill/templates-calls","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}