Mautic API - get all the contacts

Your software
My Mautic version is: v3
My PHP version is: 7.2.33
My Database type and version is:

Your problem
My problem is:

I’m connecting to Mautic via API, and I’m already getting the contacts correctly by segments or by searches, but the option to retrieve all the contacts doesn’t work for me.

If I call the API with this url: {{MauticDomain}}/api/contacts

I get these results:

In reality there are 144 contacts and they don’t correspond to the ids returned in this query.

The first contact it outputs is the id 4844 and in the contacts snapshot you can see that this id does not exist

How can I get all the contacts? Can you help me?

Hello,
I have found the solution and I answer myself, in case someone comes here looking for a solution.
With the query /contacts, I retrieved the contacts with a limit of 30 and I was only showing myself the anonymous contacts.
In order to get all the non-anonymous contacts out, you have to run this query:

{{MauticDomain}}/api/contacts?search=!is:anonymous&limit=0

I hope more people will find it helpful

1 Like