This article will cover the following:
Overview
The Sub Affiliates API lets you retrieve sub affiliate accounts, create new ones with defined payout terms, and pull performance reports scoped to any combination of parent affiliate and sub affiliate.
List Sub Affiliates
GET /api/2/sub_affiliates.json
| Parameter | Type | Required | Description |
|---|---|---|---|
| sub_affiliate_id | integer | No | Filter to a single sub affiliate by ID. |
| affiliate_id | integer | No | Filter to sub affiliates belonging to a specific parent affiliate. |
| sub_affiliate_status | string | No | Filter by status: active, inactive, or all. Default: all. |
Sample request
GET https://your-instance.cakemarketing.com/api/2/sub_affiliates.json
?api_key=YOUR_API_KEY
&affiliate_id=67890
&sub_affiliate_status=activeSample response
{
"request_status": "Success",
"sub_affiliates": [
{"sub_affiliate_id": 301, "sub_affiliate_name": "MediaPartner_A", "payout": 5.00, "payout_type": "cpa", "sub_affiliate_status": "active"},
{"sub_affiliate_id": 302, "sub_affiliate_name": "MediaPartner_B", "payout": 20.00, "payout_type": "percent", "sub_affiliate_status": "active"}
]
}Create Sub Affiliate
POST /api/2/sub_affiliate.json
| Parameter | Type | Required | Description |
|---|---|---|---|
| affiliate_id | integer | Yes | The parent affiliate under whom this sub affiliate will be created. |
| sub_affiliate_name | string | Yes | Display name. Must be unique within the parent affiliate. |
| payout | decimal | Yes | Commission amount. Flat currency value (cpa) or percentage (percent). |
| payout_type | string | Yes | How payout is calculated: cpa (flat) or percent (% of parent payout). |
Sample request
POST https://your-instance.cakemarketing.com/api/2/sub_affiliate.json
{
"api_key": "YOUR_API_KEY",
"affiliate_id": 67890,
"sub_affiliate_name": "MediaPartner_C",
"payout": 7.50,
"payout_type": "cpa"
}Sample response
{
"request_status": "Success",
"sub_affiliate": {
"sub_affiliate_id": 303,
"sub_affiliate_name": "MediaPartner_C",
"payout": 7.50,
"payout_type": "cpa",
"sub_affiliate_status": "active"
}
}Sub Affiliate Performance Report
Returns aggregated conversion and revenue data for sub affiliates within a specified date range.
GET /api/2/report/sub_affiliate.json
| Parameter | Type | Required | Description |
|---|---|---|---|
| start_date | date | Yes | Report start date (YYYY-MM-DD). |
| end_date | date | Yes | Report end date (YYYY-MM-DD). |
| affiliate_id | integer | No | Filter to sub affiliates of a specific parent affiliate. |
| sub_affiliate_id | integer | No | Filter to a specific sub affiliate. |
| offer_id | integer | No | Filter to a specific offer. |
| start_at_row | integer | No | Row offset. Default: 0. |
| row_limit | integer | No | Max rows. Default: 25. |
Sample request
GET https://your-instance.cakemarketing.com/api/2/report/sub_affiliate.json
?api_key=YOUR_API_KEY
&start_date=2024-01-01
&end_date=2024-01-31
&affiliate_id=67890Sample response
{
"request_status": "Success",
"sub_affiliate_report": [
{"sub_affiliate_id": 301, "sub_affiliate_name": "MediaPartner_A", "clicks": 840, "conversions": 42, "payout": 210.00},
{"sub_affiliate_id": 302, "sub_affiliate_name": "MediaPartner_B", "clicks": 620, "conversions": 31, "payout": 186.00}
]
}If you have any questions, please reach out to your dedicated CAKE Client Success Manager/Account Manager or contact the CAKE Support Team at support@getCAKE.com.