Metadata examples
Metadata examples
See what kind of metadata you can combine with Voucherify resources:
- Customer:
loyalty_tier: gold,lifetime_value: 1200 - Order:
cart_value: 85,contains_subscription: true - Product:
category: skincare,margin_band: high - Campaign:
customer_group: A,objective: repurchase
Technical detailsIn the Voucherify API, metadata are handled as JSON key-value pairs.
How metadata works
You can attach metadata to the following Voucherify resources.Supported resources in metadata
Supported resources in metadata
Voucherify resources with metadata:
- Voucher
- Campaign
- Customer
- Product
- Redemption
- Publication
- Order
- Order line item
- Loyalty tier
- Promotion tier
- Earning rule
- Reward
Nested metadata example
Nested metadata example
You can create a metadata property called
Payment and add nested properties such as:payment_methodwith a string type,payment_channelwith a string type,payment_taxwith a number type,payment_deferredwith a flag type.
Payment nested metadata can be then added, for example, to the Product resource as an Object type metadata definition.Metadata types
You can define metadata using the following data types:- String: Supports properties – min./max./exact length, is equal to any of.
- Number: Supports properties – less/greater than (or equal), is equal to any of, is not equal to.
- Flag: Boolean values (true or false).
- Date and Date time: Complies with ISO 8601 (for example,
2020-03-11T09:00:00.000Z). - Image URL: Represents an image URL.
- Object: Uses nested metadata, which groups several custom attributes under one object.
- Geopoint (enterprise feature, on demand): Represents location. Stores coordinates as latitude, longitude, for example “37.786971, -122.399677”. Only available for customers and products.
Define new metadata schema
Metadata definition permissionsOnly users with the Admin role and the Add and modify Metadata schema can add, edit, and manage metadata schemas.
Define metadata details
In Property name (key), type the name of your metadata field.Use the dropdown next to is a(n) to mark the metadata as:Use the dropdown next to property containing to choose:
- optional
- required
Required metadata: Definitions and requestsIf a metadata field is required, you must provide it when creating a new resource of this object type.If required metadata is not attached to a given resource when sent in a payload, Voucherify will reject the request with a validation error.
- single (one value)
- multiple (an array of values)
Select the metadata type
Use the Type dropdown to select the value type:
- String
- Number
- Date
- Datetime
- Flag
- Image URL
- Object (nested metadata)
- Geopoint (enterprise feature)
The selected type controls which you can define. Some metadata types can’t be used in validation rules, for example geopoint.
Properties (optional)
You can add properties, like is equal to any of, for the metadata value. You can set properties for strings, numbers, and objects.The metadata value then must meet the defined properties.
Define nested metadata schema
Nested metadata are used as Object type attribute and they are used to group other metadata fields under one key. Go to Project settings > Metadata schema to Create nested schema.Name the nested metadata schema object
In the pop-up screen, name your nested metadata schema and Save it to open its detailed view.When saved, your nested metadata schema object is added to the Nested metadata list.
Define metadata for the nested metadata object
In the nested metadata schema details, Create new metadata schema. Create your new metadata like in Define new metadata schema.Add as many metadata schemas as needed.
Unknown metadata
You can find the Unknown metadata tab in the detailed view of every resource. Unknown metadata is custom data sent to Voucherify without a definition in the Metadata schema. Unknown metadata:- Are always treated as a string.
- Have limited filtering and validation compared to defined metadata. You have to type their key and value in the Unknown metadata filter.
- Are usually created through API requests, CDP imports, or manual entry of undefined properties.
Maintenance
Once you’ve added metadata definitions to schemas, you can manage them in the detailed view of a given resource. Go to Project settings > Metadata schema and select a given resource to open its detailed view.Metadata validation modes
Metadata can be validated by Voucherify as follows:- Allow any metadata (default): Accepts undefined fields, but Voucherify still validates defined fields against the schema. For example, metadata with a different type, allowed values, or with properties that don’t meet the defined schema will not be accepted and the request will be rejected.
- Allow only defined metadata: Rejects requests if they contain undefined metadata fields or metadata doesn’t meet its definition.
Manage metadata schemas
In the metadata schema, you can:- Edit: Change metadata definition. However, you can’t change its Type.
- Remove: Move the definition to the Removed definitions tab.
- Restore: Return a removed definition to the active schema under Definitions tab.
-
Purge: Permanently remove the definition from the Removed definitions list and from all existing resources (for example removes the “VIP” flag from all customers). This is an asynchronous process that may take time to complete.
Metadata purge is not available for:
- Earning rule
- Publication
- Redemption
- Reward
- Clear schema: Completely delete the schema and its Definitions, Unknown definitions, and Removed definitions. However, this action does not Purge the metadata from relevant resources. If you want to also remove metadata from associated resources, first Purge then Clear schema.
Irreversible actionsBoth Purge and Clear schema can’t be reversed. Make sure you really want to perform these actions!
Copy schema from another project
You can copy metadata schema definitions from another project into your current project. Go to Project settings > Metadata schema.
All defined metadata schema are added to the definition in the current project.
Use metadata in Voucherify
When you add metadata to your resources, like campaign or customer, you can either:- Use an existing metadata schema. This is a schema that’s defined in Project settings.
- Add unknown property: Metadata that isn’t defined and won’t be added to the schema. It will be listed as an Unknown definition with a string type.
- Add to schema: Define new metadata schema. Once saved, the metadata is added to the Definitions of a given resource.
- Undefined: The metadata is not added to the resource.
- Null: The metadata is added to the resource, but its value is empty (set to
null). - Value: Add value that meets the schema definition – its type and other properties.
Related features
Experiment with other features to improve your incentive optimization. You can use metadata with many different resources. Check some basic use scenarios below to get inspired.Metadata in customers
Metadata in customers
Metadata added to the Customer schema extends basic attributes assigned to each customer in Voucherify. In this way, Voucherify can reflect your CRM data structure. Each metadata attribute can later serve as a redemption limit or filter in segmenting your audience.
Metadata in products
Metadata in products
By using metadata, you can create product-specific promotion rules without uploading your product catalog to Voucherify. Metadata added to cart items is validated while redeeming the code to check if a customer qualifies for a promotion. You can also add your products to Voucherify and use metadata to extend product characteristics. Likewise, each product metadata can model redemption limits and promotion rules.
Metadata in validation rules
Metadata in validation rules
You can use metadata schemas to build fine-grained validation rules that determine your desired redemption circumstances. The validation rule builder can create limits on customer, product, order, and redemption metadata.
Some metadata types, like geopoint, can’t be used to create a validation rule.

