How Can I Clear a HubSpot Company Property Using the API?

Hi,

I’m trying to update a company property in HubSpot and want to clear the current value (i.e., set it to blank). However, when I pass values like the following in API calling:
“custom_property”: “” OR “custom_property”: “null”
HubSpot ends up saving the property as an empty string, the string “null”, or just leaves it unchanged.

What is the correct way to clear (nullify) a HubSpot company property using the API?

I want the property to be completely cleared—not contain an empty string or the word “null”.

Any help or examples would be greatly appreciated!
For example: removing the property_string in the below snapshot and keep the value as blank. Lets assume it has a value ABC, i wanted to clear that value.

Thanks

Raja Kosuri

Hi @RKOSURI
Setting the value to an empty string is indeed the correct way to clear a property via the API. That’s also how HubSpot handles it internally.

You can verify this behavior using the API. When you retrieve a field that has never been populated, the API returns null. If you then assign a value to that property in the UI, save it, and later clear it in the UI again, the API will return an empty string (“”) instead of null.

If this helps, feel free to mark it as the solution and give it an upvote :slightly_smiling_face:

Thanks for your response. You’re right about the changes in the UI, but I’m not using the UI — I’m working with the HubSpot API to clear the values.

I just re-tested the use case, and here are the results:

  • When I set the description field to “test” using the API, it worked as expected. The HTTP response returned: “description”: “test”.
  • When I tried to clear the value by setting it to an empty string “”, the response returned: “description”: “\”\“”.
  • If I used two single quotes ‘’, the result was: “description”: “‘’”.
  • If I passed null as the value, the response returned: “description”: “null”.
  • If I omitted the field entirely, I received the error: No properties found to update, please provide at least one.

I’m now unclear on what value should be sent to truly clear the description field — either setting it to null or an actual empty string. No matter what I send, it appears to be wrapped in a string.

Could you please clarify the correct approach to clear or nullify this field via the API?

Hi @RKOSURI,
Thanks for clarifying. That’s indeed unusual and shouldn’t be happening. The correct approach is to set it to an empty string, as shown in the screenshot below.

Could you share some screenshots or actual code of your setup? That might help us identify what’s causing the issue.
Kind regards
Dennis

All sorted now. It turns out the issue was related to using the web-based Postman interface, as shown below. When I tested the same request using the desktop Postman app, the value appeared as expected.

It might be worth flagging this to the technical team, as it could be confusing for developers using the HubSpot-provided web-based REST API tool.

Thanks for your time!

Hi @RKOSURI,
Thank you for posting to the Community!
I’d like to tag in some of our Top Contributors to take a look here -- @Mike_Eastwood @ChrisoKlepke and @HubSpot_Corey Do any of you all have any ideas on this?
Thank you!
Cassie, Community Manager