Skip to content

Email & Templates

Email templates are the reusable HTML or plain-text content behind your outbound campaigns and automations. This API manages the templates and template folders saved in your account’s email builder: list them, create new ones, import one from another email provider, fetch a template’s content, update it, or delete it. It also creates, edits, schedules, and deletes email campaigns, reads the email campaigns that workflows and bulk actions send, and returns delivery statistics for email, workflow, and bulk action campaigns. Campaign endpoints also pause, resume, cancel, archive, duplicate, preview, validate, and test-send a campaign, and size an audience before you schedule.

Base URL: https://services.smbcrm.com · Version header: v3 · Scopes: emails/templates.readonly / emails/templates.write (templates and folders), emails/campaigns.readonly / emails/campaigns.write (campaigns), and emails/stats.readonly (statistics). See Scopes.

Every endpoint on this page takes your account/location ID as a path segment. See Base URL & Headers for where <location_id> comes from. Responses carry a traceId that identifies the request.

GET/emails/locations/{locationId}/templates

List email templates and folders saved in your account's email builder.

scope emails/templates.readonlyauth Location token or PIT

Page through results with limit and offset, or narrow the list with search, archived, and folderId. A page holds at most 20 items, so for a longer list, step offset forward until you have read total items.

Terminal window
curl "https://services.smbcrm.com/emails/locations/<location_id>/templates?limit=20&offset=0" \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"items": [
{
"id": "<template_id>",
"name": "Welcome Email",
"type": "template",
"editorType": "html",
"isPlainText": false,
"previewUrl": "<preview_url>",
"updatedAt": "2026-06-02T10:15:00.000Z",
"createdAt": "2026-05-28T09:00:00.000Z"
},
{
"id": "<folder_id>",
"name": "Spring Campaigns",
"type": "folder",
"childCount": 3,
"hasChildren": true,
"updatedAt": "2026-06-01T08:30:00.000Z",
"createdAt": "2026-05-20T14:00:00.000Z"
}
],
"total": 2,
"traceId": "<trace_id>"
}
Query param Type Required Description
limit number No Number of items to return, 1 to 20. Default 10.
offset number No Number of items to skip. Default 0.
search string No Search by template name.
sortBy string No Field to sort by. Only updatedAt is supported, and it is the default.
sortOrder string No asc or desc. Default desc.
archived boolean No Return archived templates. Default false.
folderId string No List the contents of a single folder. Use root for the top level.
include string No templates returns only templates, folders returns only folders, and all returns both. Default all.

Only id, name, and type are always present on a list item. The other fields depend on the item’s type.

Field Type Description
id string Template or folder ID.
name string Template or folder name.
type string template or folder.
editorType string html, builder, or text. Templates only.
isPlainText boolean Whether the template is plain text. Templates only.
previewUrl string Preview URL. Templates only.
parentFolderId string ID of the folder that holds the item.
childCount number Number of items in the folder. Folders only.
hasChildren boolean Whether the folder has items in it. Folders only.
createdAt string ISO 8601 creation time.
updatedAt string ISO 8601 time of the last update.
POST/emails/locations/{locationId}/templates

Create an email template in your account's email builder.

scope emails/templates.writeauth Location token or PIT

name and editorType are required, and every other field is optional. Send the template body as editorContent, along with the default subjectLine, fromName, and fromEmail for messages sent from it. Leave out editorContent to create a blank template and fill it in later with an update. Send an optional Idempotency-Key header to make a retry safe.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/templates \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome Email",
"editorType": "html",
"editorContent": "<html>...</html>",
"parentFolderId": "<folder_id>",
"subjectLine": "Welcome to Acme",
"fromName": "Acme Support",
"fromEmail": "support@example.com",
"previewText": "Thanks for signing up"
}'
201 Created
{
"id": "<template_id>",
"name": "Welcome Email",
"editorType": "html",
"isPlainText": false,
"parentFolderId": "<folder_id>",
"fromName": "Acme Support",
"fromEmail": "support@example.com",
"subjectLine": "Welcome to Acme",
"previewText": "Thanks for signing up",
"previewUrl": "<preview_url>",
"createdAt": "2026-06-02T10:15:00.000Z",
"updatedAt": "2026-06-02T10:15:00.000Z",
"traceId": "<trace_id>"
}
Body field Type Required Description
name string Yes Template name.
editorType string Yes html for a code-editor template, builder for a design-editor template, or text for a plain-text template.
editorContent string or object No Initial content: an HTML or plain-text string for html and text, or design-editor JSON for builder.
parentFolderId string No Create the template inside this folder.
subjectLine string No Default email subject line.
fromName string No Default sender name.
fromEmail string No Default sender email address.
previewText string No Preview text that appears after the subject line in the inbox.
userId string No ID of the user performing the action.
GET/emails/locations/{locationId}/templates/{templateId}

Get a single email template, including a link to its content.

scope emails/templates.readonlyauth Location token or PIT

Add includeContent=true to also get the current editorContent in the response: the HTML or plain-text string for html and text templates, or the design-editor JSON for builder templates. Fetch it before you edit a body, so your change starts from the latest version.

Terminal window
curl https://services.smbcrm.com/emails/locations/<location_id>/templates/<template_id> \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"id": "<template_id>",
"name": "Welcome Email",
"editorType": "html",
"isPlainText": false,
"parentFolderId": "<folder_id>",
"fromName": "Acme Support",
"fromEmail": "support@example.com",
"subject": "Welcome to Acme",
"previewText": "Thanks for signing up",
"editorContentUrl": "https://<storage_host>/<path>.html",
"deleted": false,
"createdAt": "2026-05-28T09:00:00.000Z",
"updatedAt": "2026-06-02T10:15:00.000Z",
"traceId": "<trace_id>"
}
Query param Type Required Description
includeContent boolean No Return editorContent in the response. Default false.
PATCH/emails/locations/{locationId}/templates/{templateId}

Update an email template's content or metadata.

scope emails/templates.writeauth Location token or PIT

Send only the fields you want to change. To change the body, send editorContent together with editorType (html, builder, or text) in the same request. A content write must keep the template’s editor: sending html or text to a builder template, or builder to an html or text template, returns 409 unless you set allowEditorTypeChange to true. Switching between html and text is always allowed.

Terminal window
curl -X PATCH https://services.smbcrm.com/emails/locations/<location_id>/templates/<template_id> \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome Email (v2)",
"subjectLine": "Welcome to the Acme family"
}'

To replace the body, send both content fields:

Terminal window
curl -X PATCH https://services.smbcrm.com/emails/locations/<location_id>/templates/<template_id> \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"editorType": "html",
"editorContent": "<html><body>Welcome aboard.</body></html>"
}'
200 OK
{
"id": "<template_id>",
"name": "Welcome Email (v2)",
"archived": false,
"fromName": "Acme Support",
"fromEmail": "support@example.com",
"subjectLine": "Welcome to the Acme family",
"previewText": "Thanks for signing up",
"previewUrl": "<preview_url>",
"updatedAt": "2026-07-01T12:00:00.000Z",
"traceId": "<trace_id>"
}
Body field Type Required Description
name string No Template name.
editorContent string or object No New content: an HTML or plain-text string, or design-editor JSON for builder. Send it together with editorType.
editorType string No html, builder, or text. Send it together with editorContent.
allowEditorTypeChange boolean No Set true to convert the template to a different editor on purpose. Default false.
previewText string No Preview text that appears after the subject line in the inbox.
subjectLine string No Default email subject line.
fromName string No Default sender name.
fromEmail string No Default sender email address.
archived boolean No Whether the template is archived.
parentFolderId string No Move the template into this folder. Send null to move it to the top level.
userId string No ID of the user performing the action.

Set archived to true to archive a template without deleting it; archived templates are excluded from List email templates unless you pass archived=true.

DELETE/emails/locations/{locationId}/templates/{templateId}

Delete an email template.

scope emails/templates.writeauth Location token or PIT
Terminal window
curl -X DELETE https://services.smbcrm.com/emails/locations/<location_id>/templates/<template_id> \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"deleted": true,
"traceId": "<trace_id>"
}

For editorType: "builder", editorContent is a JSON object with three parts: elements, attrs, and templateSettings. elements is the layout tree, with mj-section holding mj-column holding leaf elements such as mj-text, mj-image, and mj-button. Every node has a unique id and a tagName. attrs is a flat map keyed by node id, with one entry for every node in the tree, sections and columns included. Each entry holds tagName, content (the text or HTML of leaf elements), and an attributes list of { name, default, unit? } objects, where sizes are a number plus a px or % unit.

Two rules keep a design from changing on first edit. First, send the full attribute set for every element, because any attribute you leave out is filled in with the editor default when someone selects the element. Second, split padding into padding-top, padding-right, padding-bottom, and padding-left with enable-padding set to true; the padding shorthand and inline style are not read. The simplest way to get a valid shape is to fetch an existing builder email with includeContent=true, change the values you need, and send it back.

The same format applies to campaign content and to A/B variations on this page.

POST/emails/locations/{locationId}/templates/{templateId}/duplicate

Copy a template, optionally renaming it or placing it in a folder.

scope emails/templates.writeauth Location token or PIT

All body fields are optional. Omit name to keep the source name. Omit parentFolderId to place the copy at the top level; if you send one, it must be an active template folder in this account. The response is the same shape as Retrieve an email template. It accepts an Idempotency-Key header.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/templates/<template_id>/duplicate \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"name": "Welcome Email (copy)",
"parentFolderId": "<folder_id>"
}'
201 Created
{
"id": "<new_template_id>",
"name": "Welcome Email (copy)",
"editorType": "html",
"isPlainText": false,
"parentFolderId": "<folder_id>",
"subject": "Welcome to Acme",
"editorContentUrl": "https://<storage_host>/<path>.html",
"deleted": false,
"createdAt": "2026-11-17T10:00:00.000Z",
"updatedAt": "2026-11-17T10:00:00.000Z",
"traceId": "<trace_id>"
}
Body field Type Required Description
name string No Name for the copy. Must not be empty when you send it.
parentFolderId string No Folder to put the copy in.
userId string No ID of the user recorded as the creator of the copy.
POST/emails/locations/{locationId}/templates/{templateId}/preview

Return a template's saved HTML, subject, and preview text without sending anything.

scope emails/templates.readonlyauth Location token or PIT

The body is returned exactly as saved, so merge fields such as {{contact.first_name}} stay in place; they are filled in per contact at send time. unresolvedMergeFields lists the distinct merge tokens still present. No request body is needed.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/templates/<template_id>/preview \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"html": "<html><body><p>Hello {{contact.first_name}}</p></body></html>",
"subject": "Welcome to Acme",
"previewText": "Thanks for signing up",
"unresolvedMergeFields": ["{{contact.first_name}}"],
"traceId": "<trace_id>"
}
POST/emails/locations/{locationId}/templates/{templateId}/test

Send a template to one to five addresses as a test.

scope emails/templates.writeauth Location token or PIT

emails is required. The test uses the template’s stored subject and sender unless you override them, and merge fields are filled with sample contact data, not real recipient values. Test sends are limited to 20 per account per hour, shared with campaign test sends. Send an Idempotency-Key so a retry cannot send twice. A 200 means the test was accepted, not that it was delivered.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/templates/<template_id>/test \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Idempotency-Key: <unique_key>" \
-H "Content-Type: application/json" \
-d '{
"emails": ["qa@example.com"],
"userId": "<user_id>"
}'
200 OK
{
"accepted": true,
"recipients": ["qa@example.com"],
"note": "Accepted for sending; delivery is not confirmed.",
"traceId": "<trace_id>"
}
Body field Type Required Description
emails string[] Yes One to five recipient addresses.
subject string No Subject for this test. Defaults to the stored subject; an empty string fails validation.
fromName string No Sender name for this test.
fromEmail string No Sender address for this test. Must be a valid email address.
userId string No Active user of the account the test is sent as. Defaults to the token’s user, so it is required when the token has no user, such as a location token without one. Find IDs with Users.
POST/emails/locations/{locationId}/templates/folders

Create a folder to group email templates.

scope emails/templates.writeauth Location token or PIT

Folders group templates in the email builder. name is required. Pass the folder’s id as parentFolderId when you create, import, or move a template, and as folderId when you list templates.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/templates/folders \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"name": "Spring Campaigns"
}'
201 Created
{
"id": "<folder_id>",
"name": "Spring Campaigns",
"createdAt": "2026-06-02T10:15:00.000Z",
"updatedAt": "2026-06-02T10:15:00.000Z",
"traceId": "<trace_id>"
}
Body field Type Required Description
name string Yes Folder name.
userId string No ID of the user performing the action.
POST/emails/locations/{locationId}/templates/import

Create a template from a public template URL at another email provider.

scope emails/templates.writeauth Location token or PIT

importProvider and importUrl are required. The import works from a public template URL, so it supports only the providers listed below. The response has the same fields as Create an email template.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/templates/import \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"importProvider": "mailchimp",
"importUrl": "https://templates.example.com/public/template-123",
"name": "Imported Template",
"parentFolderId": "<folder_id>"
}'
201 Created
{
"id": "<template_id>",
"name": "Imported Template",
"editorType": "html",
"isPlainText": false,
"parentFolderId": "<folder_id>",
"previewUrl": "<preview_url>",
"createdAt": "2026-06-02T10:15:00.000Z",
"updatedAt": "2026-06-02T10:15:00.000Z",
"traceId": "<trace_id>"
}
Body field Type Required Description
importProvider string Yes mailchimp or active_campaign.
importUrl string Yes Public URL of the template to import.
name string No Name for the imported template.
parentFolderId string No Folder to import the template into.
userId string No ID of the user performing the action.

An email campaign sends one email to the contacts you select when you schedule it. Create the campaign, edit its content, check it with validate and a test send, then schedule it. You can update a campaign’s content and send settings while it is a draft, paused, or cancelled, and you can schedule it only from draft, cancelled, or paused status. Once it is sending, use pause or cancel to stop it.

A campaign’s status is draft, scheduled, processing, sent, paused, cancelled, failed, or archived. Reads, previews, validation, and the audience lists need emails/campaigns.readonly. Create, update, schedule, delete, test sends, state changes (pause, resume, cancel, archive), duplicate, A/B variations, and recipient estimates need emails/campaigns.write.

GET/emails/locations/{locationId}/campaigns/emails

List the email campaigns in your account.

scope emails/campaigns.readonlyauth Location token or PIT

Page through results with limit (1 to 20, default 10) and offset (default 0). Filter with search, which matches the campaign name, and status: all, sent, failed, archived, draft, processing, scheduled, cancelled, or paused.

Terminal window
curl "https://services.smbcrm.com/emails/locations/<location_id>/campaigns/emails?limit=10&offset=0&status=sent" \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"campaigns": [
{
"id": "<campaign_id>",
"source": "email-campaign",
"sourceId": "<source_id>",
"name": "February Newsletter",
"status": "sent",
"campaignType": "bulk-email",
"deleted": false,
"createdAt": "2026-02-01T11:55:43.598Z",
"updatedAt": "2026-02-09T04:49:12.322Z"
}
],
"total": 1,
"traceId": "<trace_id>"
}

Every campaign response uses these fields. Only id, deleted, createdAt, and updatedAt are always present.

Field Type Description
id string Campaign ID.
name string Campaign name.
status string draft, scheduled, processing, sent, paused, cancelled, failed, or archived.
source string Source of the campaign.
sourceId string ID to pass to the statistics endpoint.
campaignType string Delivery type of the campaign.
campaignCategory string Category of the campaign.
variations array A/B test campaigns only. Each entry has sourceId, which you pass to the statistics endpoint for that variation, and isWinner.
deleted boolean Whether the campaign is deleted.
createdAt string ISO 8601 creation time.
updatedAt string ISO 8601 time of the last update.
POST/emails/locations/{locationId}/campaigns/emails

Create an email campaign, either blank or from an existing template.

scope emails/campaigns.writeauth Location token or PIT

name, editorType, timeZone, and userId are required. Pass templateId to start from an existing template, or leave it out to create a blank campaign. To set the content in the same request, send editorContent. The request accepts an Idempotency-Key header.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/campaigns/emails \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"name": "October Newsletter",
"editorType": "html",
"templateId": "<template_id>",
"timeZone": "America/New_York",
"userId": "<user_id>"
}'
201 Created
{
"id": "<campaign_id>",
"name": "October Newsletter",
"status": "draft",
"editorContentUrl": "https://<storage_host>/<path>.html",
"deleted": false,
"createdAt": "2026-10-08T14:00:00.000Z",
"updatedAt": "2026-10-08T14:00:00.000Z",
"traceId": "<trace_id>"
}
Body field Type Required Description
name string Yes Campaign name.
editorType string Yes html for a code-editor campaign, builder for a design-editor campaign, or text for a plain-text campaign.
timeZone string Yes Time zone for the campaign, such as America/New_York.
userId string Yes ID of the user performing the action.
templateId string No Existing template to create the campaign from.
editorContent string or object No Initial content, saved right after the campaign is created: an HTML or plain-text string, or design-editor JSON for builder.
parentFolderId string No Parent folder ID.
userName string No Name of the user performing the action.
GET/emails/locations/{locationId}/campaigns/emails/{campaignId}

Get a single email campaign, including its sender details and a link to its content.

scope emails/campaigns.readonlyauth Location token or PIT

In addition to the fields above, a single campaign returns editorType (html, builder, or text), isPlainText, fromName, fromEmail, subject, replyToAddress, and previewText. As with templates, the body reads back as editorContentUrl, a link you fetch with a GET request. Add includeContent=true to also get editorContent inline (a string, or design-editor JSON for builder), and fetch it before editing so you start from the latest version. A campaign last saved in the newer block-based design editor returns designEditorV2: true and no editorContent; a builder update through this API would replace that design.

If you have created A/B versions and not yet scheduled the test, the response lists them in abVersions. Each entry has variationIndex (1 is version B, 2 is version C), version, and documentId, plus subject for subject-line tests.

Terminal window
curl https://services.smbcrm.com/emails/locations/<location_id>/campaigns/emails/<campaign_id> \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"id": "<campaign_id>",
"source": "email-campaign",
"sourceId": "<source_id>",
"name": "October Newsletter",
"status": "sent",
"editorType": "html",
"isPlainText": false,
"editorContentUrl": "https://<storage_host>/<path>.html",
"fromName": "Acme Support",
"fromEmail": "support@example.com",
"subject": "Our October newsletter",
"replyToAddress": "reply@example.com",
"previewText": "What's new this month",
"deleted": false,
"createdAt": "2026-09-20T14:00:00.000Z",
"updatedAt": "2026-09-25T09:00:00.000Z",
"traceId": "<trace_id>"
}
PATCH/emails/locations/{locationId}/campaigns/emails/{campaignId}

Update the name, content, or send settings of an email campaign that has not started sending.

scope emails/campaigns.writeauth Location token or PIT

Send only the fields you want to change. To change the content, send editorContent together with editorType (html, builder, or text). A content write must keep the campaign’s editor: sending html or text to a builder campaign, or builder to an html or text campaign, returns 409 unless you set allowEditorTypeChange to true. Switching between html and text is always allowed. Design JSON sent to a campaign last saved in the newer block-based design editor is always refused with 409; edit it in the SMBcrm email builder, or convert it by sending html with allowEditorTypeChange: true.

subject, fromName, fromEmail, and previewText save the send settings on the draft so that preview, validate, and test send use them. They can change only while the campaign is a draft, paused, or cancelled, and the sender should be on one of your sending domains. The values that actually go out are the emailMeta you send when you schedule the campaign.

Terminal window
curl -X PATCH https://services.smbcrm.com/emails/locations/<location_id>/campaigns/emails/<campaign_id> \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"name": "October Newsletter (final)",
"editorType": "html",
"editorContent": "<html><body>Hello from October.</body></html>"
}'
200 OK
{
"id": "<campaign_id>",
"name": "October Newsletter (final)",
"status": "draft",
"editorContentUrl": "https://<storage_host>/<path>.html",
"deleted": false,
"createdAt": "2026-10-08T14:00:00.000Z",
"updatedAt": "2026-10-08T14:20:00.000Z",
"traceId": "<trace_id>"
}
Body field Type Required Description
name string No Campaign name.
editorContent string or object No New content: an HTML or plain-text string, or design-editor JSON for builder. This is version A of an A/B test; use the variation endpoint for the others. Send it together with editorType.
editorType string No html, builder, or text. Send it together with editorContent.
allowEditorTypeChange boolean No Set true to convert the campaign to a different editor on purpose. Default false.
subject string No Subject saved on the campaign.
fromName string No Sender display name saved on the campaign.
fromEmail string No Sender address saved on the campaign.
previewText string No Inbox preview text saved on the campaign.
userId string No ID of the user performing the action.
DELETE/emails/locations/{locationId}/campaigns/emails/{campaignId}

Delete an email campaign.

scope emails/campaigns.writeauth Location token or PIT
Terminal window
curl -X DELETE https://services.smbcrm.com/emails/locations/<location_id>/campaigns/emails/<campaign_id> \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"deleted": true,
"traceId": "<trace_id>"
}
POST/emails/locations/{locationId}/campaigns/emails/{campaignId}/schedule

Schedule or start an email campaign.

scope emails/campaigns.writeauth Location token or PIT

The campaign must be in draft, cancelled, or paused status. scheduleType, timeZone, userId, emailMeta, and recipients are required. This example sends a campaign to two contacts at a set time. The request accepts an Idempotency-Key header; a repeat of the same request with the same key does not schedule or send twice. A 409 means the campaign is already scheduled or processing, or that a request with the same key is still in progress.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/campaigns/emails/<campaign_id>/schedule \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"scheduleType": "scheduled",
"timeZone": "America/New_York",
"userId": "<user_id>",
"emailMeta": {
"subject": "Our October newsletter",
"fromName": "Acme Support",
"fromEmail": "support@example.com"
},
"recipients": {
"type": "contact",
"contactIds": ["<contact_id>", "<contact_id>"]
},
"scheduleConfig": {
"sendAt": "2026-10-15 09:00 AM",
"tracking": { "clickTracking": true }
}
}'
201 Created
{
"campaignId": "<campaign_id>",
"sourceId": "<source_id>",
"traceId": "<trace_id>"
}

sourceId is the ID you pass to the statistics endpoint. It can be null.

Body field Type Required Description
scheduleType string Yes immediate, scheduled, batch, rss, or smart_send.
timeZone string Yes IANA time zone, such as America/New_York.
userId string Yes ID of the user performing the action.
userName string No Name of the user performing the action.
emailMeta object Yes Subject and sender details. See the table below.
recipients object Yes Who receives the email. See the table below.
sendDays string[] No Days of the week sending is allowed: Mon, Tue, Wed, Thu, Fri, Sat, or Sun. Used for batch and rss.
scheduleConfig object Required unless scheduleType is rss Timing, batching, tracking, and resend options.
rssConfig object Required when scheduleType is rss RSS feed settings.
abTestConfig object No A/B test settings. Works with every scheduleType except rss.

emailMeta fields:

Field Type Required Description
subject string Yes Email subject line.
fromName string Yes Sender display name.
fromEmail string Yes Sender email address.
replyToAddress string No Reply-to email address.
previewText string No Preview text that appears after the subject line in the inbox.
attachments string[] No Download URLs of files to attach.

recipients fields:

Field Type Required Description
type string Yes contact, tag, segment, smart_list, custom_segment, or all. all sends to every contact in the account, so check the size with Estimate recipients first.
contactIds string[] When type is contact Contact IDs to send to. Every ID must be a contact in this account; if any is not, nothing is scheduled and the request returns 422.
tagIds string[] When type is tag Tag IDs to select recipients by.
segment string When type is segment A prebuilt segment: engaged_last_7_days, engaged_last_30_days, engaged_last_60_days, engaged_last_5_campaigns, or unengaged_last_5_campaigns.
smartListIds string[] When type is smart_list Smart list IDs from List audience options. Only the first is used.
conditions object[] When type is custom_segment Rows that build a segment. See the table below.
freezeList boolean No Freeze the recipient list at schedule time, so contacts that match later are not added. Default true.

Each conditions row has kind (contact, tag, smart_list, or segment), values (the contact IDs, tag IDs, smart list IDs, or one segment name), an optional negate boolean for “is not” (not supported for smart lists), and join (and or or), which says how the row combines with the previous one.

This example sends to a smart list right away:

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/campaigns/emails/<campaign_id>/schedule \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Idempotency-Key: <unique_key>" \
-H "Content-Type: application/json" \
-d '{
"scheduleType": "immediate",
"timeZone": "America/New_York",
"userId": "<user_id>",
"emailMeta": {
"subject": "Our October newsletter",
"fromName": "Acme Support",
"fromEmail": "support@example.com"
},
"recipients": {
"type": "smart_list",
"smartListIds": ["<smart_list_id>"]
},
"scheduleConfig": {}
}'

The three config objects take these fields:

Field Type Required Description
scheduleConfig.sendAt string For scheduled, batch, and smart_send Date and time to send, such as 2026-04-01 09:00 AM. Ignored for immediate.
scheduleConfig.batch.batchSize number When scheduleType is batch Number of contacts to process per batch.
scheduleConfig.batch.interval number When scheduleType is batch Delay between batches.
scheduleConfig.batch.intervalUnit string When scheduleType is batch minutes, hours, or days.
scheduleConfig.batch.skipDays string[] No Days to skip sending, using the same day names as sendDays.
scheduleConfig.batch.windowStart string No Earliest time to send batches, such as 09:00 AM.
scheduleConfig.batch.windowEnd string No Latest time to send batches, such as 05:00 PM.
scheduleConfig.tracking.clickTracking boolean No Track clicks on links.
scheduleConfig.tracking.utmTracking boolean No Add UTM parameters to links.
scheduleConfig.resend.enabled boolean No Resend to contacts who did not open the email.
scheduleConfig.resend.waitHours number When resend.enabled is true Hours to wait before resending.
scheduleConfig.resend.subject string No Subject line to use for the resend.
scheduleConfig.emailPreferenceId string No Email preference type ID used to categorize the campaign.
rssConfig.name string Yes RSS schedule name.
rssConfig.rssFeedURL string Yes RSS feed URL.
rssConfig.repeatAfter string Yes How often to check the feed: every_day, every_week, or every_month.
rssConfig.repeatAfterTime string Yes Time of day to run, such as 09:00 AM.
rssConfig.rssFeedLimit number No Maximum number of feed items per email.
rssConfig.startAtDay string No Day of the week for weekly feeds, Monday through Sunday.
rssConfig.startAtMonthDay string No Day of the month for monthly feeds, such as 15.
rssConfig.firstExecutionDate string No Override the first run, such as 2026-04-01 10:00:00.
abTestConfig.testType string Yes What to test: emailContent or subjectLine.
abTestConfig.testDuration number Yes Seconds to run the test before picking a winner.
abTestConfig.variationCount number Yes Number of variations.
abTestConfig.testSize number Yes Percentage of contacts in the test group, 0 to 100.
abTestConfig.winningCriteria string Yes How to pick the winner: openRate or clickRate.
abTestConfig.variations array Yes One entry per variation, each with a subject and an optional documentId. For an emailContent test, use the documentId returned by the variation endpoint, never a template ID.

A field marked required under rssConfig or abTestConfig is required only when you send that object.

For an A/B test, the test group must give every version at least 10 contacts, or the request returns 400. Raise testSize or send to a larger audience.

POST/emails/locations/{locationId}/campaigns/emails/{campaignId}/validate

Check a campaign's content and sender before you schedule it.

scope emails/campaigns.readonlyauth Location token or PIT

Validation inspects the rendered HTML and the intended sender for problems that would block or hurt a send: a missing subject, sender, or unsubscribe link, broken placeholders, merge field syntax the send cannot parse (INVALID_MERGE_FIELD_SYNTAX), and unresolved merge fields. ready is true only when errors is empty. A sender outside your sending domains adds a SENDER_DOMAIN_NOT_VERIFIED warning. This is a content check, not a guarantee of delivery. For an A/B test, every version is checked and each issue carries a variationIndex (omitted for version A).

The body is optional. Send subject, fromName, or fromEmail to check overrides without saving them.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/campaigns/emails/<campaign_id>/validate \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"fromEmail": "support@example.com"
}'
200 OK
{
"ready": false,
"errors": [
{
"code": "MISSING_SUBJECT",
"message": "Add an email subject."
}
],
"warnings": [],
"summary": {},
"unresolvedMergeFields": ["{{contact.first_name}}"],
"traceId": "<trace_id>"
}

summary holds the effective subject, sender, and counts for the inspected HTML. Each error or warning has code, message, and optional detail (the offending URL or merge token).

POST/emails/locations/{locationId}/campaigns/emails/{campaignId}/preview

Return a campaign's saved HTML, subject, and preview text without sending anything.

scope emails/campaigns.readonlyauth Location token or PIT

Works like Preview an email template and returns html, subject, previewText, and unresolvedMergeFields. It shows version A unless you pass variationIndex as a query parameter (1 for version B, 2 for version C). A version that does not exist returns 404.

POST/emails/locations/{locationId}/campaigns/emails/{campaignId}/test

Send a campaign to one to five addresses as a test.

scope emails/campaigns.writeauth Location token or PIT

emails is required. The test uses the campaign’s saved subject and sender unless you override them, and fills merge fields with sample contact data. It sends version A, or the A/B version you pick with variationIndex (1 is version B). A version that does not exist returns 404. Test sends are limited to 20 per account per hour, shared with template test sends. Send an Idempotency-Key so a retry cannot send twice. A 200 means the test was accepted, not delivered.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/campaigns/emails/<campaign_id>/test \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Idempotency-Key: <unique_key>" \
-H "Content-Type: application/json" \
-d '{
"emails": ["qa@example.com"],
"userId": "<user_id>"
}'
200 OK
{
"accepted": true,
"recipients": ["qa@example.com"],
"note": "Accepted for sending; delivery is not confirmed.",
"traceId": "<trace_id>"
}
Body field Type Required Description
emails string[] Yes One to five recipient addresses.
subject string No Subject for this test. Defaults to the saved subject.
fromName string No Sender name for this test.
fromEmail string No Sender address for this test. Must be a valid email address.
variationIndex number No A/B version to send: 1 is version B, 2 is version C. Omit for version A.
userId string No Active user of the account the test is sent as. Required when the token has no user.
POST/emails/locations/{locationId}/campaigns/emails/{campaignId}/variations/{index}

Create the content for an A/B version of a campaign, or fetch or update it.

scope emails/campaigns.writeauth Location token or PIT

An A/B test inside one campaign works in this order. Version A is the campaign itself: create it and edit it with Update an email campaign. Versions B, C, and so on are stored inside the same campaign. Call this endpoint once per version, with index 1 for B, 2 for C, up to 9. A missing version is cloned from the campaign’s current content. Create them in order, because an index whose previous version does not exist returns 400. Then start the test through abTestConfig when you schedule: for an emailContent test, pass each returned documentId as abTestConfig.variations[index].documentId. For a subjectLine test you do not need this endpoint, only one subject per version. Without abTestConfig, only version A is sent.

Send editorType with editorContent to write the version’s content, using the same editorType as the campaign, or send neither to just create or fetch it. Add includeContent=true as a query parameter to get the current editorContent back. The campaign must be a draft, paused, or cancelled, and a paused campaign can edit only versions it already has. Otherwise the endpoint returns 409. Make calls for one campaign one at a time: a call made while another is still running returns 409, so retry it. The same allowEditorTypeChange rules as the campaign update apply.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/campaigns/emails/<campaign_id>/variations/1 \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"editorType": "html",
"editorContent": "<html><body>Version B</body></html>"
}'
200 OK
{
"campaignId": "<campaign_id>",
"variationIndex": 1,
"documentId": "<document_id>",
"editorContentUrl": "https://<storage_host>/<path>.html",
"traceId": "<trace_id>"
}
Body field Type Required Description
editorType string No html, builder, or text. Send it together with editorContent.
editorContent string or object No Content for this version.
allowEditorTypeChange boolean No Set true to switch the editor on purpose. Default false.
userId string No ID of the user performing the action.
POST/emails/locations/{locationId}/campaigns/emails/{campaignId}/pause

Pause a scheduled or processing campaign.

scope emails/campaigns.writeauth Location token or PIT

Works on a campaign in scheduled or processing status, including batch sends, RSS schedules, and A/B tests, and stops sending until you resume it. While it is paused you can edit the content with Update an email campaign, then call resume or schedule again with new settings. Any other status returns 409. The response is campaignId and the new status (paused).

POST/emails/locations/{locationId}/campaigns/emails/{campaignId}/resume

Resume a paused campaign with its existing schedule.

scope emails/campaigns.writeauth Location token or PIT

Continues a paused campaign where it stopped, with its existing schedule settings. Batch progress and RSS timing carry on. For an A/B test, the winner is still picked at the original start plus testDuration; if that time passed while the campaign was paused, it is picked right away. To change the schedule instead, call schedule on the paused campaign. Any other status returns 409. The response is campaignId and the new status, processing when sending is due now or scheduled when the next send is still in the future.

POST/emails/locations/{locationId}/campaigns/emails/{campaignId}/cancel

Cancel a scheduled, processing, or paused campaign.

scope emails/campaigns.writeauth Location token or PIT

Stops pending sends, batch sends, RSS schedules, A/B versions, and any resend to people who did not open. Emails already sent are not recalled. You can edit a cancelled campaign and schedule it again. Any other status returns 409. The response is campaignId and status: "cancelled".

POST/emails/locations/{locationId}/campaigns/emails/{campaignId}/archive

Archive a campaign. This hides it and does not stop sending.

scope emails/campaigns.writeauth Location token or PIT

Archiving changes only visibility. To stop a campaign, cancel it. The request is safe to repeat: it returns archived: true without toggling the state.

200 OK
{
"id": "<campaign_id>",
"archived": true,
"traceId": "<trace_id>"
}
POST/emails/locations/{locationId}/campaigns/emails/{campaignId}/unarchive

Restore a campaign from the archive.

scope emails/campaigns.writeauth Location token or PIT

Also safe to repeat: it returns archived: false without toggling the state.

POST/emails/locations/{locationId}/campaigns/emails/{campaignId}/duplicate

Copy a campaign and its content into a new draft.

scope emails/campaigns.writeauth Location token or PIT

The copy is a draft and is not scheduled. The body is optional: name sets the copy’s name (the source name is kept if you omit it), and userId records the creator. The response uses the same fields as Create an email campaign and accepts an Idempotency-Key header.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/campaigns/emails/<campaign_id>/duplicate \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"name": "November Newsletter"
}'
POST/emails/locations/{locationId}/campaigns/recipients/estimate

Count how many contacts an audience matches right now, before you schedule.

scope emails/campaigns.writeauth Location token or PIT

Send the same audience fields you would put in recipients when you schedule: type plus contactIds, tagIds, segment, smartListIds, or conditions. The response returns only a count and a one-line description, never contact IDs. The count is taken before send-time suppression: contacts who are unsubscribed, set to do-not-disturb for email, or lack a valid email address are skipped when the campaign goes out, so treat it as the most people who can receive it. An audience that cannot be resolved, such as an empty tag list, returns 422.

Terminal window
curl -X POST https://services.smbcrm.com/emails/locations/<location_id>/campaigns/recipients/estimate \
-H "Authorization: Bearer <token>" \
-H "Version: v3" \
-H "Content-Type: application/json" \
-d '{
"type": "smart_list",
"smartListIds": ["<smart_list_id>"]
}'
200 OK
{
"type": "smart_list",
"count": 1240,
"description": "Smart list",
"traceId": "<trace_id>"
}

This endpoint needs the write scope because an exact count for any filter would otherwise let a read-only token enumerate contacts.

GET/emails/locations/{locationId}/campaigns/audience-options

Find the tags, smart lists, or engagement segments a campaign can target.

scope emails/campaigns.readonlyauth Location token or PIT

source is required: tag, smart_list (the saved smart lists of the user the token acts as), or segment (engagement segments). Narrow with query where the source supports search, and page with limit (default 20, maximum 50) and skip (default 0). Individual contacts are not listed here. Use an option’s id as a tagIds or smartListIds entry, or as a segment value, in Estimate recipients and Schedule an email campaign.

Terminal window
curl "https://services.smbcrm.com/emails/locations/<location_id>/campaigns/audience-options?source=smart_list&limit=20&skip=0" \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"options": [
{ "id": "<smart_list_id>", "label": "VIP customers" }
],
"total": 42,
"hasMore": true,
"traceId": "<trace_id>"
}

total counts all matches, not just the current page. Some options come back without an id.

GET/emails/locations/{locationId}/campaigns/sending-domains

List the domains your account can send campaigns from.

scope emails/campaigns.readonlyauth Location token or PIT

Pick the fromEmail for a campaign on one of these domains (or a subdomain) before you schedule. When smtpMode is true, the account has no dedicated sending domains and sends through its own SMTP provider, so any sender that provider accepts works. The endpoint can return 503 when the list is temporarily unavailable; retry shortly.

Terminal window
curl https://services.smbcrm.com/emails/locations/<location_id>/campaigns/sending-domains \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"domains": [
{ "domain": "mail.example.com", "ownershipType": "location_owned" }
],
"smtpMode": false,
"traceId": "<trace_id>"
}

ownershipType says who owns the domain: location_owned, agency_owned, or another value for a shared platform domain.

These endpoints are read-only. They list the email campaigns that workflows and bulk actions send, and they return the IDs the statistics endpoint needs. All four require emails/campaigns.readonly. limit (1 to 20, default 10) and offset (default 0) page through the lists, and search takes a query to filter the list.

GET/emails/locations/{locationId}/campaigns/workflows

List the workflow campaigns in your account.

scope emails/campaigns.readonlyauth Location token or PIT

Filter with status, which is published or draft.

Terminal window
curl "https://services.smbcrm.com/emails/locations/<location_id>/campaigns/workflows?limit=10&offset=0&status=published" \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"campaigns": [
{
"id": "<campaign_id>",
"name": "New lead follow-up",
"status": "published",
"source": "workflow",
"sourceId": "<source_id>",
"deleted": false,
"createdAt": "2025-12-12T08:24:46.700Z",
"updatedAt": "2026-01-23T05:58:48.453Z"
}
],
"total": 1,
"traceId": "<trace_id>"
}
GET/emails/locations/{locationId}/campaigns/workflows/{campaignId}

Get a workflow campaign and the email steps inside it.

scope emails/campaigns.readonlyauth Location token or PIT

campaignId must be the 24-character hex id from the list, and any other value is rejected. subSources lists the email-sending steps in the workflow. Pass a step’s id as subSourceId to the statistics endpoint to get that step’s numbers. Each step has id, name, subject, fromName, fromEmail, previewText, editorType (html, builder, or text), isPlainText, editorContentUrl, createdAt, and updatedAt. Only id is always present.

Terminal window
curl https://services.smbcrm.com/emails/locations/<location_id>/campaigns/workflows/<campaign_id> \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"id": "<campaign_id>",
"name": "New lead follow-up",
"status": "published",
"source": "workflow",
"sourceId": "<source_id>",
"subSources": [
{
"id": "<step_id>",
"name": "Send welcome email",
"subject": "Welcome to Acme",
"fromName": "Acme Support",
"fromEmail": "support@example.com",
"previewText": "Thanks for signing up",
"editorType": "html",
"isPlainText": false,
"editorContentUrl": "https://<storage_host>/<path>.html",
"createdAt": "2025-12-12T08:24:46.700Z",
"updatedAt": "2026-01-23T05:58:48.453Z"
}
],
"deleted": false,
"createdAt": "2025-12-12T08:24:46.700Z",
"updatedAt": "2026-01-23T05:58:48.453Z",
"traceId": "<trace_id>"
}
GET/emails/locations/{locationId}/campaigns/bulk-actions

List the bulk action email campaigns in your account.

scope emails/campaigns.readonlyauth Location token or PIT

Filter with status (processing, scheduled, paused, complete, or cancelled) and with dateFrom and dateTo, both ISO 8601 date-times. opType filters by bulk operation type, and bulk-email is the only supported value. sortBy (title, type, createdAt, completedAt, or status) and sortOrder (asc or desc) are accepted but not applied yet; results come back in the service’s default order, so sort on your side.

Terminal window
curl "https://services.smbcrm.com/emails/locations/<location_id>/campaigns/bulk-actions?status=complete&dateFrom=2026-09-01T00:00:00.000Z&dateTo=2026-09-30T23:59:59.999Z" \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"campaigns": [
{
"id": "<campaign_id>",
"source": "email-marketing",
"sourceId": "<source_id>",
"name": "September promo",
"status": "complete",
"scheduleType": "SCHEDULED",
"deleted": false,
"createdAt": "2026-09-10T11:55:43.598Z",
"updatedAt": "2026-09-12T04:49:12.322Z",
"completedAt": "2026-09-12T04:49:12.000Z",
"emailMetadata": {
"subject": "Our September promotion",
"from": "Acme Support <support@example.com>",
"name": "Acme Support",
"templateId": "<template_id>"
}
}
],
"total": 1,
"traceId": "<trace_id>"
}

scheduleType is NOW, SCHEDULED, or DRIP. id, status, deleted, createdAt, and updatedAt are always present.

GET/emails/locations/{locationId}/campaigns/bulk-actions/{campaignId}

Get a single bulk action email campaign, including its sender details and a link to its content.

scope emails/campaigns.readonlyauth Location token or PIT
Terminal window
curl https://services.smbcrm.com/emails/locations/<location_id>/campaigns/bulk-actions/<campaign_id> \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"id": "<campaign_id>",
"source": "email-marketing",
"sourceId": "<source_id>",
"name": "September promo",
"status": "complete",
"scheduleType": "SCHEDULED",
"fromName": "Acme Support",
"fromEmail": "support@example.com",
"subject": "Our September promotion",
"replyToAddress": "reply@example.com",
"previewText": "Save on your next order",
"editorType": "html",
"isPlainText": false,
"editorContentUrl": "https://<storage_host>/<path>.html",
"deleted": false,
"createdAt": "2026-09-10T11:55:43.598Z",
"updatedAt": "2026-09-12T04:49:12.322Z",
"completedAt": "2026-09-12T04:49:12.000Z",
"traceId": "<trace_id>"
}
GET/emails/locations/{locationId}/campaigns/stats/{source}/{sourceId}

Get delivery and engagement statistics for an email campaign, a workflow campaign, or a bulk action.

scope emails/stats.readonlyauth Location token or PIT

One endpoint serves all three campaign types. source picks the type, and sourceId is the sourceId field of that campaign, which you find in the list and retrieve responses above and in the schedule response.

source sourceId is the sourceId of
email-campaigns An email campaign. For an A/B test, use a variation’s sourceId to read that variation.
workflow-campaigns A workflow campaign.
bulk-actions A bulk action campaign.

To narrow a workflow campaign to one email step, add subSourceId as a query parameter, using a step id from Retrieve a workflow campaign. subSourceId is valid only when source is workflow-campaigns.

Terminal window
curl https://services.smbcrm.com/emails/locations/<location_id>/campaigns/stats/email-campaigns/<source_id> \
-H "Authorization: Bearer <token>" \
-H "Version: v3"
200 OK
{
"locationId": "<location_id>",
"source": "email-campaigns",
"sourceId": "<source_id>",
"stats": {
"sent": 1020,
"accepted": 5,
"delivered": 1000,
"opened": 450,
"clicked": 120,
"unsubscribed": 5,
"complained": 2,
"permanentFail": 15,
"temporaryFail": 3,
"rejected": 10,
"failed": 5,
"replied": 25,
"openRate": 45,
"clickRate": 12,
"unsubscribeRate": 0.5,
"complaintRate": 0.2,
"bounceRate": 1.76,
"replyRate": 2.5
},
"traceId": "<trace_id>"
}

The response echoes locationId, source, and sourceId, and adds subSourceId when you send one. Every field in stats is present:

Field Description
sent Total emails sent (delivered, accepted, and bounced).
accepted Emails accepted by the mail server.
delivered Emails delivered to the inbox.
opened Emails opened.
clicked Links clicked.
unsubscribed Unsubscribes.
complained Spam complaints.
permanentFail Hard bounces.
temporaryFail Soft bounces.
rejected Rejected emails.
failed Failed emails.
replied Replies received.
openRate, clickRate, unsubscribeRate, complaintRate, replyRate Percentages of delivered.
bounceRate Percentage of sent.