Metadata
Updateable Smartbills objects—including Receipts, Customers, Products, and Merchants—have ametadata parameter. You can use this parameter to attach key-value data to these Smartbills objects.
Overview
Metadata allows you to store additional, structured information on an object. This is useful for:- Linking Smartbills objects to your internal systems
- Storing custom business logic data
- Adding context that’s specific to your application
- Tracking additional information not covered by standard fields
Smartbills doesn’t use metadata for any internal purposes—for example, we don’t use it to authorize or decline operations, and it won’t be seen by your users unless you choose to show it to them.
Limitations
- Maximum keys: 50 keys per object
- Key name length: Up to 40 characters
- Value length: Up to 500 characters
- Format: Key-value pairs (both must be strings)
Supported Objects
Metadata can be attached to the following object types:- Receipts
- Customers
- Products
- Merchants
- Locations
- Employees
- Expenses
- Expense Reports
Adding Metadata
You can add metadata when creating or updating an object:Updating Metadata
You can update metadata on existing objects:When updating metadata, the entire metadata object is replaced. Include all keys you want to keep, not just the ones you’re changing.
Retrieving Metadata
Metadata is included in the object response:Deleting Metadata
To remove specific metadata keys, set them tonull:
Sample Use Cases
Link Internal IDs
Link Internal IDs
Attach your system’s unique IDs to Smartbills objects to simplify lookups.
Track Business Context
Track Business Context
Store business-specific information for reporting and analytics.
Customer Segmentation
Customer Segmentation
Annotate customers with segmentation data.
Workflow Tracking
Workflow Tracking
Track approval workflows and processing status.
Campaign Tracking
Campaign Tracking
Associate receipts or transactions with marketing campaigns.
Filtering by Metadata
You can filter list requests by metadata values:Best Practices
Use Consistent Naming
Use Consistent Naming
Use a consistent naming convention for metadata keys across your application.
Document Your Metadata Schema
Document Your Metadata Schema
Maintain documentation of which metadata keys you use and their purposes.
Validate Metadata Values
Validate Metadata Values
Validate metadata values in your application before sending to the API.
Don't Store Sensitive Data
Don't Store Sensitive Data
Never store sensitive information in metadata:
- Passwords or API keys
- Credit card numbers
- Social security numbers
- Personal health information
- Any PII that requires encryption
Use Metadata for Filtering
Use Metadata for Filtering
Design your metadata schema to support efficient filtering and querying.
Error Handling
Common metadata-related errors:Example: Complete Integration
Here’s a complete example showing how to use metadata in a real-world scenario:Related Resources
API Reference
Complete API documentation
Best Practices
Learn API best practices