▪️Reporting API

This document describes API to get affiliation metrics (commission, balance, registrations, etc.).

It can be used by the Operator - to get metrics for all affiliates

Or it can be used by the Affiliate - to get only their own metrics

The Smartico Affiliation module provides API to retrieve configurational, operational, and analytical data. API is provided as a REST over HTTP and uses SSL for data protection.

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.

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, YEAR, or keep it empty in order to get aggregate data for the lifetime.

  • 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

    • deal_root_original_id

    • registration_id (requires "Registrations report" permissions)

    • ext_customer_id (requires "Registrations report" permissions)

    • username (requires "Registrations report" permissions)

  • 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

Important note regarding setting date_from and date_to parameters.

  • date_from is inclusive

  • date_to is exclusive

This means that for the request with date_from = 2022-07-12 and date_to=2022-07-14, API will return data for 12 and 13 July only.

Example of response:

 
{
   "meta": {
       "affiliate_id": 34598,
       "operator_currency": "EUR",
       "operator_public_name": "Supper Affiliate",
       "operator_bo_domain": "https://admin.aff.smartico.ai/",
       "operator_image_url": "https://static.smartico.ai/73a6af827f2162f79c7996-cropped-FBLogo.png"
   },
   "data": [{
       "dt": "2020-08-01T00:00:00.000Z",
       "link_id": "29",
       "link_name": "test redirect",
       "brand_id": "5",
       "brand_name": "XP",
       "visit_count": 4,
       "registration_count": 24,
       "qftd_count": 0,
       "deposit_count": 2,
       "deposit_total": 40,
       "ftd_count": 2,
       "ftd_total": 40,
       "withdrawal_count": 1,
       "withdrawal_total": 20,
       "commissions_cpa": 0,
       "commissions_rev_share": 5,
       "sub_commission_from_child": 0,
       "adjustment_affiliate": 0,
       "adjustment_registration": 0,
       "payments": 0,
       "conversion_rate": 0.08333332986111125,
       "net_deposit_total": 20,
       "commissions_total": 5,
       "adjustments": 0,
       "balance": 5
   }, {
       "dt": "2020-07-01T00:00:00.000Z",
       "link_id": "4",
       "link_name": "Test/XPK-Registration",
       "brand_id": "5",
       "brand_name": "XP",
       "visit_count": 7,
       "registration_count": 0,
       "qftd_count": 0,
       "deposit_count": 0,
       "deposit_total": 0,
       "ftd_count": 0,
       "ftd_total": 0,
       "withdrawal_count": 0,
       "withdrawal_total": 0,
       "commissions_cpa": 0,
       "commissions_rev_share": 0,
       "sub_commission_from_child": 0,
       "adjustment_affiliate": 0,
       "adjustment_registration": 0,
       "payments": 0,
       "conversion_rate": 0,
       "net_deposit_total": 0,
       "commissions_total": 0,
       "adjustments": 0,
       "balance": 0
   }]
}

Here is the visual presentation of the same response in the reporting UI of the affiliation system:

API for the Operator

Accessing analytical data

Operator API is similar to the Affiliate API.

Example of the API call using CURL:

curl --location --request GET 'https://boapi.smartico.ai/api/af2_media_report_op?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'

The difference between APIs:

.Affiliate APIOperator API

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

Possible values for filtering data

date_from, date_to

date_from, date_to, affiliate_id

Important to know

  • all amounts are in operator currency

  • As Smartico 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 to not all of the attributes being available for every affiliate. It depends on the permissions that were given to the Affiliate regarding what he can see

  • If you query for aggregated data, the response will show only changes for a specified period. Given the example in the image below, you should treat it in the following way:

    • 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.”

Last updated