This article will cover the following:
Overview
The Geo & Device Targeting API lets you read and update targeting rules on your offers programmatically. Use it to manage geo restrictions at scale or sync targeting configurations from an external system.
Get Offer Geo Targets
| Parameter | Type | Required | Description |
|---|---|---|---|
| offer_id | integer | Yes | The unique ID of the offer whose geo targets you want to retrieve. |
Sample request
GET https://yourplatform.cake.com/api/2/offer_geo_targets.json
?api_key=YOUR_API_KEY
&offer_id=12345Sample response
{
"request_status": "Success",
"offer_id": 12345,
"geo_targets": [
{"country_id": 1, "country_code": "US", "country_name": "United States", "action": "allow"},
{"country_id": 39, "country_code": "CA", "country_name": "Canada", "action": "allow"}
]
}Update Offer Geo Targets
Adds or removes country-level targeting rules on an offer. Pass a comma-separated list of country codes with an action to allow or block those countries.
| Parameter | Type | Required | Description |
|---|---|---|---|
| offer_id | integer | Yes | The unique ID of the offer to update. |
| countries | string | Yes | Comma-separated ISO 3166-1 alpha-2 country codes (e.g., US,CA,GB). |
| action | string | Yes | Either allow or block. |
Sample request
POST https://yourplatform.cake.com/api/2/update_offer_geo_targets.json
{
"api_key": "YOUR_API_KEY",
"offer_id": 12345,
"countries": "US,CA,GB",
"action": "allow"
}Sample response
{
"request_status": "Success",
"offer_id": 12345,
"updated_countries": ["US", "CA", "GB"],
"action": "allow"
}Get Countries
Returns all countries available in CAKE. Use this to look up valid country IDs and ISO codes before configuring targeting rules.
| Parameter | Type | Required | Description |
|---|---|---|---|
| country_id | integer | No | Filter to a specific country by its CAKE numeric ID. |
| country_code | string | No | Filter to a specific country by its ISO 3166-1 alpha-2 code (e.g., DE). |
Sample request
GET https://yourplatform.cake.com/api/2/countries.json?api_key=YOUR_API_KEY&country_code=DESample response
{
"request_status": "Success",
"countries": [{"country_id": 57, "country_code": "DE", "country_name": "Germany"}]
}Get Device Types
| Parameter | Type | Required | Description |
|---|---|---|---|
| device_type_id | integer | No | Filter to a specific device type by its CAKE numeric ID. |
Sample request
GET https://yourplatform.cake.com/api/2/device_types.json?api_key=YOUR_API_KEYSample response
{
"request_status": "Success",
"device_types": [
{"device_type_id": 1, "device_type_name": "Desktop"},
{"device_type_id": 2, "device_type_name": "Smartphone"},
{"device_type_id": 3, "device_type_name": "Tablet"}
]
}Get Operating Systems
| Parameter | Type | Required | Description |
|---|---|---|---|
| os_version_id | integer | No | Filter to a specific OS version by ID. |
Sample request
GET https://yourplatform.cake.com/api/2/os_versions.json?api_key=YOUR_API_KEYSample response
{
"request_status": "Success",
"os_versions": [
{"os_version_id": 1, "os_version_name": "iOS"},
{"os_version_id": 2, "os_version_name": "Android"},
{"os_version_id": 3, "os_version_name": "Windows"},
{"os_version_id": 4, "os_version_name": "macOS"}
]
}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.