How to create a new contact in hubspot via RESTAPI



Hi I am new to hub spot, I wish to create a new contact through rest api.
My piece of code is:

<cfhttp url="" method="post" result="httpResp" timeout="60">
<cfhttpparam type="header" name="Content-Type" value="application/json" />
<cfhttpparam type="body" value="#serializeJSON(stFields)#">
<cfdump var="#httpResp#" label="HTTP response">

If I dump the value it shows “Json node is missing child properties” what might be the error.How to fix it.
Thanks in advance.
see this link for cfdump output:


I received this error.400 Bad Request how to rectify this.


@boopathi_s I would try removing the outside {} it looks like you almost have duplicate open braces and closing braces. try to follow this from the dev documentation. (

        "properties": [
                "property": "email",
                "value": ""
                "property": "firstname",
                "value": "Adrian"

Let me know if that helps at all.


@pmanca If i removed the open and closed braces in cfset and commented serialise json .then It shows the invalid json input error below screen shot.


how to rectify this.Any suggestion would help me.


@boopathi_s I am unfamiliar with CFML but I found some documentation here.

Do you need to wrap the JSON in ‘’ before you serialize it?
Hopefully you can follow the documentation above for creating a CFML struct and then serializing it to JSON. If this doesn’t help please let me know so I can continue to look into it.


@pmanca Your data is already serialized. so don’t need to serialize it.that’s why i remove the line.Give some alternative approach if you have any.thanks for reply bro


@pmanca I fixed the issue bro…thanks for reply bro…


@boopathi_s That’s Great! Do you mind letting me know what it was? My own curiosity is killing me now.


remove the serializejson and put stfields only in cfhttpparam.Keep help me bro…i have lot of tasks to do from now onwards.:smirk:

<cfhttpparam type="body" value="#stFields#">