Segments

Overview

Segments group customers by criteria — purchase history, attributes, and behaviour — so you can target specific offers. These endpoints return the plans, coupons, and product SKUs the authenticated customer is eligible for based on their segment membership.


How It Works

  1. Define segments - Create segments and attach plans, coupons, or product SKUs to them in the Pelcro dashboard.
  2. Customers are matched - Pelcro evaluates which customers belong to each segment.
  3. Query eligibility - Call these endpoints to retrieve what the authenticated customer qualifies for.

Example: Show a returning customer a win-back plan and a segment-specific coupon they alone are eligible for.


API Endpoints

MethodEndpointDescription
GET/api/v1/sdk/customer/plansEligible plans
GET/api/v1/sdk/customer/couponsEligible coupons
GET/api/v1/sdk/customer/product_skuEligible product SKUs

Important Behaviors

  • Authentication: All three endpoints require a bearer token.
  • No eligible items: When the customer qualifies for nothing (or the account has no matching segments), the endpoint returns 404 No eligible items found.
  • Granting segments: Each returned item includes the segments that make the customer eligible.
  • Cached briefly: Results are cached for a short period per customer.