Back to Glossary
Templates & Automation

Text Variable

Also known as: Variable

Definition

A named text token defined at the scene level that can be embedded in text blocks and populated with a value at runtime. Variables separate design from content: a template author defines the variable names and places them in text blocks using {{variableName}} syntax; a product or automation layer provides the actual values when generating output.

Variables are the mechanism behind personalization and data-driven generation: certificates with recipient names, social posts with product titles, direct mail with customer addresses, ID badges with employee data.

How Variables Work

Variables are stored in the scene. A variable has a key and a string value. When the scene is rendered, CE.SDK resolves all variable tokens in text blocks to their current values.

Variable keys are case-sensitive: {{Name}} and {{name}} are treated as distinct variables. Consistent casing between template authoring and data injection is required.

How to Create and Use Variables in the Editor

Define the variable programmatically before opening the editor

Variables must be defined via the Variables API before they are available in the editor UI. There is no “create variable” button in the interface.

Open the scene with the Creator role active

Once the variable is defined in the scene, it becomes available to insert through the editor UI.

Double-click a text block to enter edit mode

Position the cursor where the variable token should appear.

Open the Insert Variable dropdown in the Canvas Menu

This dropdown only appears if at least one variable is already defined in the scene. Select the variable to insert, and CE.SDK places the token into the text block at the cursor position.

The token renders as the variable’s current value

In both the editor preview and any export, the token is replaced with whatever value the variable currently holds.

How to Create and Use Variables Programmatically

Define the variable via the Variables API

Provide a key and a string value. If the key does not exist it is created; if it already exists its value is updated.

Retrieve all variables currently defined in the scene

Useful when loading an existing template to understand what data it expects before attempting to inject values.

Embed the token in a text block

Include the {{variableName}} syntax in the block’s text content. CE.SDK resolves all tokens at render time.

Set values, export, and remove when done

Read a variable’s current value using the get method. Update it before export for each row in a batch. Remove variables using the remove method on the Variables API when no longer needed.

To show localized labels for variables in the Insert Variable dropdown, configure translations via the i18n API. This is useful when templates are authored in a different locale than the one used in the editor UI.

Variables vs. Placeholders

Variables

Handle dynamic text content populated from data. Content is injected programmatically via the Variable API: the source is a structured data set, not a user typing in an editor.

Placeholders

Handle interactive content slots where Adopters manually replace images, videos, or text. The content originates from a human decision at edit time.

Both can coexist in the same template: a postcard template might have image placeholders that the Adopter swaps manually, and text variables that the platform injects automatically.