# Not able to fetch contacts listing by API calling

**URL:** <https://forum.mautic.org/t/not-able-to-fetch-contacts-listing-by-api-calling/10138>\
**Category:** Development\
**Created:** [January 17, 2018, 8:24am UTC](https://forum.mautic.org/t/not-able-to-fetch-contacts-listing-by-api-calling/10138 "2018-01-17T08:24:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rizwan-mindcrew](https://avatars.discourse-cdn.com/v4/letter/r/e9c0ed/32.png) [@rizwan-mindcrew](https://forum.mautic.org/u/rizwan-mindcrew)\
**Post date:** [January 17, 2018, 8:24am UTC](https://forum.mautic.org/t/not-able-to-fetch-contacts-listing-by-api-calling/10138/1 "2018-01-17T08:24:36Z")

</div>

Hello All,

I am using mautic API for email listing and email sending. I am trying to get all email list with mautic API auth2.0  
I am getting access token properly but while i am calling email api like this

$apiUrl = “[https://travialist-main.scapp.io](https://travialist-main.scapp.io)”;  
$api = new MauticApi();  
$emailApi = $api-\>newApi(“emails”, $auth, $apiUrl);  
$emails = $emailApi-\>getList();  
print\_r($emails);

its giving me error

Array ( [errors] =\> Array ( [0] =\> Array ( [message] =\> Looks like I encountered an error (error #404). If I do it again, please report me to the system administrator! [code] =\> 404 [type] =\> ) ) [error] =\> Array ( [message] =\> Looks like I encountered an error (error #404). If I do it again, please report me to the system administrator! (`error` is deprecated as of 2.6.0 and will be removed in 3.0. Use the `errors` array instead.) [code] =\> 404 ) )

Can anyone please help me why its happening?

---

<div class="post-metadata">

**Author:** ![mohamed](https://avatars.discourse-cdn.com/v4/letter/m/d78d45/32.png) [@mohamed](https://forum.mautic.org/u/mohamed)\
**Post date:** [June 13, 2018, 5:22am UTC](https://forum.mautic.org/t/not-able-to-fetch-contacts-listing-by-api-calling/10138/2 "2018-06-13T05:22:23Z")

</div>

Hello EveryOne,

I have the same problem on create contact here is my code:

```
        $initAuth = new ApiAuth();
        $auth = $initAuth-&gt;newAuth($settings);
        $apiUrl = "XXXXX";//url to Mautic
        $api = new MauticApi();
        $contactApi = $api-&gt;newApi("contacts", $auth, $apiUrl);
             
             //CREATE Contact :
             
			$data = array(
			'firstname' =&gt; 'Jim',
			'lastname' =&gt; 'Contact',
			'email' =&gt; 'jim@his-site.com',
			'ipAddress' =&gt; $_SERVER['REMOTE_ADDR']
			);
			
			$contact = $contactApi-&gt;create($data);

```

and i get this :

Array ( [errors] =\> Array ( [0] =\> Array ( [message] =\> Looks like I encountered an error (error #404). If I do it again, please report me to the system administrator! [code] =\> 404 [type] =\> ) ) [error] =\> Array ( [message] =\> Looks like I encountered an error (error #404). If I do it again, please report me to the system administrator! (`error` is deprecated as of 2.6.0 and will be removed in 3.0. Use the `errors` array instead.) [code] =\> 404 ) )
