Mixins
Mixins let you extend business resources with custom properties by defining JSON schemas, hosting them, and referencing them in resource metadata for flexible, schema-driven data enrichment.
Mixins are custom properties that you can use to describe your business resources in more details. Mixins can be applied to most objects in the Emporix API. Learn more about mixin schemas in Schema Service.
APIs that support mixins
The following APIs and services support mixins in their data models:
Core entities (with Schema Service support)
These entities support mixin schema creation through the Schema Service API:
Cart - Cart Service
Category - Category Tree Service
Company - Client Management Service
Coupon - Coupon Service
Custom Entities and Custom Instances
Customer - Customer Service / Customer Management Service
Media - Media Service
Customer Address - Customer Service
Location - Vendor Service
Order - Order Service
Availability - Availability Service
Price List - Price Service
Product - Product Service
Quote - Quote Service
Return - Returns Service
Site - Site Settings Service
Vendor - Vendor Service
Additional mixin support
These services accept mixins in their API requests and responses, but require manually created JSON schemas (not supported through Schema Service schema creation):
Customer, Item, and Group Assignments - Customer Segments Service
Customer Segments - Customer Segments Service
Groups - IAM Service (supports
mixinsfield directly, withoutmetadata.mixins)Locations and Contact Assignment - Client Management Service
Prices - Price Service
Returns - Returns Service
Shopping List - Shopping List Service
Schemas
To apply a mixin to a resource, you need to define the mixin schema in the form of a JSON Schema object. Mixin schemas need to be uploaded to a hosting service and then referenced in a resource's mixin metadata.
Here's an example of a JSON schema that defines custom delivery options for customers:
Usage example
Here's an example of custom delivery options applied inside a Customer object with the schema referenced in mixin metadata:
How to add mixins to an object
Define your mixin schema.
Upload your schema to a hosting service and save its URL.
Update an object with mixins and the mixin schema.
Site-aware mixins
Site-aware mixins are supported for products and custom instances only. They let those resources store per-site overlay values on top of a shared base mixin. The product stays the same across sites, and site-aware mixins let you add attribute values per site. For how site codes fit the wider platform model, see Multi-Site Architecture.
Mark the mixin schema with siteAware: true in Schema Service. On the product or custom instance, use the same mixin key you would use without site awareness ({mixinName} under mixins and metadata.mixins), then store overlays under {mixinName}__{siteCode}, where {siteCode} matches a site code in your tenant. Declare only the base mixin name in metadata.mixins. Overlay values are validated against the same JSON Schema URL as the base mixin.
When you send the emporix-site header on a read request, Product Service or Schema Service deep-merges the overlay whose {siteCode} matches that header into the base mixin and returns only the merged base keys. Nested objects are merged recursively. Non-null, non-object values in the overlay replace the base value. A null overlay node does not clear the base value. If there is no overlay for that site, the base mixin is returned. Without the header, base and overlay keys are returned as stored. If mixin fields are localized, Accept-Language is applied to the merged result when emporix-site is present.
For step-by-step procedures, see:
Custom instances use the same overlay key pattern and emporix-site read behavior on the Schema Service custom instance endpoints.
Localized mixin attributes
Mixin schemas can mark TEXT attributes as localized. With the tenant configuration languageSchemaVersion set to v2, you can also localize OBJECT attributes and array items of localized TEXT or OBJECT. Under v2, those fields store language-keyed maps. Under v1, localized mixin TEXT values can still use [{language,value}] arrays. On product and custom-instance reads, Accept-Language filters v2 maps to a single preferred language key and leaves v1 arrays unchanged.
For the workflow, localization rules, and migration notes, see How to use localized OBJECT mixin attributes. For first-class localized fields such as product name, see Translations.
Updating and removing mixins
How you update or remove mixins depends on the API.
Product Service
The Partially updating a product endpoint keeps mixin names that you omit from the request. It merges sent mixin fields recursively. A null value does not remove a mixin.
To remove a mixin, retrieve the product and send a full replacement to the Upserting a product endpoint with partial=false. Omit the mixin from mixins and metadata.mixins. For the full procedure, see How to update product mixins.
Quote Service and Schema Service
The Partially updating a quote and Patching a custom instance endpoints use add, replace, and remove operations on mixin paths. You can send the operation names in lowercase or uppercase. Both endpoints can remove a mixin without replacing the entire resource.
Last updated
Was this helpful?

