Affiliate Object
An affiliate contains information about their account, performance metrics, and nested account details:Key Fields
id: Store affiliate public ID (prefixed withsaff_)status: Current status (activeorsuspended)source: How the affiliate joined (e.g.,invitation,network)total_visits: Number of referral link visitstotal_sales: Number of completed sales from referralstotal_earnings: Total commission earned with formatted amountaccount: Nested affiliate account details including user informationaccount.user: The affiliate’s user profile (name, email, etc.)account.pseudo: Display name used by the affiliateaccount.country: The affiliate’s country with code and namesuspended_at: Timestamp when suspended (null if active)suspended_reason: Reason for suspension (null if active)
Affiliate Statuses
| Status | Description |
|---|---|
active | Affiliate is active and can earn commissions |
suspended | Affiliate account has been suspended |
Getting an Affiliate
Retrieve a specific affiliate using their unique referral code:- Validating an affiliate code before applying commissions
- 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, who sent it, 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 |
cancelled | Invitation has been cancelled |
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)
- Handle skipped emails 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