Create a note on Contacts with engagement API


Hi guys,

I am trying to create a note on contacts by using engagement API, I am using Python
Here is my code:

    url = ""
    payload = {}
    # engagement
    payload["engagement"] = {}
    payload["engagement"]["active"] = True
    payload["engagement"]["ownerId"] = 9999561
    payload["engagement"]["type"] = "NOTE"
    payload["engagement"]["timestamp"] = 1457973595049
    # associations
    payload["associations"] = {}
    payload["associations"]["contactIds"] = [contact_id]
    payload["associations"]["companyIds"] = []
    payload["associations"]["dealIds"] = []
    payload["associations"]["ownerIds"] = []
    # netadata
    payload["metadata"] = {}
    payload["metadata"]["body"] = "Testing Note"
    response =, data = payload)

somehow it gives my response 415 error:
415 Client Error: Unsupported Media Type for url:


Hi @Eddie_Z,

I believe all you need to do is set the header to be Content-Type: Application JSON. So you should add

#set headers
headers = {}

Then your last line should look like this:

response =,data=payload,headers=headers

Let me know if that doesn’t work.



Hi @zwolfson ,

Thanks for your reply, after adding headers, I am getting response 400 error:
400 Client Error: Bad Request for url:

and the error is:
{“status”:“error”,“message”:“Invalid input JSON on line 1, column 14: Unrecognized token ‘associations’: was expecting (‘true’, ‘false’ or ‘null’)”,“correlationId”:“5ed0a8f4-4318-4854-a15d-855db56d6d4d”,“requestId”:“ec25612d-2a56-41a0-b5a2-0b5c8f1a4299”}


I got it solved, I should pass a string to data instead of json.
Thank you so much for helping me out.