Email API for Sending

Effortlessly send emails via Advantus APIs.

To access the Advantus email service, generate the token by authenticating API using client_id and client_secret from the Advantus web application. Then, the token needs to be provided in the header of the email API to send a successful notification.

Pre-Requisites

To get started with Advantus email notifications, please consider the following points.:

  1. Create an application on the Advantus Dashboard. Learn how to create an application on Advantus Dashboard.

  2. Configure your email notification set-up on the Advantus Dashboard. (Learn how to configure email notification set up on Advantus Dashboard)

  3. Generate a token using client_id and client_secret within the Advantus application.

Method Type and API Endpoint

The Method Type and API Endpoint are as follows:

POST: /api/notifications/email

The Header for email sending is:

{
  "Authorization": "YOUR_TOKEN_HERE"
}

API Request

To send a request to the API, the following parameters must be included in the payload.

ItemData TypeDescriptionRequired
subjectstringYour email subject line. You can include dynamic variables like or .Required unless using template_uuid
receiverobjectGroups all your recipient email addresses (to, cc, bcc).Required unless using segment_uuid
receiver.tostringList of primary recipient email addresses. Must include at least one valid email.Required if using receiver
receiver.to.{dynamic_fileds}stringPersonalised emails make the messages more relevant and engaging to the recipients.

For example, sending an email to a customer with product recommendations based on their past purchase history, browsing behaviour, or wishlist items, and addressing the customer by name in the email.
Optional
receiver.ccstringList of CC recipient emails. Use empty array if no CC recipients.Required if using receiver
receiver.bccstringList of BCC recipient emails. Use empty array if no BCC recipients.Required if using receiver
segment_uuidstringID of a pre-saved recipient group. Use this instead of manually listing receivers.Optional
campaign_namestringA friendly name for your email campaign (e.g., "December Newsletter", "Welcome Series").Optional
contentobjectContains your email's content and format.Required unless using template_uuid
content.typeenumFormat of your email: "text/plain" for plain text, "text/html" for HTML emails.Required with content
content.valuestringYour actual email content. Supports dynamic variables like .Required with content
template_uuidstringID of a pre-saved email template. Use this instead of creating content from scratch.Required unless providing subject and content
reply_tostringEmail address where recipients can reply. This must be whitelisted to ensure all communications are received smoothly.Optional
attachmentsobjectList of files to attach to your email.Optional
attachments.typearray of objectFile type (e.g., "application/pdf", "image/jpeg").

Supported Attachment Types
PDF: application/pdf
HTML: text/html
Images: image/jpeg, image/png, image/gif, image/bmp, image/tiff
Audio: audio/mpeg, audio/wav, audio/aac, audio/ogg
Archives: application/zip

Documents:
DOCX: application/vnd.openxmlformats-officedocument.wordprocessingml.document
XLSX: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
PPTX: application/vnd.openxmlformats-officedocument.presentationml.presentation
ODT: application/vnd.oasis.opendocument.text
TXT: text/plain
Required per attachment
attachments.filenamestringName of your file including extension (e.g., "report.pdf").Required per attachment
attachment.contentstringThe content is encoded base-64.Optional
attachments.dispositionstringHow to display the file: "inline" (shown in email) or "attachment" (downloadable).Required per attachment
scheduleobjectMain configuration object that contains all scheduling settingsYes
schedule.message_typeobjectContains settings about how often and when to send messagesYes
schedule.campaign_start_dateobjectContains settings about when to start the campaignYes
schedule.sunsetobjectContains settings about when to end the campaignYes when message_type.type = 3
schedule.message_type.typeintegerChoose how often to send messages:
1 = send once
2 = send on specific dates
3 = send repeatedly
Yes
schedule.message_type.date
(for one-time sending)
integerThe exact date and time to send the message, in UTC timestamp format.
Only used when type = 1
Yes when type = 1
schedule.message_type.date
(for multiple dates)
integerList of dates and times to send the message, each in UTC timestamp format.
Only used when type = 2
Yes when type = 2
schedule.message_type.interval
(for recurring1 messages)
integerHow many seconds to wait between each message send.
Only used when type = 3.
Cannot be used with days_of_week or days_of_month
Yes when type = 3 and not using days
schedule.message_type.days_of_week
(for recurring messages)
integerWhich day of the week to send (1-7).
Only used when type = 3.
Cannot be used with interval or days_of_month
Yes when type = 3 and not using interval or month
schedule.message_type.days_of_month
(for recurring messages)
integerWhich day of the month to send (1-31).
Only used when type = 3.
Cannot be used with interval or days_of_week
Yes when type = 3 and not using interval or week
schedule.campaign_start_date.type2integerChoose when to start the campaign:
1 = send immediately
2 = intelligent delivery (The notification will be sent based on user's timezone between 10am to 7pm and on the weekdays of Tuesday, Wednesday and Thursday.)
3 = time (After a fixed time is set, the next one can only be scheduled after 900 seconds.)

Please refer to important notes below.
Yes
schedule.campaign_start_date.send_immediatelybooleanMust be set to true if starting right away.
Only used when type = 1
Yes when type = 1
schedule.campaign_start_date.intelligent_deliverybooleanMust be set to true if letting system choose time.
Only used when type = 2
Yes when type = 2
schedule.campaign_start_date.timeintegerThe specific time to start (in seconds).
Only used when type = 3
Yes when type = 3
schedule.sunset.type
(for recurring3 campaigns)
integerChoose when to stop the campaign:
1 = Stop on specific date
2 = Never end campaign
3 = Stop after sending X times
Only needed for recurring campaigns (message_type.type = 3)
Yes when using recurring messages
schedule.sunset.date
(for specific end date)
integerThe date to stop the campaign, in UTC timestamp format.
Only used when sunset.type = 1
Yes when sunset.type = 1
schedule.sunset.never_end_campaign
(for endless campaigns)
booleanMust be set to true for never-ending campaigns.
Only used when sunset.type = 2
Yes when sunset.type = 2
schedule.sunset.number_of_send
(for limited sends)
integerHow many times to send before stopping.
Must be a positive number.
Only used when sunset.type = 3
Yes when sunset.type = 3

Important Notes:

  1. For recurring messages (type = 3), you must choose exactly ONE of these options:
  • Interval between messages (in seconds)
  • Specific day of the week (1-7)
  • Specific day of the month (1-31)
  1. For campaign start, you must choose exactly ONE of these options:
  • Start immediately (type = 1)
  • Intelligent delivery (type = 2)
  • Fixed time (type = 3)
  1. For recurring campaigns, you must specify when to stop by choosing ONE of these options:
  • End on a specific date
  • Run indefinitely
  • End on reaching send limit
  1. All timestamps must be UTC.
  2. Include country code in phone numbers (e.g., "91" for India).
  3. Choose only one option for recurring messages: interval, days_of_week, or days_of_month.
  4. Template variables start from .
  5. Maximum 2 buttons per template.
  6. Only one header variable allowed.
  7. Time Interval Requirements
  • All schedules must be divisible by 900 seconds (15-minute intervals)
  • Schedules must align with fixed times: HH:00, HH:15, HH:30, HH:45
  • No arbitrary times between intervals are allowed. Examples:
    ✅ Valid: 09:00, 09:15, 09:30, 09:45, 10:00
    ❌ Invalid: 09:05, 09:20, 09:40, 09:50
  • Non-compliant schedules will be automatically rejected by the system.

curl --location --request POST 'https://api.advantus.io/api/notifications/email' \
--header 'Authorization: YOUR_TOKEN_HERE\
--header 'Content-Type: application/json' \
--data-raw '{
  "receiver": {
    "to": [
      {
        "email": "RECEIPIENT'S_EMAIL_ADDRESS",
        "name": "RECEIPIENT'S_NAME"
      }
    ],
    "cc": [
      "List_Of_Recipients_Who_will_Receive_Copy_Of_Your_Email"
    ],
    "bcc": [
      "List_Of_Recipients_Who_will_Receive_Carbon_Copy_Of_Your_Email"
    ]
  },
  "subject": "SUBJECT_OF_YOUR_EMAIL",
  "content": {
    "type": "text/plain or text/html",
    "value": "content of email"
  },
  "attachments": [
    {
      "content": "base64 encode",
      "filename": "index.html",
      "type": "text/html",
      "disposition": "attachment"
    }
  ],
  "reply_to": null,
  "campaign_name": "campaign name",
  "schedule": {
    "message_type": {
      "type": 1,
      "date": 1735516800
    },
    "campaign_start_date": {
      "type": 1,
      "send_immediately": true
    },
    "sunset": {
      "type": 1,
      "date": 1735516800
    }
  }
}

curl --location --request POST 'https://api.advantus.io/api/notifications/email' \
--header 'Authorization: YOUR_TOKEN_HERE\
--header 'Content-Type: application/json' \
--data-raw '{
  "receiver": {
    "to": [
      {
        "email": "RECEIPIENT'S_EMAIL_ADDRESS",
        "name": "RECEIPIENT'S_NAME"
      }
    ],
    "cc": [
      "List_Of_Recipients_Who_will_Receive_Copy_Of_Your_Email"
    ],
    "bcc": [
      "List_Of_Recipients_Who_will_Receive_Carbon_Copy_Of_Your_Email"
    ]
  },
  "subject": "SUBJECT_OF_YOUR_EMAIL",
  "content": {
    "type": "text/plain or text/html",
    "value": "content of email"
  },
  "attachments": [
    {
      "content": "base64 encode",
      "filename": "index.html",
      "type": "text/html",
      "disposition": "attachment"
    }
  ],
  "reply_to": null,
  "campaign_name": "campaign name",
  "schedule": {
    "message_type": {
      "type": 1,
      "date": 1735516800,
    },
    "campaign_start_date": {
      "type": 1,
      "send_immediately": true,
    },
    "sunset": {
      "type": 1,
      "date": 1735516800,
    }
  }
}

Email schedule message types

There are multiple ways to use email scheduling platform.

Examples

Schema if the message.type either 1, or 2, or 3

{
    "schedule": {
        "message_type": {
            "type": 1,
            "date": 1735516800,
 
            "type":2,
            "date": [1735516800,1735516800],
 
            "type":3,
            "days_of_week": [],
            "days_of_month": [],
            "months_of_year": [],
            "interval":3600
        }
    }
}

Schema if the campaign_start_date.type either 1, or 2, or 3

{
  "schedule": {
     "campaign_start_date": {
        "type":1,
        "send_immediately":true,
 
        "type": 2,
        "intelligent_delivery":"true",
 
        "type": 3,
        "time": 72000
     }
  }
}

Schema if the sunset.type either 1, or 2, or 3

{
  "schedule": {
     "sunset":{
        "type":1,
        "date":1735516800,
 
        "type":2,
        "never_end_camgaign":false,
 
        "type":3,
        "number_of_send":3
     }
  }
}

API Response

When making a request, replace value with your token. If the request is successful, you will get a JSON response containing the access token.

Success response use case

If the API receives a successful request, it will typically return specific parameters as part of the response:

  {
    "success": true,
    "message": "Your notification has been queued for delivery.",
    "data": {
      "notification_id": 4753 OR "schedule_id": "5c1f2266-b4fc-4bfe-84ef-819e552cc6da"
    }
  }
ParameterTypeDescriptionMandatory
successbooleanIndicating whether the request was successful or not.Yes
messageboolean/stringInforms of additional value if sent along with the response, which can be either false or a string that defines the action done by the API caller.Yes
dataobjectA JSON object containing information related to the requestYes
data.notification_idintegerA notification id generated after making an API call.Yes
data.schedule_idstringOnly received at the time of email scehdulingOptional

Failure response use case

If the email request fails, the API will return specific parameters (HTTP errors) as part of the response:

Error CodeHTTP StatusCauseSolution
1000401Invalid tokenProvide correct token in API request
1003400Missing dataProvide the mandatory data in API request
1298400Missing/invalid configuration detailsTo configure, choose an email service provider and provide the necessary details in the API request
1357400Invalid reply-to email addressProvide a valid email address in the reply-to field
1359400Invalid schedule message typeSpecify a valid message schedule type
1360400Invalid scheduled message dateProvide a valid date for scheduled messages
1361400Invalid scheduled advanced settingsCheck and correct the advanced scheduling settings
1362400Invalid timezone setting for scheduled deliveryEnsure correct timezone is specified for scheduled delivery
1363400Invalid campaign start dateProvide a valid start date for the campaign
1364400Missing schedule parametersProvide either 'interval' or at least one of: 'days_of_week', 'days_of_month', or 'months_of_year'
1365400Invalid schedule timeSpecify a valid time for scheduling
1366400Invalid days of weekProvide valid days of the week values
1367400Invalid days of monthProvide valid days of the month values
1368400Invalid months of yearProvide valid months of the year values
1369400Invalid date selection for immediate campaignCannot select future date when campaign is set to start immediately
1374400Past date selectedSelect a future date where required
1375400Invalid sunset dateProvide a valid sunset date
1376400Invalid sunset typeSpecify a valid sunset type
1377400Invalid never-end campaign settingProvide valid settings for never-ending campaigns
1378400Missing recipient informationProvide either 'segment_uuid' or 'receiver'
1379400Conflicting recipient informationProvide either 'segment_uuid' or 'receiver', not both
1380400Missing subjectProvide 'subject' when 'template_uuid' is not specified
1381400Missing contentProvide 'content' when 'template_uuid' is not specified
1382400Missing contentProvide 'content' when 'template_uuid' is not specified
1383400Missing content typeInclude 'type' in the content object
1384400Invalid meta fieldsProvide valid meta_fields
1385400Unsupported content typeUse a supported content type
1386400Invalid attachmentsProvide valid attachments
1387400Invalid schedule payloadEnsure schedule payload is properly formatted
1388400Invalid receiver formatEnsure receiver is provided as a dictionary
1389400Invalid 'to' field formatEnsure 'to' field is provided as a list
1390400Invalid recipient formatEnsure each recipient in 'to' is a dictionary
1391400Invalid email in recipientsProvide valid email addresses in 'to' field
1392400Invalid list formatEnsure the field is provided as a list
1393400Invalid email formatProvide valid email address
1394400Duplicate emailsRemove duplicate email addresses
1395400Duplicate template nameChoose a unique template name
1396400Invalid end dateEnsure end date is after Tuesday