The Email Campaign API allows you to create, retrieve, update, list, and delete email campaigns from your account.
Available API Functions
| Method | Endpoint | Description |
|---|---|---|
| GET | /getCampaign |
Retrieve a single email campaign |
| GET | /getCampaigns |
Retrieve email campaigns |
| POST | /addCampaign |
Create a new email campaign |
| POST | /updateCampaign |
Update an existing campaign |
| POST | /deleteCampaign |
Delete an email campaign |
Add Email Campaign
Creates a new email campaign.
Endpoint
POST /addCampaign
Parameters
| Parameter | Required | Description |
|---|---|---|
campaign_group |
Yes | Group/category for the campaign |
campaign_label |
Yes | Internal campaign name |
email_subject |
Yes | Email subject |
email_content |
Yes | HTML version of the email |
text_content |
Yes | Plain-text version of the email |
attach_file1 |
No | First attachment |
attach_file2 |
No | Second attachment |
attach_file3 |
No | Third attachment |
Example Request
curl -X POST "https://YOUR-DOMAIN/API-PATH/addCampaign" \
-d "campaign_group=Newsletter" \
-d "campaign_label=September Newsletter" \
-d "email_subject=September Newsletter" \
-d "email_content=<h1>Hello %%first_name%%</h1><p>Welcome to our newsletter.</p>" \
-d "text_content=Hello %%first_name%%, Welcome to our newsletter."
Example Response
{
"success": true,
"Campaign ID": 125
}
Save the returned Campaign ID. It can be used when retrieving, updating, deleting, or scheduling the campaign.
Add Campaign With Attachment
Campaigns support up to three attachments.
Use multipart/form-data when uploading files.
Example
curl -X POST "https://YOUR-DOMAIN/API-PATH/addCampaign" \
-F "campaign_group=Newsletter" \
-F "campaign_label=September Newsletter" \
-F "email_subject=September Newsletter" \
-F "email_content=<h1>Hello %%first_name%%</h1>" \
-F "text_content=Hello %%first_name%%" \
-F "[email protected]"
Supported attachment types include images and PDF files.
The available upload fields are:
attach_file1
attach_file2
attach_file3
Get Email Campaign
Returns the complete details of one email campaign.
Endpoint
GET /getCampaign
Parameters
| Parameter | Required | Description |
|---|---|---|
campaign_id |
Yes | Email Campaign ID |
email_campaign_id may also be supplied as an alternative to campaign_id.
Example Request
curl -X GET \
"https://YOUR-DOMAIN/API-PATH/getCampaign?campaign_id=125"
Example Response
{
"success": true,
"email_campaign_id": "125",
"campaign_group": "Newsletter",
"campaign_label": "September Newsletter",
"email_subject": "September Newsletter",
"email_content": "<h1>Hello %%first_name%%</h1>",
"text_content": "Hello %%first_name%%",
"create_date": "2026-09-21",
"links": [
"https://example.com/offer",
"https://example.com/contact"
]
}
The API returns the complete HTML and text versions of the campaign.
Get Email Campaigns
Returns email campaigns belonging to the account.
Endpoint
GET /getCampaigns
Parameters
| Parameter | Required | Default | Description |
|---|---|---|---|
start |
No | 0 |
Starting record |
records |
No | 100 |
Number of records to return |
search |
No | — | Search campaign label, group, or subject |
campaign_group |
No | — | Filter by campaign group |
created_after_date |
No | — | Return campaigns created on/after date |
created_before_date |
No | — | Return campaigns created on/before date |
A maximum of 1,000 records can be requested at one time.
Example
curl -X GET \
"https://YOUR-DOMAIN/API-PATH/getCampaigns?start=0&records=100"
Search Campaigns
curl -X GET \
"https://YOUR-DOMAIN/API-PATH/getCampaigns?search=Newsletter"
Filter by Campaign Group
curl -X GET \
"https://YOUR-DOMAIN/API-PATH/getCampaigns?campaign_group=Newsletter"
Example Response
{
"success": true,
"data": [
{
"email_campaign_id": "125",
"campaign_group": "Newsletter",
"campaign_label": "September Newsletter",
"email_subject": "September Newsletter",
"create_date": "2026-09-21"
},
{
"email_campaign_id": "124",
"campaign_group": "Marketing",
"campaign_label": "Weekend Promotion",
"email_subject": "Weekend Special Offer",
"create_date": "2026-09-20"
}
]
}
For performance reasons, /getCampaigns does not return the full HTML and plain-text campaign content. Use /getCampaign when you need the complete campaign.
Update Email Campaign
Updates an existing email campaign.
Endpoint
POST /updateCampaign
Parameters
| Parameter | Required | Description |
|---|---|---|
campaign_id |
Yes | Campaign to update |
campaign_group |
No | Campaign group |
campaign_label |
No | Internal campaign name |
email_subject |
No | Email subject |
email_content |
No | HTML email content |
text_content |
No | Plain-text content |
attach_file1 |
No | Upload attachment |
attach_file2 |
No | Upload attachment |
attach_file3 |
No | Upload attachment |
del_file1 |
No | Delete existing attachment |
del_file2 |
No | Delete existing attachment |
del_file3 |
No | Delete existing attachment |
Only fields supplied in the request need to be changed. Fields that are not supplied retain their existing values.
Example
curl -X POST \
"https://YOUR-DOMAIN/API-PATH/updateCampaign" \
-d "campaign_id=125" \
-d "email_subject=Updated September Newsletter" \
-d "campaign_label=September Newsletter Updated"
Update Campaign Content
curl -X POST \
"https://YOUR-DOMAIN/API-PATH/updateCampaign" \
-d "campaign_id=125" \
-d "email_content=<h1>Hello %%first_name%%</h1><p>Our newsletter has been updated.</p>" \
-d "text_content=Hello %%first_name%%. Our newsletter has been updated."
Example Response
{
"success": true,
"Campaign ID": 125
}
A campaign that is currently in a running state cannot be edited.
Delete Email Campaign
Deletes an email campaign.
Endpoint
POST /deleteCampaign
Parameters
| Parameter | Required | Description |
|---|---|---|
campaign_id |
Yes | Campaign ID to delete |
email_campaign_id may also be supplied instead of campaign_id.
Example
curl -X POST \
"https://YOUR-DOMAIN/API-PATH/deleteCampaign" \
-d "campaign_id=125"
Example Response
{
"success": true,
"Campaign ID": 125
}
Associated extracted campaign links and campaign attachment files are also removed by this API implementation.
A campaign in a running state cannot be deleted.
Dynamic Variables
Dynamic variables can be included in the campaign content.
For example:
Hello %%first_name%%,
Your email address is %%email%%.
<a href="%%unsubscribelink%%">Unsubscribe</a>
Common variables supported by the campaign system include:
| Variable | Description |
|---|---|
%%email%% |
Subscriber email |
%%first_name%% |
First name |
%%last_name%% |
Last name |
%%city%% |
City |
%%country%% |
Country |
%%post_code%% |
Postal code |
%%state%% |
State |
%%mobile%% |
Mobile |
%%phone%% |
Phone |
%%fax%% |
Fax |
%%title%% |
Title |
%%company%% |
Company |
%%create_date%% |
Subscriber creation date |
%%list_name%% |
List name |
%%list_id%% |
List ID |
%%email_id%% |
Email/subscriber ID |
%%message_id%% |
Message ID |
%%campaign_id%% |
Campaign ID |
%%from_name%% |
Sender name |
%%from_email%% |
Sender email |
%%today_date%% |
Current date |
The campaign system also supports custom fields, Spin Tags, and Dynamic Content Tags where those features are enabled.
Unsubscribe Link
An unsubscribe link can be included in the HTML content.
Example:
<a href="%%unsubscribelink%%">Unsubscribe</a>
It is recommended that marketing campaigns include the appropriate unsubscribe link required for your use case and applicable requirements.
Campaign Links
URLs contained in campaign content are automatically detected when a campaign is created or updated.
For example:
<a href="https://example.com/special-offer">
View Special Offer
</a>
The URL is associated with the campaign in the campaign links table.
GET /getCampaign also returns the detected links:
{
"links": [
"https://example.com/special-offer"
]
}
Both <a href=""> and <area href=""> links are detected.
HTML and Plain-Text Content
Each campaign contains two versions of the message.
HTML Version
Use:
email_content
Example:
<h1>Hello %%first_name%%</h1>
<p>Check out our latest offers.</p>
<a href="https://example.com/offers">
View Offers
</a>
Plain-Text Version
Use:
text_content
Example:
Hello %%first_name%%,
Check out our latest offers:
https://example.com/offers
Providing both versions helps clients that cannot or do not display HTML email.
Campaign Groups
campaign_group can be used to organize campaigns.
For example:
Newsletter
Promotions
Transactional
Customers
Product Updates
Example:
curl -X POST \
"https://YOUR-DOMAIN/API-PATH/addCampaign" \
-d "campaign_group=Promotions" \
-d "campaign_label=Black Friday 2026" \
-d "email_subject=Black Friday Special" \
-d "email_content=<h1>Black Friday Special</h1>" \
-d "text_content=Black Friday Special"
You can later retrieve campaigns belonging to a specific group:
GET /getCampaigns?campaign_group=Promotions
Typical Workflow
A common API workflow is:
1. Create Email Campaign
↓
POST /addCampaign
2. Receive Campaign ID
↓
Campaign ID: 125
3. Schedule Campaign
↓
POST /scheduleCampaign
4. Supply Campaign ID
↓
email_campaign_id_fk[]=125
5. Select Lists or Segments
↓
list_id_fk[]=10
or
segment_id_fk[]=15
6. Select SMTP
↓
smtp_list[]=smtp-user
7. Campaign is scheduled for delivery
Creating an email campaign does not send it automatically.
The /addCampaign API creates the email content. Use the Schedule Campaign API to select recipients, SMTP accounts, sender information, tracking settings, and delivery time.
Error Responses
If a required parameter is missing, the API returns an error.
Example:
{
"success": false,
"message": "campaign_label is required"
}
Other possible errors include:
campaign_group is required
campaign_label is required
email_subject is required
email_content is required
text_content is required
campaign_id is required
Campaign not found or access denied
Campaign in Running State is not editable.
Campaign in Running State cannot be deleted.
Security and Account Access
Campaigns are restricted to the authenticated account.
A user cannot retrieve, modify, or delete an email campaign belonging to another account.
Always use the same authentication method required by the other API functions on your account.
Complete Example
Create the campaign:
curl -X POST \
"https://YOUR-DOMAIN/API-PATH/addCampaign" \
-d "campaign_group=Newsletter" \
-d "campaign_label=Weekly Newsletter" \
-d "email_subject=This Week's News" \
-d "email_content=<h1>Hello %%first_name%%</h1><p>Here is this week's news.</p><p><a href='https://example.com/news'>Read More</a></p><p><a href='%%unsubscribelink%%'>Unsubscribe</a></p>" \
-d "text_content=Hello %%first_name%%. Here is this week's news. https://example.com/news"
The API returns the Campaign ID:
{
"success": true,
"Campaign ID": 125
}
Retrieve it:
GET /getCampaign?campaign_id=125
Update it:
curl -X POST \
"https://YOUR-DOMAIN/API-PATH/updateCampaign" \
-d "campaign_id=125" \
-d "email_subject=Updated: This Week's News"
When the campaign is ready, use its Campaign ID with the Schedule Campaign API:
email_campaign_id_fk[]=125
