Skip to main content
POST
/
api
/
v1
/
sequences
Create Sequence
curl --request POST \
  --url https://api.sequenzy.com/api/v1/sequences \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "trigger": "<string>",
  "listId": "<string>",
  "tagName": "<string>",
  "segmentId": "<string>",
  "eventName": "<string>",
  "inactiveDays": 123,
  "minCount": 123,
  "timeWindowDays": 123,
  "enrollmentMode": "<string>",
  "enrollmentFieldPath": "<string>",
  "stopCondition": {},
  "goal": "<string>",
  "emailCount": 123,
  "steps": [
    {
      "type": "<string>",
      "subject": "<string>",
      "previewText": "<string>",
      "blocks": [
        {}
      ],
      "html": "<string>",
      "delay": {
        "days": 123,
        "hours": 123,
        "minutes": 123
      },
      "name": "<string>",
      "discount": {
        "label": "<string>",
        "provider": "<string>",
        "discountType": "<string>",
        "percentOff": 123,
        "amountOff": 123,
        "currency": "<string>",
        "duration": "<string>",
        "durationInMonths": 123,
        "appliesToAllPlans": true,
        "planIds": [
          {}
        ],
        "codePrefix": "<string>",
        "maxRedemptions": 123,
        "lockToSubscriber": true,
        "expiresAt": "<string>",
        "expiresInHours": 123,
        "name": "<string>"
      }
    }
  ]
}
'
{
  "success": true,
  "message": "Sequence created. AI is generating email content based on your brand. This typically takes 30-60 seconds.",
  "sequence": {
    "id": "seq_abc123",
    "name": "Onboarding Sequence",
    "status": "draft",
    "emailCount": 5
  }
}

Documentation Index

Fetch the complete documentation index at: https://docs.sequenzy.com/llms.txt

Use this file to discover all available pages before exploring further.

Create Sequence

Create an automation sequence that sends emails based on triggers. You can either:
  • Provide a goal to have AI generate the email content
  • Provide steps with explicit email content and actions such as Stripe discount creation

Request

name
string
required
Name for the sequence
trigger
string
required
Trigger type: contact_added, tag_added, segment_entered, event_received, inactivity, or frequency
listId
string
List ID (for contact_added trigger)
tagName
string
Tag name (for tag_added trigger)
segmentId
string
Segment ID (for segment_entered trigger)
eventName
string
Event name (for event_received, inactivity, frequency triggers)
inactiveDays
number
Days of inactivity (for inactivity trigger)
minCount
number
Minimum event count (for frequency trigger)
timeWindowDays
number
Time window in days (for frequency trigger)
enrollmentMode
string
Re-entry mode: unlimited, one_time, or matching_field. Defaults to matching_field for Shopify replenishment and back-in-stock events, otherwise unlimited. matching_field is only valid for event_received sequence triggers.
enrollmentFieldPath
string
Dot-path event property used by matching_field, such as order.id or product.providerVariantId. Leave empty for the built-in Shopify product/variant default.
stopCondition
object
Optional auto-stop condition. Use has_tag to end the sequence when a subscriber gets a tag, does_not_have_tag when a tag is removed, event_received when an event is tracked, added_to_list when a subscriber joins a list, removed_from_list when a subscriber leaves a list, or none to clear auto-stop behavior.

Option A: AI Generation

goal
string
Description of what the sequence should accomplish. AI will generate email content based on this.
emailCount
number
Number of emails to generate (default: 5, maximum: 10)

Option B: Explicit Content

steps
array
Array of explicit steps. Email steps must have either blocks or html; discount steps use type: "create_discount" and can run before an email that references {{discount.code}}.

Discount Merge Tags

When a create_discount step runs, later emails in the same sequence can use discount merge tags from the most recent created discount:
  • {{discount.code}}
  • {{discount.percentOff}}
  • {{discount.amountOff}}
  • {{discount.currency}}
  • {{discount.expiresAt}}
Discount sequences require a connected integration for the selected provider, such as Stripe or Shopify, before activation.

Enrollment Modes

Use matching_field for event-triggered sequences where each run belongs to a specific object in the event payload. It lets a subscriber have separate active runs for different products, variants, orders, subscriptions, or other event-scoped objects, while blocking duplicate active runs for the same resolved field. Set enrollmentFieldPath for custom events, or send sequenceEnrollmentKey, enrollmentKey, or common product/variant fields in the event properties.
{
  "trigger": "event_received",
  "eventName": "ecommerce.order_placed",
  "enrollmentMode": "matching_field",
  "enrollmentFieldPath": "order.id"
}

Event-Personalized Sequence Emails

If you create a sequence with trigger: "event_received", the event payload that enrolls the subscriber is available inside sequence emails through event. merge tags. For example, if your app sends:
{
  "email": "user@example.com",
  "event": "weather.wind_alert",
  "properties": {
    "city": "Tel Aviv",
    "alert": {
      "maxSpeed": 75
    },
    "duration": {
      "hours": 6
    }
  }
}
You can use values like:
  • {{event.city}}
  • {{event.alert.maxSpeed}}
  • {{event.duration.hours|a few}}
Sequenzy stores the event snapshot on the sequence run, so delayed follow-up emails in the same sequence keep using the original values.

Examples

AI-Generated Content

curl -X POST "https://api.sequenzy.com/api/v1/sequences" \
  -H "Authorization: Bearer seq_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Onboarding Sequence",
    "trigger": "contact_added",
    "stopCondition": {
      "type": "has_tag",
      "value": "customer"
    },
    "goal": "Welcome new users and help them get started with our product",
    "emailCount": 5
  }'

Explicit Content with Blocks

curl -X POST "https://api.sequenzy.com/api/v1/sequences" \
  -H "Authorization: Bearer seq_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Welcome Sequence",
    "trigger": "contact_added",
    "steps": [
      {
        "subject": "Welcome to our product!",
        "blocks": [
          {
            "id": "heading-1",
            "type": "heading",
            "content": "Welcome!",
            "level": 1
          },
          {
            "id": "text-1",
            "type": "text",
            "content": "<p>Thanks for signing up. We are excited to have you.</p>",
            "variant": "paragraph"
          }
        ]
      },
      {
        "subject": "Getting started guide",
        "delay": { "days": 1 },
        "blocks": [
          {
            "id": "heading-2",
            "type": "heading",
            "content": "Getting Started",
            "level": 1
          },
          {
            "id": "text-2",
            "type": "text",
            "content": "<p>Here is everything you need to get started...</p>",
            "variant": "paragraph"
          }
        ]
      }
    ]
  }'

Explicit Content with HTML (Auto-converted)

Use this when migrating from other platforms or when you have existing HTML templates (React Email, MJML, etc.).
curl -X POST "https://api.sequenzy.com/api/v1/sequences" \
  -H "Authorization: Bearer seq_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Migrated Sequence",
    "trigger": "contact_added",
    "steps": [
      {
        "subject": "Welcome!",
        "html": "<h1>Welcome to our platform!</h1><p>We are thrilled to have you on board.</p><a href=\"https://example.com/start\">Get Started</a>"
      },
      {
        "subject": "Quick tips to get started",
        "delay": { "days": 2 },
        "html": "<h2>Getting Started Guide</h2><p>Here are some tips:</p><ul><li>Complete your profile</li><li>Explore the dashboard</li><li>Connect your integrations</li></ul>"
      }
    ]
}'

Explicit Discount Action

Use this when you want Sequenzy to generate a Stripe promotion code before sending a follow-up email. Connect Stripe in Settings before enabling the sequence.
curl -X POST "https://api.sequenzy.com/api/v1/sequences" \
  -H "Authorization: Bearer seq_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Win-back Discount",
    "trigger": "tag_added",
    "tagName": "cancelled",
    "steps": [
      {
        "type": "create_discount",
        "discount": {
          "label": "Create win-back discount",
          "discountType": "percent",
          "percentOff": 20,
          "duration": "once",
          "appliesToAllPlans": true,
          "maxRedemptions": 1,
          "lockToSubscriber": true,
          "codePrefix": "WINBACK"
        }
      },
      {
        "subject": "Come back with {{discount.code}}",
        "delay": { "days": 1 },
        "html": "<p>Use {{discount.code}} for {{discount.percentOff}}% off your next subscription.</p>"
      }
    ]
  }'

Event-Triggered Sequence With {{event.*}}

curl -X POST "https://api.sequenzy.com/api/v1/sequences" \
  -H "Authorization: Bearer seq_live_xxx" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Wind Alert Follow-up",
    "trigger": "event_received",
    "eventName": "weather.wind_alert",
    "steps": [
      {
        "subject": "Wind alert for {{event.city}}",
        "html": "<p>Winds may reach {{event.alert.maxSpeed}} km/h for {{event.duration.hours|a few}} hours.</p>"
      },
      {
        "subject": "Stay safe in {{event.city}}",
        "delay": { "hours": 12 },
        "html": "<p>The original alert is still active for {{event.city}}. Check local guidance if conditions change.</p>"
      }
    ]
  }'

Responses

{
  "success": true,
  "message": "Sequence created. AI is generating email content based on your brand. This typically takes 30-60 seconds.",
  "sequence": {
    "id": "seq_abc123",
    "name": "Onboarding Sequence",
    "status": "draft",
    "emailCount": 5
  }
}

Notes

  • The sequence is created in draft status. Use POST /api/v1/sequences/{id}/enable to activate it.
  • For backwards compatibility, POST /v1/sequences is still accepted as an alias.
  • When using email steps, each email step creates an email template in your account that can be edited later.
  • Sequences with create_discount steps require a connected Stripe integration before activation.
  • When using goal, AI generates content asynchronously. Poll GET /api/v1/sequences/{id} to check enrichment status.
  • The first step typically has no delay (sends immediately after trigger).
  • For event_received sequences, properties sent to POST /api/v1/subscribers/events are available as {{event.*}} merge tags in sequence emails.
  • When using html in steps, the content is automatically converted to Sequenzy blocks using AI. This supports:
    • Plain HTML
    • React Email rendered output
    • MJML compiled output
    • Any HTML-like email content