Skip to main content
GET
/
v1
/
embed
/
data
curl "https://api.affonso.io/v1/embed/data?token=a1b2c3d4e5f6789..."
{
  "success": true,
  "data": {
    "affiliate": {
      "name": "John Doe",
      "email": "[email protected]",
      "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

token
string
required
The public token from POST /v1/embed/token.

Response

success
boolean
Always true for successful responses.
data
object
Complete dashboard data.

Caching

Responses include Cache-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": "[email protected]",
      "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.