{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-docs/email-api/template_language/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":["code-snippet"]},"type":"markdown"},"seo":{"title":"Passport","siteUrl":"https://dev.mailjet.com/","projectTitle":"Mailjet Developer Documentation","description":"Use Passport, Mailjet's email builder, to add conditional show/hide sections, template blocks, and product loops with template language.","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":"passport","__idx":0},"children":["Passport"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"using-the-passport-integration-tool","__idx":1},"children":["Using the Passport integration tool"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Passport is offering you a functionality, which generates simple conditional statement for you for specific section. It allows you to show/hide a section, based on the result of the condition."]},{"$$mdtype":"Tag","name":"ol","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["In order to add the condition, hover your mouse on the section and click on the ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["add condition"]}," button."]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["A menu will pop up, prompting you to define the condition. This section will be displayed only if the contact data ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["client"]}," is set to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["true"]},", which means that this address has already been registered in the system. If not, the section will be skipped."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"adding-logic-as-a-text","__idx":2},"children":["Adding logic as a text"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In order to include more advanced conditional statements, which should not necessarily apply for the whole section, but to part of the content (could be part of the section or multiple sections), you can insert the condition directly as a text. For example, you can add the following condition."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The syntax is:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"file":"./code_snippets/passport_logic_1.html","language":"html","title":"","header":{"title":"","controls":{"copy":{}}},"lang":"html","source":"html linenums=\"1\" hl_lines=\"1 3 7 11\"\n{% if var:step == \"confirmorder\" %} Confirmation of purchase: {{\nvar:productname:\"\" }} {% elseif var:step == \"unavailable\" %} Sorry, {{\nvar:productname:\"\"}} is out of stock :( If you would like a refund, please\n<a href=\"http://mailjet.com/\">contact us</a>. {% elseif var:step == \"refund\" %}\nRefund of your purchase {{ var:productname:\"\" }} has been issued. The amount of\n{{var:totalprice}} will be returned to your credit card within 10 business days.\n{% endif %}"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"inserting-template-block","__idx":3},"children":["Inserting Template block"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["Template block"]}," is a functionality of the editing tool, allowing you to insert template language inside it. It can be either a conditional statement or a loop."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["In order to add template language inside the block, you double click on it and enter the code on the left hand side of the builder."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"use-case","__idx":4},"children":["Use case"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Now that you are aware of the possibilities Mailjet's template language offers, we can put them all together."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["This guide will show you how to quickly be up and running with your first transactional template. This guide leverages Mailjet's responsive mail builder (Passport) which helps you design your emails easily."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["At the end of this guide you will have a flexible e-commerce template, which will cover different types of actions - order confirmation (including list of purchased products), out of stock notice, refund request, unavailable product notification."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"content-insertion","__idx":5},"children":["Content insertion"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"leverage-custom-contact-data","__idx":6},"children":["Leverage custom contact data"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can personalize the name for the recipient using the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/docs/email-api/contact-management/manage-sub-status-existing-contact"},"children":["contact data"]},"."]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"Hello {{data:firstname:”customer”}}\n","lang":"html"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"insert-an-image","__idx":7},"children":["Insert an image"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can insert an image, providing only the public image URL. For example:"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"html","header":{"controls":{"copy":{}}},"source":"<img src=\"{{var:url}}\" alt=\"some_text\" style=\"width:width;height:height;\" />\n","lang":"html"},"children":[]}]},"headings":[{"value":"Passport","id":"passport","depth":1},{"value":"Using the Passport integration tool","id":"using-the-passport-integration-tool","depth":2},{"value":"Adding logic as a text","id":"adding-logic-as-a-text","depth":3},{"value":"Inserting Template block","id":"inserting-template-block","depth":3},{"value":"Use case","id":"use-case","depth":3},{"value":"Content insertion","id":"content-insertion","depth":2},{"value":"Leverage custom contact data","id":"leverage-custom-contact-data","depth":3},{"value":"Insert an image","id":"insert-an-image","depth":3}],"frontmatter":{"title":"Templating Language Passport","seo":{"description":"Use Passport, Mailjet's email builder, to add conditional show/hide sections, template blocks, and product loops with template language.","title":"Passport"}},"lastModified":"2026-08-26T10:53:57.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/docs/email-api/template_language/passport","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}