APIs & Integrations

ychakka
Participant

How to update Lead Status field from API (oAuth 2.0)?

SOLVE

This is how my body looks like:

{
  "properties": [
    {
      "property""hs_lead_status",
      "value""unqualified"
    }
  ]
}
 
And this is the error msg:
{
    "validationResults": [
        {
            "isValid"false,
            "message""unqualified 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"
        }
    ],
    "status""error",
    "message""Property values were not valid",
}
 
I tried with lead statuses of new/open but everything failed. 
Any help is appreciated!
0 Upvotes
1 Accepted solution
Mike_Eastwood
Solution
Key Advisor | Gold Partner
Key Advisor | Gold Partner

How to update Lead Status field from API (oAuth 2.0)?

SOLVE

Hi @ychakka 

 

Try using "UNQUALIFIED" instead of "unqualified" as your value.

 

The values are Case Sensitive.

 

Have fun

Mike

 

View solution in original post

3 Replies 3
NTohill
Member

How to update Lead Status field from API (oAuth 2.0)?

SOLVE

Is it possible to update the lead status using the hubspot python client? We are currently creating contacts as follows through our python api

    contact_properties = {
        "email": user.email,
        "lifecyclestage": "customer",
        "company": organisation.name,
        "firstname": user.first_name,
        "lastname": user.last_name,
    }
    new_contact = SimplePublicObjectInput(properties=contact_properties)
    add_contact_response = api_client.crm.contacts.basic_api.create(simple_public_object_input=new_contact)

However when we try to add leadstatus in here with this param:

    contact_properties = {
        "email": user.email,
        "lifecyclestage": "customer",
        "company": organisation.name,
        "firstname": user.first_name,
        "lastname": user.last_name,
        "leadstatus":"Trial User"
    }

or 

    contact_properties = {
        "email": user.email,
        "lifecyclestage": "customer",
        "company": organisation.name,
        "firstname": user.first_name,
        "lastname": user.last_name,
        "lead status":"Trial User"
    }

we get the following error (same with "lead status"):

HTTP response body: {"status":"error","message":"Property values were not valid: [{\"isValid\":false,\"message\":\"Property \\\"leadstatus\\\" does not exist\",\"error\":\"PROPERTY_DOESNT_EXIST\",\"....

When reading through the docs it outlines specifically how to add lifecycle stage with the api but not lead status.

https://developers.hubspot.com/docs/api/crm/contacts
 

0 Upvotes
ychakka
Participant

How to update Lead Status field from API (oAuth 2.0)?

SOLVE

I am using oAuth authentication with JSON object. This is the code we have used:

{
"properties": [
{
"property": "hs_lead_status",
"value": "UNQUALIFIED"
}
]
}

0 Upvotes
Mike_Eastwood
Solution
Key Advisor | Gold Partner
Key Advisor | Gold Partner

How to update Lead Status field from API (oAuth 2.0)?

SOLVE

Hi @ychakka 

 

Try using "UNQUALIFIED" instead of "unqualified" as your value.

 

The values are Case Sensitive.

 

Have fun

Mike