# REST API Payload to create a new contact

**URL:** <https://forum.mautic.org/t/rest-api-payload-to-create-a-new-contact/7276>\
**Category:** Product Support\
**Created:** [January 24, 2017, 9:03am UTC](https://forum.mautic.org/t/rest-api-payload-to-create-a-new-contact/7276 "2017-01-24T09:03:46Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![marcodes](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@marcodes](https://forum.mautic.org/u/marcodes)\
**Post date:** [January 24, 2017, 9:03am UTC](https://forum.mautic.org/t/rest-api-payload-to-create-a-new-contact/7276/1 "2017-01-24T09:03:46Z")

</div>

Hello,  
  
I am new to mautic and I am trying to leverage the API to programmatically create contacts, but I can not find any documentation on the payload for POSTs. I don’t intent to use the php client, as I will be calling the API from a node code project. I am not interested in the forms option either, as the contacts need to be created server-side.  
  
  
  
I have the API working with basic auth and I can successfully create an empty contact (I am receiving a 201 response, and everytime the contact id is increased), but I can not successfully pass the information I need (email, firstname, lastname, ipaddress, etc).  
  
What is the payload format that I should use? Should I send a json payload?  
  
  
  
I think it would really help adding a curl example to the API documentation, so everyone using it from a different programming language has a reference.  
  
  
  
Thank you in advance,  
  
Marco

---

<div class="post-metadata">

**Author:** ![marcodes](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@marcodes](https://forum.mautic.org/u/marcodes)\
**Post date:** [January 24, 2017, 9:03am UTC](https://forum.mautic.org/t/rest-api-payload-to-create-a-new-contact/7276/2 "2017-01-24T09:03:46Z")

</div>

Hello,  
I am new to mautic and I am trying to leverage the API to programmatically create contacts, but I can not find any documentation on the payload for POSTs. I don’t intent to use the php client, as I will be calling the API from a node code project. I am not interested in the forms option either, as the contacts need to be created server-side.

I have the API working with basic auth and I can successfully create an empty contact (I am receiving a 201 response, and everytime the contact id is increased), but I can not successfully pass the information I need (email, firstname, lastname, ipaddress, etc).  
What is the payload format that I should use? Should I send a json payload?

I think it would really help adding a curl example to the API documentation, so everyone using it from a different programming language has a reference.

Thank you in advance,  
Marco

---

<div class="post-metadata">

**Author:** ![patrykkalinowski](https://avatars.discourse-cdn.com/v4/letter/p/a6a055/32.png) [@patrykkalinowski](https://forum.mautic.org/u/patrykkalinowski)\
**Post date:** [January 24, 2017, 9:54pm UTC](https://forum.mautic.org/t/rest-api-payload-to-create-a-new-contact/7276/3 "2017-01-24T21:54:52Z")

</div>

Did you try JSON you mention?  
Raw payload:

`{
"firstname": "Test Name",
"email": "email@example.com"
}`

---

<div class="post-metadata">

**Author:** ![marcodes](https://avatars.discourse-cdn.com/v4/letter/m/94ad74/32.png) [@marcodes](https://forum.mautic.org/u/marcodes)\
**Post date:** [January 25, 2017, 10:05am UTC](https://forum.mautic.org/t/rest-api-payload-to-create-a-new-contact/7276/4 "2017-01-25T10:05:11Z")

</div>

Thank you Patrykkalinowski, I figured it out. The JSON format is straightforward, exactly as you put in the example. I had tried that, but I was missing the “Content-Type: application/json” header.

Without the header, I got a 201 and an empty contact was created, so I was focusing on the payload format, trying different options and I didn’t notice I was missing the header.

Works like a charm now! Thank you 🙂

---

<div class="post-metadata">

**Author:** ![ashishajmani](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.mautic.org/ashishajmani/32/608_2.png) [@ashishajmani](https://forum.mautic.org/u/ashishajmani)\
**Post date:** [April 27, 2021, 6:01am UTC](https://forum.mautic.org/t/rest-api-payload-to-create-a-new-contact/7276/5 "2021-04-27T06:01:31Z")

</div>

HI

I am new to mautic and API world…  
can you pl give me HTTP URL API which i can try firing out for my instance ?

Thanks  
Ashish
