curl "https://api.affonso.io/v1/embed/data?token=a1b2c3d4e5f6789..."
const response = await fetch(
`https://api.affonso.io/v1/embed/data?token=${token}`
);
const { data } = await response.json();
console.log(data.link); // Referral link
console.log(data.stats.sales); // Number of sales
console.log(data.earnings); // Recent transactions
import requests
response = requests.get(
'https://api.affonso.io/v1/embed/data',
params={'token': 'a1b2c3d4e5f6789...'}
)
data = response.json()['data']
print(data['link'])
print(data['stats']['earnings']['paid'])
{
"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",
"description": "Promote Acme and earn recurring commissions on every qualified referral.",
"logoUrl": "https://acme.com/logo.png"
},
"theme": {
"primaryColor": "#881337",
"secondaryColor": "#f0f0f0",
"hideBranding": false
},
"token": "a1b2c3d4e5f6789..."
}
}
{
"success": false,
"error": {
"code": "MISSING_TOKEN",
"message": "Token is required"
}
}
{
"success": false,
"error": {
"code": "TOKEN_EXPIRED",
"message": "Token has expired"
}
}
{
"success": false,
"error": {
"code": "INVALID_TOKEN",
"message": "Invalid or expired token"
}
}
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..."
const response = await fetch(
`https://api.affonso.io/v1/embed/data?token=${token}`
);
const { data } = await response.json();
console.log(data.link); // Referral link
console.log(data.stats.sales); // Number of sales
console.log(data.earnings); // Recent transactions
import requests
response = requests.get(
'https://api.affonso.io/v1/embed/data',
params={'token': 'a1b2c3d4e5f6789...'}
)
data = response.json()['data']
print(data['link'])
print(data['stats']['earnings']['paid'])
{
"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",
"description": "Promote Acme and earn recurring commissions on every qualified referral.",
"logoUrl": "https://acme.com/logo.png"
},
"theme": {
"primaryColor": "#881337",
"secondaryColor": "#f0f0f0",
"hideBranding": false
},
"token": "a1b2c3d4e5f6789..."
}
}
{
"success": false,
"error": {
"code": "MISSING_TOKEN",
"message": "Token is required"
}
}
{
"success": false,
"error": {
"code": "TOKEN_EXPIRED",
"message": "Token has expired"
}
}
{
"success": false,
"error": {
"code": "INVALID_TOKEN",
"message": "Invalid or expired token"
}
}
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
string
required
The public token from
POST /v1/embed/token.Response
boolean
Always
true for successful responses.object
Complete dashboard data.
Show Data Object Properties
Show Data Object Properties
object
Affiliate information.
name(string | null): Display nameemail(string): Email addresstrackingId(string | null): Unique tracking identifieravatarUrl(string | null): Profile picture URL
string
Full referral link with tracking parameter.
string
Program’s website URL.
object | null
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
array
Commission incentives configured for this affiliate. Includes both group incentives and affiliate-specific overrides.
object
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
array
Recent transactions (up to 10). 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”
string
URL to the full affiliate portal (with email pre-filled for login).
object | null
Affiliate’s coupon code (if they have one).
code(string): The coupon codediscountType(string): “percentage” or “flat”discountValue(number): Discount amount
object | null
If present, affiliate can create their own coupon via
/v1/embed/coupon.discountType(string): “percentage” or “flat”discountValue(number): Discount amount
array
Marketing resources/creatives for the affiliate to use.
object
Program information.
name(string): Program namedescription(string | null): Program description shown whenshowDescription=truelogoUrl(string | null): Program logoaffiliateLinksEnabled(boolean): Whether the referral link card is availabledefaultReferralParameter(string): Default referral parameter, such asviaenabledReferralParameters(string[]): Allowed referral parameter options
object
Brand colors from portal settings.
primaryColor(string | null): HEX color codesecondaryColor(string | null): HEX color codehideBranding(boolean): Whether the “Powered by Affonso” badge is hidden
string
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..."
const response = await fetch(
`https://api.affonso.io/v1/embed/data?token=${token}`
);
const { data } = await response.json();
console.log(data.link); // Referral link
console.log(data.stats.sales); // Number of sales
console.log(data.earnings); // Recent transactions
import requests
response = requests.get(
'https://api.affonso.io/v1/embed/data',
params={'token': 'a1b2c3d4e5f6789...'}
)
data = response.json()['data']
print(data['link'])
print(data['stats']['earnings']['paid'])
{
"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",
"description": "Promote Acme and earn recurring commissions on every qualified referral.",
"logoUrl": "https://acme.com/logo.png"
},
"theme": {
"primaryColor": "#881337",
"secondaryColor": "#f0f0f0",
"hideBranding": false
},
"token": "a1b2c3d4e5f6789..."
}
}
{
"success": false,
"error": {
"code": "MISSING_TOKEN",
"message": "Token is required"
}
}
{
"success": false,
"error": {
"code": "TOKEN_EXPIRED",
"message": "Token has expired"
}
}
{
"success": false,
"error": {
"code": "INVALID_TOKEN",
"message": "Invalid or expired token"
}
}
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
