# Problem with API - Add to Segment

**URL:** <https://forum.mautic.org/t/problem-with-api-add-to-segment/15281>\
**Category:** Mautic 3 - Install/Upgrade Support\
**Created:** [July 20, 2020, 2:36am UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281 "2020-07-20T02:36:04Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![fcrdossantos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/fcrdossantos/32/844_2.png) [@fcrdossantos](https://forum.mautic.org/u/fcrdossantos)\
**Post date:** [July 20, 2020, 2:36am UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/1 "2020-07-20T02:36:04Z")

</div>

**Your software**  
_My PHP version is_ : 7.2.31  
_My MariaDB version is_: 10.4.13

**Updating/Installing Errors**  
_I am_: Updating  
_Upgrading/installing via_ : Command Line

_These errors are showing in the Mautic log_ : None

_My problem is_ :

Hi, i use Mautic as a e-mail marketing automation in Hotmart (it’s a Brazilian company that hosts and sell online courses).

I recently updated my Mautic to 3.0.1 and I’m facing problemas with the Hotmart API.

There’s a tool called ListBoss, that connects to a lot of e-mail automation tools (as Mautic) and send contacts infos, for example:

If a contact has a status of “Abandoned Cart” or “Payment Error” or “Purshace Done”, they create this contact to me and send it to a new segment.

After the upload, ListBoss can still create the new Contact, but it’s doesn’t add the contact to my Segment.

Their API can even show a list of all segments available, but can’t add on it…

When i talked with Hotmart they told me that Mautic didn’t changed anything on it’s API in version 3.0, so it’s must be an error with My Mautic.

Is it true? Did Mautic changed anything regarding it’s API to create a new contact and add it to a segment?

PS: Just to be sure, that’s a two step process:

- Creates a new user
- Add it to a segment

Hotmart can still create the user (that’s why they told me that the API isn’t the problem and did not changed anything from 2.x to 3.0). But ListBoss can not add this contact to any segment

_Steps I have tried to fix the problem_ :

I’ve tried:

- Create a new OAUTH 2 credentials.
- Create a new account on ListBoss.
- Disable/Enable the API.
- Recreate all the segments.

---

<div class="post-metadata">

**Author:** ![fcrdossantos](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/fcrdossantos/32/844_2.png) [@fcrdossantos](https://forum.mautic.org/u/fcrdossantos)\
**Post date:** [July 21, 2020, 9:15pm UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/2 "2020-07-21T21:15:32Z")

</div>

Anyone can help me, please?

The question is simple: Did Mautic changed anything on API to ADD Contact to Segment in Mautic 3.0?

---

<div class="post-metadata">

**Author:** ![leoschuler](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/leoschuler/32/4798_2.png) [@leoschuler](https://forum.mautic.org/u/leoschuler)\
**Post date:** [July 5, 2021, 3:35pm UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/3 "2021-07-05T15:35:37Z")

</div>

I had the same issue today,

It was solved by clearing / warming up the cache on mautic  
see documentation for reference: [Troubleshooting | Mautic](https://docs.mautic.org/en/troubleshooting)

---

<div class="post-metadata">

**Author:** ![paolosn](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/paolosn/32/7028_2.png) [@paolosn](https://forum.mautic.org/u/paolosn)\
**Post date:** [May 25, 2022, 8:23pm UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/4 "2022-05-25T20:23:58Z")

</div>

Hello, how do you put a contact in a segment via api?

I use webinarpress and it connects with mautic via api, it sends the contact BUT IT DOESN’T SEND IT TO ANY SEGMENT, I don’t know how to do it.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [May 25, 2022, 8:34pm UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/5 "2022-05-25T20:34:14Z")

</div>

Hi, via API you can use the following call in php:

POST /segments/SEGMENT\_ID/contacts/CONTACT\_ID/add

The info seems off here:  
CONTACT\_ID is missing:  
[https://developer.mautic.org/#add-contacts-to-a-segment](https://developer.mautic.org/#add-contacts-to-a-segment)

---

<div class="post-metadata">

**Author:** ![paolosn](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/paolosn/32/7028_2.png) [@paolosn](https://forum.mautic.org/u/paolosn)\
**Post date:** [May 25, 2022, 9:10pm UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/6 "2022-05-25T21:10:21Z")

</div>

hello!

Thank you for answering my message. Thank you so much.

I’ll see if I can but I don’t handle php so it will be very difficult ☹

But what I thought to do is:  
Create a segment and in filters choose “visited url” and it is equal to or contains

 ![Captura de Pantalla 2022-05-25 a las 23.02.44](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/0/00fae1e5f564466300f9c0395c0ae777c047b3ac.png)

Maybe this will work…

Why do I think it can work? Well, because when you register you go to a thank you page created by webinarpress.

With what webinarpress when registering sends the contact to mautic and the contact if or if you visit the url of thanks for registering to the webinar since it is automatically redirected, then “you would have to enter the segment” since you visited the url…

do you think that is an option?

Thank you.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [May 26, 2022, 5:20am UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/7 "2022-05-26T05:20:12Z")

</div>

Hi, you are welcome.  
Your idea would work. Since you use wordpress you can also use the WP Mautic plugin and add tags on different pages with the help of the following shortcodes:

### MAUTIC TAGS

You can add or remove multiple lead tags on specific pages using commas. To remove an tag you have to use minus “-” signal before tag name:

```auto
[mautic type="tags" values="mytag,anothertag,-removetag"]

```

---

<div class="post-metadata">

**Author:** ![paolosn](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/paolosn/32/7028_2.png) [@paolosn](https://forum.mautic.org/u/paolosn)\
**Post date:** [May 26, 2022, 10:40am UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/8 "2022-05-26T10:40:19Z")

</div>

Thanks for the reply.

I have the plugin installed, and there is no where to put that tag.  
Basically the plugin screen is this:

 ![Captura de Pantalla 2022-05-26 a las 12.06.35](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/0/0ca6c6a014c11ff9029285f334c86477c4175eea.png)

so there is no where to put labels.  
I have looked at the documentation and it talks about labels but it does not say where to put them

 ![Captura de Pantalla 2022-05-26 a las 12.08.48](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/f/fa1113f35a52965c59f5839ba2a12e3d4b2ea2eb.png)

I have created a page in wordpress to see if in the creation of the page a field appears to put the label and it does not appear either.

so I don’t know where to put the label,  
joey did you ever use the plugin to insert a tag?

By the way, the webinarpress plugin in the webinar subscription confirmation page configuration has a script tags section:

 ![Captura de Pantalla 2022-05-26 a las 12.38.15](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/c/ca7c1e99120eb0bb59141a3a2d3deeca756e8ff4.png)

Do you think it is created to be able to put “labels” as for example in my case?

Thanks for the support @joeyk You help me a lot to overcome my obstacles

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [May 26, 2022, 10:54am UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/9 "2022-05-26T10:54:54Z")

</div>

Hey,

Can you edit the page with the Gutenberg builder (What is visual Editor?)?  
If yes, then you can add the shortcode there, just like any WP shortcode.  
I can see, that you can add a custom thank you page. It seems like a good way to go.

If not, then I have one more idea. BTW - did you add the Mautic tracking to the header of the page in WP? Tracking works?  
Let me know.

---

<div class="post-metadata">

**Author:** ![paolosn](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/paolosn/32/7028_2.png) [@paolosn](https://forum.mautic.org/u/paolosn)\
**Post date:** [May 26, 2022, 12:11pm UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/10 "2022-05-26T12:11:35Z")

</div>

Hello  
yes, it is possible but unfortunately the shortcodes of the webinarpress plugin do not work, I tried all the ways and they always came out:

The time you chose is the following:

[webinarpress\_confirmation\_stars\_at format=”D MMM YYYY HH:mm”]

more text here

[webinarpress\_confirmation\_stars\_at format=”D MMM YYYY HH:mm”]

that is, if you make a custom page it does not work.

 ![Captura de Pantalla 2022-05-26 a las 14.06.39](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/6/62e462aba0e3df86c88f8fa509febea5dc1ce752.png)

but if I use the one that brings those shortcode by default, it shows the information such as the name of the webinar, the date of the webinar and the link and button to the webinar

 ![Captura de Pantalla 2022-05-26 a las 14.03.37](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/d/d2e9f6d7fc546c630caaaba3e960a4f3f78c44a0.png)

con lo que creo que está descartada esa opcion ☹

On the other hand, I have realized (I made several test records) that it sends the contact to mautic but the name is the email, that is, it does not collect other fields… this is a bit strange, right?

 ![Captura de Pantalla 2022-05-26 a las 13.59.36](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/3/32a3d5694ae4e0d32d48d7eca3f46f42958cff1e.png)

I forgot to put the tag:

 ![Captura de Pantalla 2022-05-26 a las 14.10.03](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/b/ba98abfd9c4967615ffc8b1f640135c7a7e66989.png)

and it doesn’t work either, mautic doesn’t collect subscribers with that tag

 ![Captura de Pantalla 2022-05-26 a las 14.10.24](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/b/bcbf8b63afc3597d9073ed6b9fcc6ee41cc7b1be.png)

Gracias.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [May 26, 2022, 12:15pm UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/11 "2022-05-26T12:15:37Z")

</div>

No… it doesn’t work this way.

---

<div class="post-metadata">

**Author:** ![joeyk](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/joeyk/32/11164_2.png) [@joeyk](https://forum.mautic.org/u/joeyk)\
**Post date:** [May 26, 2022, 12:47pm UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/12 "2022-05-26T12:47:11Z")

</div>

Can you plz open a new thread, cause we are offtopic here.

---

<div class="post-metadata">

**Author:** ![muldersc](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/muldersc/32/6471_2.png) [@muldersc](https://forum.mautic.org/u/muldersc)\
**Post date:** [February 15, 2024, 7:23pm UTC](https://forum.mautic.org/t/problem-with-api-add-to-segment/15281/13 "2024-02-15T19:23:57Z")

</div>

> [@joeyk](#):
>
> /segments/SEGMENT\_ID/contacts/CONTACT\_ID/add

for anyone else struggling… it’s “contact” not “contacts” and it needs to be sent as a POST explicitly.  
[https://YOURMAUTICURL.com/api/segments/SEGMENT\_ID/contact/CONTACT\_ID/add](https://YOURMAUTICURL.com/api/segments/SEGMENT_ID/contact/CONTACT_ID/add)
