Is it possible to unsubscribe contact via API

Your software
My Mautic version is: Latest 4.x
My PHP version is: 7.4.25
My Database type and version is: MySQL 5.7.34

I’m working with another company creating and sending their email campaigns. They are a startup but are part of a much larger financial services company, so they have a fairly large IT department. Seems almost everything they use is custom built from code, including their website, which at the moment is extremely basic and is not using a CMS system.

Looking to do two things:

  1. Generate a report of all “unsubscribes” for each DAY that gets sent via email. At present, we send a report but I can only get it to show ALL opt-outs. I haven’t figured a way to filter it to ONLY show that day’s unsubscribes as a CSV file. Any help appreciated. Doing this via API would also be nice so they can grab the data dynamically into their MySQL database.

  2. They separately run other contact campaigns and promotions themselves, including SMS and direct mail, so they get “unsubscribe” and “Do Not Contact” requests from those that need to be updated in Mautic’s contacts (at the moment about 15,000 total).
    Currently we manually update them, which is s pain. Is there a way to use the API to allow my client to trigger an unsubscribe or Do Not Call update to a contact?

Steps I have tried to fix the problem: Researched online for hour or so and I’ve used Zapier in the past for some automations, but unsure of how to do this using Zapier since the clients’ CRM is proprietary.

Any help appreciated.
Chris Blair

Hello @chrisb_hallcomm and welcome to the community!

Mautic can do it.

There are many ways you can achieve this, here are my ideas:

  1. Use the webhooks feature in Mautic, where by each unsubscribe generates a webhook including the email or other important info you need. You can create an endpoint in your Financial Services Company system which captures your webhook and adds the unsubscribe.

  2. You can use Mautic api to unsubscribe contacts in Mautic. You’ll need to do it in 2 steps: