Create an automation
Creates an automation: when a contact submits the trigger event, the linked email template is rendered with their attributes and sent to them automatically. Optional attributes filters limit which contacts get the email.
/v2/ accounts/ {accountId}/ automationsPath parameters
accountIdstringrequired
The account the request is scoped to.
Request body
Request body for creating or updating an automation. Update is a PATCH but takes the complete object, so both calls need every required field.
namestringrequired
Name of the automation, shown on the dashboard.
templateIdstringrequired
Id of the email template the automation sends.
triggerEventSlugstringrequired
Contact event that triggers the send - see List event names.
triggerEventConditionone of: once, everytimerequired
Send on the first occurrence of the event only, or on every occurrence. Only once is accepted when timingCondition is x_days_after.
timingConditionone of: immediately, x_days_afterrequired
Send as soon as the event arrives, or a number of days later. x_days_after additionally requires timingValue.
timingValueintegeroptional
Whole days to wait before sending. Required when timingCondition is x_days_after, omit it otherwise.
isEnabledbooleanrequired
Whether the automation fires; create it disabled to configure before going live.
attributesarray of objectsoptional
Filters the contact must match when the email is due: at the contact event for immediately, at the scheduled time for x_days_after. All filters must match. A contact that does not match gets no email, and a once automation can still reach it at a later contact event. A filter change also applies to emails that are already scheduled. Each operator must fit the type of its attribute, or the request fails with 400. A slug the workspace does not have yet is accepted, and until a contact gets a value for it, every contact counts as not having it. Omit the field or send an empty array to send to every contact. On update, an omitted field keeps the stored filters, and an empty array or null removes them.
slugstringrequired
Attribute slug to test - see the attribute metas endpoint. Case, underscores and hyphens are ignored, so has_mail_server finds hasMailServer. A slug that names no attribute of the workspace is accepted: every contact counts as not having the attribute, so a positive operator matches no contact and a negative operator matches every contact.
operatorone of: exists, not_exists, true, false, not_true, s_equal, s_not_equal, contains, not_contains, n_equal, n_not_equal, greater_than, greater_than_equal, less_than, less_than_equal, after, before, d_equal, d_not_equalrequired
Comparison to apply. The s_/n_/d_ prefixes select string, number and date comparison; pick the family that matches the attribute’s type. String comparisons ignore case and take the value as plain text. false needs a stored false; not_true matches false and a contact without the attribute. Each negative operator (not_exists, not_true, s_not_equal, not_contains, n_not_equal, d_not_equal) matches exactly the contacts its positive operator does not, so it also matches a contact without the attribute.
valueanyoptional
Value to compare against. Its type is dictated by the operator: send an empty string for exists, not_exists, true, false and not_true; a number for the n_ and greater_/less_than operators; a date for after, before, d_equal and d_not_equal; a string for the rest.
Response
The created automation.
Errors
400
The request body or parameters failed validation.
401
Missing or invalid token, or the token is not authorized for this account/user.
See Errors and rate limits for what error responses look like.
curl --location --request POST 'https://api.sendstreak.com/v2/accounts/YOUR_ACCOUNT_ID/automations' \
--header 'Authorization: Bearer YOUR_API_TOKEN' \
--header 'Content-Type: application/json' \
--data-raw '{
"name": "Example name",
"templateId": "6650cc1d3e8a220013ef78ab",
"triggerEventSlug": "signup",
"triggerEventCondition": "once",
"timingCondition": "immediately",
"timingValue": 3,
"isEnabled": false,
"attributes": [
{
"slug": "hasMailServer",
"operator": "true",
"value": ""
}
]
}'
const res = await fetch('https://api.sendstreak.com/v2/accounts/YOUR_ACCOUNT_ID/automations', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SENDSTREAK_TOKEN}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"name": "Example name",
"templateId": "6650cc1d3e8a220013ef78ab",
"triggerEventSlug": "signup",
"triggerEventCondition": "once",
"timingCondition": "immediately",
"timingValue": 3,
"isEnabled": false,
"attributes": [
{
"slug": "hasMailServer",
"operator": "true",
"value": ""
}
]
})
});
import os, requests
res = requests.post(
'https://api.sendstreak.com/v2/accounts/YOUR_ACCOUNT_ID/automations',
headers={'Authorization': f"Bearer {os.environ['SENDSTREAK_TOKEN']}"},
json={
"name": "Example name",
"templateId": "6650cc1d3e8a220013ef78ab",
"triggerEventSlug": "signup",
"triggerEventCondition": "once",
"timingCondition": "immediately",
"timingValue": 3,
"isEnabled": False,
"attributes": [
{
"slug": "hasMailServer",
"operator": "true",
"value": ""
}
]
},
)
{
"_id": "665f0a2b1c9d440012ab34cd",
"name": "Example name",
"templateId": "6650cc1d3e8a220013ef78ab",
"triggerEventSlug": "signup",
"triggerEventCondition": "once",
"timingCondition": "immediately",
"timingValue": 3,
"isEnabled": false,
"attributes": [
{
"slug": "hasMailServer",
"operator": "true",
"value": ""
}
],
"createDate": "2026-07-07T09:30:00.000Z"
}