> Agents can also search and read this documentation through its [MCP server](https://documentation.alpaco.email/~gitbook/mcp).

# Introduction

This documentation is for developers/designers of HTML templates. If you are a marketeer / email content creator, please refer to the Fundamentals.

## What is Alpaco?

Alpaco is an an intuitive, flexible, scalable, collaborative Email Design Platform for your Marketing Team that integrates with your existing setup. Our platform gives life to your Email Design System with unprecedented control over your email campaigns and an approach to email management, much like you would build a website in a CMS. The result is 90% less time spent on email creation, and ensure your emails will be on brand and on time - all the time.

### Get started

Follow the next step and start making your emails templates smarter:


# What are the fundamentals

In this section we'll go over what are the fundamentals to understand before you get going with setting up your organization in Alpaco.

### Preliminary

In order to get started with making your templates smart, first you'll need:

1. A template in HTML
2. Basic understanding of HTML
3. Understanding of [Liquid markup coding](https://shopify.github.io/liquid/).

### What is a Template?

A **Template** is the entirety of the combinations of design, rules, dependencies you create your emails with. A template contains the overall design rules and thus serves as the foundation for your emails. In order to distinguish between what is the "foundation" and what is the building blocks that can be set on to that foundation, we've divided the Template into two different sections. "[Base](https://documentation.alpaco.email/template/base)" will be referred to as the foundation, where as "[Blocks](#what-is-a-block)" are the building blocks to be inserted into the [Base](https://documentation.alpaco.email/template/base) - they're both vital elements around the concept of a Template.<br>

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FX6D6w3wHkTqZyXbzab3l%2FSk%C3%A6rmbillede%202023-09-21%20131134.png?alt=media&amp;token=367de8e8-b295-4258-bfe2-31bb9d27e093" alt=""><figcaption><p>A Template usually starts off only with the top and bottom, leaving a frame in the middle to insert Blocks, also known as the Base.</p></figcaption></figure>

For more on how to get started with a template, read the section [**Base**](https://documentation.alpaco.email/template/base) in Fundamentals.

### What is a Block?

A [Block](https://documentation.alpaco.email/template/blocks) is an element that can be moved around, repeated, deleted and basically what is being drag & dropped into the [Base](https://documentation.alpaco.email/template/base). It is a container that has its own sets of code and rules.

A Block can be many things, containing many different rules and settings, however you like it - the fundamental principal to understand is it's movable within the "foundation" that is the [Base](https://documentation.alpaco.email/template/base).

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FGzfB6HJIMd0AZjzbx8tM%2FSk%C3%A6rmbillede%202023-09-21%20131503.png?alt=media&amp;token=ead140f3-3d13-4bd0-a281-865c92a288ca" alt=""><figcaption><p>Here a Block has been inserted into the frame. Right side shows the settings allowed in that Block.</p></figcaption></figure>

For more on how to get started with a block, read the section [Blocks](https://documentation.alpaco.email/template/blocks) in Fundamentals.

### What is an Integration?

An **Integration** is the link that is made between Alpaco and your Email Service Provider(ESP). Through the integration the email you've created will be exported to your ESP, which will populate your email with customer data and be able to send it out.\
It's important to understand that Alpaco is not an email platform, but serves as an addition to your current Email Marketing Setup. It will substitute the editing and creative part, making it increasingly faster and more productive working with email.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FUuOq2XM90htiIbE4n8Um%2FSk%C3%A6rmbillede%202023-09-21%20133935.png?alt=media&amp;token=c64d5ee3-7f82-4aac-9e92-b8e671ea6d6f" alt=""><figcaption><p>Here the user has completed the content creation of an Email and is now ready to export it to their ESP.</p></figcaption></figure>

For more on how to setup an integration, read the section [Integrations](https://documentation.alpaco.email/account-settings/integrations) in Account Settings.

### What is a Merge Tag?

A **Merge Tag** is a personalization variable that is contained, defined and managed within your Email Service Provider(ESP), and to be used within the content of your emails. It can be things like your customers *Firstname*, *Birthdays, loyalty-points ect.* Basically anything you have in a structured format, to be used in text. Whichever syntax your ESP dictates, Merge Tags can handle.\
\
Because these variables can be hard to spell correctly and are even stripped if typed in-correct, Merge Tags is a way of setting them up in a simple and structured dropdown, so you don't have to remember the exact syntax of for instance "firstname".

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FyCtNDiUCW6E3n8hc7rmF%2FSk%C3%A6rmbillede%202023-09-21%20135355.png?alt=media&amp;token=d031fecf-f0b1-4829-9df3-5d4e7e258045" alt=""><figcaption><p>Here the user has clicked the Merge tag button on a text field to show which Merge Tag is available to them.</p></figcaption></figure>

For more on how to get started with a Merge Tags, read the section [Merge Tags](https://documentation.alpaco.email/account-settings/merge-tags) in Account Settings.


# Creating an email

In this section we'll go over how you actually get started with creating an email when all have been setup correctly with Base, Blocks, Merge Tags and Integrations

When you've got all the fundamentals right, setup your [Base](https://documentation.alpaco.email/template/base), [blocks](https://documentation.alpaco.email/template/blocks), [Merge Tags](https://documentation.alpaco.email/account-settings/merge-tags) and [Integration](https://documentation.alpaco.email/account-settings/integrations), you're ready to start creating some emails with it.

### Step 1

In the lobby, Click the button saying "**New email**" in the top right corner.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2F7qOTPd2X4YtiH6sUW6HE%2FSk%C3%A6rmbillede%202023-09-21%20142032.png?alt=media&amp;token=d9b940ff-5d1e-43ee-a80e-677223a6a604" alt=""><figcaption><p>The Lobby contains all emails created on your account. Here you can segment them into folders, templates, brands ect.</p></figcaption></figure>

### Step 2

You'll be redirected to a page where you need to type in the **name** of the email and choose which **Template** to use. Click "**Save**" when you're satisfied with your choose (the name of the email can always be changed later).

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2Fh4OJagLOo40iCAWUViF7%2FSk%C3%A6rmbillede%202023-09-21%20142302.png?alt=media&amp;token=3d84c4a2-2d24-4e97-83b4-ed8c4e8cb1ff" alt=""><figcaption></figcaption></figure>

### Step 3

You'll start off with a fresh [Template](https://documentation.alpaco.email/template/base) ready to insert [Blocks](https://documentation.alpaco.email/template/blocks) into it and all settings set to their default state.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FX6D6w3wHkTqZyXbzab3l%2FSk%C3%A6rmbillede%202023-09-21%20131134.png?alt=media&amp;token=367de8e8-b295-4258-bfe2-31bb9d27e093" alt=""><figcaption></figcaption></figure>

### Step 4

Start editing the content, by changing the settings in the right-side and drag\&drop Blocks into the "Base" in the right side.\
\
Some settings can be done on the Base, affecting the "frame" of the template, or even individual blocks. In this example, clicking the tab "Base settings" in the right side, we're able to turn off the menu header at the top.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2F4cBFBZNtuvhOFf8GfqZl%2FSk%C3%A6rmbillede%202023-09-21%20145429.png?alt=media&amp;token=805d5ec7-4b3d-4bc6-8a07-e1dbcab10747" alt=""><figcaption><p>Notice the tickbox saying "header" in the right side is ticked off, leaving the menu in the top in the left side preview to dissapear.</p></figcaption></figure>

Switching the Tab in the right side back to "Blocks" we're able to choose from a variety of Blocks, designed for this Template.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FX6D6w3wHkTqZyXbzab3l%2FSk%C3%A6rmbillede%202023-09-21%20131134.png?alt=media&amp;token=367de8e8-b295-4258-bfe2-31bb9d27e093" alt=""><figcaption></figcaption></figure>

In this example we'll be inserting the Block, called "*Article*" from the right side and drag\&drop it into the Base. That should leave us with something looking like this, seeing all the settings we have available for that particular Block in the right side.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FayUOa5AWFUyI6L9NIov0%2FSk%C3%A6rmbillede%202023-09-21%20150650.png?alt=media&amp;token=f26e0013-f11b-4a68-ae9c-d660e68a2409" alt=""><figcaption></figcaption></figure>

Now playing around with those settings in the right side, we can start to see we can alter how the Block looks like, however only to the degree that the Developer/Designer has allowed us to change.

This process can be repeated, altered and continued for an indefinite number of Blocks. It is adviced for safety reasons to click the "**Save**" button as you go along with your content creation.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2Fur9gIdRlsb29GM0hhLSk%2FSk%C3%A6rmbillede%202023-09-21%20151250.png?alt=media&amp;token=baeee6c6-2120-4107-ba77-9a4d758c348a" alt=""><figcaption><p>Notice how the settings in the right side has been altered, affecting the look of the Block in the left side.</p></figcaption></figure>

### Step 5

When you're happy with the outcome, you're able to view how it will all look on Desktop and Mobil devices at the top, and you can safely click the "**Review**" button to advance to the last stage - the "*Review page*".

Here you're able to do a series of things, but most importantly you're able to click the "**Export"** button in the top right side and it will automatically send your email to your Email Service Provider(ESP).

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2F3jdPp1KAOy8O5mt2i3hy%2FSk%C3%A6rmbillede%202023-09-21%20153459.png?alt=media&amp;token=acc11904-9d06-40b9-a784-b9d6c479c886" alt=""><figcaption></figcaption></figure>

#### Settings on this page

* Preview the email in Desktop and Mobile view
* Go back and edit the email
* Clone the email
* Export the email
* Change the name of the email
* Change the folder an email belongs to


# Base

Alpaco is much more than a email builder, HTML or CSS, it's a way to systemize and manage your brand, design rules, data-integrations, languages, all those small details needed for an email template.

{% hint style="info" %}
Only users with role **Designer** or **Admin** can access and edit Base
{% endhint %}

A template consist of the following elements:

* A Template [Base](#base)
* A series of [Blocks](#blocks)
* A series of [Inputs](https://documentation.alpaco.email/template/input-groups)

When [creating an email](https://documentation.alpaco.email/fundamentals/creating-an-email), the user first selects the name and which **Template** to use for that particular email. All the options, settings, design and [Blocks](#blocks) are all contained and confined within that template. The design rules are based on the universal language [Liquid](https://liquidjs.com/tutorials/intro-to-liquid.html) and opens up for immense possibilities.&#x20;

\
It's within and between the [Base](#base) and these [Blocks](#blocks), design-rules, data-rules and others are defined.

### Template Editor

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FiuTiuGdNDTfxLUJx6X8M%2FSk%C3%A6rmbillede%202023-09-26%20142835.png?alt=media&amp;token=7ca46d1a-2ce3-41e7-adad-62bd89218faf" alt=""><figcaption><p>The Template Editor wtih Left,- Center,- and Right panel</p></figcaption></figure>

The **Template Editor** is divided into 3 panels:&#x20;

* **Left panel** - is a menu where you can navigate between the [Base](#base) and [Blocks](https://documentation.alpaco.email/template/blocks). By Clicking the + button here you create a new [Block](https://documentation.alpaco.email/template/blocks).&#x20;
* **Center panel -** this is where HTML, CSS and Liquid rules are inserted and highlighted.
* **Right panel -** this is where all [input types](https://documentation.alpaco.email/template/input-groups/input-types) are chosen, named, grouped and configured. From here you can insert different inputs like images, text, links and similar values.&#x20;

### Base

The Base is the foundation of the Template. Think of it as the foundation or the wrapper, from which users can insert[ Blocks](https://documentation.alpaco.email/template/blocks) into. The Base consist of **HTML/CSS** and usually contains tags like `<html>`  and `<head>` but also usually things shared across emails (such as a header with logo or a footer with social links).

The Base will always be found in the **Left panel** at the top.

#### Content Placement

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FFXD1EP8G815lVAqiZk4S%2FSk%C3%A6rmbillede%202023-09-26%20154220.png?alt=media&amp;token=158f5f98-4134-4660-ad89-6e4f45886fea" alt=""><figcaption><p>Insert {{ blocks }} and give the Base a name and a key</p></figcaption></figure>

1. Click the **Base** in the Left panel.
2. Insert your entire template code into the Center panel.
3. Scroll down into the template code in the Center panel and locate where, you in a moment, want to insert [Blocks](https://documentation.alpaco.email/template/blocks). There you **must** insert the following Liquid tag `{{ blocks }}`.
4. In the Right panel, Give the **Base** a compelling name, and a key, like "template", "foundation" or simply "base".

### Global variables

The global tab, found under the Base, is a tab created solely for global rules and styles to be used across **Base** and [Blocks](https://documentation.alpaco.email/template/blocks) governed from a centralized place.

&#x20;\
The tab allows for [JSON](https://www.json.org/json-en.html) formatted objects and does not come with any options for inputs. It's a developer-only list of objects to quickly control multiple values across the template.

Referencing your variables any places is done by the following prefix:

```liquid
{{global.variable-name}}
```

\
The Global tab is excellent at managing any sort of brand defining settings like fonts, font-size, colors, margins, paddings and others that are repeated throughout your template.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FU2JfO7Ck5lDyO09jspEM%2FSk%C3%A6rmbillede%202025-05-13%20172404.png?alt=media&amp;token=2b9677f9-d10c-49aa-9756-ac2146f7d8af" alt=""><figcaption></figcaption></figure>

### Block position logic

In Base, you have access to the **entire sequence of Blocks**. This lets you define logic across all positions — for example, detecting if a certain Block comes third, or inserting a design pattern every fourth block. Sometimes, you want a something in the Base appearance or behavior to change depending on the order in which a certain type of Block is listed.

This is where **Block Position Logic** comes in: a feature that allows to detect the position or sequence of Blocks, and create rules based on that.\
\
The core concept here is that you have an array of Blocks. From here we can start creating rules.\
\
Here are the variables:

```liquid
{% for item in base.all_blocks %}
    {{ item }}
{% endfor %}
```

Put into practice we can then start to look for the Block name, and check if there ever comes a Block named "Article" as the last block in the array, make a change to the footer, so it neatly blends in with the rest of the design.

```liquid
{% assign last_block = base.all_blocks | last %}
{% assign is_article_last = last_block == "article" %}

{% if is_article_last %}
    Background-color:#3a3b38;
{% endif %}
```

**Result**

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2Fu8R870MGQcsMNJGxnoyH%2FSk%C3%A6rmbillede%202025-05-22%20160802.png?alt=media&amp;token=cc6d32d9-a959-49bd-beae-fa3bfe6b412b" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Want to listen to the sequence of Blocks — for example, to detect if a certain type of Block is before or after a specific type of Block and have design logic based on that?\
Check out how [Block Position Logic works](https://documentation.alpaco.email/template/blocks#block-position-logic) *inside* individual Blocks too.
{% endhint %}


# Blocks

If Base is the foundation of a template, Blocks are the building-blocks to build up your template. It's individual modules you can have infinite of.

{% hint style="info" %}
Only users with role **Designer** or **Admin** can access and edit Blocks
{% endhint %}

Blocks consists of the following elements:

* HTML/CSS code
* A series of [Inputs](https://documentation.alpaco.email/template/input-groups)

​When creating a Block, the user needs to think of that Block as a separate entity. It is something that can be inserted multiple times. Usually when implementing the [Base](https://documentation.alpaco.email/template/base) template, the code considered as a Block will be nested in the Base code. In this situation we want to cut it out and separated into it's own Block.

### Creating a Block

​From within the Template Editor, you can create a **Block** from the Left panel.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2F0x5T3gKT11Q0N8fyONed%2FSk%C3%A6rmbillede%202023-09-27%20122736.png?alt=media&amp;token=cbf81a8f-39e6-49a3-bad4-29dd695036a3" alt="" width="237"><figcaption><p>The Left panel is where you create a Block on the + button</p></figcaption></figure>

Either by marking code inside the [Base](https://documentation.alpaco.email/template/base) or by clicking the + icon a new Block will be created. If code has been marked, it will be cut out and pasted into the Block.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FtjEMusoYDgEH7fmPEeV1%2FSk%C3%A6rmbillede%202023-09-27%20125028.png?alt=media&amp;token=093dc5dd-6c17-4d81-84fe-820201456e85" alt=""><figcaption><p>The user is marking code in the Base, and clicking the + button in the left panel to separate it into its own Block</p></figcaption></figure>

### Naming the Block

Next step is to give it a compelling name, for later use in both the [Inputs](https://documentation.alpaco.email/template/input-groups) and how the Block is displayed when [Creating an email](https://documentation.alpaco.email/fundamentals/creating-an-email).

To create a name for [Inputs](https://documentation.alpaco.email/template/input-groups), Insert the "**Name**" and "**Key**" in the Right panel. \
The "**Name**" Can be with capital letters and spaces as it's used for display only. \
They "**Key**" cannot, as it's used for the Liquid rules. \
We suggest however you name them more or less the same as not to create confusion later on.<br>

Clicking the Pen in the Left Panel gives you the option to change the name of the Block and how it's displayed when [Creating an email](https://documentation.alpaco.email/fundamentals/creating-an-email). It can be individually named for flexibility reasons.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FnCEy8C8d0Z3Xzd1M2VJK%2FSk%C3%A6rmbillede%202023-09-27%20125148.png?alt=media&amp;token=d4ec4ad6-5d72-4519-bcb6-03e0c6e6ecf0" alt=""><figcaption><p>In this example we named the block Hero in all places</p></figcaption></figure>

Next step is to create the many Settings that makes up all the rules which we will go over in the next chapter.

### Thumbnail

Inserting a thumbnail can be nice, to indicate to your users how that Block generally look, and give them an easier time navigating their options. <br>

To upload a thumbnail for a Block, click on the Block in the Template Editor in the left hand side. Once done, click the tab called Thumbnail in the right hand side menu. There you will be able to upload a thumbnail image. Once done, click save.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FXzsWKIM4uHjy9VEnotwE%2FSk%C3%A6rmbillede%202025-02-18%20123546.png?alt=media&amp;token=25a847dc-a44b-400b-b40a-bef8d4a190e5" alt=""><figcaption><p>In this example we're uploading a Thumbnail to a Block</p></figcaption></figure>

&#x20;This is how it appear in the Email Designer.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FKViAbAv6WtNF4EnhFrI1%2FSk%C3%A6rmbillede%202025-02-18%20123822.png?alt=media&amp;token=940bbf6f-f9df-4c30-933e-3f3bb5316e09" alt=""><figcaption></figcaption></figure>

### Block position logic

This section covers how a Block can react to **its own position** by checking which Block comes before or after it. Sometimes, you want a Block’s appearance or behavior to change depending on the order in which it's situated in the final email.

This is where **Block Position Logic** comes in: a feature that allows a Block to detect its neighboring Blocks and respond accordingly.\
\
The core concept here is that you have a series of objects targeting the directions around the Block. From there you can start creating your rules.\
\
Here are the variables:

```liquid
{{ self.before_block }}
{{ self.block }}
{{ self.after_block }}
```

Put into practice we can then start listening for what comes before this particular Block. Here we're for instance making a rule for if the Block type, named "spacer" comes before our Block or after it and make a rounding of the border-radius accordingly.&#x20;

```liquid
{% assign is_after_spacer = self.before_block == "spacer" %}
{% assign is_before_spacer = self.after_block == "spacer" %}

{% if is_after_spacer %}
  border-top-left-radius: 50px;
  border-top-right-radius: 50px;
{% endif %}
{% if is_before_spacer %}
  border-bottom-left-radius: 50px;
  border-bottom-right-radius: 50px;
{% endif %}
```

**Result**

{% embed url="<https://youtu.be/mnewEpiT8LQ>" %}

Let's try and expand on this logic, and look for if the Block is the last in the list of Blocks.\
With this logic we're creating a variable called "is\_last\_block", checking if the "self.after\_block" object is empty, if so then in execute this design.&#x20;

```liquid
{% assign is_last_block = self.after_block == blank %}

    {% if is_last_block %}
      Background-color:#3a3b38;
      color: #ffffff;
      border-bottom-left-radius: 0px;
      border-bottom-right-radius: 0px;
    {% endif %}
  
```

**Result**

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FVTodrw8pUwvhbNPhkscq%2FSk%C3%A6rmbillede%202025-05-22%20152309.png?alt=media&amp;token=8d6f8198-2c18-418a-9efa-d22878cb09e7" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Looking to control layout based on the **entire Block order** — like checking if a certain Block appears last in the sequence of Blocks?\
See how [Block Position Logic](https://documentation.alpaco.email/template/base#block-position-logic) works *in the Base*.
{% endhint %}


# Input Groups

If Blocks are the building-blocks the template is build on, Inputs are the mortar. This is where your settings and rules are defined and the key part of what separates Alpaco from other email editors.

{% hint style="info" %}
Only users with role **Designer** or **Admin** can access and edit Settings
{% endhint %}

This is where the magic happens and where Alpaco is really set apart from any ESP or other platform.\
\
Both the [Base](https://documentation.alpaco.email/template/base) and every [Block](https://documentation.alpaco.email/template/blocks) has their own inputs.

Inputs is per default scoped, but unique to Alpaco they can all be accessed between each other, meaning an Input in **Base** can affect a **Block**, but also the other way around.

* Inputs can be grouped into an [Input group](#input-group).
* Input groups can be [Repeatable](#repeatable).
* Inputs comes in [different types](https://documentation.alpaco.email/template/input-groups/input-types).

### Input group

Everything starts with an **Input Group** as we need to organize which elements needs to be parteded from eachother. In the Right panel you'll see an **Input Group** with a "**Name**" and a "Key"\
\
To create a name for the **Input Group**, Insert the "**Name**" and "**Key**" in the Right panel. \
The "**Name**" Can be with capital letters and spaces as it's used for display only. In this example we will call it `My Input Group Name` and the "**Key**" `my_input_group_name` as it's used for the Liquid rules.&#x20;

{% hint style="warning" %}
**The naming scheme inserted here will be prefixed to anything existing in that Input group.** \
We suggest you name them more or less the same as not to create confusion later on.
{% endhint %}

It is also wise to consider at this stage what this group should contain - like inputs that are only to be filled out once, or maybe we want these inputs to be [repeateable](#repeatable).

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2F8xboMO8W9OLBK17rTpNp%2FSk%C3%A6rmbillede%202023-09-29%20152322.png?alt=media&amp;token=5eeeb275-ee78-4701-bcf1-b72db2833703" alt=""><figcaption><p>In the example we've inserted a simply Input type Text to explain the naming scheme in Input groups</p></figcaption></figure>

### Repeatable

Say you wanted a part of your Inputs to be repeated in an infinite amount. This is a nice feature for when you want something like a button, a list item or a product-tile repeated, all by a click of a button. This can be done for all inputs contained within each [Input group](#input-group) and is an immensely powerful feature as this can be configured to not only iterate, but to count, to vary between odd and even and various ways later on, if you for instance wanted to:&#x20;

> "*Change the code if there are 3 product-tiles, but not if there are 2*"

This is a core-feature of how Alpaco is configurable and it's only the imagination that limits the possibilities for this feature.&#x20;

The way to enable it, is to switch the checkbox saying "**Repeatable**" on an **Input group.**

In our example here we created an Input group, gave it a name like "Button" and checked the "Repeatable". Notice below the platform helps you with the liquid code. \
The key `button`is the Input group key and the `collections.button` indicates it's something that is repeated, what we call a "Repeatable" and in Liquid what is known as a for-loop.

Wrap your element in the code it provides you, like so: &#x20;

```liquid
{% for button in collections.button %}

{% endfor %}
```

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FFFxFvpcwRm4D0SW9Jd1i%2FSk%C3%A6rmbillede%202023-09-29%20163802.png?alt=media&amp;token=02835889-92b7-4382-b5a1-15cbae67ce0a" alt=""><figcaption><p>This is an example of a Input Group with a Repeatable. It contains a Button text and a Button link that can be repeated</p></figcaption></figure>

### Cross reference Inputs

Sometimes you want to have different inputs affect each other in various ways. For instance:

> "*If **Block-1** is inserted into **Base**, change the background color of the body tag in **Base***"

or

> "*For each Repeated product-tile that is repeated in **Block-1**, insert some new CSS in the head tag of **Base***"

The rules and combinations could be between [Base](https://documentation.alpaco.email/template/base) and [Blocks](https://documentation.alpaco.email/template/blocks), and vice versa or it could be between **Blocks** - there's are very few limitations to this feature, so long as your naming convention is kept neat and concise.

In order to access inputs across **Blocks** and **Base**, simply pre-fix the input you're trying to target with the **Block name/Base name** that is visible in the Left panel. + **Input group key** in Right panel. + **input key** in the Right Panel. This can be done with any type of rule and any type of [Input type](https://documentation.alpaco.email/template/input-groups/input-types) Like so:

```liquid
block-name.input-group-key.input-key 
```

Or in this instance, we're trying to access a forloop for a Block-1 in the Base, it would be done like so:

```liquid
{% for button in block-1.collections.button %}
    .button_{{ forloop.index }}{
     left: 10px;
    }
   {% endfor %}
```

The code above will access the **Block-1**'s `button` in `collections.button` to be used in the **Base.** In this example we're injecting a class called `button_` and giving it a number for each iteration that it's clicked on. For each button that is inserted in the **Block**, it will create a new class with a unique number added to the style tag of **Base**.

\
The same principle can be applied the other way around from **Base** to **Block** and between **Blocks.**

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FTk4y25dFvilaG3oJM68z%2FSk%C3%A6rmbillede%202023-09-29%20171937.png?alt=media&amp;token=b76f51e9-7eaa-4211-ad9a-5a967f18e42e" alt=""><figcaption><p>Here we're injecting code from Block-1 into the Base. Foreach iteration that is clicked in Block-1, it will create another class in Base</p></figcaption></figure>

### Show or hide

When building your Email Design system, over time it can become very crowded with fields and options for the users to fill in. However many times fields are dependent on each other, and is useless  without the other - in these cases you want to hide those uncessary fields.\
\
That's where the **if/unless** **field** come in handy on Input Groups. You'll be able to hide or show a [Input group](#input-group) or [Repeatable](#repeatable) by typing in a liquid condition in this field. The liquid condition could be coming either internally from the [Block](https://documentation.alpaco.email/template/blocks) or even from [Cross reference inputs](#cross-reference-inputs).

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FjBJgNqnkbqRuOB9U8LzG%2FSk%C3%A6rmbillede%202026-02-04%20101830.png?alt=media&amp;token=06fe5a0f-2834-49ab-8491-91f0511d4618" alt=""><figcaption><p>Notice the If input on the repeatable in the right-hand side, it's condition is set up to only show if boolean called Header is true. </p></figcaption></figure>

The syntax is a bit deconstructed in so far as you're not suppose to write the entire liquid statement with the proper opening and closing tag, eg. *{%if \*YOUR STATEMENT\*%}{%endif %}* as the platform will be doing that for you. Simply type in the liquid condition however complex you may need. \
You're able to use if or unless as your initial condition.<br>

Next up we will look into the different Input types that can be used in Input groups.


# Input Types

In Alpaco you can have many different input types, separated or grouped together to form sets of settings.

These are the current allowed **Input Types:**

* **​**[**Text String**](https://documentation.alpaco.email/template/input-groups/input-types/text-string)

  \- A single line of text with no formatting options.
* [**Textarea**](https://documentation.alpaco.email/template/input-groups/input-types/textarea)

  \- Multi-line text input with simple formatting options.
* [**Link**](https://documentation.alpaco.email/template/input-groups/input-types/link)

  \- Link validator w. tracking
* **​**[**Select**](https://documentation.alpaco.email/template/input-groups/input-types/select)

  \- Select/Dropdown of predefined values.
* **​**[**Boolean**](https://documentation.alpaco.email/template/input-groups/input-types/boolean)

  \- On/off toggle/switch.
* [**​Image**](https://documentation.alpaco.email/template/input-groups/input-types/image)

  \- Image upload or URL input.
* **​**[**Color picker**](https://documentation.alpaco.email/template/input-groups/input-types/color-picker)

  \- Color picking wheel w/ eyedrop tool.
* [**​Code**](https://documentation.alpaco.email/template/input-groups/input-types/code)

  \- Ability to insert raw code.
* [**​**](https://documentation.alpaco.email/template/input-groups/input-types/code)[**Feed**](https://documentation.alpaco.email/template/input-groups/input-types/feed)

  \- Json and XML feeds options.

### How to get started?

Simply open up your [Base](https://documentation.alpaco.email/template/base) or [Block](https://documentation.alpaco.email/template/blocks), depending on where you want your input, navigate to the Right panel, click the button called "**Add input**" and select your input type from the dropdown.\
Just like with [Input Groups](https://documentation.alpaco.email/template/input-groups#input-group), the **Name** and **Key** needs to be inserted and given a proper name.

{% hint style="info" %}
Notice the tag below the name, that's generated when you give your input a **Key.** Putting your cursor in the center panel and clicking the tag in the right panel will automatically insert the tag with correctly formatted syntax in the center panel for you.
{% endhint %}

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FWzBYKNdINsvC8tvUBAbN%2FSk%C3%A6rmbillede%202023-10-04%20135513.png?alt=media&amp;token=77d596aa-b1e8-400b-8176-962bb50ba4c5" alt=""><figcaption></figcaption></figure>

### Validate Inputs

Validating inputs and give warnings is an essential part of handing over your template to others users. By using validation rules you can add clarity to what the intended use for an input should be.\
\
All Input types have a dropdown option in the Template Editor where multiple validation rules can be added and they all come with an option to make a Custom Error Message per validation rule, for each input field.&#x20;

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2F6AWP8eXNg4C81dOCGzQ6%2FSk%C3%A6rmbillede%202025-10-21%20163005.png?alt=media&amp;token=74aec2f7-6302-4343-96ca-3e0bd72ba6ff" alt=""><figcaption><p>In the image we see two Validations types, Required Field and Maximum Length set to 25 characters, has been added to a Text String</p></figcaption></figure>

If an input is not validated in the Email Editor, the user will be informed of the error, taken to where the error is, have the error highlighted and prevented from saving the email before adhering to the specific input requirement.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FIKvQnFfjptHFAmxDdREB%2FSk%C3%A6rmbillede%202025-10-21%20164832.png?alt=media&amp;token=5c714e5d-dd6f-4a66-831f-a532052d8d63" alt=""><figcaption><p>Here we see a validation rule trigger, showcasing the error message, highlighting and prevention of saving</p></figcaption></figure>

<table><thead><tr><th valign="top">Validation types</th><th valign="top">Description</th><th valign="top">Applicable in Input type</th></tr></thead><tbody><tr><td valign="top"><strong>Required field</strong></td><td valign="top">This field must be blank</td><td valign="top"><strong>​</strong><a href="https://documentation.alpaco.email/template/input-groups/input-types/text-string"><strong>Text String</strong></a><br><a href="https://documentation.alpaco.email/template/input-groups/input-types/textarea"><strong>Textarea</strong></a><br><a href="https://documentation.alpaco.email/template/input-groups/input-types/link"><strong>Link</strong></a><br><strong>​</strong><a href="https://documentation.alpaco.email/template/input-groups/input-types/select"><strong>Select</strong></a><br><strong>​</strong><a href="https://documentation.alpaco.email/template/input-groups/input-types/boolean"><strong>Boolean</strong></a><br><a href="https://documentation.alpaco.email/template/input-groups/input-types/image"><strong>​Image</strong></a><br><strong>​</strong><a href="https://documentation.alpaco.email/template/input-groups/input-types/color-picker"><strong>Color picker</strong></a><br><a href="https://documentation.alpaco.email/template/input-groups/input-types/code"><strong>​Code</strong></a></td></tr><tr><td valign="top"><strong>Must Not Be Default</strong></td><td valign="top">This field must not be indentical to the default content</td><td valign="top"><strong>​</strong><a href="https://documentation.alpaco.email/template/input-groups/input-types/text-string"><strong>Text String</strong></a><br><a href="https://documentation.alpaco.email/template/input-groups/input-types/textarea"><strong>Textarea</strong></a><br><a href="https://documentation.alpaco.email/template/input-groups/input-types/link"><strong>Link</strong></a><br><strong>​</strong><a href="https://documentation.alpaco.email/template/input-groups/input-types/select"><strong>Select</strong></a><br><strong>​</strong><a href="https://documentation.alpaco.email/template/input-groups/input-types/boolean"><strong>Boolean</strong></a><br><a href="https://documentation.alpaco.email/template/input-groups/input-types/image"><strong>​Image</strong></a><br><strong>​</strong><a href="https://documentation.alpaco.email/template/input-groups/input-types/color-picker"><strong>Color picker</strong></a><br><a href="https://documentation.alpaco.email/template/input-groups/input-types/code"><strong>​Code</strong></a></td></tr><tr><td valign="top"><strong>Maximum Length</strong></td><td valign="top">This field may contain X amount of characters</td><td valign="top"><strong>​</strong><a href="https://documentation.alpaco.email/template/input-groups/input-types/text-string"><strong>Text String</strong></a><br><a href="https://documentation.alpaco.email/template/input-groups/input-types/textarea"><strong>Textarea</strong></a></td></tr><tr><td valign="top"><strong>Minimum Length</strong></td><td valign="top">This field must be at least X amount of characters</td><td valign="top"><strong>​</strong><a href="https://documentation.alpaco.email/template/input-groups/input-types/text-string"><strong>Text String</strong></a><br><a href="https://documentation.alpaco.email/template/input-groups/input-types/textarea"><strong>Textarea</strong></a></td></tr><tr><td valign="top"><strong>Regex</strong></td><td valign="top">Define any form of regular expression you want. Be that URL, numbers, wordings ect.</td><td valign="top"><strong>​</strong><a href="https://documentation.alpaco.email/template/input-groups/input-types/text-string"><strong>Text String</strong></a><br><a href="https://documentation.alpaco.email/template/input-groups/input-types/textarea"><strong>Textarea</strong></a><br><a href="https://documentation.alpaco.email/template/input-groups/input-types/link"><strong>Link</strong></a></td></tr></tbody></table>

### Show or hide

When building your Email Design system, over time it can become very crowded with fields and options for the users to fill in. However many times fields are dependent on each other, and is useless  without the other - in these cases you want to hide those uncessary fields.\
\
That's where the **if/unless** **field** come in handy on Inputs. You'll be able to hide or show any input types by typing in a liquid condition in accompanying if/unless field. The liquid condition could be coming either internally from the [Block](https://documentation.alpaco.email/template/blocks) or even from [Cross reference inputs](#cross-reference-inputs).

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FEZGH8YfguWHQBGekwlav%2FSk%C3%A6rmbillede%202026-02-04%20101022.png?alt=media&amp;token=cf4fb493-0af4-40f2-a996-57ef40372d29" alt=""><figcaption><p>Notice the if statement on Button link in the right-hand side, is now dependent on the input called Button text is not empty.</p></figcaption></figure>

The syntax is a bit deconstructed in so far as you're not suppose to write the entire liquid statement with the proper opening and closing tag, eg. *{%if \*YOUR STATEMENT\*%}{%endif %}* as the platform will be doing that for you. Simply type in the liquid condition however complex you may need. \
You're able to use if or unless as your initial condition.


# Text String

A simple text string, single line that can be used for settings where users only can insert one line of text

A **Text String** input is the most basic text input.

Works great for:

* Text values for titles, headlines and buttons
* URL values for buttons and links

### Template Editor

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FW76HOcqUOe242WsOFtGV%2FSk%C3%A6rmbillede%202023-10-04%20151257.png?alt=media&amp;token=e41102ae-8701-44e8-88ad-8f5eb23d34f6" alt="" width="293"><figcaption><p>This is how it looks in the Template Editor</p></figcaption></figure></div>

### Email Editor

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FcSCHqeDI4Nkp0JHtFz6N%2FSk%C3%A6rmbillede%202023-10-04%20151820.png?alt=media&amp;token=fb20cdc2-4052-4d45-84c4-b9baa1956863" alt="" width="362"><figcaption><p>This is how it looks in the Email Editor</p></figcaption></figure></div>


# Textarea

Textarea are more refined compared to Text String and can be used for when you want to allow for multiple lines of text, but also open up for rich-text options

A **Textarea** input provides a small, multi-line rich text editor with very basic formatting options:\
&#x20;bold, italic, underline, supertext, subtext, Link and very dear option Soft Hyphen (`&shy;`) for when you want to insert a "-" in long words that may or may not risk breaking your design on various screen sizes. For further elaboration read this [article](https://alpaco.email/blog/An-ode-to-Soft-hypen).

The input type also gives users access to an **Emoji dropdown** of various glyphs and icons to insert in their text.

Furthermore This input type has the option of creating a **Link style**, so you can inject the css styling for all links created in that textarea. These settings are found in the foldout called "Advanced" below each Textarea. Link styling also allows for liquid variables, so you can dynamically change stylings based on template rules e.g.\
`color: {{ textcolor }}; text-decoration: underline;`\
\
Additionally we allow for **custom text stylings** in the options dropdown. This is particularly helpful for situations where you want to give the user an ability to use some custom text formatting, but only within the specific limits you set them to, for instance:\
`font-size:35px;`*.*\
\
*In order to use this feature properly it's important that the CSS values are valid.*

Individual text styling options like bold, Italic, soft-hypen ect. can be disabled from the template editor foreach textarea input.

Works great for:

* Body/content texts
* Custom styled text inputs with specific design limitations

### Template editor

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2Fa70e6ymK7cr3GASIVlHg%2FSk%C3%A6rmbillede%202026-04-29%20194421.png?alt=media&amp;token=0b844c2a-d841-454a-8b14-1cd5fac01b5d" alt=""><figcaption><p>This is how it looks in the Template Editor</p></figcaption></figure></div>

### Email editor

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FYTbtBXLiE8uLIEGgxtdw%2FSk%C3%A6rmbillede%202025-05-13%20153955.png?alt=media&amp;token=fbb5349f-6d98-464c-be7e-fcb4edf01b7f" alt="" width="371"><figcaption><p>This is how it looks in the Email Editor</p></figcaption></figure></div>


# Link

Links are a fundamental and dynamic input type that helps the user and the platform in managing links

A **Link** input provides seemingly no nuances compared to a [Text String](https://documentation.alpaco.email/template/input-groups/input-types/text-string), but it's not what happens in plain sight that's the real power of it, but rather what happens in the background. By adding a Link input type to your field you automatically add the ability to add link tracking and various safety measures validation rules won't be able to.

Works great for:

* CTA's
* Menues
* Link tracking

### Template editor

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FZdRVukKzwIJQBXnSpJLy%2FSk%C3%A6rmbillede%202026-10-05%20223321.png?alt=media&amp;token=8d4c3a1d-4130-4872-a4c0-67320d75f115" alt=""><figcaption><p>This is how it looks in the Template Editor</p></figcaption></figure></div>

### Email editor

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FjvjipragWYpq9berH0Bd%2FSk%C3%A6rmbillede%202026-10-05%20223705.png?alt=media&amp;token=3edb754b-79aa-42a8-a465-ad6d889b69dc" alt=""><figcaption><p>This is how it looks in the Email Editor</p></figcaption></figure></div>


# Select

Select inputs are used for when you want to give the user options to choose from.

Works great for:

* **Alignment -** Provide the allowed text alignments (i.e. left, center, right).
* **Colors -** Provide a list of available colors to choose from (i.e. brand colors), for example for a CTA button background.
* **Text Sizes** - Give the marketeer an option to change text size (i.e. small, medium, large), between some preselected and approved values.
* **Market/Country** - Use one **Template** for all markets/countries/languages, and allow the marketeer to change it per email. Works best as setting on **Base** so it can be applied to the entire **Template**.

### Template Editor

When creating a new **Select** input, you will be able to add the predefined options. The **Value** of the selected option will be outputted in the liquid variable. You can set a default value to be preselected using the **Advanced Options** for the input.

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FXd6rtovxdwIt9apVyonC%2FSk%C3%A6rmbillede%202023-10-04%20160824.png?alt=media&amp;token=88b2c466-fd40-44d9-a5ca-f23ee7650e5e" alt=""><figcaption><p>In this example we created the options of Red and Green for background color. <br>Default value has been set to Red</p></figcaption></figure></div>

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2F7z0Yg4JvK2qOQ57N3Oow%2FSk%C3%A6rmbillede%202023-10-04%20161041.png?alt=media&amp;token=f2a6c34a-e946-44ea-a441-08b2ac42d79e" alt=""><figcaption><p>This is how it can be applied in the code. Notice the {% if statement %} wrapping around the TD's</p></figcaption></figure>

Notice how with **Select** we can wrap other code bits into a Liquid statement like so:

```liquid
{% if my_input_group_name.my_background_color == 'red' %}
  <td style="background-color: red">
   {% else %}
   <td style="background-color: green">
    {% endif %}
```

### Email Editor

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FuD0tqWhap3AYtXg9S6xy%2FSk%C3%A6rmbillede%202023-10-04%20161258.png?alt=media&amp;token=fd802caf-8f09-4478-b70a-2a0fbb0a14d7" alt=""><figcaption><p>This is how it looks in the Email Editor</p></figcaption></figure></div>


# Boolean

A Boolean is used for when you want something to be either true or false, like a lighting switch that can be toggled on or off

A simple on/off or true/false input, displayed as a switch in the **Email Editor**.

Works great for:

* **Show/hide** specific elements, i.e. making a CTA button optional.
* **Toggle direction**, i.e. in a component showing an image on the left, and a text on the right, you can make a toggle to allow the marketeer to switch the direction, so text shows on the left and image on the right.

### Template Editor

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2F6iXPC7A4PieafytJ8IUj%2FSk%C3%A6rmbillede%202023-10-04%20162847.png?alt=media&amp;token=3ed18b29-17fd-4c46-b01c-e36318f87aab" alt=""><figcaption><p>This is how it looks in the Template Editor</p></figcaption></figure></div>

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2F8L4wT2n8W14YmhspPEwS%2FSk%C3%A6rmbillede%202023-10-04%20163023.png?alt=media&amp;token=6c6f677a-30df-496d-8715-8ab00f07bfb8" alt=""><figcaption><p>This is how it can be applied in the code. Notice the {% if statement %} wrapping around the TD's</p></figcaption></figure>

Notice how with **Boolean** we can wrap other code bits into a Liquid statement like so:

```liquid
{% if my_input_group_name.my_text_align %}
  <td align="left">
   {% else %}
   <td align="center">
    {% endif %}
```

### Email Editor

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FAuRw2iKoU7OPsqeX00eb%2FSk%C3%A6rmbillede%202023-10-04%20163252.png?alt=media&amp;token=da547b38-9bf0-4e58-87cf-2b19cdc13877" alt=""><figcaption><p>This is how it looks in the Email Editor</p></figcaption></figure></div>


# Image

Images are a fundamental part of an email, that's why we've built this feature with deep setting possibilities to take care of all scenarios that you would need

Images are a fundamental part of email, wether you use it as standalone images or you're more into the advanced of using it as background images - to us it's all the same in terms of settings. We've done our best to make it easy for the marketeer to work with images, without having to worry too much about resizing and scaling.

The **Image** input allows images uploaded directly from the marketeers browser, or alternatively via a URL.

### Template Editor

<div align="left"><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2Ff3VRonAGwUw9QBZxixBr%2FSk%C3%A6rmbillede%202023-10-04%20164948.png?alt=media&amp;token=8584a8a9-2a05-4e43-84eb-ff13e05d77d3" alt=""></div>

You can reference this image in your template code in several ways:

* `{{ my_input_group_name.my_image.url }}` - Outputs the URL of the image, with no resizing, just pure image.
* `{{ my_input_group_name.my_image.url | image: width: 320 }}` - Outputs the image  and resizes it to 320px in width. It gives access to the many different options defined in [Image settings](https://documentation.alpaco.email/template/input-groups/input-types/image/image-settings). &#x20;

Additional variables are exposed on the image object with the width, height, DPR and Default image accessible in the **Advanced** dropdown, which is useful for setting width/height in `<img>` attributes and in `style` attributes.

* `{{ image.width }}` - The width of the image in pixels (after automatic resizing). It ignores the **DPR,** so if `width: 320` and `DPR: 2` is set in options, `image.width` will output `320`.
* `{{ image.height }}` - The height of the image. If image resizing is used with width only, the image will be resized preserving aspect ratio, and the outputted height will be the resulting height.

### Email Editor

Before marketeer uploads/inserts image:

<div align="left"><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FsLRpQwEMobiS1MzMwmK9%2FSk%C3%A6rmbillede%202023-10-04%20170250.png?alt=media&amp;token=f69a5ebf-60c3-4ec1-964c-bef9db1e4c32" alt=""></div>

​

After image upload, the image is shown with a preview:

​

<div align="left"><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FZhpX8ids1vnekHfEcUiD%2FSk%C3%A6rmbillede%202023-10-04%20170343.png?alt=media&amp;token=765d706b-4127-4679-8a40-441532c0b218" alt=""></div>

### Hosting

In Alpaco we know how important speed and stability is to any email marketing campaign.\
So in order to make sure images are reutilized and served properly we've made an **Asset Manager.**\
\
The Asset Manager is accessible from all emails, and anywhere on the platform, and serves as an overview of which assets has been uploaded to the platform.\
\
These assets are stored in their original form, regardless of which way the user has uploaded them in, so they can be saved in the maximum resolution possible. This not only saves time, but also free's the user from having to crop images all the time.\
\
&#x20;When using an asset in an email, it is up to the Image input to define which variant or variables to add to the original image in order to create a new image.\
\
Lastly the new image that is served to the email, is stored on the Alpaco domain and served through a global cloud CDN, ensuring speed and reliably to the viewers of the email, no matter where they are on the globe.&#x20;

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FRSbD6YFcpy7RiG7zRkgD%2FSk%C3%A6rmbillede%202024-05-07%20162243.png?alt=media&amp;token=be28ba70-27db-46b5-90fa-03389579cedd" alt=""><figcaption></figcaption></figure>

​


# Image settings

Image settings are the powerful features that enables you to model, filter, rotate, resize and expand on what your template needs to ensure those images looks just right, each time - without Photoshop

Image settings are some powerful features that helps you ensure the images are always the right size, right tone, right hue.

Image settings are always used in combination with an Image and is that little tag that comes after the " **| image:** " defined like so:

```
{{ ... | image: ... }}
```

We use [Cloudflare's Image Optimization](https://developers.cloudflare.com/images/transform-images/transform-via-workers/) behind the scenes. It may be useful to read their documentation to learn more about the options, arguments and behaviors.

### **Image settings**

* `width` - Overwrites the width provided in Image input options and uses this value for resizing
* `height` - Sets the height explicitly and resizes based on this, depending on `fit` argument.
* `dpr` - Overwrites the dpr provided in Image input options and uses this value for resizing.
* `fit` - Affects interpretation of width and height. All resizing modes preserve aspect ratio. Read about the options [here](https://developers.cloudflare.com/images/transform-images/transform-via-url/#fit).
* `background` - Sets a background color for the resulting image, used together with `fit=pad`.
* `blur` - Sets a blur on the image.
* `Rotate` - Enables you to rotate the image.
* `Gamma` - Enables you to set the gamma ratio on the image.
* `Gravity` - Enables you to specify how an image should be cropped given the content
  * `Auto` - figures out the focus itself.
  * `Top` - Crops image from top down.
  * `Center` - Crops image from Center out.
  * `Bottom` - Crops image from bottom up.
  * `Face` - Registers faces, puts them in center, and crops from that.
* `Contrast` - Enables you to set the contrast ratio on the image.
* `Draw` - A feature that enables you to merge images together with the uploaded. Further explained in the subject [Draw](https://developers.cloudflare.com/images/transform-images/draw-overlays/).
* `Repeat` - A feature that enables you to repeat an image. This can be done in both directions or only one. Usually used for something like overlays ontop of an image.
* `Position` - A feature that enables you to position an image in its container. It can be left, right, top or bottom and indicated in pixels. Usually used for something like overlays ontop of an image.
* `Radius` - Sets rounded corners on the image in pixels in numerical values (e.g., *radius: 16*). Automatically accounts for `dpr` .
  * `Radius_top_left` - individual control settings for top left corner radius.
  * `Radius_top_right` - individual control settings for top right corner radius.
  * `Radius_bottom_right` - individual control settings for bottom right corner radius.
  * `Radius_bottom_left` - individual control settings for bottom left corner radius.

### Draw

Often you want to merge images together to form one. That's what the draw function does. \
Draw introduces a few more settings for how you want to place your images\
\
**Draw settings**

* `Url` - Link to the url you want to place ontop of another image.
* `Text` - Writes an given text ontop on an image.
  * `font` - set the font family for the text.
  * `color` - set the color for the text.
  * `size` - set the size for the text. Numerical values.
* `Width` - Sets the width of the image.
* `Height` - Sets the height of the image.
* `Repeat` - Repeats the image. Set to `true`, `x` or `y`
* `Top` - Place the image x pixels from the top. Numerical values. Automatically accounts for `dpr` .
* `Left` - Place the image x pixels from the left. Numerical values. Automatically accounts for `dpr` .
* `Bottom` - Place the image x pixels from the bottom. Numerical values. Automatically accounts for `dpr` .
* `right`- Place the image x pixels from the right. Numerical values. Automatically accounts for `dpr`&#x20;
* `opacity` - Set the opacity of the image. Numerical values.

We suggest using what is called a **Capture** in Liquid, and then inserted all your draw values. A **Capture** can contain information like position and whether you want the image to stretch across the uploaded image it's being merged with.&#x20;

Like so:

```liquid
{% capture draw_play %}
  { "url": "https://asset.alpaco.email/B8URBuJNlGJnIV40Am2SUggn1r0oxY02wFcNUgzV.png", "width": 640, "fit": "cover" }
{% endcapture %}

```

Notice how attributes are encased in a "", if the value is a string, that too needs a "", but if it's an integer it should be without "".

Then you need to apply the **Draw** into an Image setting like so:

```html
<img src="{{ my_input_group_name.my_image.url | image: width: 640, draw: draw_play }}" height="{{ my_input_group_name.my_image.height }}" />
```

#### Multiple overlays

Pass an array of JSON objects to apply multiple overlays at once. Overlays are drawn in the order they appear in the array (the last object is drawn on top).

```html
{% capture two_logos %}
  [
    { 
      "url": "https://asset.alpaco.email/YuuwBkrjhnITV337yev9LhqPFbQSHCkznhU6XYVp.png",
      "width": 80,
      "top": 0,
      "left": 0 
    },
    { 
      "url": "https://asset.alpaco.email/YuuwBkrjhnITV337yev9LhqPFbQSHCkznhU6XYVp.png",
      "width": 80,
      "bottom": 0,
      "right": 0,
      "composite": "xor"
    }
  ]
{% endcapture %}

<img src="{{ watermarks.image.url | image: width: 600, draw: two_logos }}" />
```

#### Compositing (Porter-Duff Modes)

Control how an overlay blends with the base image by setting the `composite` property. Available modes. For more documentation, read the [Porter-duff section](https://developers.cloudflare.com/images/optimization/draw-overlays/#composite).\
\
**Porter duff settings**

* `over` *(default)*: Standard overlay behavior.
* `in`: Shows overlay *only* where the base image is opaque.
* `out`: Shows overlay *only* where the base image is transparent.
* `atop`: Clips overlay to the shape of the base image.
* `xor`: Creates a cutout; overlapping opaque areas become transparent.
* `lighter`: Adds color values of both images together to brighten overlaps.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FXS2vfH1w93bokUKjtrxF%2FSk%C3%A6rmbillede%202026-09-18%20104305.png?alt=media&amp;token=dc4e09cb-9c1d-4731-830f-1a3a7ca66b74" alt=""><figcaption></figcaption></figure>


# Color Picker

Unlike Select, where you can create things like themes that will alter your entire color palate, Color Picker is meant for when you want to give users a color wheel to pick any color manually

A **Color Picker** input is great for when you need to give the user flexibility to pick just the exact color they need. The color modes along with the eyedrop tool build into the color picker gives your user immense freedom, without sacrificing the validity of the output, making sure it's always valid and doesn't change from what you intended it to.

Works great for:

* Text colors
* Background color
* Places where opacity is a important
* Places where matching or deviating the color of an image is important

### Template Editor

When creating a new **Color picker** input, you will be able to choose between RGBA and HEX mode as well as the default color.&#x20;

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FMkW0AzZrYvej8Ero53Gx%2FSk%C3%A6rmbillede%202025-02-05%20135311.png?alt=media&amp;token=8b389a19-62a1-455f-91c2-420c1ccf5a7f" alt=""><figcaption></figcaption></figure></div>

### Email Editor

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FaRlMiFkVuIsz3EcYiY6O%2FSk%C3%A6rmbillede%202025-02-05%20135944.png?alt=media&amp;token=74a1f9e0-d493-4754-a3c0-8cde4511cd04" alt="" width="370"><figcaption><p>This is how it looks in the Email Editor</p></figcaption></figure></div>


# Code

An input field, unlike Text String, that can be used for specific scenarios where users needs to input elaborate pieces of code

A **Code** input is great for when you need to give the user flexibility to write elaborate pieces of code. This could be things like complex ESP code that wouldn't otherwise be able to be made flexible enough with Selects and Text Strings. It's important to stress caution of implementing these types of inputs as it can defeat the purpose of having a Drag\&Drop editor in the first place.

Works great for:

* Complex ESP code
* Code Blocks

### Template Editor

When creating a new **Code** input, you will be able to insert some default code along with any Hints you may want to inform the user about.&#x20;

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FwxlMSvr1TzN7HgoFbH5e%2FSk%C3%A6rmbillede%202025-10-21%20155815.png?alt=media&amp;token=9565aecc-d70e-47bc-b735-76cfde0faca1" alt=""><figcaption></figcaption></figure></div>

### Email Editor

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FDh5xQRCX328VxELzWZfZ%2FSk%C3%A6rmbillede%202025-10-21%20160108.png?alt=media&amp;token=085f411d-2165-4b13-bf26-e76bab536a90" alt=""><figcaption><p>This is how it looks in the Email Editor</p></figcaption></figure></div>


# Feed

Feed inputs are used for when you want to dynamically insert a feed into your emails

A **Feed** input is great for when you want to give users the ability to dynamically access any type of feed, be that a product feed, article feed or anything similar. Then extract those values and insert them into your emails as you see fit. \
The format is irellevant, whether that is XML, JSON, as long as it's structured.

\
A Feed input can be used in a normal input group or inside a [repeatable](https://documentation.alpaco.email/template/input-groups#repeatable).

Works great for:

* Product feeds
* Article feeds

### Template Editor

When creating a new **Feed** input, you'll need to provide the URL for the raw access to your feed. Upon doing so, a list of output fields gets propagated based on the feed and converted into usable liquid fields ready to be inserted into your template. \
\
Because all fields are transformed into liquid fields, all liquid filters becomes available to moderate the output to fit into your template. All field names are directly interpreted from the feed, except images, that gets it's own naming convention `{{ .feed.images.url }}` for the tradeoff of being able to use all abilities available in the [image settings](https://documentation.alpaco.email/template/input-groups/input-types/image/image-settings) filter.\
\
Lastly you get two dropdown options to configure the dropdown lists in the Email Editor.

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FCNMbaPmQsaEbHRpCM29U%2FSk%C3%A6rmbillede%202026-08-05%20151432.png?alt=media&amp;token=207a9b84-f7a2-40fe-8b7b-780c74e6296f" alt=""><figcaption><p>In this example we see a product feed with multiple fields to simply click to use in your code.</p></figcaption></figure></div>

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FINNyGjHZJL6c7WjVTnb8%2FSk%C3%A6rmbillede%202026-08-05%20151625.png?alt=media&amp;token=0dbfa55c-a8a3-40fd-87fc-82838404eee2" alt=""><figcaption><p>In the code we see multiple examples of using the output fields in combination with liquid filters, ensuring the description is not too long, calculating the height of a container, based on the altered image dimensions ect.</p></figcaption></figure>

### Email Editor

<div align="left"><figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FWfaKmksUSTxlBzsDS12v%2FSk%C3%A6rmbillede%202026-08-05%20152534.png?alt=media&amp;token=366dce57-df94-406a-ad84-792e16e98ebd" alt=""><figcaption><p>In the Email Editor, there will be a user-friendly search bar with a dropdown list</p></figcaption></figure></div>


# Integrations

Integrations are what makes Alpaco connect with your existing Email Platform, and enables it to send over your creation to the platform, so you can send it ou

{% hint style="info" %}
Only **Alpaco Support** can create new integrations currently
{% endhint %}

Alpaco supports a constantly growing list of ESPs that we have an API connection with, and support 1-click exports of emails to.

Go to **Organization Settings** in the top menu, navigate to the Integration card in the lower right corner and click the edit button next to the ESP connection that has been set up for you.

<div align="left"><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FfBdiDMgn2eG2a21HWsoc%2FSk%C3%A6rmbillede%202024-03-27%20171006.png?alt=media&amp;token=ac016bad-4e9c-455f-ab57-a8a7c333676a" alt=""></div>

Depending on the platform you're using, different fields will appear to be filled out.&#x20;

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FqdnBoAktWHTZsimZgkqJ%2FSk%C3%A6rmbillede%202024-03-27%20171143.png?alt=media&amp;token=2d2acb83-91ae-4128-baaf-412a2266436d" alt=""><figcaption><p>for Example In Customer IO we only need to set the Name for how it appears in the UI in Alpaco, but also the Customer IO Server Region and Auth key your ESP enviroment is situated in.</p></figcaption></figure>

### Export

Make sure you have at least 1 active integration.

Go to any **Email,** click **Export** and select the **Integration** you want to export to.

![](https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FxxvKp8QjGYyf1DML7vsL%2FSk%C3%A6rmbillede%202023-10-04%20174852.png?alt=media\&token=f5b968b8-c368-4cb3-acaa-95be12f0f29c)

The **Email** will be immediately exported. If the export was successful, you will see a message confirming everything went right.


# Merge Tags

{% hint style="info" %}
Only users with role **Admin** can edit Merge Tags
{% endhint %}

Many ESPs have support for merge tags or personalization variables, for example to write out a customers first name in the email.

The Alpaco Platform supports a Merge Tag feature, where you can add Merge Tags in Alpaco and define the matching merge tag code in the ESP/Integration.

### Creating and using a Merge Tag <a href="#creating-and-using-a-merge-tag" id="creating-and-using-a-merge-tag"></a>

In the below example, we have added a Merge Tag with the name `First Name`. Alpaco automatically creates a tag that you can use within your templates to reference this merge tag, in this case it's `[first_name]`.

![](https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FCdQLPWxFkVbiU8FjqdaN%2FSk%C3%A6rmbillede%202023-10-04%20173847.png?alt=media\&token=6b1df6d2-eda8-4c66-b422-f4ac94076772)

For this newly created Merge Tag, I have to specify the corresponding tag in your Email Service Provider(ESP). In this example we'll use Mailchimp:

Now I can go ahead and use the tag `[first_name]` anywhere in my Template code:

`<h1>Hello [first_name]!</h1>`

When the **Email** is exported to Mailchimp, Alpaco will replace the `[first_name]` tag with the correct Mailchimp tag, `*|FNAME|*`:

`<h1>Hello *|FNAME|*!</h1>`


# REST API

The Alpaco REST API allows you to programmatically inspect workspaces, compile designs, and push finalized email assets directly to your external distribution channels.

### Base Configuration & Auth

All API requests must be made over HTTPS and authenticated using your organization-level JSON Web Token (JWT). Each user can generate a JWT token on their profile page<br>

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FJJpETtyoWDyazcEzsyCE%2FSk%C3%A6rmbillede-2026-06-15-144414.jpg?alt=media&amp;token=3a8331fd-6206-4646-8567-5cf86edc635c" alt=""><figcaption></figcaption></figure>

**Base URL:** <mark style="color:$warning;">`https://platform.alpaco.email/api/mcp/v1/`</mark>

**Authentication Header:** <mark style="color:$warning;">`Bearer <your_organization_jwt>`</mark>

```http
Authorization: Bearer YOUR_ORGANIZATION_JWT
Content-Type: application/json
Accept: application/json
```

### Endpoint Lifecycle Matrix

<table><thead><tr><th width="249">Description</th><th>Endpoint</th><th>Method</th></tr></thead><tbody><tr><td>Retrieves active workspace brand identities, target audiences, and copywriting rules.</td><td><code>/brand/guidelines</code></td><td><strong>GET</strong></td></tr><tr><td>Lists all active templates <em>with</em> their block keys and allowed inputs.</td><td><code>/templates</code></td><td><strong>GET</strong></td></tr><tr><td>Searches for existing approved graphics, logos, and banners in your media library.</td><td><code>/assets?search={keyword}</code></td><td><strong>GET</strong></td></tr><tr><td>Compiles a brand-new design layout into a fresh HTML draft asset and returns a unique <code>id</code>.</td><td><code>/assemble</code></td><td><strong>POST</strong></td></tr><tr><td>Fetches the current raw JSON configuration tree state of a saved email layout draft.</td><td><code>/assemble/{email_id}</code></td><td><strong>GET</strong></td></tr><tr><td>Updates and re-compiles an existing email draft asset for seamless content iterations.</td><td><code>/assemble/{email_id}</code></td><td><strong>POST</strong></td></tr><tr><td>Retrieves active third-party ESP/CRM integration connection IDs (HubSpot, Braze, etc.).</td><td><code>/connections</code></td><td><strong>GET</strong></td></tr><tr><td>Pushes a finalized, compiled email design straight into your external marketing platform.</td><td><code>/export</code></td><td><strong>POST</strong></td></tr></tbody></table>

### Getting Started

Unlike traditional, rigid APIs that force you to memorize hundreds of syntax rules, the Alpaco API is discovery-driven and self-correcting.

You do not need a static instruction guide for every email layout in your workspace. Instead, you dynamically query our engine to find your template constraints, construct your payload, and rely on our real-time validation engine to guide you through any structural mistakes.:

#### Phase 1: Inspect

Before your code can assemble an email, it needs to know what layouts are valid in your specific workspace. You do this by calling the templates directory.

* The Endpoint: <mark style="color:$warning;">`GET /templates`</mark>
* The Goal: Capture your target <mark style="color:$warning;">`template_id`</mark> and read the <mark style="color:$warning;">`available_blocks`</mark> array.

{% hint style="info" %}
Look closely at the response. The API will explicitly tell you what block components are allowed (e.g., `article`, `products`) and the exact array keys (`header_text`, `body_text`) those blocks require. Your application holds these keys in memory to map your raw data correctly.
{% endhint %}

#### Phase 2: Listen

Once your application maps out the text, images, and layout choices, you shoot your composition payload to the compilation track.

* The Endpoint: <mark style="color:$warning;">`POST /assemble`</mark>
* The Goal: Render your raw JSON into bulletproof HTML markup.

If your code passes a typo (like writing `bodycopy` instead of `body_text`), or forgets a global parameter like the marketing `subjectline`, the Alpaco compiler will instantly stop and hand you a `422 Unprocessable Entity` response containing a highly explicit error path.

**Example of error response**

```json
{
  "success": false,
  "errors": {
    "design.blocks.0.values": "Invalid keys: [bodycopy]. Allowed keys for block 'article': [header_text, body_text]"
  }
}
```

{% hint style="info" %}
You don't need a manual to troubleshoot your formatting. Simply read the `errors` object. It acts as a real-time code reviewer, telling you exactly which array index failed and providing a list of allowed alternative keys to fix your script instantly.
{% endhint %}

#### Phase 3: Scale

When your payload clears the validator, the engine returns a successful response alongside a unique, tracked asset number.

* The Output: A unique, persistent database integer identifier (e.g., `"id": 771024`).

**Chaining your next actions:**

Once you have this tracking ID, you can interact with the layout indefinitely using simple lifecycle combinations:

1. Content Iterations (`GET /assemble/{id}`) and (`POST /assemble/{id}`): If an automated process or reviewer needs to adjust a headline later, you don't generate a new orphan draft. You run an update request against that exact asset ID, passing the entire content back with adjustments.
2. Platform Syncing (`POST /export`): When the campaign is perfect, pass the email `id` alongside your `esp_connection_id` to cleanly push the final layout directly into your email sending account, connected to your organization in Alpaco.


# MCP

The Alpaco MCP gateway exposes a standardized connection layer that allows compliant AI clients to natively understand and operate your email workspace.

### Connect

Alpaco supports two integration tracks. Choose the method that best fits your workspace environment.

#### method 1# OAuth Authentication

This is the automated, zero-token track managed directly through our secure authentication bridge.

{% hint style="info" %}
Only users with role **Admin** can create and manage OAuth keys.
{% endhint %}

1. Log into your Alpaco platform and go to **Organization Settings**
2. Create an MCP connection > give it a name and change the redirect URI(optional) > note down the *Client secret* and *Client ID*.
3. Open your preferred Ai LLM and type in the following info:\
   **Remote MCP server URL:** <mark style="color:$warning;">`https://platform.alpaco.email/api/mcp/v1/gateway`</mark>\
   **OAuth Client ID:** *<mark style="color:$warning;">`*Your Client IDfrom the above step*`</mark>*\
   **OAuth Client Secret:** *<mark style="color:$warning;">`*Your Client secret from the above step*`</mark>*
4. *Because this method validates protocol commands through your live browser handshake, you must keep your Alpaco workspace open in an active browser tab while running your AI chat client to establish the gateway connection.*

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FIhy8uWTjRyaHqAr7jYA8%2FSk%C3%A6rmbillede-2026-07-06-150533.jpg?alt=media&amp;token=e86f25ef-0a00-497a-a1a0-dc69601fb5b3" alt=""><figcaption><p>Example of MCP connection creation from Organization settings in Alpaco</p></figcaption></figure>

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FvQq1lvSM7gzC5QU0Bl9c%2FSk%C3%A6rmbillede%202026-07-06%20151611.png?alt=media&amp;token=0f574433-1a0b-4018-bcad-6f7b31fd3a63" alt=""><figcaption><p>Example of how setting up a MCP connector from the Claude Ai LLM interface</p></figcaption></figure>

#### Method #2 Manual setup (Advanced / Headless Agents)

If you are building custom background scripts, persistent automated workflows, or using an AI client that doesn't support our OAuth bridge, you can connect manually using raw data variables.

To hook up a client manually via Streamable HTTP (Server-Sent Events / SSE), your environment will ask you for two foundational values:

1. Grab your JWT(Jason Web token) token from user profile > click Generate token
2. **Remote MCP server URL:** <mark style="color:$warning;">`https://platform.alpaco.email/api/mcp/v1/gateway`</mark>

{% hint style="info" %}
Every LLM client (Claude Desktop, Cursor, Gemini, etc.) expects these two data points in completely different syntax structures—some require the JWT passed as an environment variable (`ALPACO_JWT_TOKEN`), some as a standard HTTP Bearer header (`Authorization: Bearer YOUR_JWT`), and others via local JSON config files. Refer directly to your specific AI tool's developer docs to see how it prefers to ingest an SSE endpoint and authorization token.
{% endhint %}

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FstttNTrPj2CFA1R1Rdxc%2FSk%C3%A6rmbillede-2026-07-06-153029.jpg?alt=media&amp;token=895d111f-b141-4fc6-83e1-db36e8e5034f" alt=""><figcaption><p>An example of a JWT token generated on the user profile page</p></figcaption></figure>

### Capabilities

With your AI client securely authenticated, you are ready to access and command your Alpaco organization directly through natural language chat. Your model functions as an active, context-aware operator of your workspace, transforming conversation into verified, production-ready design elements.

{% embed url="<https://youtu.be/mWVFYX0eLT8>" %}

{% hint style="info" %}
For some LLM's we'll be able to render a preview directly in the Chat window for you to review. While this is not supported by every Ai chat, you will get a link to the campaign you're prompting on.
{% endhint %}

The matrix below outlines some examples of what you can prompt, what to expect during execution, and how the platform handles edge-case errors behind the scenes:

<table data-search="true"><thead><tr><th width="249">Prompt examples</th><th>What it executes under the hood</th><th>The Outcome inside Alpaco</th><th>Error / Guardrail Behavior</th></tr></thead><tbody><tr><td><strong>"What email templates do I have access to right now?"</strong></td><td>Invokes the <code>templates</code> tool to pull your workspace design rules directory.</td><td>The AI prints a clean list of available template names and IDs, the structural block components they allow, and their input field requirements.</td><td>If your workspace has no templates created, the engine responds with an empty array, and the AI will prompt you to build a template in the dashboard.</td></tr><tr><td><strong>"Create a new email campaign called 'Summer Product Update' using My template"</strong></td><td>Executes the <code>assemble</code> tool, passing the required <code>name</code> and conditional <code>template_id</code>.</td><td>A brand-new, fresh email draft asset is initialized in your database. Supported chat clients will instantly pop open a native visual preview window rendering your template.</td><td>If the AI forgets to pass global layout metadata, your validation loop rejects the request with a <code>422 Unprocessable Entity</code> listing missing fields (e.g., <code>design.settings.subjectline is required</code>).</td></tr><tr><td><strong>"Insert Block type Article after Hero Block and write a teaser article about our summer products"</strong></td><td>Runs <code>get_details</code> to fetch the canvas state, appends a new block object to the <code>blocks</code> array with <code>key: "article"</code>, populates the nested <code>values</code> object with the generated summer teaser text, and hits <code>assemble</code>.</td><td>A new component block is placed into your email layout. The core layout updates on the server, and the real-time chat preview window instantly shifts to render the new summer article.</td><td>If the AI makes a typo and maps text to a non-existent key (like <code>teaser_text</code> instead of <code>body_text</code>), the compilation engine throws a <code>422</code> validation error detailing the allowed keys for the <code>article</code> block, forcing the model to instantly self-correct the payload parameters.</td></tr><tr><td><strong>"Find our standard company logo from the media library to use for the header"</strong></td><td>Executes the <code>assets</code> tool, passing a targeted query string (e.g., <code>{"search": "logo"}</code>).</td><td>The AI locates the graphic inside your asset library and extracts its secure, optimization-ready CDN URL to pass to your layout blocks.</td><td>If the AI attempts to pull your entire database without a keyword, your token safeguard forces a search filter requirement to prevent context window exhaustion.</td></tr><tr><td><strong>"Change the main headline text on the last block read 'Summer Sale Now On'"</strong></td><td>First executes <code>get_details</code> to read the current layout JSON state. It safely modifies the text inside the targeted block, wrapping it strictly inside the block's <code>values</code> object, and shoots the entire payload back to <code>assemble</code>.</td><td>The existing email draft record is overwritten and re-compiled on the server. Your chat preview frame instantly flashes to display the text update.</td><td>The protocol strictly blocks partial or empty array updates. If the AI fails to run a state-fetch first, the platform prevents the save command to ensure your existing design blocks are never accidentally wiped out.</td></tr><tr><td><strong>"Export the email to our Hubspot"</strong></td><td>Runs the <code>connections</code> tool to verify linked platforms, then executes the <code>export</code> tool passing the target <code>email_id</code> and <code>esp_connection_id</code>.</td><td>The engine compiles your layout into fully inline-styled, responsive HTML/AMP markup and syncs the template directly to your live HubSpot dashboard.</td><td>If your AI specifies an invalid integration ID or the platform connection has expired, the engine rejects the request with an authentication failure error, and the AI provides your workspace settings link.</td></tr></tbody></table>


# Subject line & Preheader

Subject line & preheaders are a natural part of email marketing, it's the first thingbut the way it's handled and supported by the various ESP's are different

Arguably one of the most important aspects of email marketing is writing a banger of a subject line and preheader to grab readers attention to even open your email in the first place.

### Editor

In the editor users are able to insert both Subject line and preheader for their email. The editor will give indications if the suggested amount of characters have been reached.\
More advanced ESP's are able to pick up one or both of these fields at export, saving you time to have to do it again.

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FYFGynmjZfMZgN4l1QPmw%2FSk%C3%A6rmbillede%202025-05-23%20140057.png?alt=media&amp;token=4c50e2ad-f8cd-4925-89b2-fbce6aed35e5" alt=""><figcaption></figcaption></figure>

### How to insert Subject line & Preheader into HTML

For some ESP's it's not part of their export options and thus it needs to be either manually inserted when sending out the email, and some of the fetch the information straight from the HTML. In these cases we've made it possible to insert those fields from the editor, so you don't have to create your own.\
\
**Subject line**

```html
<html>
  <head>
    <title>{{subjectline}}</title>
  </head>
```

**Preheader**

{% code overflow="wrap" %}

```html
<div style="display: none !important; padding: 0; height: 1px; font-size: 1px; background-color: inherit !important; opacity: 0; color: transparent; mso-line-height-rule: exactly; line-height: 1px; mso-hide: all">
      {{preheader}}
      <div style="display: none; max-height: 0px; overflow: hidden">
        &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
      </div>
    </div>
```

{% endcode %}


# Escape code from the editor

Sometimes you want to display something for the editor, but have some other code executed on export, or sometimes you just want the code editor to leave your delicate ESP specific variables alone

We know how important your code is to you and the slightest little mistake can be detrimental to your output. So we've created two tags for you that each serves their purpose.

### Raw code

This tag tells the editor to disregard whatever is within it. The code won't be processed by the Editor, but it will be present at export for your ESP to process. This is useful when you have something you don't want the Editor to try and process, but still want it present for your own data processing in your ESP.

```
{% raw %}
// This is not processed by the Editor, but will be exported for your ESP
{% endraw %}
```

### Preview only

This tag give you some options to show something in the editor, but have something else displayed at export. This is particular useful for something like product variables or a recommended feed. You can have something neat and informative displayed for the user, but at the export have all the necessary variables injected that the user should not see.

```
{% if preview %}
// This is shown in the Editor for visual purposes
{% else %}
// But this is what's actually exported for the ESP
{% endif %}
```


# Use custom fonts

Here we'll describe how you can add custom fonts to your email campaigns and start making use of them

### Google Fonts

Adding a Google font is just like when you do it for websites:

1. Go to <https://fonts.google.com/>
2. Pick a font.
3. Select the Styles needed
4. Copy the link code and insert into your `<head>` section of the [Base](https://documentation.alpaco.email/template/base).
5. Start using it in your design, by copying the CSS rules for the font-family into your CSS in the various places you want to use it in your [Base](https://documentation.alpaco.email/template/base) and [Blocks](https://documentation.alpaco.email/template/blocks).

<figure><img src="https://4158541773-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUZwvCYi7VuSyayWGoc6M%2Fuploads%2FP0qWZTe9GRGb60hc4DAf%2FSk%C3%A6rmbillede%202023-10-13%20125519.png?alt=media&amp;token=133be660-37e0-4446-9685-8ce0f1800bcb" alt=""><figcaption></figcaption></figure>

### Custom hosted fonts

Adding a Custom hosted font, is very similar, however Alpaco offers to host it for you:

1. Open your Alpaco Account
2. Navigate to *Assets Manager* in the top menu
3. Upload your font where it says "*Drop files here or click here to upload*"
4. When a font is uploaded it will be indicated with a "Aa" icon.
5. Click the font that was uploaded and insert it your `<head>` section of the [**Base**](https://documentation.alpaco.email/template/base) using the *@fontface* method of declaration.&#x20;
6. Start using it in your design, by copying the CSS rules for the font-family into your CSS in the various places you want to use it in your [**Base**](https://documentation.alpaco.email/template/base) and [**Blocks**](https://documentation.alpaco.email/template/blocks).
7.

```
<figure><img src="/files/sIazvFZR5fjhPKLPYDrv" alt=""><figcaption></figcaption></figure>
```


# AMP

AMP for email stands for Accelerated Mobile Pages for email and is the ability to add immersive interactions to your email. It's usually paired up with a fallback versions for non-amp inboxes

AMP is a massive opportunity to stand out in the inbox for your audience, with interactive versions of your Blocks, where users can engage right away in the Inbox with answering questionnaires, pick the color of a product they want, spin the wheel to get a discount or scratch a field to find their coupon code - the options are endless!

### Prerequisites

AMP comes with a bunch of Asterixes\* and here are the highlevel:

* You need an ESP that supports sending AMP versions of Emails. Here's an updated [list](https://amp.dev/support/faq/email-support)
* Set up your SPF, DMARC and DKIM
* Fill out the official form, that whitelists your domain for all the supported ESP's. Here's the [formula](https://docs.google.com/forms/d/e/1FAIpQLSdso95e7UDLk_R-bnpzsAmuUMDQEMUgTErcfGGItBDkghHU2A/viewform?gxids=7628)
* send an AMP email to the following addresses:&#x20;
  * <ampverification@yahoo.com>
  * <postmaster_amp@corp.mail.ru>
  * <ampforemail.whitelisting@gmail.com>
* now pick out some Blocks you want to make AMP versions of while we wait for the 3 weeks approval time
* Be mindful that AMP is very picky about what tags, scripts and CSS is being injected into it

### Raw code

This tag tells the editor to seperate your code into two different versions. The AMP code won't be visible in the Design Editor but show the HTML version and the same [inputs](https://documentation.alpaco.email/template/input-groups/input-types) will be usable across both versions. On the Review page you'll be able to toggle between the AMP,- and HTML version of your Block testing out the fully operational version of both versions of the Email.

The tag must be used both within your [Base](https://documentation.alpaco.email/template/base) and [Blocks](https://documentation.alpaco.email/template/blocks) in order to fully be operational, segmenting out the needed tags for each version. When exporting, downloading or previewing in code view your AMP,- and HTML versions will all be exported in the correct format. <br>

```
{% if AMP %}
// This is exported for your AMP version
{% else %}
// This is exported for your HTML version
{% endif %}   
```

### Result

{% embed url="<https://youtu.be/QDrPLHgVGIc>" %}


