How to Create and Manage Smart Links via the CAKE API

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
ParameterTypeRequiredDescription
smart_link_idintegerNoFilter to a specific smart link ID.
affiliate_idintegerNoFilter smart links for a specific affiliate.
smart_link_statusstringNoFilter 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=active

Sample 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
ParameterTypeRequiredDescription
smart_link_namestringYesDisplay name for the smart link.
affiliate_idintegerYesID of the affiliate this smart link is assigned to.
smart_link_statusstringYesInitial status: active or inactive.
rotation_typestringYesTraffic 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
ParameterTypeRequiredDescription
offer_idintegerYesID of the offer whose rules you want to retrieve.
rule_type_idintegerNoFilter to a specific rule type.

Sample request

GET https://yourdomain.cakemarketing.com/api/2/offer_rules.json ?api_key=YOUR_API_KEY &offer_id=12345

Sample 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
ParameterTypeRequiredDescription
offer_idintegerYesID of the offer to attach the rule to.
rule_type_idintegerYesInteger identifying the condition category (e.g., country, device type).
rule_valuestringYesThe value to match against (e.g., US for a country rule).
target_offer_idintegerYesID of the offer to route matching traffic to.
priorityintegerYesEvaluation 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.


Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.