Time to read: 5 min

The article covers the following topics:

General Info

First of all, to get started with API, you need to find your API-key. To do it, just navigate to 'Users' Tab - > 'Users management' -> 'User edit page'.

Only the General manager has permission to get the 'User edit page'.

Next thing you need is API URL, you can find it in Settings tab -> Settings -> Tracking domains -> Default URL's tab.

Find out more about where you can find your/Affiliate's API-key and API URL here.

API Request Structure: GET/POST + api domain + path + ? + api-key=189471975956279174174.

It should be noted that header content-type - application/x-www-form-urlencoded is used on an ongoing basis, and content-type - multipart/form-data is used for uploading files (logo, creative files).

How to edit existing data?

In case you want to change some existing data, you need to use the editing method and rewrite your POST API call with all old values and new changed values. When updating existing data, the body must include the original schema definition and the new fields you are adding.

❗ When you want to change the data, it is very important to re-specify all the old values; otherwise, all the existing values automatically will have a null value (deleted), and you will lose the important information.

Let's look at an example of changing some data.

Data editing example

Imagine you want to change first targeting group in the offer: set new allowed country, device type and connection type. Let's check the old offer data:

curl --location --request POST 'https://api-rocketcompany.affise.com/3.0/admin/offer' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: bf09c801ff9b95b14ac8e17d6e4904b6' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'title=OFFER WITH Targeting groups' \
--data-urlencode 'advertiser=5e39279bac611cda7e5765ab' \
--data-urlencode 'url=https://track.gjane.com/hc/click?afclick={clickid}&afpid={pid}&afoffer={offer_id}' \
--data-urlencode 'targeting[0][country][allow][]=RU' \
--data-urlencode 'targeting[0][device_type][]=mobile' \
--data-urlencode 'targeting[0][connection][]=cellular' \
--data-urlencode 'targeting[0][sub][allow][1][]=qwerty' \
--data-urlencode 'targeting[0][os][allow][0][name]=iOS' \
--data-urlencode 'targeting[0][os][allow][0][comparison]=EQ' \
--data-urlencode 'targeting[0][os][allow][0][version]=12.0' \
--data-urlencode 'targeting[0][isp][allow][RU][0]=Mts' \
--data-urlencode 'targeting[0][ip][allow][0]=11.12.13.0-17.18.19.22' \
--data-urlencode 'targeting[0][browser][allow][0]=Yandex.Browser for iOS' \
--data-urlencode 'targeting[0][brand][deny][0]=Smartbook Entertainment' \
--data-urlencode 'targeting[0][connection][0]=wi-fi' \
--data-urlencode 'targeting[0][block_proxy]=1' \
--data-urlencode 'targeting[0][url]=http://test-url.com' \
--data-urlencode 'targeting[1][country][allow][]=US' \
--data-urlencode 'targeting[1][device_type][]=desktop' \
--data-urlencode 'targeting[1][connection][]=wi-fi' \
--data-urlencode 'targeting[1][affiliate_id][]=2' \
--data-urlencode 'targeting[1][sub][deny][2][]=qwerty213' \
--data-urlencode 'targeting[1][sub][deny_groups][1][4]=' \
--data-urlencode 'targeting[1][sub][deny_groups][0][1]=fu' \
--data-urlencode 'targeting[1][sub][deny_groups][0][2]=lu'

You decided to change next fields:

  • from targeting[0][country][allow][]=RU to targeting[0][country][allow][]=BY

  • from targeting[0][device_type][]=mobile to targeting[0][device_type][]=desktop

  • from targeting[0][connection][]=cellular to targeting[0][connection][]=wi-fi

New changed cURL request:

curl --location --request POST 'https://api-rocketcompany.affise.com/3.0/admin/offer/132966' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--header 'api-key: bf09c801ff9b95b14ac8e17d6e4904b6' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'title=OFFER WITH Targeting groups' \
--data-urlencode 'advertiser=5e39279bac611cda7e5765ab' \
--data-urlencode 'url=https://track.gjane.com/hc/click?afclick={clickid}&afpid={pid}&afoffer={offer_id}' \
--data-urlencode 'targeting[0][country][allow][]=BY' \
--data-urlencode 'targeting[0][device_type][]=desktop' \
--data-urlencode 'targeting[0][connection][]=wi-fi' \
--data-urlencode 'targeting[0][sub][allow][1][]=qwerty' \
--data-urlencode 'targeting[0][os][allow][0][name]=iOS' \
--data-urlencode 'targeting[0][os][allow][0][comparison]=EQ' \
--data-urlencode 'targeting[0][os][allow][0][version]=12.0' \
--data-urlencode 'targeting[0][isp][allow][RU][0]=Mts' \
--data-urlencode 'targeting[0][ip][allow][0]=11.12.13.0-17.18.19.22' \
--data-urlencode 'targeting[0][browser][allow][0]=Yandex.Browser for iOS' \
--data-urlencode 'targeting[0][brand][deny][0]=Smartbook Entertainment' \
--data-urlencode 'targeting[0][connection][0]=wi-fi' \
--data-urlencode 'targeting[0][block_proxy]=1' \
--data-urlencode 'targeting[0][url]=http://test-url.com' \
--data-urlencode 'targeting[1][country][allow][]=US' \
--data-urlencode 'targeting[1][device_type][]=desktop' \
--data-urlencode 'targeting[1][connection][]=wi-fi' \
--data-urlencode 'targeting[1][affiliate_id][]=2' \
--data-urlencode 'targeting[1][sub][deny][2][]=qwerty213' \
--data-urlencode 'targeting[1][sub][deny_groups][1][4]=' \
--data-urlencode 'targeting[1][sub][deny_groups][0][1]=fu' \
--data-urlencode 'targeting[1][sub][deny_groups][0][2]=lu'

❗ Make sure you use the API method for data editing. In this case we used the Edit Offer method.

You may also find the following articles helpful:


If you have more questions on how to edit existing data via API, feel free to contact the Affise Support Team via support@affise.com or your Dedicated Account Manager.

Did this answer your question?