Using the node-klaviyo library making a call to the “identify” endpoint, if a custom property already exists on a profile with a value and I want to remove that property, or set it to blank/null if I have to, how do I do that? I’ve tried passing in null or empty string and the existing value remains unchanged.
The use case here is a subscription club level, so someone signs up for “Gold Level” and we set a custom property for Club: “Gold Level”, but then they cancel the club, so now we want to set the club to blank/null or remove the property so they’re not in segments checking for club level.
The only thing I’ve found that kinda works is setting it equal to an empty array. I feel like that’s going to cause me some grief down the road, so I’m hoping there’s a better way. Help?
Best answer by julie.accardo
You should be able to use the unset command to remove a custom property from a users profile. Below is the example PUT request formatting that I just used in POSTMAN to successfully remove a profile property.
curl -X PUT 'https://a.klaviyo.com/api/v1/person/enteruserIDhere?api_key=XXXX&$unset=[%22enterprofilepropertyhere%22]'
So in your case, your request would look something like this:
curl -X PUT 'https://a.klaviyo.com/api/v1/person/enteruserIDhere?api_key=XXXX&$unset=[%22Gold Level%22]'
I hope this helps!