Send email over API
You can use the Email API (opens in a new tab) as another way of sending emails to your customers.
Prerequisites
To send an email with Infobip, your domain needs to be active in the Infobip system. Verify your email domain on the User Profile in your Infobip account (opens in a new tab).
Send email messages
To send email messages, including sending a simple single message to a single destination or batch sending of personalized messages to many recipients with a single API request, use the Send Email messages (opens in a new tab) API.
Fully-featured email
To send a fully-featured email - send one or more email messages with attachments to one or more destination addresses. For more details, see Send a Fully Featured Email (opens in a new tab) reference documentation.
Send email to multiple recipients
Send the same email to multiple recipient addresses by including more than one to
parameters in the request.
Send an email With multiple attachments
To send an email with more than one attachment, add multiple attachment parameters in the request.
Send email to multiple To, Cc, Bcc recipients
Send the same email to multiple recipient addresses by including more than one to
, cc
, bcc
parameters in the request.
curl -s --user user:password \
https://./3/send \
-F from='Jane Smith ' \
-F to='[email protected]' \
-F to='[email protected]' \
-F cc='[email protected]' \
-F cc='[email protected]' \
-F bcc='[email protected]' \
-F bcc='[email protected]' \
-F subject='Mail subject text' \
-F text='Mail body text' \
--form-string html='Html bodyRich HTML message body.' \
-F attachment=@files/image1.jpg
Send personalized emails using templates
Send personalized emails by adding placeholder values within the to
parameter of the request. If you want to send the message based on a previously defined template, pass the template identifier value in the templateId
parameter. To manage Templates, login (opens in a new tab) to the Infobip web interface.
Send email with IP pool ID
IP pool selection allows you to send emails through department-specific IP pools, even when all departments use the same sending domain. This approach offers deliverability, operational, and compliance advantages.
When multiple departments share an IP pool, they also share its sending reputation. If one department’s sending practices harm that reputation, it can affect all other departments. By assigning each department to its own IP pool, you can isolate and protect individual reputations.
To use a specific IP pool for sending, include the ipPoolId
parameter in your request to the Send Email Messages (opens in a new tab) API.
Send an email with custom messageID
Send emails with custom messageId
by including your unique messageId
within the to
parameter of the request.
Send emails with dynamic content
There are two supported approaches for sending emails with dynamic content:
- Template language (recommended)
- Use
templateLanguageVersion=2
in your API request. - Allows more powerful syntax for substitutions, logic, and expressions.
- Use
- Legacy handlebars helpers
- Do not set
templateLanguageVersion
in the API request. - Still supported for backward compatibility.
- Do not set
See Send fully featured email (opens in a new tab) API endpoint for the full API reference.
Refer to the sections below to learn more about these two approaches.
Template language
To send emails with dynamic content, use the template language within your HTML content and define placeholder values in the to
or default parameter of your request.
You can add any available template language constructs to handle substitutions, conditional statements, or iterations directly in your email template.
For details, see Template language.
Legacy handlebars helpers
Legacy helpers use the familiar {{#helper}} ... {{/helper}}
syntax. These are still supported, but we recommend migrating to the new template language for future-proof projects.
Send email using MIME format
You can send MIME (Multipurpose Internet Mail Extensions) formatted emails over API. Sending email content using MIME gives you more flexibility for structuring and sending email. For example:
- Flexible message formatting
- Inline images, HTML, and attachments
To send an email with the content in MIME format, see the Send MIME email (opens in a new tab) API reference documentation.
Email delivery reports
The Email delivery reports (opens in a new tab) method allows you to get one-time delivery reports (DLR) for all sent emails. Email delivery reports provide detailed information and metrics relating to performance all the sent emails. You can set a limit to the number of reports or, for example, target a specific message or campaign.
Delivery reports provide key insights that enable you to optimize workflows, such as creating failover logic or slowing down traffic if delivery performance is not optimal.
The delivery report is returned only once. Additional delivery report requests return an empty collection.
The following are examples to get email delivery reports.
Get reports by Message ID
Use the messageId
parameter to specify a specific message.
For example:
GET /email/4/reports?messageId=
Get the initial two delivery reports
Use the limit
parameter to define the maximum number of reports.
For example:
GET /email/4/reports?limit=2 HTTP/1.1
Get reports by bulk ID
Use the bulkId
parameter to request the unique report.
For example
GET /email/4/reports?bulkId=lrzkq6gatdkxouhrkgni HTTP/1.1
Email messages logs
The Get Email logs (opens in a new tab) method allows you to get logs for email messages. None of the query parameters is mandatory for this request. Any combination of parameters can be used to filter results. Some examples are shown below.
Email logs are available for the last 48 hours only.
Response format
If successful, the response header HTTP status code is 200 OK
and the message logs are returned.
If you try to send a message without authorization, you get a response with HTTP status code 401 Unauthorized
.
If you use this method too many times in a short period of time, you receive the 429 Too Many Requests
status code. This prevents misusing logs in cases where reports would be more appropriate.
Get logs with multiple message ID filters
The fields from
, to
, and limit
accept a single parameter, which is used to filter response message logs.
Get logs with date range and general status filters
The fields sentSince
and generalStatus
accept a single parameter, which is used to filter response message logs.
Get logs by bulk ID
To use this method, use the bulkId
returned in the response for an email/emails you wish to filter message logs for.
Tracking notifications
Tracking notifications help you monitor how recipients interact with your emails. They provide valuable insights into engagement and deliverability by notifying you about specific events:
- Opens - Triggered when a recipient opens your email.
- Clicks - Triggered when a recipient clicks any URL within your email.
- Unsubscribes - Triggered when a recipient opts out of receiving further emails.
- Complaints - Triggered when a recipient marks your email as spam or reports it to their provider.
- Late bounces - Triggered when an email that was initially accepted by the recipient’s server later fails delivery.
If you pass a trackingUrl
, Infobip will send these notifications back to your system. The notification payload includes structured data about the event, so you can process it automatically and feed it into your reporting, analytics, or suppression workflows.
The following sections show examples of notification payloads for opens, clicks, unsubscribes, complaints, and late bounces.
Open notifications
{
"notificationType": "OPENED",
"eventId": "8d2f8781-91fc-4473-9b0a-b12b51fafbe6",
"domain": "some-domain.com",
"recipient": "[email protected]",
"sendDateTime": 1704106800000,
"messageId": "14b734recsf69n8zkao5",
"bulkId": "ikzzmbhu6223bxkhmyrj",
"callbackData": "Callback data",
"recipientInfo": {
"deviceType": "Phone",
"os": "iOS 12",
"deviceName": "Apple"
},
"geoLocation": {
"countryName": "Los Angeles",
"city": "United States"
},
"entityId": "promotional-traffic-entity",
"applicationId": "marketing-automation-application",
"campaignReferenceId": "campaign-reference-123"
}
Click notifications
{
"notificationType": "CLICKED",
"eventId": "8d2f8781-91fc-4473-9b0a-b12b51fafbe6",
"domain": "some-domain.com",
"recipient": "[email protected]",
"url": "https://www.somelink.com",
"sendDateTime": 1704106800000,
"messageId": "14b734recsf69n8zkao5",
"bulkId": "ikzzmbhu6223bxkhmyrj",
"callbackData": "Callback data",
"recipientInfo": {
"deviceType": "Phone",
"os": "iOS 12",
"deviceName": "Apple"
},
"geoLocation": {
"countryName": "Los Angeles",
"city": "United States"
},
"entityId": "promotional-traffic-entity",
"applicationId": "marketing-automation-application",
"campaignReferenceId": "campaign-reference-123"
}
Unsubscribe notifications
{
"notificationType": "UNSUBSCRIBED",
"eventId": "8d2f8781-91fc-4473-9b0a-b12b51fafbe6",
"domain": "some-domain.com",
"recipient": "[email protected]",
"sendDateTime": 1704106800000,
"messageId": "14b734recsf69n8zkao5",
"bulkId": "ikzzmbhu6223bxkhmyrj",
"callbackData": "Callback data",
"recipientInfo": {
"deviceType": "Phone",
"os": "iOS 12",
"deviceName": "Apple"
},
"geoLocation": {
"countryName": "Los Angeles",
"city": "United States"
},
"entityId": "promotional-traffic-entity",
"applicationId": "marketing-automation-application",
"campaignReferenceId": "campaign-reference-123"
}
Complaint notifications
{
"notificationType": "COMPLAINED",
"eventId": "8d2f8781-91fc-4473-9b0a-b12b51fafbe6",
"domain": "some-domain.com",
"recipient": "[email protected]",
"sender": "[email protected]",
"sendDateTime": 1704106800000,
"messageId": "14b734recsf69n8zkao5",
"bulkId": "ikzzmbhu6223bxkhmyrj",
"callbackData": "Callback data",
"entityId": "promotional-traffic-entity",
"applicationId": "marketing-automation-application",
"campaignReferenceId": "campaign-reference-123"
}
Late bounces notifications
{
"notificationType": "LATE_BOUNCE",
"eventId": "8d2f8781-91fc-4473-9b0a-b12b51fafbe6",
"domain": "some-domain.com",
"recipient": "[email protected]",
"sender": "[email protected]",
"sendDateTime": 1704106800000,
"messageId": "14b734recsf69n8zkao5",
"bulkId": "ikzzmbhu6223bxkhmyrj",
"callbackData": "Callback data",
"entityId": "promotional-traffic-entity",
"applicationId": "marketing-automation-application",
"campaignReferenceId": "campaign-reference-123"
}