Custom Attributes
Store and query custom data on any API object
Every object has a predefined set of default attributes, which you can find in the object reference. Some objects also have non-default attributes which you can explicitly request to include in a response.
You also have the ability to add any custom attributes you want to any object.
Request Specific Attributes
Filter Attributes
If only certain attributes are needed, you can explicitly request which attributes you want returned.
Include Extra Attributes
If there's an additional attribute you want included in the response that is not a default
attribute, you can specify that attribute and all default fields using the default attributes
symbol, *.
Set Global Preferences
The software packages allow you to set global query string parameters by object resource using
the default_params class attribute. You can use this to set the fields attribute to apply
your preferences globally.
Set Custom Attributes
You can add any key/value custom attributes to any object by updating the attrs nested object.
Adding Custom Attributes
Complex Custom Attributes
You can store complex data structures in custom attributes:
Querying Custom Attributes
You can also query objects based on their custom attributes:
Query by Custom Attribute Values
Use Cases for Custom Attributes
Business Logic
- Store business-specific flags or status indicators
- Add custom workflow states
- Include integration-specific identifiers
Analytics and Tracking
- Store UTM parameters or campaign data
- Add custom tracking identifiers
- Include A/B test variants
Integration Data
- Store third-party service IDs
- Include external system references
- Add synchronization timestamps
Best Practices
Naming Conventions
- Use descriptive, consistent naming for custom attributes
- Consider using prefixes to organize attributes by purpose (e.g.,
crm_,analytics_,workflow_) - Avoid using reserved words or conflicting with existing attribute names
Data Structure
- Use nested objects to organize related custom attributes
- Keep the data structure as flat as possible for better queryability
- Consider the data types supported by your target systems
Performance Considerations
- Be mindful of the size of custom attribute data
- Index frequently queried custom attributes if supported
- Consider using separate objects for large amounts of custom data
Documentation
- Document your custom attribute schema for team members
- Include examples of expected data formats
- Maintain consistency across your application