Reusing content with snippets

Snippets are common pieces of content that you can share across your messages.

Create Snippets

To create a snippet, follow these steps:

  1. Under Create content, click More > Snippets.

  2. Click Create snippet.

  3. Enter a Name and Value for the snippet.

    The New snippet page with the name address and a street address as the value.

    Avoid spaces in snippet names

    To make snippets easier to insert in your message, use underscores or hyphens to separate words in your snippet name. Otherwise, your snippet requires additional syntax.

  4. Click Save.

The Snippets list showing the saved address snippet and its liquid tag.

You can also create snippets through our API.

Add Snippets

You can use snippets anywhere that you can use liquid, including email content, subject lines, SMS, and more. Reference a snippet using {{snippets.<name_of_your_snippet>}}:

{{snippets.address}}

If your snippet name contains spaces, you need to use bracket notation instead: {{snippets["main address"]}}

An email editor with the snippets.address liquid tag in the body and a preview showing the rendered address.

Insert snippets in Design Studio

In Design Studio, type {{ in a text-based component to open liquid autocomplete. The menu lists your available snippets and customer data. Select a snippet to insert it.

Autocomplete also works in text fields in the Properties panel, like a button link, image URL, or alt text. Click a component to open the Properties panel, and type {{ in the field. Learn more about the Properties panel in the visual editor.

Advanced example: iterate over JSON data

You can store JSON data in a snippet, and use liquid to iterate over the JSON. For example, here’s a snippet {{snippets.random_greetings}} containing an array of objects, each object representing a random greeting:

[
  {
    "version": "0",
    "greeting":"How is your day going?"
  },
  {
    "version": "1",
    "greeting":"Hope your week is going well."
  },
  {
    "version": "2",
    "greeting":"Hey there!"
  },
  {
    "version": "3",
    "greeting":"Hope your day is going great so far."
  }
]

You can use JSON dot notation to access variables in your snippet. You can also display a random greeting from the snippet in your message using the following liquid code:

{% capture randomize%}{% random 3 %}{% endcapture %}
{% for g in snippets.random_greetings%}
  {% if g.version == randomize %}
    {{g.greeting}}
  {% endif %}
{% endfor %}

Frequently asked questions

  1. Can I use liquid within a snippet? Yes, liquid within a snippet will render in your message normally. For example, adding {{customer.id}} to your Snippet content will show a person’s id attribute wherever you use your snippet. You can even store liquid in JSON objects and strings, helping you store variable information. (You cannot store liquid in a JSON array in a snippet. Liquid inside a JSON array will simply render as text when you use your snippet.)

    Note that you shouldn’t use person liquid in snippets for anonymous messages because anonymous messages don’t have a person to resolve against. If you want to use a snippet in an anonymous message, you should keep it free of profile data. If you use a snippet in both identified and anonymous messages, you should add a fallback to any profile liquid so it degrades gracefully—for example, {{customer.first_name | default: "there"}}. The fallback shows whenever the attribute is missing, including in anonymous messages.

    Snippets can't reference variables from a message body

    While snippets can contain liquid, you cannot reference variables that you set in the message body. Message body variables are out of the snippet scope and won’t code be parsed.
  2. Can I change the name of a snippet? No, you cannot change the name of a snippet. To use a different name, copy the snippet body and create a new snippet.

  3. Can I use HTML in a snippet? Yes! HTML in a snippet renders normally in anywhere where HTML is allowed. Just make sure that you intend to use a snippet in a place that renders HTML first. For example, HTML in a subject line will not render. If you use a snippet including HTML in your subject line, your audience will see raw code.

  4. Is there a size limit for a snippet? Yes, the default max size for an individual snippet is 16 KB, which can be increased on a case-by-case basis. The sum of all snippets in a workspace must be less than 5 MB. Contact win@customer.io to request an increase.

Updated October 23, 2026