# API error The response has unexpected status code (0)

**URL:** https://forum.mautic.org/t/api-error-the-response-has-unexpected-status-code-0/19183
**Category:** Product Support
**Tags:** development
**Created:** [April 26, 2021, 9:02am UTC](https://forum.mautic.org/t/api-error-the-response-has-unexpected-status-code-0/19183 "2021-04-26T09:02:06Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![jcpicot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jcpicot/32/2336_2.png) [@jcpicot](https://forum.mautic.org/u/jcpicot)
#### Post date: [April 26, 2021, 9:02am UTC](https://forum.mautic.org/t/api-error-the-response-has-unexpected-status-code-0/19183/1 "2021-04-26T09:02:06Z")

</div>

Hi! I’m trying to connect with the API using Basic Auth but I’m getting an error 0.  
It’s not a caché problem, i’m deleting the caché frequently.  
The full response it’s:

array(1) { [“errors”]=\> array(1) { [0]=\> array(2) { [“code”]=\> int(0) [“message”]=\> string(56) "The response has unexpected status code (0). Response: " } } }

That’s my code:

 ![Captura](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/1/19552aef14f3e194cbd3f7428eca9e8ceba6fb1e.png)

And all good in the config:  
 ![Captura2](https://us1.discourse-cdn.com/flex020/uploads/mautic/original/2X/9/904a179ce75b4b3518e6e5bfe0114dfea0626f17.png)

Thanks!

---

<div class="post-metadata">

### Author: ![jcpicot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jcpicot/32/2336_2.png) [@jcpicot](https://forum.mautic.org/u/jcpicot)
#### Post date: [April 27, 2021, 8:57am UTC](https://forum.mautic.org/t/api-error-the-response-has-unexpected-status-code-0/19183/2 "2021-04-27T08:57:14Z")

</div>

UPDATE:  
The code return the same error in post/update but works!

It’s not working only for GET method, only returns the 0 error.

Any help? Thanks!

---

<div class="post-metadata">

### Author: ![jcpicot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/jcpicot/32/2336_2.png) [@jcpicot](https://forum.mautic.org/u/jcpicot)
#### Post date: [May 3, 2021, 7:19am UTC](https://forum.mautic.org/t/api-error-the-response-has-unexpected-status-code-0/19183/3 "2021-05-03T07:19:50Z")

</div>

Any idea @joeyk ? Im stuck on this.

---

<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 3, 2021, 8:10am UTC](https://forum.mautic.org/t/api-error-the-response-has-unexpected-status-code-0/19183/4 "2021-05-03T08:10:04Z")

</div>

Sorry no. I’m not a real developer. If it works for put/post but not for GET, then I’m also lost.
