# Unlayer Documentation > Unlayer is an embeddable, white-label drag-and-drop editor SDK that lets your users design responsive emails, landing pages, documents, and popups inside your own application. It pairs the visual builders with built-in AI — an assistant that edits designs from a chat prompt and an importer that turns HTML or screenshots into editable templates — plus a server-side Cloud API for exporting designs to HTML, PDF, images, and ZIP. These docs cover embedding and configuring the JavaScript builders (with React, Angular, and Vue wrappers), the AI features, deep white-label customization, the Cloud API, developer tools (CLI, Hyper Elements for transactional emails, landing pages, invoices, and PDFs in React code, MCP server, and AI coding-assistant Skills), and the portable design JSON data model. This file contains all documentation content in a single document following the llmstxt.org standard. ## Vanilla JS # Vanilla JS Setup This guide covers embedding Unlayer directly with plain HTML and JavaScript. No framework or build tools required. --- ## Step 1: Add the Embed Script Include the Unlayer embed script in your HTML page: ```html Unlayer Editor ``` --- ## Step 2: Initialize the Editor ```html ``` --- ## Step 3: Add Export and Save Buttons ```html ``` --- ## Complete Example ```html Unlayer Editor ``` --- ## Configuration Options Pass additional options to customize the builder: ```javascript unlayer.init({ id: 'editor-container', displayMode: 'email', appearance: { theme: 'modern_light', }, features: { textEditor: { spellChecker: true, }, }, }); ``` --- ## Loading a Saved Design ```javascript // After the editor is ready unlayer.addEventListener('editor:ready', function () { var savedDesign = /* fetch from your backend */; unlayer.loadDesign(savedDesign); }); ``` --- ## What's Next - Explore the full [Builders documentation](/builder/installation) for advanced options. - Consider using a [framework wrapper](/builder/react-component) for richer integration. --- ## Get Started with Unlayer Unlayer helps developers add content creation to their applications. Let users design emails, pages, images, and documents with drag-and-drop builders, while your app uses APIs and AI to generate, save, export, and automate content. Ship a complete content workflow without building the entire stack yourself. Pick a product and follow the step-by-step guide, or choose your framework below. ## Framework Setup Already know your stack? Wire up the SDK in your framework. ## How Unlayer Fits Together --- ## Export HTML Now that you have set up the editor in your application and users are creating content, it's time to save the resulting work i.e HTML. This is how you can export the design's HTML. :::tip Save Button Most applications will add a save button that calls this export function. ::: ```javascript unlayer.exportHtml(function (data) { var json = data.design; // design json var html = data.html; // final html // Do something with the json and html }); ``` ## Callback Parameters The exportHtml callback returns the following parameters. | Name | Description | | :--------- | :-------------------------------------------------------------------------------------------------------------------------------------------- | | **design** | This is the JSON of the design | | **html** | This is the full HTML of the design, starting with the opening `` tag to the closing `` tag. | | **chunks** | This includes the chunks of HTML separately in case you want to build your own layout. Check the [chunk parameters](#chunk-parameters) below. | --- ## Chunk Parameters The following chunks of HTML are available. | Name | Description | | :-------- | :--------------------------------------------------------------------------------------------------------------------------------------------------- | | **body** | This is the body part of the HTML that is added inside the `` tags. | | **css** | This is the CSS required for the design to render properly. You can add it inside the `` tags. | | **js** | This is the JS required for the design to render properly. You can add it inside the `` tags. | | **fonts** | This includes any web fonts or [custom fonts](../../advanced-configuration/font-management/custom-fonts.md) used in the design so you can load them. | --- ## Export Options You can also pass certain options to this function as a second parameter. ### Cleanup By default, we clean up the final HTML and remove unused HTML class names and CSS styles. If you want to disable that feature, you can pass `cleanup: false`. ```javascript unlayer.exportHtml( function (data) { var json = data.design; var html = data.html; }, { cleanup: true, }, ); ``` ### Minify By default, the HTML output is not minified or compressed. However, it is recommended to export the HTML minified and compressed as it can reduce the file size by up to 25%. ```javascript unlayer.exportHtml( function (data) { var json = data.design; var html = data.html; }, { minify: true, }, ); ``` ### Outlook Support Email exports include compatibility markup for classic Outlook for Windows and legacy Internet Explorer by default. If your recipients use email clients that render standard HTML and CSS, pass `outlookSupport: false` to reduce the exported HTML size. ```javascript unlayer.exportHtml( function (data) { // Send or save data.html }, { minify: true, outlookSupport: false, }, ); ``` This removes conditional comments and their Outlook-only content, including layout tables, VML backgrounds and buttons, and Outlook image copies. The normal HTML content is preserved. The option also applies to conditionals in custom HTML and custom exporters, and to `chunks.body` and `chunks.tags`. Only use this option when you can accept reduced layout, image scaling, background image, and button compatibility in classic Outlook for Windows. This also removes Outlook's image-scaling safeguards and conditionals around web-font links. Content hidden on desktop may also appear in classic Outlook when its conditional hiding markup is removed. Modern Outlook clients that use standard HTML rendering keep the normal HTML version. Other display modes and AMP HTML are unchanged; an AMP export's normal HTML fallback honors the option. The option applies to that export call. Preview, including Inbox Previews, and Send Test Email keep the default compatibility markup. Editor versions released before this option ignore it. ### Reducing Email Size Start with `minify: true` and keep the default cleanup enabled. Use fewer rows and columns where possible, remove unused content, and avoid repeating large blocks of inline HTML or CSS. Use `outlookSupport: false` only if the compatibility tradeoff above fits your recipients. Measure the UTF-8 byte size of the final HTML after your email provider adds tracking links or other markup: ```javascript const bytes = new TextEncoder().encode(html).length; ``` Leave room below Gmail's approximately 102 KB clipping limit. Minification and the Outlook opt-out reduce markup but do not guarantee that a long email will avoid clipping. Remote image file sizes are separate from the HTML size; embedded image data contributes to it. ### Merge Tags If you want the [Merge Tags](../../advanced-configuration/dynamic-content/merge-tags.md) in your design to be replaced by different values, you can pass the `mergeTags` object to export options. ```javascript unlayer.exportHtml( function (data) { var json = data.design; var html = data.html; }, { mergeTags: { first_name: 'John', last_name: 'Doe', }, }, ); ``` ### Inline Styles Inline Styles options can be used to Inline the global css styles for links. This is useful in some instances for the email builder where Gmail or some other clients may not respect the link styles. By default, this is set to `false`. ```javascript unlayer.exportHtml( function (data) { var json = data.design; var html = data.html; }, { inlineStyles: true, }, ); ``` --- ## Cloud API You can also use our Cloud API if you want to export a design to HTML from a server-to-server API call. [Learn More](/server/cloud-api/reference#tag/export/operation/exportHtml) --- ## Export Image Similar to the [Export HTML](./export-html.md) function, you can also export a design in image format. This would upload the generated image to your connected [File Storage](../../files-storage/file-storage/overview.md) and send the link to the callback function. Note: Unlike HTML or plain text, images are not generated on the client. This function uses our cloud API to generate the image. Each call counts toward your workspace's monthly [export allowance](/server/cloud-api/export-allowances). When the allowance is used up, the callback receives an `error` message and no `url`. ```javascript unlayer.exportImage(function (data) { var json = data.design; // design json var imageUrl = data.url; // image url // Do something with the image url }); ``` ## Callback Parameters The exportImage callback returns the following parameters. | Name | Description | | :--------- | :------------------------------------- | | **design** | This is the JSON of the design | | **url** | This is the URL of the generated image | --- ## Export Options You can also pass certain options to this function as a second parameter. ### Merge Tags If you want the [Merge Tags](../../advanced-configuration/dynamic-content/merge-tags.md) in your design to be replaced by different values, you can pass the `mergeTags` object to export options. ```javascript unlayer.exportImage( function (data) { var json = data.design; // design json var imageUrl = data.url; // image url }, { mergeTags: { first_name: 'John', last_name: 'Doe', }, }, ); ``` --- ### Full Page If you want the exported image to be the full page design, you can use this option. It is enabled by default. ```javascript unlayer.exportImage( function (data) { var json = data.design; // design json var imageUrl = data.url; // image url }, { fullPage: false, }, ); ``` --- ## Cloud API If you want to generate an image on the server-side, you can use our [Cloud API](/server/cloud-api/reference#tag/export/operation/exportImage). ```javascript const fetch = require('node-fetch'); let url = 'https://api.unlayer.com/v2/export/image'; let options = { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: 'Basic BASE64-ENCODED-API-KEY', }, body: JSON.stringify({ displayMode: 'email', design: {}, // json of your design mergeTags: { first_name: 'John', last_name: 'Doe' }, }), }; fetch(url, options) .then((res) => res.json()) .then((json) => console.log(json)) .catch((err) => console.error('error:' + err)); ``` Learn more at [Cloud API reference](/server/cloud-api/reference#tag/export/operation/exportImage). ### Document designs For a design built with the [Document Builder](../../builders/document-builder/overview.md) (`displayMode: 'document'`), the image is the first page of the document as the [PDF export](./export-pdf.md) shows it: the same page size, margins, header and footer. The header and footer appear when your plan includes them, as in the PDF. To change the paper, pass `pageSize` and `documentOrientation`. They work as in the [PDF export](./export-pdf.md#page-format), with the same plan rules and the same `403` and `400` responses. The image is as wide as the page, for example 794 pixels for A4, multiplied by `deviceScaleFactor` when you pass it. For document designs the scale counts as at least 1 and at most 3, so 0.5 still gives 794 pixels and 4 gives 2382. `fullPage` doesn't apply, and later pages aren't included; export a PDF to get every page. In the editor, `unlayer.exportImage` doesn't support document designs, so use the Cloud API. ### Response The API response will return an uploaded image URL. ```json { "success": true, "data": { "url": "https://.../1593082715347-8LCcNZuuBpU4D92W.png" } } ``` --- ## Export PDF Similar to the [Export HTML](./export-html.md) function, you can also export a design in PDF format. This would upload the generated PDF to your connected [File Storage](../../files-storage/file-storage/overview.md) and send the link to the callback function. In the [Document Builder](../../builders/document-builder/overview.md), the PDF is rendered in the browser and stored like a server export, on plans that include PDF export. These PDFs don't count toward your export allowance, and in Unlayer's storage they are deleted after 7 days. Our cloud API renders the few the browser can't deliver, such as one over 25 MB, and those count. To get the PDF itself instead of a link, use [`dataUrl`](#data-url). See [PDF Rendering](../../builders/document-builder/pdf-rendering.md). :::warning Document Builder links can expire after 7 days A Document Builder `url` that points to Unlayer's storage stops working 7 days after the export when the browser rendered the PDF, which is most of the time. PDFs that Unlayer's servers render instead (on a free plan, or when the browser can't build or upload the PDF) and PDFs stored in your own Amazon S3 bucket stay until you delete them. The callback doesn't say which one you got, so if you keep PDFs longer than 7 days, save the file itself: download it from `url` within 7 days, or pass [`dataUrl: true`](#data-url) and store the PDF yourself. Links from the other display modes don't expire. ::: In the other display modes, this function uses our cloud API to generate the PDF. Each PDF our cloud API generates counts toward your workspace's monthly [export allowance](/server/cloud-api/export-allowances). When the allowance is used up, the callback receives an `error` message and no `url`. ```javascript unlayer.exportPdf(function (data) { var json = data.design; // design json var pdfUrl = data.url; // pdf url // Do something with the PDF url }); ``` ## Callback Parameters The exportPdf callback returns the following parameters. | Name | Description | | :----------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **design** | This is the JSON of the design | | **url** | This is the URL of the generated PDF, or the PDF itself as a `data:` URL with [`dataUrl`](#data-url) | | **offline** | `true` when a document was rendered in the browser in offline mode: `url` is then a `data:` URL, not an upload | | **error** | Why no PDF was produced. `url` is then `null` or absent | | **warnings** | What a document's PDF misses or draws differently, such as an image that couldn't be loaded, when it was rendered in the browser. Absent when there's nothing to report | --- ## Export Options You can also pass certain options to this function as a second parameter. ### Merge Tags If you want the [Merge Tags](../../advanced-configuration/dynamic-content/merge-tags.md) in your design to be replaced by different values, you can pass the `mergeTags` object to export options. ```javascript unlayer.exportPdf( function (data) { var json = data.design; // design json var pdfUrl = data.url; // pdf url }, { mergeTags: { first_name: 'John', last_name: 'Doe', }, }, ); ``` In the [Document Builder](../../builders/document-builder/overview.md), substituted values can change how tall each row is. The browser paginates each PDF from its rendered content, with the values and `language` you pass, so when those differ from what the canvas displays (a merge tag's sample, or its name when it has no sample), the PDF's page breaks can differ from the canvas. --- ### Data URL Pass `dataUrl: true` to receive the PDF itself in `url`, as a `data:` URL, instead of a link to a stored file. Use it when you store or send the PDF yourself. ```javascript unlayer.exportPdf( function (data) { var pdfDataUrl = data.url; // data:application/pdf;base64,... }, { dataUrl: true, }, ); ``` In the [Document Builder](../../builders/document-builder/overview.md), where the browser renders the PDF, nothing is uploaded. When the browser can't build the PDF, the callback receives an `error` instead: when the editor is hidden with `display: none`, which leaves the browser nothing to measure, when the PDF's fonts can't be loaded, or when the document is too large for the browser renderer (hundreds of dense pages). Without `dataUrl`, Unlayer's servers render those. In the other display modes, our cloud API renders the PDF and stores it in your File Storage, and the editor reads it back to return it. If it can't be read, the callback receives an `error` and no `url`. Browsers don't open a `data:` URL in a new tab or window. To show the PDF, convert it to a `Blob` and open an object URL, or download it with a link that has a `download` attribute. --- ### Page Format When using the [Document Builder](../../builders/document-builder/overview.md) (`displayMode: 'document'`), you can override the page format that the PDF will be rendered at without modifying the saved design. This is useful for generating the same design at different paper sizes — for example, rendering a US customer's invoice as Letter and an EU customer's as A4 from a single template. :::info Availability In the editor SDK and Export API v3, `pageSize` and `documentOrientation` overrides require a plan that includes PDF page-format overrides. Legacy plans use A4 portrait for document-mode exports. They can omit the fields or explicitly pass the A4 portrait no-op; a different format is refused: `exportPdf` receives an `error`, and Export API v3 returns a `403` response. The deprecated Export API v2 keeps its original `pageSize` contract for backward compatibility. Existing PDF customers, including legacy plans, can continue to use its full supported format list. The newer `documentOrientation` option still requires PDF page-format overrides. All versions still require PDF export access. ::: | Option | Type | Description | | :------------------------ | :------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------- | | **`pageSize`** | `'Letter'` \| `'Legal'` \| `'Tabloid'` \| `'Ledger'` \| `'A0'` \| `'A1'` \| `'A2'` \| `'A3'` \| `'A4'` \| `'A5'` \| `'A6'` | Paper size for the PDF. Requires PDF page-format overrides on v3; retained for existing PDF customers on v2. | | **`documentOrientation`** | `'portrait'` \| `'landscape'` | Page orientation override. Requires a plan that includes PDF page-format overrides. | When `pageSize` is omitted, document-mode exports use the design's saved page size and orientation when the plan includes page-format controls. Projects without this feature use A4 portrait instead; non-default page values stored in their designs are ignored. The saved setting is named `body.values.documentSize`; it is not a separate export parameter. Saved formats use their standard physical paper dimensions consistently across Export API v2 and v3. Page margin comes from the design's saved `body.values.documentMargin`, including when `pageSize` overrides the paper. The default `'auto'` uses the format's standard margin (A5 uses a tighter margin than A4), and a pixel value applies as saved. Margin isn't a per-call option. See [Page Format](../../builders/document-builder/page-format.md). When `pageSize` is used without `documentOrientation`, it keeps the named PDF format's natural orientation instead of inheriting the orientation stored in the design. Ledger is naturally landscape; every other listed format is naturally portrait. Projects with PDF page-format overrides can pass `documentOrientation: 'portrait'` to rotate Ledger. All plans with PDF export access can export without a per-call format override: ```javascript unlayer.exportPdf((data) => console.info(data)); ``` Plans with PDF page-format overrides can select another format through the editor SDK or Export API v3: ```javascript unlayer.exportPdf((data) => console.info(data), { pageSize: 'Letter' }); ``` Legacy integrations calling Export API v2 directly can also continue sending `pageSize`. An unsupported `pageSize` isn't replaced by another paper size: `exportPdf` receives an `error`, and the Export API returns a `400` response. ```javascript unlayer.exportPdf( function (data) { var json = data.design; var pdfUrl = data.url; }, { pageSize: 'Letter', documentOrientation: 'landscape', }, ); ``` When an override changes the page geometry, the PDF is paginated using the override's dimensions rather than the editor's currently-displayed pagination. The result will differ from what you see on the canvas if the override's geometry doesn't match the design's saved values — that's intentional. Existing v2 integrations continue using `pageSize` for PDF export. New v3 integrations need PDF page-format override access to select a non-A4 document format. --- ### Watermark When using the [Document Builder](../../builders/document-builder/overview.md), you can stamp a text watermark over every page of the PDF. For example, you can mark a draft you send to a client for review. The watermark is drawn on top of the finished pages, so your content and layout stay exactly as designed. :::info Availability Custom watermarks require a current paid plan that includes Document Watermarks; legacy plans don't include them. They work on document-mode PDFs (`displayMode: 'document'`) through the editor SDK, Export API v3 and the deprecated Export API v2. On free plans, document PDFs and the editor canvas carry an Unlayer watermark on every page. Free plans don't include Document Watermarks, so a request for a custom watermark is refused, as described below. ::: | Option | Type | Description | | :------------- | :-------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------- | | **`text`** | `string` | Required. Plain text, printed literally on a single line (HTML isn't interpreted). 1 to 100 characters. | | **`position`** | `'diagonal'` \| `'center'` \| `'top'` \| `'bottom'` | Where the watermark sits on each page. `diagonal` runs corner to corner; `top` and `bottom` place it along that edge. Defaults to `'diagonal'`. | | **`opacity`** | `number` | From `0.05` to `1`. Defaults to `0.2`. | | **`color`** | `string` | Color as `#RGB`, `#RRGGBB` or `rgb(r, g, b)` with 0–255 channels. Defaults to `#808080`. | The text size is chosen automatically so the watermark fits the page. Watermark a single export: ```javascript unlayer.exportPdf( function (data) { var pdfUrl = data.url; }, { watermark: { text: 'Draft for client review', position: 'diagonal', opacity: 0.2, color: '#808080', }, }, ); ``` To watermark every PDF by default, including the document preview and its **Download PDF** button, set `features.watermark` when you initialize the editor: ```javascript unlayer.init({ // ... displayMode: 'document', features: { watermark: { text: 'Draft', position: 'top' }, }, }); ``` The editor also draws this default on every page of the canvas and its page thumbnails, where the PDF will place it, so you design with it in view. The canvas watermark is only a guide in the editor and is never part of the exported HTML. A `watermark` passed to a single call replaces the default for that call, and `watermark: false` turns it off: ```javascript unlayer.exportPdf((data) => console.info(data), { watermark: false }); ``` You can also set the watermark for one preview: ```javascript unlayer.showPreview({ watermark: { text: 'Draft v2' } }); ``` If you request a watermark on a plan without Document Watermarks, or with invalid options, `exportPdf` doesn't create a PDF and its callback receives an `error` instead of a `url`. `showPreview` refuses it the same way: the preview shows that error instead of the document, and its **Download PDF** button doesn't download. An `unlayer.init` default that can't apply, including one with invalid options, is skipped with a console warning instead, so exports and previews keep working. --- ## Cloud API If you want to generate the PDF on the server-side, you can use our [Cloud API](/server/cloud-api/reference#tag/export/operation/exportPdf). ```javascript const fetch = require('node-fetch'); let url = 'https://api.unlayer.com/v2/export/pdf'; let options = { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: 'Basic BASE64-ENCODED-API-KEY', }, body: JSON.stringify({ displayMode: 'email', design: {}, // json of your design mergeTags: { first_name: 'John', last_name: 'Doe' }, }), }; fetch(url, options) .then((res) => res.json()) .then((json) => console.info(json)) .catch((err) => console.error('error:' + err)); ``` Learn more at [Cloud API reference](/server/cloud-api/reference#tag/export/operation/exportPdf). For document-mode designs, set `displayMode: 'document'`. This v2 endpoint preserves `pageSize` for existing PDF customers, including legacy plans. Passing `documentOrientation` still requires PDF page-format override access. On Export API v3, selecting a non-A4 document format requires that access as well. Page margin comes from the design's `body.values.documentMargin` and isn't a separate request field. ```javascript body: JSON.stringify({ displayMode: 'document', design: {}, // json of your document design pageSize: 'Letter', documentOrientation: 'landscape', }); ``` To watermark a document PDF from your server, pass `watermark` to Export API v3. It takes the same options as the [editor SDK](#watermark) and requires a plan that includes Document Watermarks. When the watermark has been applied, the response `data` includes `"watermark": "custom"`. Free plans don't include PDF export, so the API returns a `403` response. On a free plan with PDF export enabled, whose document PDFs always carry the Unlayer watermark, it includes `"watermark": "unlayer"` instead, even when you don't pass `watermark`. The deprecated v2 endpoint accepts the same `watermark` field and returns the same confirmation. ```javascript let url = 'https://api.unlayer.com/v3/templates/export/pdf'; let options = { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: 'Bearer unlayer_sk_your_api_key', }, body: JSON.stringify({ displayMode: 'document', design: {}, // json of your document design watermark: { text: 'Confidential', position: 'top', opacity: 0.4 }, }), }; ``` An API key is scoped to one project. With a [Personal Access Token](/server/authentication), add `?projectId=YOUR_PROJECT_ID` to the URL. See the [Export PDF reference](/server/cloud-api/reference#tag/export/operation/exportPdf) for every request field. ### Response The API response will return an uploaded pdf URL. ```json { "success": true, "data": { "url": "https://.../1593082715347-8LCcNZuuBpU4D92W.pdf" } } ``` --- ## Export Plain Text Similar to [Export HTML](./export-html.md), you can also export a design in plain text. This is useful if you want to send an email in multiple formats for different email clients. ```javascript unlayer.exportPlainText(function (data) { var json = data.design; // design json var text = data.text; // final text // Do something with the json and text }); ``` ## Callback Parameters The exportPlainText callback returns the following parameters. | Name | Description | | :--------- | :---------------------------------------- | | **design** | This is the JSON of the design | | **text** | This is the full plain text of the design | --- ## Export Options You can also pass certain options to this function as a second parameter. ### Omit Content You can configure which parts of the design you want to omit in the plain text. For example, you can choose to ignore images, links, or preheader text. ```javascript unlayer.exportPlainText( function (data) { var json = data.design; var text = data.text; }, { ignoreLinks: true, ignoreImages: true, ignorePreheader: true, }, ); ``` | Name | Description | | :------------------ | :---------------------------------------------- | | **ignoreLinks** | Links and buttons will not be included | | **ignoreImages** | Image alt text will not be included | | **ignorePreheader** | Pre-header text for emails will not be included | ### Merge Tags If you want the [Merge Tags](../../advanced-configuration/dynamic-content/merge-tags.md) in your design to be replaced by different values, you can pass the `mergeTags` object to export options. ```javascript unlayer.exportPlainText( function (data) { var json = data.design; var text = data.text; }, { mergeTags: { first_name: 'John', last_name: 'Doe', }, }, ); ``` --- ## Export ZIP Similar to the [Export HTML](./export-html.md) function, you can also export a design as a ZIP file. This generates a bundle ZIP file that also includes all the images required by your design and uploads it to your connected [File Storage](../../files-storage/file-storage/overview.md). Note: Unlike HTML or plain text, ZIP file is not generated on the client. This function uses our cloud API to generate the ZIP file. Each call counts toward your workspace's monthly [export allowance](/server/cloud-api/export-allowances). When the allowance is used up, the callback receives an `error` message and no `url`. ```javascript unlayer.exportZip(function (data) { var json = data.design; // design json var fileUrl = data.url; // zip file url // Do something with the ZIP url }); ``` ## Callback Parameters The exportZip callback returns the following parameters. | Name | Description | | :--------- | :---------------------------------------- | | **design** | This is the JSON of the design | | **url** | This is the URL of the generated ZIP file | --- ## Export Options You can also pass certain options to this function as a second parameter. ### Merge Tags If you want the [Merge Tags](../../advanced-configuration/dynamic-content/merge-tags.md) in your design to be replaced by different values, you can pass the `mergeTags` object to export options. ```javascript unlayer.exportZip( function (data) { var json = data.design; // design json var fileUrl = data.url; // zip file url }, { mergeTags: { first_name: 'John', last_name: 'Doe', }, }, ); ``` --- ## Cloud API If you want to generate the ZIP file on the server-side, you can use our [Cloud API](/server/cloud-api/reference#tag/export/operation/exportZip). ```javascript const fetch = require('node-fetch'); let url = 'https://api.unlayer.com/v2/export/zip'; let options = { method: 'POST', headers: { 'Content-Type': 'application/json', Authorization: 'Basic BASE64-ENCODED-API-KEY', }, body: JSON.stringify({ displayMode: 'email', design: {}, // json of your design mergeTags: { first_name: 'John', last_name: 'Doe' }, }), }; fetch(url, options) .then((res) => res.json()) .then((json) => console.log(json)) .catch((err) => console.error('error:' + err)); ``` Learn more at [Cloud API reference](/server/cloud-api/reference#tag/export/operation/exportZip). ### Response The API response will return an uploaded zip file URL. ```json { "success": true, "data": { "url": "https://.../1593082715347-8LCcNZuuBpU4D92W.zip" } } ``` --- ## Installation This page will help you get started with Unlayer. You'll be up and running in a jiffy!