curl "https://api.affonso.io/v1/embed/data?token=a1b2c3d4e5f6789..."
{
"success": true,
"data": {
"affiliate": {
"name": "John Doe",
"email": "john@example.com",
"trackingId": "john-doe",
"avatarUrl": null
},
"link": "https://acme.com?via=john-doe",
"websiteUrl": "https://acme.com",
"rewards": {
"type": "percentage",
"amount": 20,
"recurring": true,
"duration": "lifetime"
},
"incentives": [],
"stats": {
"clicks": 150,
"leads": 45,
"sales": 12,
"salesAmount": 2400,
"earnings": {
"pending": 120,
"approved": 280,
"paid": 480
}
},
"earnings": [
{
"id": "tx_abc123",
"customerId": "ref_xyz789",
"date": "2024-01-14T15:30:00.000Z",
"amount": 99.00,
"commission": 19.80,
"status": "APPROVED"
}
],
"portalUrl": "https://yourcompany.affonso.io/auth?email=john%40example.com",
"coupon": {
"code": "JOHN20",
"discountType": "percentage",
"discountValue": 20
},
"couponBlueprint": null,
"creatives": [
{
"id": "cr_123",
"name": "Banner 300x250",
"description": "Standard banner ad",
"category": "banners",
"url": "https://cdn.example.com/banner.png",
"dimensions": { "width": 300, "height": 250 }
}
],
"program": {
"name": "Acme Affiliate Program",
"logoUrl": "https://acme.com/logo.png"
},
"theme": {
"primaryColor": "#881337",
"secondaryColor": "#f0f0f0"
},
"token": "a1b2c3d4e5f6789..."
}
}
Embed
Get Embed Data
Retrieve all data needed to render the embedded referral dashboard
GET
/
v1
/
embed
/
data
curl "https://api.affonso.io/v1/embed/data?token=a1b2c3d4e5f6789..."
{
"success": true,
"data": {
"affiliate": {
"name": "John Doe",
"email": "john@example.com",
"trackingId": "john-doe",
"avatarUrl": null
},
"link": "https://acme.com?via=john-doe",
"websiteUrl": "https://acme.com",
"rewards": {
"type": "percentage",
"amount": 20,
"recurring": true,
"duration": "lifetime"
},
"incentives": [],
"stats": {
"clicks": 150,
"leads": 45,
"sales": 12,
"salesAmount": 2400,
"earnings": {
"pending": 120,
"approved": 280,
"paid": 480
}
},
"earnings": [
{
"id": "tx_abc123",
"customerId": "ref_xyz789",
"date": "2024-01-14T15:30:00.000Z",
"amount": 99.00,
"commission": 19.80,
"status": "APPROVED"
}
],
"portalUrl": "https://yourcompany.affonso.io/auth?email=john%40example.com",
"coupon": {
"code": "JOHN20",
"discountType": "percentage",
"discountValue": 20
},
"couponBlueprint": null,
"creatives": [
{
"id": "cr_123",
"name": "Banner 300x250",
"description": "Standard banner ad",
"category": "banners",
"url": "https://cdn.example.com/banner.png",
"dimensions": { "width": 300, "height": 250 }
}
],
"program": {
"name": "Acme Affiliate Program",
"logoUrl": "https://acme.com/logo.png"
},
"theme": {
"primaryColor": "#881337",
"secondaryColor": "#f0f0f0"
},
"token": "a1b2c3d4e5f6789..."
}
}
Fetch comprehensive dashboard data for an affiliate using an embed token. This endpoint is public and uses token-based authentication via query parameter (no API key required).
This endpoint does not require API key authentication. Instead, it uses the
token query parameter for authentication.Query Parameters
The public token from
POST /v1/embed/token.Response
Always
true for successful responses.Complete dashboard data.
Show Data Object Properties
Show Data Object Properties
Affiliate information.
name(string | null): Display nameemail(string): Email addresstrackingId(string | null): Unique tracking identifieravatarUrl(string | null): Profile picture URL
Full referral link with tracking parameter.
Program’s website URL.
Legacy commission structure (if no incentives configured).
type(string): “percentage” or “flat”amount(number): Commission amountrecurring(boolean): Whether commission is recurringduration(string | null): Duration type
Commission incentives configured for this affiliate. Includes both group incentives and affiliate-specific overrides.
Performance statistics.
clicks(number): Total referralsleads(number): Leads generatedsales(number): Successful conversionssalesAmount(number): Total sales amountearnings.pending(number): Pending commissionearnings.approved(number): Approved but unpaidearnings.paid(number): Total paid out
Recent transactions (up to 20). Each contains:
id(string): Transaction IDcustomerId(string): Referral ID (for anonymous name generation)date(string): ISO 8601 timestampamount(number): Transaction amountcommission(number): Commission earnedstatus(string): “PENDING”, “APPROVED”, “PAID”, “REFUNDED”, or “DECLINED”
URL to the full affiliate portal (with email pre-filled for login).
Affiliate’s coupon code (if they have one).
code(string): The coupon codediscountType(string): “percentage” or “flat”discountValue(number): Discount amount
If present, affiliate can create their own coupon via
/v1/embed/coupon.discountType(string): “percentage” or “flat”discountValue(number): Discount amount
Marketing resources/creatives for the affiliate to use.
Program information.
name(string): Program namelogoUrl(string | null): Program logo
Brand colors from portal settings.
primaryColor(string | null): HEX color codesecondaryColor(string | null): HEX color code
The token used for this request (for subsequent API calls).
Caching
Responses includeCache-Control: private, max-age=60 header. Data can be cached for up to 60 seconds client-side.
curl "https://api.affonso.io/v1/embed/data?token=a1b2c3d4e5f6789..."
{
"success": true,
"data": {
"affiliate": {
"name": "John Doe",
"email": "john@example.com",
"trackingId": "john-doe",
"avatarUrl": null
},
"link": "https://acme.com?via=john-doe",
"websiteUrl": "https://acme.com",
"rewards": {
"type": "percentage",
"amount": 20,
"recurring": true,
"duration": "lifetime"
},
"incentives": [],
"stats": {
"clicks": 150,
"leads": 45,
"sales": 12,
"salesAmount": 2400,
"earnings": {
"pending": 120,
"approved": 280,
"paid": 480
}
},
"earnings": [
{
"id": "tx_abc123",
"customerId": "ref_xyz789",
"date": "2024-01-14T15:30:00.000Z",
"amount": 99.00,
"commission": 19.80,
"status": "APPROVED"
}
],
"portalUrl": "https://yourcompany.affonso.io/auth?email=john%40example.com",
"coupon": {
"code": "JOHN20",
"discountType": "percentage",
"discountValue": 20
},
"couponBlueprint": null,
"creatives": [
{
"id": "cr_123",
"name": "Banner 300x250",
"description": "Standard banner ad",
"category": "banners",
"url": "https://cdn.example.com/banner.png",
"dimensions": { "width": 300, "height": 250 }
}
],
"program": {
"name": "Acme Affiliate Program",
"logoUrl": "https://acme.com/logo.png"
},
"theme": {
"primaryColor": "#881337",
"secondaryColor": "#f0f0f0"
},
"token": "a1b2c3d4e5f6789..."
}
}
Using with iframe
For the pre-built dashboard UI, use the embed page instead of the API directly:<iframe
src="https://yourcompany.affonso.io/embed/referrals?token=a1b2c3d4e5f6789..."
width="100%"
height="600"
frameborder="0"
/>
Tokens expire after 30 minutes. If you receive a
TOKEN_EXPIRED error, generate a new token using POST /v1/embed/token.Was this page helpful?
⌘I
