APIs & Integrations

Member | Partner
Member | Partner

Properties with History - Get /crm/v3/objects/contacts/{contactId}

Hi all,


Has anyone had any trouble getting the following error:


hubspot.crm.contacts.exceptions.ApiTypeError: Got an unexpected keyword argument 'properties_with_history' to method get_by_id


I am using the following page: https://developers.hubspot.com/docs/api/crm/contacts


I test the inputs within the documentation and get the response I needed with the code below (Access token hidden for obvious reasons 😀) but when copying and running in Pycharm the get by ID method does not seem to accept the properties with the history parameter.



I instead get this error saying it does not expect it:



Any guidance would be great!


2 Replies 2

Properties with History - Get /crm/v3/objects/contacts/{contactId}

I hit similar problem, expect in the opposite direction (i.e. worked fine in Jupyter Notebook but fell over when I used in custom code block with a HubSpot workflow).

I think it's maybe something to do with the the way I'm creating the HubSpot client object, but I'm again finding the HS API documentation rather frustrating.

I solved this by falling back to using GET request with API key authorisation, then adding the parameter propertiesWithHistory=desired_property as suggested in this old post. Essentially:

client = hubspot.Client.create(access_token="YOUR_ACCESS_TOKEN")
api_response = client.crm.contacts.basic_api.get_by_id(contact_id="contactId", properties=["propertyName"], properties_with_history=["propertyName"], archived=False)


headers = {
    'accept': 'application/json',
    'content-type': 'application/json',
    "authorization": f"Bearer {YOUR_ACCESS_TOKEN}"

url = f'https://api.hubapi.com/crm/v3/objects/contacts/{contactId}?propertiesWithHistory=propertyName'
response = requests.request("GET", url, headers=headers)

Which will return json object rather than the weird hubspot public object thingy. I'm not sure how this would work if you were hoping for multiple properties with history.


I also had the idea of batch reading, because it too has a propertyWithHistory argument in the method, but it appears you can only search by contact email and not by Record ID.


Hopefully someone else has a better idea than this though! 

Community Manager
Community Manager

Properties with History - Get /crm/v3/objects/contacts/{contactId}

Hi, @dwhittington 👋 Hey, @JBeatty @taran42, do you have any experience here? Thank you! — Jaycee


Jaycee Lewis

Developer Community Manager

Community | HubSpot