▪️Reporting API
TheAffiliatePlatform (TAP) provides API to retrieve configurational, operational, and analytical data. API is provided as a REST over HTTP and uses SSL for data protection.
Reporting API is designed for the high level aggregated reporting (aggregated overview per operation/affiliate and not per individual user).
Affiliates can use API to get reports related to the activities of their own traffic and for the Operator to have access to all affiliates' data.
To get an API key, see API Keys and URL. Send the key in the authorization header of each request.
API for the Affiliate
Accessing analytical data
The Affiliation system has an API endpoint that provides statistical information about visits, registrations, commissions, etc., aggregated by a specified period or for a lifetime.
Example of the API call using CURL:
curl --location --request GET 'https://boapi.smartico.ai/api/af2_media_report_af?aggregation_period=DAY&group_by=utm_campaign,utm_medium,utm_source,afp&date_from=2022-07-12&date_to=2022-07-14' --header 'authorization: your_api_key'Example of API call using NodeJs:
var request = require('request');
var options = {
'method': 'GET',
'url': 'https://boapi.smartico.ai/api/af2_media_report_af?aggregation_period=DAY',
'headers': {
'authorization': 'your_api_key'
}
};
request(options, function (error, response) {
if (error) throw new Error(error);
console.log(response.body);
});
Parameters in API call:
As aggregation_period you can pass DAY, MONTH or YEAR (in capital letters), or keep it empty in order to get aggregate data for the lifetime. In lifetime data, the
dtfield isall.Optional parameter group_by could have a comma-separated list of the fields to group results. Possible values are:
utm_campaign
utm_medium
utm_source
afp, afp1, afp2.... afp9
link_id
brand_id
campaign_id
source_id
registration_id (requires the "Access Registrations report" permission)
ext_customer_id (requires the "Access Registrations report" permission)
username (requires the "Access Registrations report" permission)
If group_by is empty, or has no value from this list, the results are grouped by link_id and brand_id. Values that are not in the list are ignored. registration_id, ext_customer_id and username are also ignored when the affiliate does not have the "Access Registrations report" permission.
Only one afp field (afp, afp1 … afp9) can be used in one request. With two or more, the API returns an error.
When you group by brand_id, link_id or campaign_id, each row also has brand_name, link_name or campaign_name.
Optional parameters date_from and date_to could be used to limit results for the defined period. The format of the date is YYYY-MM-DD.
Optional parameter brand_id limits the results to one brand.
Example of response:
Use the field names exactly as they come in the response. For example, chargback_total is spelled this way.
The affiliate sees the same data in Analytics, Media Report

API for the Operator
Accessing analytical data
Operator API is similar to the Affiliate API.
Example of the API call using CURL:
The difference between APIs:
Method name
af2_media_report_af
af2_media_report_op
Possible values for group_by parameter
afp(1..9), utm_campaign, utm_medium, utm_source, link_id, brand_id, source_id, campaign_id, registration_id, ext_customer_id, username
affiliate_id, registration_id, ext_customer_id, username, afp(1..9), utm_campaign, utm_medium, utm_source, link_id, brand_id, campaign_id, source_id, deal_root_original_id, child_affiliate_id, manager_id
Possible values for filtering data
date_from, date_to, brand_id (one brand)
date_from, date_to, affiliate_id, brand_id, manager_id
In the Operator API response, meta has operator_id instead of affiliate_id. When you group by affiliate_id, child_affiliate_id or deal_root_original_id, each row also has affiliate_name, child_affiliate_name or deal_group_name.
Important to know
All amounts are in operator currency
As TAP is providing an affiliation system as a white-label solution, you can find the name, domain, and image of the “Operator” operating affiliation system in response to API calls.
In grouping by "day", the report will show the change of commission during this day. It's not a total commission at the end of the day.
If you are querying aggregated data and there are no activities for a specific period, the record for a specific period will be missing in response.
If you query for aggregated data, the response will show only changes for a specified period. For example, with aggregation_period=MONTH:
During July, the affiliate had a change of balance “-795.50 EUR”, and because it was his first month, at the end of the month, his balance will be -795.50 EUR
During August, he had a positive change, +225 EUR. This means that his balance was “-570.50 EUR at the end of August.”
In the Operator API, "affiliate_id", "brand_id" and "manager_id" values can be passed as 123 or as 123,456. You can pass up to 500 affiliate IDs.
The number of API calls per minute can be limited for your account. Above the limit, the API answers "Too many requests to API from the same account, please decrease the query rate or try again later". Wait a minute and try again.
Note that not all attributes are available for every affiliate in the Affiliate API. Visibility depends on the Additional Permissions granted to each Affiliate. The operator sets these permissions in the affiliate's profile: Affiliates → Active Affiliates → the affiliate → Overview → Additional permissions → Edit.

Last updated
Was this helpful?