# 500 error when trying to create a contact

**URL:** <https://community.hubspot.com/t/500-error-when-trying-to-create-a-contact/21287>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [May 31, 2020, 9:16pm UTC](https://community.hubspot.com/t/500-error-when-trying-to-create-a-contact/21287 "2020-05-31T21:16:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![product\_fer](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/product_fer/32/82448_2.png) [@product\_fer](https://community.hubspot.com/u/product_fer)\
**Post date:** [May 31, 2020, 9:16pm UTC](https://community.hubspot.com/t/500-error-when-trying-to-create-a-contact/21287/1 "2020-05-31T21:16:22Z")

</div>

Here’s the response I received. Would appreciate your help

{“status”:“error”,“message”:“internal error”,“correlationId”:“8a69d9e2-de63-4b5e-bc16-94eb9d933c4b”}

I tried these two endpoints and received the same error:

From [https://developers.hubspot.com/docs/methods/contacts/create\_contact](https://developers.hubspot.com/docs/methods/contacts/create_contact)

‘[https://api.hubapi.com/contacts/v1/contact?hapikey=](https://api.hubapi.com/contacts/v1/contact?hapikey=)’

From [https://developers.hubspot.com/docs/methods/contacts/create\_or\_update](https://developers.hubspot.com/docs/methods/contacts/create_or_update)

‘[https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/](https://api.hubapi.com/contacts/v1/contact/createOrUpdate/email/){email address}/?hapikey=’

---

<div class="post-metadata">

**Author:** ![product\_fer](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/product_fer/32/82448_2.png) [@product\_fer](https://community.hubspot.com/u/product_fer)\
**Post date:** [June 1, 2020, 4:58pm UTC](https://community.hubspot.com/t/500-error-when-trying-to-create-a-contact/21287/2 "2020-06-01T16:58:57Z")

</div>

I was able to fix this issue by passing in the Content-Type string in the headers array in this way:

$res = $client-\>request(‘POST’, $endpoint, [

‘body’ =\> $post\_json,

‘headers’ =\> [

‘Content-Type’ =\> ‘application/json’

]

]);
