CAKE API — Geo & Device Targeting

This article will cover the following:

Why use this API?
Use the Geo & Device Targeting API to programmatically configure country, region, city, and device-level targeting rules on offers — enabling automated traffic routing and compliance controls without touching the CAKE UI.
Authentication: All CAKE API requests require your api_key parameter. Find yours under Setup → System Access → API Keys.

Overview

CAKE's geo and device targeting system lets you control which traffic reaches an advertiser's offer based on the visitor's geographic location and device type. Targeting rules are applied at the offer level and evaluated in real time on every click, ensuring that only qualifying traffic is routed to the offer's destination URL.

Geo targeting can be scoped down to country, region (state/province), city, and postal code. Device targeting allows you to restrict or allow traffic from desktop browsers, mobile browsers, tablets, and specific operating systems. When a click doesn't match an offer's targeting rules, CAKE redirects it to a fallback URL or blocks it, depending on your network's configuration.

Manage targeting rules through the CAKE UI at Offers → Manage Offers → [Offer] → Targeting, or configure them programmatically via the API — useful for networks that manage large offer catalogs or need to sync targeting rules from an external data source.


Key Concepts

  • Geo Targeting — A rule set applied to an offer that restricts or permits traffic based on the visitor's detected geographic location, evaluated against CAKE's GeoIP database on every click.
  • Country — The top-level geographic targeting dimension. Specified by ISO 3166-1 alpha-2 country code (e.g., US, CA, GB).
  • Region — A sub-national geographic targeting dimension corresponding to a state, province, or territory within a country. Specified by region name or code.
  • City — City-level targeting within a country and region. CAKE resolves city from the click IP via GeoIP lookup.
  • DMA — Designated Market Area — a US-specific geographic grouping used for regional advertising targeting, corresponding to television market regions.
  • Device Type — The class of device used to generate a click: Desktop, Mobile, Tablet, or Other. Detected from the User-Agent string on the click request.
  • Operating System — The OS detected from the click User-Agent: Windows, macOS, iOS, Android, Linux, etc. Used for device-level targeting granularity.
  • Targeting Mode — Controls whether the targeting rule is a whitelist (allow only matching traffic) or blacklist (block matching traffic). Configured per targeting dimension.
  • Fallback URL — The redirect destination for clicks that don't match the offer's targeting criteria. Configured at the offer level and applied when a click fails targeting validation.

Available Actions


Get Offer Geo Targets

When to use: Retrieve the current geo targeting configuration for an offer — use when auditing targeting rules, building a targeting management UI, or syncing rules to an external system.
GET/api/2/offer_geo_targets.json
ParameterTypeRequiredDescription
api_keystringYesYour CAKE API key.
offer_idintegerYesThe CAKE offer ID to retrieve targeting rules for.

Sample request

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

Sample response

{ "request_status": "Success", "response": { "offer_id": 1042, "geo_targets": [ { "country": "US", "region": "", "city": "", "targeting_mode": "whitelist" }, { "country": "CA", "region": "", "city": "", "targeting_mode": "whitelist" } ] } }

Update Offer Geo Targets

When to use: Set or replace geo targeting rules on an offer programmatically — use when onboarding offers from an advertiser spec sheet, enforcing compliance-driven geo restrictions, or syncing targeting from an external campaign management tool.
POST/api/2/update_offer_geo_targets.json
ParameterTypeRequiredDescription
api_keystringYesYour CAKE API key.
offer_idintegerYesThe CAKE offer ID to update targeting for.
countriesstringNoComma-separated list of ISO 3166-1 alpha-2 country codes to target (e.g. US,CA,GB).
regionsstringNoComma-separated region/state names or codes within the targeted countries.
citiesstringNoComma-separated city names within the targeted regions.
targeting_modestringNowhitelist (allow listed locations only) or blacklist (block listed locations). Default: whitelist.

Sample request

POST https://yourdomain.cakemarketing.com/api/2/update_offer_geo_targets.json { "api_key": "YOUR_API_KEY", "offer_id": 1042, "countries": "US,CA", "targeting_mode": "whitelist" }

Sample response

{ "request_status": "Success", "response": { "offer_id": 1042, "geo_targets_updated": true } }

Get Device Targeting

When to use: Retrieve the current device and OS targeting rules for an offer — use when auditing mobile vs desktop restrictions or building a targeting summary view.
GET/api/2/offer_device_targets.json
ParameterTypeRequiredDescription
api_keystringYesYour CAKE API key.
offer_idintegerYesThe CAKE offer ID to retrieve device targeting for.

Sample request

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

Sample response

{ "request_status": "Success", "response": { "offer_id": 1042, "device_targets": [ { "device_type": "mobile", "os": "iOS", "targeting_mode": "whitelist" }, { "device_type": "mobile", "os": "Android", "targeting_mode": "whitelist" } ] } }

Update Device Targeting

When to use: Set device and OS targeting rules on an offer — use when an advertiser's landing page is mobile-only, when enforcing OS-specific campaign requirements, or when automating targeting setup for new offers.
POST/api/2/update_offer_device_targets.json
ParameterTypeRequiredDescription
api_keystringYesYour CAKE API key.
offer_idintegerYesThe CAKE offer ID to update.
device_typesstringNoComma-separated device types to target: desktop, mobile, tablet.
operating_systemsstringNoComma-separated OS names: iOS, Android, Windows, macOS.
targeting_modestringNowhitelist or blacklist. Default: whitelist.

Sample request

POST https://yourdomain.cakemarketing.com/api/2/update_offer_device_targets.json { "api_key": "YOUR_API_KEY", "offer_id": 1042, "device_types": "mobile", "operating_systems": "iOS,Android", "targeting_mode": "whitelist" }

Sample response

{ "request_status": "Success", "response": { "offer_id": 1042, "device_targets_updated": true } }


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.