Template Variables & Spin Syntax
Personalize your email templates with dynamic variables and spin syntax for better deliverability.
Template Variables#
Use double curly braces to insert lead data into your email templates. Variables are replaced with actual values when the email is sent.
Hi {{first_name}},
I noticed {{company}} is growing fast. Would love to chat about how we can help.Result for John at Acme Inc:
Hi John,
I noticed Acme Inc is growing fast. Would love to chat about how we can help.Available Variables#
These standard variables map directly to lead fields:
| Variable | Description | Example Value |
|---|---|---|
{{first_name}} | Lead's first name | John |
{{last_name}} | Lead's last name | Doe |
{{full_name}} | First + last name combined | John Doe |
{{email}} | Lead's email address | john@example.com |
{{company}} | Company name | Acme Inc. |
{{title}} | Job title | Marketing Manager |
{{phone}} | Phone number | +1 555-1234 |
{{linkedin}} | LinkedIn profile URL | https://linkedin.com/in/johndoe |
{{website}} | Website URL | https://acme.com |
Custom Field Variables#
Any custom fields stored on a lead can also be used as variables:
I see you're in the {{industry}} space in {{location}}.Custom fields are set via the customFields object when creating or updating a lead:
{
"email": "john@example.com",
"customFields": {
"industry": "Technology",
"location": "San Francisco"
}
}Fallback Values#
If a variable has no value for a particular lead, you can provide a fallback using the pipe | syntax:
Hi {{first_name|there}},
I saw that {{company|your company}} is doing great work.If first_name is missing, the email will read "Hi there," instead of "Hi ," with an awkward blank.
Spin Syntax#
Spin syntax creates random variations of your email content. This helps improve deliverability by making each email unique, which avoids spam filter detection for bulk sends.
How It Works#
Wrap alternative phrases in single curly braces, separated by pipes:
{Hi|Hello|Hey} {{first_name}},
{I noticed|I saw|I came across} {{company}} and {wanted to reach out|thought I'd connect}.Each time an email is sent, one option is randomly selected from each spin block. This single template produces 12 unique variations (3 x 2 x 2).
Examples#
Input:
{Hi|Hello|Hey} {{first_name}},
{I hope this finds you well.|Hope you're having a great week.}
{I noticed|I saw|I came across} that {{company}} is {growing quickly|expanding|scaling up}.
{I'd love to|Would love to|I'd be happy to} chat about how we can help.
{Best|Cheers|Thanks},
{Your Name}Possible output 1:
Hello John,
Hope you're having a great week.
I came across that Acme Inc is scaling up.
I'd be happy to chat about how we can help.
Cheers,
Your NamePossible output 2:
Hi John,
I hope this finds you well.
I noticed that Acme Inc is growing quickly.
Would love to chat about how we can help.
Best,
Your NameSyntax Rules#
Single braces with pipes: {option1|option2|option3}
Used for email text variation.
Double braces: {{variable_name}}
Used for lead personalization.
- Spin blocks require at least two options separated by
| - Spin blocks cannot be nested:
{Hello {there|friend}}is not supported - Empty options are not allowed:
{Hi||Hey}is rejected with a400when you save a campaign sequence step. Templates are not checked for spin errors when you save them, so review spin blocks in a template before you use it - Spin options cannot contain variables:
{Hi {{first_name}}|Hey there}is not treated as a spin block, and its braces end up in the sent email. Spin blocks are resolved before variables, so keep each variable outside the block, for example{Hi|Hey} {{first_name}} - Variables and spin syntax can be combined in the same template, as long as every variable sits outside a spin block
Using in the API#
Both subject and body fields in templates support variables and spin syntax:
curl -X POST "https://api.foxreach.io/api/v1/templates" \
-H "X-API-Key: otr_your_key" \
-H "Content-Type: application/json" \
-d '{
"name": "Cold Outreach v1",
"subject": "{Quick question|An idea} for {{company}}",
"body": "{Hi|Hey} {{first_name|there}},\n\n{I noticed|I saw} {{company}} is {growing|scaling}. {Would love to|I'\''d like to} discuss how we can help.\n\n{Best|Cheers},\nYour Name"
}'