This article will cover the following:
Overview
The Smart Links & Routing API lets you create and manage traffic rotation links and conditional routing rules programmatically. All endpoints require your api_key.
List Smart Links
GET /api/2/smart_links.json
| Parameter | Type | Required | Description |
|---|---|---|---|
| smart_link_id | integer | No | Filter to a specific smart link ID. |
| affiliate_id | integer | No | Filter smart links for a specific affiliate. |
| smart_link_status | string | No | Filter by status: active or inactive. |
Sample request
GET https://yourdomain.cakemarketing.com/api/2/smart_links.json
?api_key=YOUR_API_KEY
&affiliate_id=67890
&smart_link_status=activeSample response
{
"request_status": "Success",
"smart_links": [
{"smart_link_id": 301, "smart_link_name": "Summer Campaign Tier 1", "affiliate_id": 67890, "rotation_type": "weighted", "smart_link_status": "active"},
{"smart_link_id": 302, "smart_link_name": "Mobile Push All Geos", "affiliate_id": 67890, "rotation_type": "priority", "smart_link_status": "active"}
]
}Create Smart Link
POST /api/2/smart_link.json
| Parameter | Type | Required | Description |
|---|---|---|---|
| smart_link_name | string | Yes | Display name for the smart link. |
| affiliate_id | integer | Yes | ID of the affiliate this smart link is assigned to. |
| smart_link_status | string | Yes | Initial status: active or inactive. |
| rotation_type | string | Yes | Traffic distribution method: even, weighted, or priority. |
Sample request
POST https://yourdomain.cakemarketing.com/api/2/smart_link.json
{
"api_key": "YOUR_API_KEY",
"smart_link_name": "Q1 Finance Rotation",
"affiliate_id": 67890,
"smart_link_status": "active",
"rotation_type": "weighted"
}Sample response
{
"request_status": "Success",
"smart_link": {
"smart_link_id": 315,
"smart_link_name": "Q1 Finance Rotation",
"rotation_type": "weighted",
"tracking_url": "https://yourdomain.cakemarketing.com/sl/315?aff_id=67890"
}
}List Offer Rules
GET /api/2/offer_rules.json
| Parameter | Type | Required | Description |
|---|---|---|---|
| offer_id | integer | Yes | ID of the offer whose rules you want to retrieve. |
| rule_type_id | integer | No | Filter to a specific rule type. |
Sample request
GET https://yourdomain.cakemarketing.com/api/2/offer_rules.json
?api_key=YOUR_API_KEY
&offer_id=12345Sample response
{
"request_status": "Success",
"offer_rules": [
{"offer_rule_id": 88, "rule_type_name": "Country", "rule_value": "US", "target_offer_id": 12398, "priority": 1, "status": "active"},
{"offer_rule_id": 89, "rule_type_name": "Country", "rule_value": "CA", "target_offer_id": 12401, "priority": 2, "status": "active"}
]
}Create Offer Rule
Adds a new conditional routing rule to an offer. When a click matches the rule condition, CAKE redirects traffic to the target offer.
POST /api/2/offer_rule.json
| Parameter | Type | Required | Description |
|---|---|---|---|
| offer_id | integer | Yes | ID of the offer to attach the rule to. |
| rule_type_id | integer | Yes | Integer identifying the condition category (e.g., country, device type). |
| rule_value | string | Yes | The value to match against (e.g., US for a country rule). |
| target_offer_id | integer | Yes | ID of the offer to route matching traffic to. |
| priority | integer | Yes | Evaluation order. Lower numbers are evaluated first. |
Sample request
POST https://yourdomain.cakemarketing.com/api/2/offer_rule.json
{
"api_key": "YOUR_API_KEY",
"offer_id": 12345,
"rule_type_id": 2,
"rule_value": "US",
"target_offer_id": 12398,
"priority": 1
}Sample response
{
"request_status": "Success",
"offer_rule": {
"offer_rule_id": 90,
"offer_id": 12345,
"rule_value": "US",
"target_offer_id": 12398,
"priority": 1,
"status": "active"
}
}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.