Breaking Change: Enhanced Validations for Non-String Properties in HubSpot's CRMObject APIs
Starting January 6, 2025, HubSpot will implement enhanced validations for non-string property values, including enumeration and multi-value enumeration property values submitted via the CRMObject APIs. This change aims to improve data integrity and user experience by prohibiting leading or trailing whitespace characters, including invisible unicode characters, from these property values. Additionally, existing non-string property values and enumeration options will be backfilled to remove any whitespace or invisible characters from the beginning or end of all property values.
What's changing?
Stricter Validation for Non-String Properties
- Current Behavior: Enumeration values and other non-string properties that include leading or trailing whitespace characters, including invisible unicode characters (e.g., no-break spaces), are accepted and may lead to data inconsistencies or reporting issues.
- New Behavior: Non-string property values, including enumeration options and multi-value enumeration properties, must not contain leading or trailing whitespace or invisible unicode characters. Values with these characters will result in a
400 Bad Request
error with aVALIDATION_ERROR
category, providing details on the validation issues encountered.
Error Message Example:
Backfilling of Existing Non-String Properties
- All existing non-string property values and enumeration options will be backfilled to remove any whitespace or invisible characters from the beginning or end of all property values.
What does this mean for developers?
Ensure all data submissions via the CRMObject APIs for non-string properties, including enumeration options and multi-value enumeration properties, strictly adhere to the new validation rule. Developers should review and update any integrations, scripts, or automated processes that submit non-string property values to HubSpot to ensure compliance with the new validation rules.
Lastly, error-handling routines should be implemented or updated to manage responses from the CRMObject APIs that indicate invalid non-string property values due to the enhanced validations.
For example:
- Before the Change for Enumeration Options: If the valid enumeration options are ["one", "two", "three"], submitting a value like " two" (with leading space) or "two " (with trailing space) would be accepted.
- After the Change for Enumeration Options: Submitting " two" or "two " as an enumeration value will result in an
400 Bad Request
error with aVALIDATION_ERROR
response because it contains leading or trailing whitespace or invisible characters. - Before the Change for Non-String Property Values: Submitting a property value like ‘“ 7”’ (a string with a leading space before the digit) would have been accepted.
- After the Change for Non-String Property Values: Submitting a value like ‘“ 7”’ or ‘“7 “‘ for a number property will not trigger a
400 Bad Request
error, with the response indicating aVALIDATION_ERROR
.
If you have questions or comments, join us in the developer forums.