Skip to main content

Overview

The Server section covers everything that runs outside the browser.

While Builders run inside your application (client-side), Server APIs allow you to:

  • Generate artifacts (HTML, PDF, Image, ZIP)
  • Process designs server-side
  • Integrate Unlayer into backend workflows
  • Execute secure operations that should not run in the browser

This is the backend execution surface of Unlayer.


When to Use the Server APIs

Use the Server surface when:

  • You need to generate a PDF from a design in a background job
  • You want to export HTML without exposing API keys to the browser
  • You want to generate an image preview server-side
  • You are running a cron job, webhook handler, or worker process
  • You need authenticated access using your API key
Embedding the builder?

If your use case involves embedding a visual builder or editor in your frontend, see Builders instead.


How It Works

Most server workflows follow this pattern:

Server workflow: design JSON from browser to backend; Cloud API returns artifact

  1. A Builder produces a design JSON (in the browser).
  2. Your backend sends that JSON to the Cloud API.
  3. The API returns a generated artifact (HTML, PDF, Image, ZIP).
  4. You store, send, or distribute the result.

Cloud API

The Cloud API is the primary server-side interface.

It allows you to:

  • Export HTML
  • Export PDF
  • Export Image
  • Export ZIP bundles
  • Fetch templates from Unlayer Console
  • Apply merge tags dynamically
  • Generate files securely using your API key

All requests are authenticated and executed server-to-server.

Exporting HTML

For HTML export, you often don't need the Cloud API—the builder can produce HTML directly in the browser via unlayer.exportHtml(); Use the Cloud API when you need to export HTML server-side (for example, in a background job or when the user is not in the builder).

See the Cloud API reference for endpoint details.


Security Model

Server APIs use API key authentication.

Keep API keys server-side

Because requests are authenticated with your API key:

  • Never call the Cloud API directly from the browser
  • Always proxy requests through your backend
  • Keep API keys in secure server-side environments only

Typical Server Use Cases

Use caseDescription
Export PDF in background jobGenerate a PDF after a user submits a form, then email it automatically.
Generate HTML for email sendingExport HTML server-side and pass it to your email provider.
Image thumbnail generationGenerate preview images for templates or documents.
ZIP export for asset bundlesProduce downloadable packages including images and required assets.

What's Next

  • See Cloud API for the full endpoint reference.
  • If you're embedding the builder, go to Builders.