# Create Contact API V1: Receiving Corrupted Error Message

**URL:** <https://community.hubspot.com/t/create-contact-api-v1-receiving-corrupted-error-message/21475>\
**Category:** APIs & Integrations\
**Tags:** contacts\
**Created:** [June 6, 2020, 7:16am UTC](https://community.hubspot.com/t/create-contact-api-v1-receiving-corrupted-error-message/21475 "2020-06-06T07:16:46Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adithya868495](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/adithya868495/32/74736_2.png) [@Adithya868495](https://community.hubspot.com/u/Adithya868495)\
**Post date:** [June 6, 2020, 7:16am UTC](https://community.hubspot.com/t/create-contact-api-v1-receiving-corrupted-error-message/21475/1 "2020-06-06T07:16:46Z")

</div>

Hi,  
I have been receiving corrupted error message when I try to create a contact using this endpoint → POST - contacts/v1/contact. I am working on handling error scenario in our integration, so I know the cause of the error. but the error response message that I received seems to be corrupted. I am unable to read thorugh the error message due to this issue.  
Example

```auto
{ 
    properties: {
      firstname: 'Trial_01',   
      hs_lead_status: '99656+6666',
      email: 'this@example.com',
      range: '50',
      number_input: '555',
      drop_down: 'Option 3',
      phone: '9888',
}

```

So this is an example error case scenario where i know the hs\_lead\_status cannot be set to ‘99656+6666’ because it has fixed set of values.  
Error Message Response I got -

`Property values were not valid: [{"isValid":false,"message":"99656+6666 was not one of the allowed options: [label: \"New\"\nvalue: \"NEW\"\ndisplay_order: 0\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"Open\"\nvalue: \"OPEN\"\ndisplay_order: 1\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"In Progress\"\nvalue: \"IN_PROGRESS\"\ndisplay_order: 2\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"Open Deal\"\nvalue: \"OPEN_DEAL\"\ndisplay_order: 2\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"Unqualified\"\nvalue: \"UNQUALIFIED\"\ndisplay_order: 3\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"Attempted to Contact\"\nvalue: \"ATTEMPTED_TO_CONTACT\"\ndisplay_order: 4\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"Connected\"\nvalue: \"CONNECTED\"\ndisplay_order: 5\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"Bad Timing\"\nvalue: \"BAD_TIMING\"\ndisplay_order: 6\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n]","error":"INVALID_OPTION","name":"hs_lead_status"}]`

Since its is corrupted, I am unable to get data out of it. Any help would be great.  
Thanks

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [June 8, 2020, 3:53am UTC](https://community.hubspot.com/t/create-contact-api-v1-receiving-corrupted-error-message/21475/2 "2020-06-08T03:53:54Z")

</div>

Hey @Adithya868495,

Do you mind clarifying what do you mean by the error mesage is corrupted?

I believe what the error message is trying to indicate is that the creation of contact failed because the value set for property

`hs_lead_status`

wasn’t one of the allowed options:

1. NEW

2. OPEN

3. IN\_PROGRESS

4. OPEN\_DEAL

5. UNQUALIFIED

6. ATTEMPTED\_TO\_CONTACT

7. CONNECTED

8. BAD\_TIMING

---

<div class="post-metadata">

**Author:** ![Adithya868495](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/adithya868495/32/74736_2.png) [@Adithya868495](https://community.hubspot.com/u/Adithya868495)\
**Post date:** [June 8, 2020, 10:10am UTC](https://community.hubspot.com/t/create-contact-api-v1-receiving-corrupted-error-message/21475/3 "2020-06-08T10:10:04Z")

</div>

Hey @WendyGoh,  
Hope you are doing great.  
Corrupted in the sense. I am unable to parse the error message I received.

`Property values were not valid: [{"isValid":false,"message":"S was not one of the allowed options: [label: \"New\"\nvalue: \"NEW\"\ndisplay_order: 0\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"Open\"\nvalue: \"OPEN\"\ndisplay_order: 1\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"In Progress\"\nvalue: \"IN_PROGRESS\"\ndisplay_order: 2\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"Open Deal\"\nvalue: \"OPEN_DEAL\"\ndisplay_order: 2\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"Unqualified\"\nvalue: \"UNQUALIFIED\"\ndisplay_order: 3\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"Attempted to Contact\"\nvalue: \"ATTEMPTED_TO_CONTACT\"\ndisplay_order: 4\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"Connected\"\nvalue: \"CONNECTED\"\ndisplay_order: 5\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n, label: \"Bad Timing\"\nvalue: \"BAD_TIMING\"\ndisplay_order: 6\ndouble_data: 0.0\nhidden: false\ndescription: \"\"\nread_only: false\n]","error":"INVALID_OPTION","name":"hs_lead_status"}]`

This is the string data which is avaliable in message property. I am unable to convert this String to JSON due to backslashes and newline (ie \ and \n). I tried using regex. but I am unable to change this to JSON. Any help regarding this issue would be great.

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [June 9, 2020, 1:33am UTC](https://community.hubspot.com/t/create-contact-api-v1-receiving-corrupted-error-message/21475/4 "2020-06-09T01:33:36Z")

</div>

Hey @Adithya868495,

Thanks for clarifying.

In this case, you may have to unescape the string first. E.g. of an online tool I used: [Free Online JavaScript (JS) Escape / Unescape Tool - FreeFormatter.com](https://www.freeformatter.com/javascript-escape.html#ad-output) in which after unescaping, it’ll be like this:

```auto
Property values were not valid: [{"isValid":false,"message":"99656+6666 was not one of the allowed options: [label: "New"
value: "NEW"
display_order: 0
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "Open"
value: "OPEN"
display_order: 1
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "In Progress"
value: "IN_PROGRESS"
display_order: 2
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "Open Deal"
value: "OPEN_DEAL"
display_order: 2
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "Unqualified"
value: "UNQUALIFIED"
display_order: 3
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "Attempted to Contact"
value: "ATTEMPTED_TO_CONTACT"
display_order: 4
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "Connected"
value: "CONNECTED"
display_order: 5
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "Bad Timing"
value: "BAD_TIMING"
display_order: 6
double_data: 0.0
hidden: false
description: ""
read_only: false
]","error":"INVALID_OPTION","name":"hs_lead_status"}]

```

without the backlash.

---

<div class="post-metadata">

**Author:** ![Adithya868495](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/adithya868495/32/74736_2.png) [@Adithya868495](https://community.hubspot.com/u/Adithya868495)\
**Post date:** [June 9, 2020, 4:15am UTC](https://community.hubspot.com/t/create-contact-api-v1-receiving-corrupted-error-message/21475/5 "2020-06-09T04:15:03Z")

</div>

Hey @WendyGoh  
I understood that I had to escape the String. But my problem is the message property. Please check the message property inside the **Property values were not valid** Array. You can find that the message property itself is a String which cannot be converted to JSON.  
I tried regex and string manipulation to convert it to JSON only to understand that they cannot be converted to JSON.

```auto
Property values were not valid: [{"isValid":false,"message":"99656+6666 was not one of the allowed options: [label: "New"
value: "NEW"
display_order: 0
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "Open"
value: "OPEN"
display_order: 1
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "In Progress"
value: "IN_PROGRESS"
display_order: 2
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "Open Deal"
value: "OPEN_DEAL"
display_order: 2
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "Unqualified"
value: "UNQUALIFIED"
display_order: 3
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "Attempted to Contact"
value: "ATTEMPTED_TO_CONTACT"
display_order: 4
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "Connected"
value: "CONNECTED"
display_order: 5
double_data: 0.0
hidden: false
description: ""
read_only: false
, label: "Bad Timing"
value: "BAD_TIMING"
display_order: 6
double_data: 0.0
hidden: false
description: ""
read_only: false
]","error":"INVALID_OPTION","name":"hs_lead_status"}]

```

You can try validating the json in this [https://jsonformatter.curiousconcept.com/](https://jsonformatter.curiousconcept.com/)  
site or any other json validation tool which is available online. It will so a lot of errors. Just paste the above result and check. The thing is it will be easier programmatically if we just receive the data as an json object intead of a string, or it should have easier to parse the message property to json. Here both is not possible. I hope you can understand what i am trying to convey here.

---

<div class="post-metadata">

**Author:** ![WendyGoh](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/wendygoh/32/42320_2.png) [@WendyGoh](https://community.hubspot.com/u/WendyGoh)\
**Post date:** [June 10, 2020, 2:49am UTC](https://community.hubspot.com/t/create-contact-api-v1-receiving-corrupted-error-message/21475/6 "2020-06-10T02:49:54Z")

</div>

Hey @Adithya868495,

Thanks for elaborating your use case further.

In this case, while it is currently not possible to easily parse the error message as JSON format, I do have a workaround that I’d love to share with you:

You may want to use the [Get a contact property endpoint](https://developers.hubspot.com/docs/methods/contacts/get_contact_property) to retrieve the property details. i.e. GET properties/v1/contacts/properties/named/hs\_lead\_status

The return response will show the property options in an array json:

```auto
options:[
{
label:"New",
hidden:false,
description:null,
doubleData:null,
readOnly:null,
displayOrder:0,
value:"NEW"},
{
label:"Open",
hidden:false,
description:null,
doubleData:null,
readOnly:null,
displayOrder:1,
value:"OPEN"},
{
label:"In Progress",
hidden:false,
description:null,
doubleData:null,
readOnly:null,
displayOrder:2,
value:"IN_PROGRESS"},
{
label:"Open Deal",
hidden:false,
description:null,
doubleData:null,
readOnly:null,
displayOrder:2,
value:"OPEN_DEAL"},
{
label:"Unqualified",
hidden:false,
description:null,
doubleData:null,
readOnly:null,
displayOrder:3,
value:"UNQUALIFIED"},
{
label:"Attempted to Contact",
hidden:false,
description:null,
doubleData:null,
readOnly:null,
displayOrder:4,
value:"ATTEMPTED_TO_CONTACT"},
{
label:"Connected",
hidden:false,
description:null,
doubleData:null,
readOnly:null,
displayOrder:5,
value:"CONNECTED"},
{
label:"Bad Timing",
hidden:false,
description:null,
doubleData:null,
readOnly:null,
displayOrder:6,
value:"BAD_TIMING"}],

```

---

<div class="post-metadata">

**Author:** ![Adithya868495](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/adithya868495/32/74736_2.png) [@Adithya868495](https://community.hubspot.com/u/Adithya868495)\
**Post date:** [June 10, 2020, 3:46am UTC](https://community.hubspot.com/t/create-contact-api-v1-receiving-corrupted-error-message/21475/7 "2020-06-10T03:46:42Z")

</div>

@WendyGoh . Thanks . Seems to solve my issue.
