▪️More API methods

Working with affiliates' profiles

Get a list of all affiliates

The HTTP GET method can be used to get a list of all affiliates in the system. The filter by aff_status_id is limiting response only to approved affiliates.

Note that this request impacts your setup performance because every time it's calculating the current balance of every affiliate.


curl --location --globoff 'https://boapi.smartico.ai/api/af2_aff_op?filter={%22aff_status_id%22%3A2}' \
--header 'authorization: your-private-api-key'

Note that API returns up to 1000 records, if you have more data, you can pass "range=[1000, 2000]" in the URL as GET parameter in order to get next 1000 records.

Example of response

[
        {
        "id": 35425,
        "affiliate_id": 35425,
        "affiliate_name": "Robby Ron",
        "country": null,
        "company": null,
        "web_site_url": null,
        "comments": null,
        "comments_from_operator": null,
        "visibility": null,
        "aff_status_id": 2,
        "operator_id": 2354,
        "parent_affiliate_id": null,
        "create_date": "2022-03-10T18:32:50.573Z",
        "update_date": "2023-04-24T11:32:35.804Z",
        "create_by": 2342,
        "bo_user_id": 3423,
        "ext_affiliate_id": null,
        "payment_method_name": "Wire Transfer",
        "payment_method_id": 1,
        "payment_method_details": {
            "bank_name": "International Bank",
            "beneficary": "Somewhone",
            "swift_code": "XX123",
            "back_country": "XX",
            "account_number": "XX123-41231-55"
        },
        "payment_threshold_oper_currency": null,
        "bo_label_id": 3111,
        "label_name": "MONYY RON / 35425",
        "no_carry_over": false,
        "no_carry_over_was_set": false,
        "sub_affiliate_url": "https://aff.theaffiliateplatform.com/?paff=35425&mgr=2342",
        "same_manager_url": "https://aff.theaffiliateplatform.com/?mgr=2342",
        "aff_status_name": "Approved",
        "last_login_date": "2023-05-09T06:03:47.083Z",
        "username": "mega_affiliate",
        "bo_user_email": "monnyy@theaffiliateplatform.com",
        "avatar_image_url": null,
        "two_fa_enabled": false,
        "api_access_enabled": true,
        "first_name": "Monyy",
        "last_name": "Ron",
        "phone_number": "",
        "skype": "",
        "contact_fb": "",
        "contact_vk": "",
        "contact_telegram": "",
        "enabled_for_login": true,
        "language": "EN",
        "operator_currency": "EUR",
        "manager_id": 2342,
        "manager_username": "smr",
        "parent_affiliate_name": null,
        "commissions_total": 30769.788354,
        "balance": 23890.833624,
        "payments": 23729.22,
        "adjustments": 16850.26527,
        "sub_affiliate_fee": null,
        "sub_cpa_fee": 0,
        "sub_commission_cut_percent": 5,
        "extra_role_ids": [
            100
        ],
        "default_deal_info": {
            "deal_group_name": "CPA + REV",
            "deal_type_id": 6,
            "cpa_amount": 30,
            "rev_share_percentage": 20,
            "cpl_amount": null
        },        
    }
]

The field "default_deal_info" represent basic details of the latest version of the default deal for each affiliate. The deal_type_id field represents a bit mask of the deal type, as defined below

export enum AffDealType {
    // Pure deals
    CPL = 1,
    CPA = 2,
    RevShare_NetPL = 4,
    RevShare_NetDeposit = 8,

    // Hybrid deals
    CPL_CPA = 3,
    CPL_RevShare_NetPL = 5,
    CPA_RevShare_NetPL = 6,
    CPL_RevShare_NetDeposit = 9,
    CPA_RevShare_NetDeposit = 10,
}

The field extra_role_ids represents permissions to the additional measurements that are visible for the affiliate or access to the "Registrations report". Possible values are:

export enum AffExtraRoles {
    RegistrationsReport = 100, // access to the "Registrations report"
    QualificationDate = 101,
    RegistrationsCountry = 102,
    FTDDate = 103,
    FTDCount = 104,
    FTDAmount = 122,
    NetDeposits = 105,
    DepositsCount = 107,
    QFTDCount = 113,
    Withdrawals = 116,
    DepositAmount = 118,
    SubAffiliateCommissions = 126,
    QLeadsCount = 151,
    EffectiveCPA = 152,
    EffectiveCPL = 153,
    AffRole_NetPnL = 165,
    AffRole_PnL = 224,
    AffBonusAmount = 232
}

Possible statuses of affiliate (aff_status_id)

export enum AffiliateStatus {
    Pending = 1,
    Approved = 2,
    Declined = 3,
    Suspended = 4,
    ViewOnly = 5
}

Update affiliate details

You should do a PUT API call with the ID of the Affiliate that you want to update in the URL.

You can include only fields that you want to update, e.g. example of updating just the first name of the affiliate

curl --location --request PUT 'https://boapi.smartico.ai/api/af2_aff_op/36971' \
--header 'authorization: your-api-key \
--header 'Content-Type: application/json' \
--data '{
    "first_name": "JohnB"
}'

Full list of supported properties

{
    "comments": "Comments visible and editable by the affiliate",
    "company": "Company name",
    "country": "BG",
    "web_site_url": "https://mysite.com",
    "comments_from_operator": "Comment that will be visible only for operator",
    "aff_status_id": 2, 
    // one of the statuses as listed above, AffiliateStatus
    "ext_affiliate_id": "some_id_in_external_system",
    "no_carry_over": true, 
    // to enabled/disabled NO NEGATIVE CARRY OVER
    "manager_id": 123, 
    // set the ID of the manager
    "custom_prop_155": 33, 
    // update "Custom tag" with ID 155, by setting tag with ID 33. 
    // see the IDs for your setup in the BackOffice in "Custom tags" section
    "bo_user_email": "email_of_affiliate@myaffiliatesite.com",
    "two_fa_enabled": false,
    // enabled/disable 2FA verification
    "api_access_enabled": true,
    // enable/disable access for affiliate via API
    "first_name": "John",
    "last_name": "Malkovich",
    "phone_number": "123",
    "skype": "john",
    "contact_fb": "https://fb.me/123123",
    "contact_vk": "",
    "contact_telegram": "",
    "contact_discord": "",    
    // set the preferred communication language
    "language": "FR"
}

The operator can use the HTTP POST method to build a tracking link for specific affilite_id and specific destination link_id.

The API key is the same as described here

curl --location 'https://boapi.smartico.ai/api/private-api' \
--header 'authorization: your-api-key' \
--header 'Content-Type: application/json' \
--data '{
    "method": "af2_build_link",
    "params": {
        "linkParams": {
            "link_id": 658,
            "affiliate_id": 46554,
            "source_id": null
        }
    }
}'

The operator can use the HTTP GET method to get a list of destination links.

The API key is the same as described here

curl --location 'https://boapi.smartico.ai/api/af2_link_op' \
--header 'authorization: your-api-key' \
--data ''

Example of response:

[
    {
        "id": 204,
        "link_id": 204,
        "enabled": true,
        "brand_id": 423,
        "link_type_id": 3,
        "link_type_name": "Home Page",
        "link_name": "Home page",
        "description": null,
        "destination_url": "https://theaffiliateplatform.com/{{_p_gamename}}?tracker={{tracker}}&aff_id={{affiliate_id}}",
        "destination_url_ab": null,
        "private_affiliate_ids": null,
        "is_public": true,
        "link_id_external": "https://go.aff.theaffiliateplatform.com/l0l6otqy?aff=XXX",
        "create_date": "2022-03-10T16:07:51.706Z",
        "update_date": "2023-06-19T09:53:48.147Z",
        "create_by": 2,
        "brand_name": "DemoBrand",
        "operator_id": 2354,
        "is_active_brand": true,
        "enable_campaigns": true,
        "enable_source_id": true,
        "link_name_and_brand": "Home page / DemoBrand",
        "asset_ids": [
            304,
            306
        ]
   }
]

Manage pixel definitions (postbacks)

The operator can use the HTTP GET method to manage pixel definitions for the affiliate.

The API key is the same as described here

To get a list of pixel definitions for the specific affiliate:

curl --location 'https://boapi.smartico.ai/api/af2_pixel_definitions_op?affiliate_id=166368' \
--header 'authorization: your-api-key' \
--data ''

Example of response:

[
    {
        // unique ID of the pixel definition in the system
        "id": 2887,
        // type of the trigger
        // 1 - Lead created
        // 2 - Lead qualified
        // 3 - FTD made
        // 4 - Qualified FTD made
        "pixel_trigger_type_id": 1,
        // type of the pixel delivery
        // 1 - server-to-server HTTP call
        // 2 - Client image
        // 3 - Client iframe
        // 4 - Client JavaScript
        "pixel_type_id": 1,
        // the name of the definition
        "pixel_name": "Name of the pixel definition",
        // URL for the call back with placeholders that will be replaced
        "pixel": "https://api.casino.com/?deal_id={{deal_id}}",
        // affiliate id to whom this pixel belongs
        "affiliate_id": 166368,
        // deal ID on which this pixel will be triggered. 
        // -1 means will be triggered for all deals of affiliate
        "deal_id": -1,
         // status of pixel definition
         // 1 - active
         // 2 - inactive
        "pixel_status": 1,
    }
]

To create a new pixel definition

curl --location 'https://boapi.smartico.ai/api/af2_pixel_definitions_op' \
--header 'authorization: your-api-key' \
--header 'Content-Type: application/json' \
--data '{
    "affiliate_id": "166368",
    "pixel_status": 1,
    "pixel_type_id": 1,
    "pixel_trigger_type_id": 1,
    "pixel": "https://api.casino.com/?deal_id={{deal_id}}",
    "pixel_name": "Name of the pixel definition2"
}'

To update existing pixel definition (pay attention that the ID of the definition should be passed in the URL, 2888 in our example)

curl --location --request PUT 'http://boapi.smartico.ai/api/af2_pixel_definitions_op/2888' \
--header 'authorization: your-api-key' \
--header 'Content-Type: application/json' \
--data '{
    "pixel_status": 2,
    "pixel_name": "This pixel will be renamed and deactivated"
}'

Last updated