Skip to main content

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?

Hi @Digimatic,

 

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=t%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=n%22Gold Level%22]' 

 

I hope this helps!

Julie


Thank you @julie.accardo for the response, but I don’t have a userId/profileId available.  I used the Identity endpoint to add and update profiles, which only ever returns a 1 or 0, so I don’t know what their IDs are.  Is there no way to do this with the Identity endpoint?  Or is there a way to retrieve an ID from an email address or something?

 

Thanks!


Hello @Digimatic,

I would recommend taking a look at a Community post answered by @jallain below on how to retrieve a profile’s ID from an email address:

You should be able to use the URL of https://a.klaviyo.com/api/v2/people/search?api_key=API_KEY_HERE&email=EMAIL_HERE to retrieve the contact’s Klaviyo profile ID.

Hope this helps!

David


Thanks @david.to , I think that will work.  Bummer that I have to make an extra call now for every profile update.  It would be great if I could just set the property to NULL or empty string in the identity endpoint and have it unset the property.  If this is the only way, I’ll go this route for now.

 

Thank you!


Reply