# How to get the Contacts after a perticular dateAdded via API call

**URL:** https://forum.mautic.org/t/how-to-get-the-contacts-after-a-perticular-dateadded-via-api-call/25266
**Category:** Development
**Created:** [September 2, 2022, 6:08am UTC](https://forum.mautic.org/t/how-to-get-the-contacts-after-a-perticular-dateadded-via-api-call/25266 "2022-09-02T06:08:23Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![prajith](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/prajith/32/6465_2.png) [@prajith](https://forum.mautic.org/u/prajith)
#### Post date: [September 2, 2022, 6:08am UTC](https://forum.mautic.org/t/how-to-get-the-contacts-after-a-perticular-dateadded-via-api-call/25266/1 "2022-09-02T06:08:23Z")

</div>

Hi,  
i am new to Mautic ,  
currently i am working in Python and i need to get the contacts from mautic, for that i use the  
_**[https://xyz.mautic.net//api/contacts](https://xyz.mautic.net//api/contacts)**_ API; this will get all the data when i call the API  
To avoid the duplication and to avoid the processing of bulk amount of data from my end;  
Is there any way to add conditions or filters in API call like get all the contact after a particular dateAdded (dateAdded\>=‘2022-01-01T10:26:09+00:00’)

Eg :- [https://xyz.mautic.net//api/contacts?search=dateAdded](https://xyz.mautic.net//api/contacts?search=dateAdded)\>=‘2022-01-01T10:26:09+00:00’

Please help me to fix this,  
Thank you

---

<div class="post-metadata">

### Author: ![mzagmajster](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/mzagmajster/32/687_2.png) [@mzagmajster](https://forum.mautic.org/u/mzagmajster)
#### Post date: [September 2, 2022, 11:32am UTC](https://forum.mautic.org/t/how-to-get-the-contacts-after-a-perticular-dateadded-via-api-call/25266/2 "2022-09-02T11:32:59Z")

</div>

Maybe try advanced filtering as described here:

[https://developer.mautic.org/#advanced-filtering](https://developer.mautic.org/#advanced-filtering)

---

<div class="post-metadata">

### Author: ![ilo](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ilo/32/1181_2.png) [@ilo](https://forum.mautic.org/u/ilo)
#### Post date: [December 1, 2022, 11:19pm UTC](https://forum.mautic.org/t/how-to-get-the-contacts-after-a-perticular-dateadded-via-api-call/25266/3 "2022-12-01T23:19:04Z")

</div>

Hi @prajith,  
I am currently facing the same issue. I don’t seem to succeed, although I am using advanced filtering.  
Please let me know if you manage to solve it and how.  
Thanks!

Later edit: after some more research I found the issue below and managed to fix my code thanks to **escopecz** answer.

> <https://github.com/mautic/mautic/issues/6942>
>
> can you please let me know how I can pass date filter in below
> 
> $url = $this-\>…base\_url.'/api/contacts?search='.urlencode('segment:"segment-alias"').'&orderBy=date\_identified&orderByDir=desc&limit=500';
> 
> I want something like that
> 
> $url =$this-\>base\_url.'/api/contacts'?search='.urlencode('segment:"dev-testlist"').'&dateFrom='.$start\_date.'&dateTo='.$end\_date.'&orderBy=date\_identified&orderByDir=desc&limit=500';
> 
> But its now working, need to filter by date range

---

<div class="post-metadata">

### Author: ![yuyu](https://avatars.discourse-cdn.com/v4/letter/y/71e660/32.png) [@yuyu](https://forum.mautic.org/u/yuyu)
#### Post date: [August 5, 2024, 10:58am UTC](https://forum.mautic.org/t/how-to-get-the-contacts-after-a-perticular-dateadded-via-api-call/25266/4 "2024-08-05T10:58:41Z")

</div>

GET /api/contacts?  
where[0][expr]=orX&  
where[0][val][0][col]=dateAdded&  
where[0][val][0][expr]=gt&  
where[0][val][0][val]=2024-08-02 15:00:00&  
where[0][val][1][col]=dateModified&  
where[0][val][1][expr]=gt&  
where[0][val][1][val]=2024-08-02 15:00:00

I want to get the contacts when their dateAdded or dateModified later than a specific datetime. But the request above doesn’t work. Can someone help me? Thank you

---

<div class="post-metadata">

### Author: ![deepvyas](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/deepvyas/32/12466_2.png) [@deepvyas](https://forum.mautic.org/u/deepvyas)
#### Post date: [August 8, 2024, 10:20am UTC](https://forum.mautic.org/t/how-to-get-the-contacts-after-a-perticular-dateadded-via-api-call/25266/5 "2024-08-08T10:20:11Z")

</div>

Did you tried OrderBy param for GET/contacts can be used?

Got an Advanced Filtering thread here, If could be helpful for you.

> Blockquote  
> [Mautic Developer Documentation](https://developer.mautic.org/?_gl=1*17m1snf*_ga*MTUwNjU5MTQxNi4xNzIzMTExMzAy*_ga_ZRB8436CFL*MTcyMzExMTMwMi4xLjEuMTcyMzExMjIxMC4xNS4wLjA.#extending-webhooks)
