API-based Segmentation Quickstart Guide
This guide covers everything you need to know about programmatically managing user segments for your CustomerGlu campaigns.
What is Segmentation?
Segmentation lets you target specific campaigns to specific users. With our APIs, you can add users to campaigns, check their status, and remove them when needed - all programmatically.
Prerequisites
Before you start:
✅ Get your API key from the CustomerGlu Dashboard
✅ Note your Campaign IDs from the Campaigns section
✅ Have your User IDs ready (same as Registration API)
API Endpoints
1. Add a User to a Campaign
Request:
Response:
Effect: User immediately starts seeing the campaign and can earn associated rewards.
2. Check User's Campaign Status
Request:
Response:
3. Remove a User from a Campaign
Request:
Response:
Effect: Campaign stops appearing for this user; they stop earning campaign rewards.
Implementation Examples
Personalized Onboarding
A/B Testing
Regional Endpoints
Select the appropriate base URL for your region:
🇺🇸 US:
https://api-us.customerglu.com
Error Handling
The API returns standard HTTP status codes. Here are common errors and solutions:
Solution: Verify your API key is correct and active.
Solution: Double-check the campaign ID exists and is active.
Best Practices
Check Before Modifying: Use the status endpoint to avoid redundant operations
Error Handling: Implement proper error handling with retries for production systems
Webhooks Integration: Connect user events to segmentation API calls for real-time targeting
Caching: Cache segment membership locally for frequently checked users
Logging: Track API calls and responses for debugging and audit purposes
Need Help?
Run into issues? Check these common troubleshooting steps:
Verify API key permissions in your CustomerGlu Dashboard
Ensure campaign IDs are correct and campaigns are active
Check that user IDs match those in your CustomerGlu account
Confirm you're using the correct regional endpoint
For more assistance, contact our developer support team via Slack
Last updated
Was this helpful?