How to target the right people with segmentation via Mailjet’s API

Every one of your subscribers is unique, so start segmenting your list and send the right emails to the right people with Mailjet’s API.

Hermes and Hera working on mechanism



Do you want to increase your email open rates, boost your click rates, and decrease your unsubscribe rates? Of course, you do! Well, the best way to achieve that is to stop sending the same email to all of your subscribers. We know you know that every one of your subscribers is unique, so why would you send the same email to all of them? Instead, start segmenting your email list and send the right emails to the right people. Keep reading to find out some segmentation ideas, and we’ll also cover how to use segmentation with Mailjet’s API.

What is segmentation?

To understand why you need to segment your list, we’re going to need to cover the basics first - namely what exactly segmentation is. Information such as age, gender, location, and interests can provide a lot of insight into your customers’ needs and help you with segmenting your list in the right way. Segmentation is actually the action of dividing your contact list into parts. Then, you can create personalized and relevant emails for each segment.

The most important thing to take into consideration is why this contact joined your list, so you can send them the right content. You wouldn’t send a promotional email for Star Trek items to a Star Wars fan, right? The point is to send them the content they would find interesting and relevant, and this way you can increase your open and click rates while worrying less about the unsubscribe rate. Consumers now actually expect personalized emails and segmentation is one of the easiest ways to deliver on that expectation.

Now that we know the basics of segmentation, let’s dig deeper into the advantages of using it.

Why you need segmentation

Segmentation is a highly effective email personalization technique. By dividing your large list into different groups, you can send more targeted emails and focus on sending emails that build trust.

Segmentation is a simple but powerful mechanism that can boost your engagement and profits. To segment correctly, you need to think in groups and find something in common for each group. And if it is something beyond the obvious separation between men and women, you can show your customers that you know them. The segments can be as large or as small as you want, but in most cases, the smaller they are, the more likely it is that the information you send will be relevant for the recipient. Without email segmentation, it’s difficult to engage your subscribers and improve your conversion rate.

Some ideas for segmenting your lists

Once you have collected the necessary data, you now need to decide what the best way to group your subscribers into segments is. You can create segments based on age, similar purchase histories, interests, and different traits relevant to your brand to send targeted emails. Once you start brainstorming segmentation criteria, the possibilities are almost endless. You can use all the data you’ve collected so you can create the perfect email for each segment. Here are some ideas for segmentation:


However large or small your target market might be, you can use geography to segment your email list. You can create a special email category for people in a particular city or country if your business has a presence multiple ones.


You can get detailed information about subscribers’ personal interests by creating user profiles on your website, or using an email subscription center, or even your opt-in. You can ask them anything that can help you send them more relevant information and offer them the right products.

Browsing behavior

If you are keeping track of website behavior, this is one of the simplest ways to create the right segments. With browsing behavior, you will know what each customer is browsing and what they are looking for.


Knowing the general age range of the people on your list can be helpful with removing those not in your target audience, or to adjust the messaging of your email communications to better suit that demographic.


This may be pretty basic, but it is still one of the best segmentations that you can use. Offering the right range of products to women and men is something that can be accomplished so easily, and still, be so efficient.

Purchase history/Purchase behavior

Segmenting by past purchases is another simple way to optimize your email targeting. You can always offer products that are similar to the one that the customer already bought. Or, if a customer bought something that requires replacement, refilling, or renewal, you can send out targeted emails based on their needs.

You can even consider some clients as VIPs after a certain number of purchases. You can add a dedicated section in your email specifically for them and create a segment to target them.

Email behavior

Open rates and click rates are metrics that everybody should be checking and collecting information on. They are the easiest way to know which contacts are] active, and which ones are no longer engaging. You can then create a specialized campaign designed at re-engaging your inactive subscribers or offer the active ones the latest news.


If you are planning on making surveys, there’s no doubt you’re planning on using the results in the best ways, and we’re positive one of them is for sure segmentation. You can build emails for the different segments that you created depending on the feedback you received.

You can segment based on everything you can think of that’s relevant to you and your brand. There are no limitations.

Now that you have some ideas, let’s explore actually creating a segment with Mailjet’s API.

How to create a segment with Mailjet’s API

Creating your segments will be so easy and it can be done with just a few lines of code. We’re going to walk you through an example where we will create a segment for all men from London that are interested in Star Trek, so we can offer them our new Star Trek-inspired male collection.

Our /contactfilter resource allows you to create segmentation formulas like the one below:

As you can see you can add a description, expression, and name for each segment. Since the name and the description is something really obvious, we will focus a little more on the expression part. This is where you are actually saying who will receive the message. You can have simple expressions with only one condition or complex ones with more conditions connected with “AND” and “OR” operators.

You can find all the operators that are available for comparing the properties here. You will need to keep in mind that not all of them are supported by our interface. Because of this, some segments created via the API may not be recognized as valid in the app. However, you will still be able to use them in your campaigns. You can use any of these operators to create the perfect segment for your needs.

Another thing that you will need to know is that you can only apply one segment to a campaign. This is why if you need to make sure that your segment is perfect before going to the next step.

When the segment is ready, it’s time to apply into your campaign! For this, you will need the Segment ID. You can find the payload you received as a response for the segment you created, and it will look a little something like this:

Take note of this ID and keep it safe because you will need it for the next step.

Sending to segment with Mailjet’s API

The segment should be applied to a campaign draft and you will also need the list that you want to use. Two more IDs will be needed for this - the one from the campaign draft and the one from the list. Once you have those IDs, the rest is easy. You’ll simply have to execute the code below and the rest is done:

Summing up

Now you are ready to send the campaign (once you’ve made it pretty, of course). The last thing you will have to do is publish the draft and send it as campaign when you’re happy with the content. All the steps for how to do so can be found in our documentation.

If you want to find out how you can use segmentation in an advanced way with our Passport tool you can check those two articles for marketing and transactional templates.

Popular posts

Hermes rides a firework next to a Goddess in front of a night sky with more fireworks

Top email marketing trends for 2022

To the outsiders, it can sometimes feel like email hasn't changed that much since it was created. Maybe this is why some are so persistent in...

Read more

Hermes on a moped delivering mail to a mailbox

Reducing email’s carbon footprint

When it comes to protecting our planet, every step toward cleaner practices – small and big – counts. So, what if we told you that emailing, as clean and green as it seems...

Read more

Mother's day gift for Hera

Marketing calendar 2024: Dates you shouldn’t miss this year

We finally got through 2023 (phew!) and Q1 is just around the corner. It’s time for you to start scribbling down your New Year’s Resolutions to make sure we start the year with a bang. If you’ve found your way here, we’re guessing that’s because creating a winning...

Read more

It's never been easier to build connected experiences. Start sending with Mailjet today.Get started on your path
CTA icon