# I cant create a lead with the HTTP REST API

**URL:** <https://forum.mautic.org/t/i-cant-create-a-lead-with-the-http-rest-api/4700>\
**Category:** Product Support\
**Created:** [August 1, 2016, 9:28am UTC](https://forum.mautic.org/t/i-cant-create-a-lead-with-the-http-rest-api/4700 "2016-08-01T09:28:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![chizuokagmail-com](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chizuokagmail-com](https://forum.mautic.org/u/chizuokagmail-com)\
**Post date:** [August 1, 2016, 9:28am UTC](https://forum.mautic.org/t/i-cant-create-a-lead-with-the-http-rest-api/4700/1 "2016-08-01T09:28:23Z")

</div>

Hello would someone be able to help out?  
  
  
  
I **CANNOT CREATE** a contact  
  
  
  
**Header**  
  
Authorization: Bearer {token}  
  
  
  
POST [http://dev.mautic.mydomain.com/api/contacts/new](http://dev.mautic.mydomain.com/api/contacts/new)  
  
  
  
The response is:  
  
  
  
{  
  
“error”: {  
  
“message”: “Requested URL not found: /index.php/api/contacts/new”,  
  
“code”: 404  
  
}  
  
}  
  
  
  
But I have managed to do all the following calls with the REST API, testing through POSTMAN  
  
  
  
**Header**  
  
Authorization: Bearer {token}  
  
  
  
**Get contact**  
  
GET [http://dev.mautic.mydomain.com/api/contacts/1](http://dev.mautic.mydomain.com/api/contacts/1)  
  
  
  
**Search contact**  
  
GET [http://dev.mautic.mydomain.com/api/contacts?search=david](http://dev.mautic.mydomain.com/api/contacts?search=david)  
  
  
  
**Edit contact**  
  
PUT [http://dev.mautic.mydomain.com/api/contacts/1/edit](http://dev.mautic.mydomain.com/api/contacts/1/edit)

---

<div class="post-metadata">

**Author:** ![chizuokagmail-com](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chizuokagmail-com](https://forum.mautic.org/u/chizuokagmail-com)\
**Post date:** [August 1, 2016, 9:28am UTC](https://forum.mautic.org/t/i-cant-create-a-lead-with-the-http-rest-api/4700/2 "2016-08-01T09:28:23Z")

</div>

Hello would someone be able to help out?

I CANNOT CREATE a contact

Header  
Authorization: Bearer {token}

POST [http://dev.mautic.mydomain.com/api/contacts/new](http://dev.mautic.mydomain.com/api/contacts/new)

The response is:

{  
“error”: {  
“message”: “Requested URL not found: /index.php/api/contacts/new”,  
“code”: 404  
}  
}

But I have managed to do all the following calls with the REST API, testing through POSTMAN

Header  
Authorization: Bearer {token}

Get contact  
GET [http://dev.mautic.mydomain.com/api/contacts/1](http://dev.mautic.mydomain.com/api/contacts/1)

Search contact  
GET [http://dev.mautic.mydomain.com/api/contacts?search=david](http://dev.mautic.mydomain.com/api/contacts?search=david)

Edit contact  
PUT [http://dev.mautic.mydomain.com/api/contacts/1/edit](http://dev.mautic.mydomain.com/api/contacts/1/edit)

---

<div class="post-metadata">

**Author:** ![chizuokagmail-com](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chizuokagmail-com](https://forum.mautic.org/u/chizuokagmail-com)\
**Post date:** [August 1, 2016, 9:29am UTC](https://forum.mautic.org/t/i-cant-create-a-lead-with-the-http-rest-api/4700/3 "2016-08-01T09:29:32Z")

</div>

Its really weird every other operation is alright except for the most important one which is create. May i know what im doing wrong?

---

<div class="post-metadata">

**Author:** ![chizuokagmail-com](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chizuokagmail-com](https://forum.mautic.org/u/chizuokagmail-com)\
**Post date:** [August 1, 2016, 9:30am UTC](https://forum.mautic.org/t/i-cant-create-a-lead-with-the-http-rest-api/4700/4 "2016-08-01T09:30:29Z")

</div>

Oh btw… im using the latest 2.01 Mautic

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [August 1, 2016, 10:14am UTC](https://forum.mautic.org/t/i-cant-create-a-lead-with-the-http-rest-api/4700/5 "2016-08-01T10:14:34Z")

</div>

It might be related to [https://github.com/mautic/mautic/pull/2142](https://github.com/mautic/mautic/pull/2142). Try to save only one contact field which you know has a valid value. For example firstname doesn’t have any validation on it. If it saves correctly, then you send some value which gets rejected by the form value validation. You should also find some error messages in the Mautic logs.

---

<div class="post-metadata">

**Author:** ![chizuokagmail-com](https://avatars.discourse-cdn.com/v4/letter/c/ecccb3/32.png) [@chizuokagmail-com](https://forum.mautic.org/u/chizuokagmail-com)\
**Post date:** [August 2, 2016, 1:30am UTC](https://forum.mautic.org/t/i-cant-create-a-lead-with-the-http-rest-api/4700/6 "2016-08-02T01:30:12Z")

</div>

Actually i managed to create a contact by doing this trick

[http://dev.mautic.rapidfy.com/api/contacts/0/edit](http://dev.mautic.rapidfy.com/api/contacts/0/edit)

because i looked in your code and saw a create if not exist. Do you still think this error with …/new is related to the above git report?

Should i update my mautic with the bugfix?

---

<div class="post-metadata">

**Author:** ![escopecz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/escopecz/32/370_2.png) [@escopecz](https://forum.mautic.org/u/escopecz)\
**Post date:** [August 2, 2016, 5:38am UTC](https://forum.mautic.org/t/i-cant-create-a-lead-with-the-http-rest-api/4700/7 "2016-08-02T05:38:09Z")

</div>

If you’d be able to test that PR, that’d be great! It’ll speed up the 2.1.0 release and you can win prizes this month:

[https://www.mautic.org/blog/community/mautic-summer-games/](https://www.mautic.org/blog/community/mautic-summer-games/)
