LogoLogo
CommunitySupport PortalYouTubeStart a free trial
  • Welcome
  • Commerce Engine
  • Orchestration Engine
  • API Documentation
  • Release Notes
  • Changelog
  • Emporix API
    • List of API Services
  • OpenAPI Generator
  • Standard Practices
    • General Info
    • Mixins
    • Query Parameter
    • Translations
    • Custom ID
    • Upsert
    • B2B Token
  • API Guides and References
    • Authorization
      • OAuth Service
        • API Reference
          • Customer Token
          • Anonymous Token
          • Service Access Token
          • Models
        • View Raw API Specification
    • Artificial Intelligence
      • AI Service
        • AI Tutorials
        • API Reference
          • Text Generation
          • AI Completions
          • Models
        • View Raw API Specification
    • Configuration
      • Configuration Service
        • Language Tutorials
        • API Reference
          • Tenant configurations
          • Client configurations
          • Global configurations
          • Models
        • View Raw API Specification
      • Country Service
        • Country Tutorial
        • API Reference
          • Countries
          • Regions
          • Models
        • View Raw API Specification
      • Currency Service
        • Currency Tutorial
        • API Reference
          • Currencies
          • Currency exchange
          • Models
        • View Raw API Specification
      • Unit Handling Service
        • Unit Handling Tutorial
        • API Reference
          • Unit management
          • Type management
          • Unit conversion
          • Models
        • View Raw API Specification
      • Site Settings Service
        • Site Settings Tutorial
        • API Reference
          • Mixins
          • Site settings
          • Models
        • View Raw API Specification
      • Indexing Service
        • Indexing Tutorial
        • API Reference
          • Configuration
          • Public Configuration
          • Reindex
          • Models
        • View Raw API Specification
    • Catalogs and Categories
      • Catalog Service
        • Catalog Tutorials
        • API Reference
          • List catalogs
          • Catalog management
          • Models
        • View Raw API Specification
      • Category Service
        • Category Tutorials
        • API Reference
          • Category Resources
          • Category Assignment Resources
          • Assignment Resources
          • Category Tree Resources
          • Models
        • View Raw API Specification
    • Products, Labels and Brands
      • Product Service
        • Product Tutorial
        • API Reference
          • Products
          • Product Templates
          • Models
        • View Raw API Specification
      • Label Service
        • Label Tutorial
        • API Reference
          • Label
          • Media
          • Models
        • View Raw API Specification
      • Brand Service
        • Brand Tutorial
        • API Reference
          • Brands
          • Media
          • Models
        • View Raw API Specification
    • Prices and Taxes
      • Price Service
        • Price Tutorials
        • API Reference
          • Price lists
          • Price matching
          • Price models
          • Prices
          • Prices assigned to price lists
          • Models
        • View Raw API Specification
      • Tax Service
        • Tax Tutorials
        • API Reference
          • Taxes
          • Tax calculation
          • Models
        • View Raw API Specification
    • Users and Permissions
      • IAM Service
        • IAM Tutorial
        • API Reference
          • Access Controls
          • Group Assignments
          • Groups
          • Permissions
          • Resources
          • Roles
          • Access Control Templates
          • Users
          • Management Dashboard Users
          • Models
        • View Raw API Specification
      • Session-context Service
        • Session-context Tutorial
        • API Reference
          • Session management
          • Session context modification
          • Own session management
          • Own session context modification
          • Models
        • View Raw API Specification
    • Companies and Customers
      • Customer Management
        • Customer Management Tutorial
        • API Reference
          • Locations
          • Contact Assignments
          • Legal Entities
          • Models
        • View Raw API Specification
      • Customer Service (Customer Managed)
        • API Reference
          • Addresses
          • Authentication and authorization
          • Account and profile
          • Double opt In
          • Credentials
          • Models
        • View Raw API Specification
      • Customer Service (Tenant Managed)
        • API Reference
          • Account and profile
          • Addresses
          • Models
        • View Raw API Specification
      • Customer Segments
        • Segments Tutorial
        • API Reference
          • Segments
          • Customers Assignments
          • Items Assignments
          • Models
        • View Raw API Specification
      • Approval Service
        • Approval Tutorials
        • API Reference
          • Approvals
          • Approval
          • Search
          • Models
        • View Raw API Specification
    • Delivery and Shipping
      • Shipping Service
        • Shipping Tutorial
        • API Reference
          • Customer Group Relations
          • Delivery Windows
          • Shipping Cost
          • Shipping Methods
          • Shipping Zones
          • Shipping Groups
          • Sites
          • Delivery Times Management
          • Delivery Times Slots Management
          • Delivery Cycles
          • Models
        • View Raw API Specification
      • Delivery Providers Service
        • API Reference
          • Delivery Orders
          • Delivery Plan
          • Models
        • View Raw API Specification
    • Rewards and Promotions
      • Coupon Service
        • Coupon Tutorial
        • API Reference
          • Coupon Management
          • Coupon Validation
          • Coupon Redemption
          • Referral Coupon Management
          • Models
        • View Raw API Specification
      • Reward-points Service
        • Reward-points Tutorial
        • API Reference
          • Redeem Options Management
          • Signed In Customer Reward Points
          • Reward Points Management
          • Models
        • View Raw API Specification
    • Quotes
      • Quote Service
        • Quote Tutorial
        • API Reference
          • Quote management
          • Quote history
          • Quote pdf
          • Quote reason
          • Models
        • View Raw API Specification
    • Checkout
      • Cart Service
        • Cart Tutorial
        • API Reference
          • Carts
          • Cart items
          • Discounts
          • Models
        • View Raw API Specification
      • Payment-gateway Service
        • Payment-gateway Tutorial
        • API Reference
          • Payment
          • Payment frontend
          • Payment mode
          • Transaction
          • Payment mode frontend
          • Models
        • View Raw API Specification
      • Checkout Service
        • Checkout Tutorial
        • API Reference
          • Checkouts
          • Models
        • View Raw API Specification
      • Fee Service
        • Fee Tutorial
        • API Reference
          • Fee management
          • Item Fee management
          • Product Fees management
          • Item Fee search
          • Models
        • View Raw API Specification
      • Shopping List
        • API Reference
          • Shopping Lists
          • Models
        • View Raw API Specification
    • Orders
      • Availability Service
        • Availability Tutorial
        • API Reference
          • Locations
          • Availabilities
          • Models
        • View Raw API Specification
      • Order Service
        • Order Tutorial
        • API Reference
          • Orders (tenant Managed)
          • Orders (customer Managed)
          • Models
        • View Raw API Specification
      • Pick-pack Service
        • API Reference
          • Orders
          • Assignees
          • Order cycles
          • Recalculations
          • Events
          • Models
        • View Raw API Specification
      • Invoice Service
        • Invoice Tutorial
        • API Reference
          • Invoice Jobs
          • Models
        • View Raw API Specification
      • Returns Service
        • Returns Tutorial
        • API Reference
          • Returns
          • Models
        • View Raw API Specification
      • SEPA Export Service
        • API Reference
          • Files
          • Jobs
          • Models
        • View Raw API Specification
    • Utilities
      • Schema Service
        • Schema Tutorial
        • API Reference
          • Schema
          • Type
          • Reference
          • Custom Schema Type
          • Custom Instance
          • Models
        • View Raw API Specification
      • Sequential-id Service
        • Sequential-id Tutorial
        • API Reference
          • Sequential IDs management
          • Models
        • View Raw API Specification
    • Media
      • Media Service
        • Media Tutorial
        • API Reference
          • Assets
          • Models
        • View Raw API Specification
    • Webhooks
      • Webhook Service
        • Webhooks Tutorial
        • API Reference
          • Config
          • Events
          • Svix Emporix Shared Account
          • Models
        • View Raw API Specification
      • Events-Availability
      • Events-Cart
      • Events-Catalog
      • Events-Category
      • Events-Client Management
      • Events-Customer
      • Events-Index
      • Events-Order
      • Events-Price
      • Events-Product
      • Events-Quote
      • Events-Product
    • Integrations
      • Identity Providers
        • Auth0
      • Workflow Automation
        • Emporix and Make
Powered by GitBook
LogoLogo

Resources

  • Emporix.com
  • Developer Policy
  • Terms of Use

Find us

  • LinkedIn

© 2025 Emporix. All Rights Reserved.

On this page
  • How to add a customer segment
  • Create a customer segment
  • Add products/categories to a segment
  • Add segment members
  • How to find a specific segment using search parameters
  • How to apply a coupon to a segment
  • How to use customer segments on a storefront
  • Retrieve all products and/or categories
  • Use the segment information

Was this helpful?

Export as PDF
  1. API Guides and References
  2. Companies and Customers
  3. Customer Segments

Segments Tutorial

PreviousCustomer SegmentsNextAPI Reference

Last updated 8 days ago

Was this helpful?

Customer Segment Service allows you to group your customers in many convenient ways that suit different purposes. You can assign products or categories to create targeted marketing campaigns and display the relevant items on the storefront. The flexible service's API facilitates configuring and managing customer segments.

How to add a customer segment

To create and configure a segment, you need the customersegment.segment_manage scope.

Create a customer segment

Create a customer segment by sending a request to the the Creating a customer segment endpoint.

curl -i -X POST \
  'https://api.emporix.io/customer-segment/{tenant}/segments' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Language: string' \
  -H 'Content-Type: application/json' \
  -d '{
    "id": "628cd20c6e8b2432b6346ca6",
    "name": {
      "en": "Golden Segment"
    },
    "description": {
      "en": "Golden Segment"
    },
    "validity": {
      "from": "2024-04-17T08:00:00.000Z",
      "to": "2025-04-17T08:00:00.000Z"
    },
    "status": "ACTIVE",
    "siteCode": "main"
  }'

Add products/categories to a segment

Connect the segment with specific products and/or categories for more customized content.

  • To add an individual product or a category, call the Updating an item assignment endpoint.

curl -i -X PUT \
  'https://api.emporix.io/customer-segment/{tenant}/segments/{segmentId}/items/{type}/{itemId}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "mixins": {
      "segmentAttributes": {
        "membershipStatus": "PREMIUM"
      }
    },
    "metadata": {
      "mixins": {
        "segmentAttributes": "https://res.cloudinary.com/saas-ag/raw/upload/v1600077014/schemata/segmentAttributes_v1.json"
      }
    }
  }'
  • To assign multiple products or categories to the segment, call the Updating multiple item assignments endpoint.

curl -i -X PUT \
  'https://api.emporix.io/customer-segment/{tenant}/segments/{segmentId}/items/{type}/bulk' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{}'

Note that this operation performs an UPSERT operation. The UPSERT means that if an item is already assigned to a segment, the assignment gets updated. If not, the new one is created in the system.

Add segment members

Now, add customers to the segment. Depending on your setup and purpose, you can add B2B or B2C customers.

  • To add a B2B customer, send the request to the Updating a customer assignment endpoint.

curl -i -X PUT \
  'https://api.emporix.io/customer-segment/{tenant}/segments/{segmentId}/customers/{customerId}/{legalEntityId}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "mixins": {
      "segmentAttributes": {
        "membershipStatus": "PREMIUM"
      }
    },
    "metadata": {
      "mixins": {
        "segmentAttributes": "https://res.cloudinary.com/saas-ag/raw/upload/v1600077014/schemata/segmentAttributes_v1.json"
      }
    }
  }'
  • To add a B2C customer, send the request to the Updating a customer assignment endpoint.

curl -i -X PUT \
  'https://api.emporix.io/customer-segment/{tenant}/segments/{segmentId}/customers/{customerId}/{legalEntityId}' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "mixins": {
      "segmentAttributes": {
        "membershipStatus": "PREMIUM"
      }
    },
    "metadata": {
      "mixins": {
        "segmentAttributes": "https://res.cloudinary.com/saas-ag/raw/upload/v1600077014/schemata/segmentAttributes_v1.json"
      }
    }
  }'
  • To add multiple customers at once, send the request to the Updating multiple customer assignments endpoint.

curl -i -X PUT \
  'https://api.emporix.io/customer-segment/{tenant}/segments/{segmentId}/customers/bulk' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{}'

Note that this operation performs an UPSERT operation. The UPSERT means that if a customer is already assigned to a segment, the assignment gets updated. If not, the customer assignment is created in the system.

How to find a specific segment using search parameters

To search for a segment, you need the customersegment.segment_read scope to retrieve all customer segments.

You can use the search API to find a segment of your interest that match a specific criteria. Send the request to the Searching with parameters for customer segments endpoint.

curl -i -X POST \
  'https://api.emporix.io/customer-segment/{tenant}/segments/search?pageSize=string&pageNumber=string&sort=string&fields=string&legalEntityId=string' \
  -H 'Accept-Language: string' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -H 'X-Total-Count: true' \
  -d '{
    "q": "siteCode:main"
  }'

In the request body, pass the criteria you're looking for in the q parameter.

How to apply a coupon to a segment

Optionally, you can offer a discount coupon to a customer segment. The coupon then applies only to the assigned products/categories and is valid only for the customers that are the segment members. To create a coupon that is valid only for a specific segment, send the request to the Creating a new coupon endpoint.

curl -i -X POST \
  'https://api.emporix.io/coupon/{tenant}/coupons' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'Content-Type: application/json' \
  -d '{
    "code": "ENG2OC0",
    "name": "Winter Sale 2018",
    "description": "Great Winter Discount of 25 USD in December 2018 and January 2019 for all Orders over 50 USD",
    "discountType": "ABSOLUTE",
    "discountAbsolute": {
      "amount": 24.99,
      "currency": "USD"
    },
    "allowAnonymous": false,
    "maxRedemptions": -1,
    "maxRedemptionsPerCustomer": -1,
    "categoryRestricted": false,
    "segmentRestricted": false,
    "restrictions": {
      "validFor": [
        "C0123456789",
        "C0123456788"
      ],
      "validFrom": "2014-12-01T00:00:00.000Z",
      "validUntil": "2015-01-31T23:59:59.999Z",
      "minOrderValue": {
        "amount": 49.99,
        "currency": "USD"
      }
    },
    "issuedTo": "C01234567989"
  }'

Set the segmentRestricted parameter as true and specify the segments you want to apply the coupon to.

How to use customer segments on a storefront

Having segments in place, you can use that functionality on your storefront. Depending on your business goals, you can utilize the segments differently. Decide whether you'd like to extend the assortment with the products/categories assigned to a given segment to, for example, promote certain items on your site. Or, you'd rather limit products/categories visibility to only those that a segment defines for segment members, to be able to sell specified products through a channel that targets the right group of people.

Retrieve all products and/or categories

To display the content you want, first retrieve all the products/categories assigned to all segments that a customer is a member of. Send the request to the Retrieving all items assignments for all customer segments endpoint.

curl -i -X GET \
  'https://api.emporix.io/customer-segment/{tenant}/segments/items?q=string&pageSize=string&pageNumber=string&sort=string&fields=string&legalEntityId=string&siteCode=string&onlyActive=false' \
  -H 'Accept-Language: string' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>' \
  -H 'X-Total-Count: true'

Depending on your needs, you can limit the search using the q parameter, for example, q=type:PRODUCT or q=type:CATEGORY.

Use the segment information

If you want to use segments to restrict the content on your storefront, to display only the product and categories assigned to a segment for segment customers, use the endpoint to build a segment-based category tree. Send the request to the Retrieving category trees for a customer segments endpoint.

curl -i -X GET \
  'https://api.emporix.io/customer-segment/{tenant}/segments/items/category-trees?legalEntityId=string&siteCode=string' \
  -H 'Accept-Language: string' \
  -H 'Authorization: Bearer <YOUR_TOKEN_HERE>'

The request generates a category tree with categories assigned to a segment and their parent categories, if applicable. If a segment specifies a subcategory only, the customer of that segment is able to see the parent category label, but content-wise, only the products from the subcategory are available.

To filter products that belong to a category that is assigned to a particular segment, send the request to the Retrieving resources assigned to a category endpoint.

curl -i -X GET 
'https://api.emporix.io/category/{tenant}/categories/{categoryId}/assignments?assignmentType=PRODUCT\&ref.localizedName=Twix\&ref.id=5c3348bda9812100098ffaa3\&showUnpublished=true\&withSubcategories=true\&segmentsIds=segmentId1%2CsegmentId2\&pageNumber=1\&pageSize=60\&sort={fieldName}%3AASC%2C{fieldName2}%3ADESC\&hideUnpublishedProducts=false' 
-H 'Accept-Language: \`\*\`, \`en\`, \`en,de,fr\`, \`en-EN\`, \`fr-CH, fr;q=0.9, en;q=0.8, de;q=0.7\`' 
-H 'Authorization: Bearer ' 
-H 'X-Total-Count: true' 
-H 'X-Version: v2'

Specify the segment id in the request.

API Reference
API Reference
API Reference
API Reference
API Reference
API Reference
API Reference
API Reference
API Reference
API Reference
API Reference

To test the endpoint, open the API reference below or check the example of a curl request.

To test the endpoint, open the API reference below or check the example of a curl request.

To test the endpoint, open the API reference below or check the example of a curl request.

To test the endpoint, open the API reference below or check the example of a curl request.

To test the endpoint, open the API reference below or check the example of a curl request.

To test the endpoint, open the API reference below or check the example of a curl request.

To test the endpoint, open the API reference below or check the example of a curl request.

To test the endpoint, open the API reference below or check the example of a curl request.

To test the endpoint, open the API reference below or check the example of a curl request.

To test the endpoint, open the API reference below or check the example of a curl request.