Affiliate Object
An affiliate contains information about their account, commission rate, and performance:Key Fields
code: The affiliate’s unique referral code used in promotional linkscommission_rate: Percentage of each sale the affiliate earns (e.g., 15.00 for 15%)status: Current status of the affiliate accountstats.total_referrals: Number of customers referred by this affiliatestats.total_sales: Number of completed sales from referralsstats.total_earnings: Total commission earned
Affiliate Statuses
| Status | Description |
|---|---|
active | Affiliate is active and can earn commissions |
inactive | Affiliate account is temporarily inactive |
suspended | Affiliate account has been suspended |
Getting an Affiliate
Retrieve a specific affiliate using their unique referral code:- Validating an affiliate code before applying discounts
- Displaying affiliate information on your website
- Building affiliate dashboards
Sending Affiliate Invitations
Invite potential affiliates to join your programme by sending invitation emails:Batch Invitations
You can send up to 25 invitations in a single request. The API will:- Create and send invitations for valid new emails
- Skip emails that are already registered affiliates
- Skip emails that have pending invitations
Response
Invitation Object
An invitation contains information about its status and expiration:Invitation Statuses
| Status | Description |
|---|---|
pending | Invitation sent but not yet accepted |
accepted | Invitation has been accepted |
expired | Invitation has passed its expiration date |
Webhook Events
When an affiliate joins your store (accepts an invitation), a webhook event is triggered via Pulses.affiliate.joined
Triggered when a new affiliate joins your store.Implementation Example
Here’s a complete example of managing affiliates in your application:API Endpoints Summary
| Endpoint | Method | Description |
|---|---|---|
/v1/affiliates/{affiliateCode} | GET | Get affiliate details by code |
/v1/affiliates/invitations | POST | Send affiliate invitations |
Best Practices
Affiliate Code Validation
- Always validate affiliate codes before applying commissions
- Check the affiliate status is
active - Cache affiliate data to reduce API calls
Invitation Management
- Use batch invitations for efficiency (up to 25 emails)
- Check the
skippedfield to handle existing affiliates gracefully - Implement retry logic for failed invitations
Webhook Integration
- Set up webhooks to receive
affiliate.joinedevents - Use webhooks to trigger onboarding workflows
- Store affiliate data when they join for faster lookups
Commission Tracking
- Track affiliate referrals accurately
- Provide affiliates with real-time statistics
- Implement proper attribution windows