# More API methods

{% hint style="info" %}
This document describes how to get a list of affiliates, a list of available destination links and a list of pixel definitions, update affiliate details, build a tracking link for affiliates via API.
{% endhint %}

{% hint style="danger" %}
The default API URL is **<https://boapi.smartico.ai/>** but depending on your setup it could be different. Check for the exact URL in the '***Settings***' section.
{% endhint %}

## 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.

```bash

curl --location --globoff 'https://boapi.smartico.ai/api/af2_aff_op' \
--header 'authorization: your-private-api-key'

```

You can pass additional query parameters to filter the results:

```typescript
//Filter by affiliate status
    "aff_status_id": number[]; 
//Set false to skip and true to include balance calculations
    "without_money": boolean;
```

{% hint style="warning" %}
Note that this request impacts your setup performance because every time it's calculating the current balance of every affiliate. You can pass `without_money=true` in the filter to avoid the performance hit **if you don't need balance data.**
{% endhint %}

{% hint style="warning" %}
Note that API returns up to 999 records. If you have more data, you can pass "range=\[1000, 1999]" in the URL as GET parameter in order to get next 1000 records.
{% endhint %}

**Example of a filtered request:**

```bash

curl --location --globoff 'https://boapi.smartico.ai/api/af2_aff_op?filter={"aff_status_id":[2],"without_money":true}' \
--header 'authorization: your-private-api-key'

```

**Example of response:**

```jsonp
[
        {
        "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,
        "brand_ids": [333,334],
        "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

```typescript
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:

```typescript
export enum AffExtraRoles {
    RegistrationsReport = 100, // access to the "Registrations report"
    QualificationDate = 101, // Date of player's deal qualification
    RegistrationsCountry = 102, // Registration country of player, as reported by platform
    FTDDate = 103, // Date of FTD
    FTDCount = 104, // Count of FTDs 
    FTDAmount = 122, // Amount of FTDs
    NetDeposits = 105, // Net Deposit amount
    DepositsCount = 107, // Count of deposits
    QFTDCount = 113, // Count of CPA qualified players
    Withdrawals = 116, // Count of withdrawals
    ConversionRate = 117, // Deposits to Registrations, %
    DepositAmount = 118, // Amount of Deposit
    QLeadsCount = 151, // Count of CPL qualified players
    EffectiveCPA = 152, //(CPA commissions ± registration level Adjustments) / FTD count
    EffectiveCPL = 153, //(CPL commissions + registration level Adjustments) / registrations count
    AffRole_NetPnL = 165, // Net PnL Amount
    AffRole_PnL = 224, // PnL Amount
    AffBonusAmount = 232 // Bonus Amount
    AffChargebacks = 255, // Chargeback amount, if reported by platform
	  AffDeductions = 256, // Deductions amount, if reported by platform
}
```

Possible statuses of affiliate: `aff_status_id`

```typescript
export enum AffiliateStatus {
    Pending = 1,
    Approved = 2,
    Declined = 3,
    Suspended = 4,
    ViewOnly = 5,
    Blocked = 6,
    Blocked(Data Only) = 7
}
```

### 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

```bash
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"
}'
```

{% hint style="warning" %}
In case API returns the following code:  \
\
`"You cannot change parent affiliate as soon as it was set and approved and affiliate earned commission"` , \
\
you have to also pass *'parent\_affiliate\_id'* and '*manager\_id'* in the update, with the same values as before.
{% endhint %}

Full list of supported properties

```jsonp
{
    "affiliate_name": "JohnB",
    "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
    "parent_affiliate_id": 35427,
    // set the ID of the parent
    "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",
    "avatar_image_url": "",
    "two_fa_enabled": false,
    // enabled/disable 2FA verification
    "api_access_enabled": true,
    // enable/disable access for affiliate via API
    "extra_role_ids": 103,104,122,
    "first_name": "John",
    "last_name": "Malkovich",
    "phone_number": "123",
    "skype": "john",
    "contact_fb": "https://fb.me/123123",
    "contact_wa": "",
    "contact_vk": "",
    "contact_telegram": "",
    "contact_discord": "",    
    "language": "FR",
    // set the preferred communication language
    "payment_method_id": 3,
    "payment_method_details": {
               "skrill_email": "user@skrill.com",
    }
    "payment_threshold_oper_currency": 1000,
    // set the payment method and payment method details of the affiliate as listed below
    "brand_ids": [333],
    //associate affiliate with one or more of your brands; has simply informational purpose

}
```

Possible payment methods  (payment\_method\_id)&#x20;

```typescript
export enum AffPaymentMethodType {
    NotSpecified = 0,
    WireTransfer = 1,
    Netteller = 2,
    Skrill = 3,
    PayPal = 4,
    BitCoin = 5,
    TRC20 = 6,
    Payfix = 7,
    Papara = 8,
    PayBrokers = 9,
    PlayerAccount = 10,
    AstroPay = 11,
    USDT_ERC20 = 12,
    PIX = 13,
    Pixtopay = 14,
    PayLivre = 15,
    Pay4Fun = 16,
    YouPayCoin = 17,
    Istpay = 18,
    Pagfast = 19,
    EzzeBank = 20,
    USDCERC20 = 21,
}
```

Possible payment method details (payment\_method\_details):

```typescript
export const AffPaymentMethodDetails = {
       [AffPaymentMethodType.WireTransfer]: {
        vat: number;
        beneficiary: string;
        account_number: string;
        bank_country: string;
        bank_name: string;
        bank_branch: string;
        bank_city: string;
        swift_code: string;
        iban: string;
        aba: string;
        correspondent: string;
    };
    [AffPaymentMethodType.Netteller]: {
        netteller_vat: number;
        netteller_email: string;
        netteller_account_number: string;
    };
    [AffPaymentMethodType.PayPal]: {
        paypal_email: string;
    };
    [AffPaymentMethodType.Skrill]: {
        skrill_email: string;
    };
    [AffPaymentMethodType.BitCoin]: {
        bitcoin_address: string;
    };
    [AffPaymentMethodType.TRC20]: {
        trc20_wallet: string;
        trc20_holder_name: string;
    };
    [AffPaymentMethodType.USDT_ERC20]: {
        erc20_wallet: string;
    };
    [AffPaymentMethodType.Payfix]: {
        payfix_no: string;
        payfix_names: string;
    };
    [AffPaymentMethodType.Papara]: {
        papara_no: string;
        papara_names: string;
    };
    [AffPaymentMethodType.PayBrokers]: {
        paybrokers_cpf: string;
        paybrokers_cnpj: string;

    };
    [AffPaymentMethodType.PlayerAccount]: {
        pa_account_id: string;
        pa_email: string;
        pa_user_name: string;
    };
    [AffPaymentMethodType.AstroPay]: {
        astro_account_id: string;
        pa_email: string;
        pa_user_name: string;
    };
    [AffPaymentMethodType.PIX]: {
        pix_cpf: string;
        pix_key: string;
        pix_full_name: string;
    };
    [AffPaymentMethodType.Pixtopay]: {
        pixtopay_cpf: string;
    };
    [AffPaymentMethodType.PayLivre]: {
        paylivre_cpf_or_cnpj: string;
    };
    [AffPaymentMethodType.Pay4Fun]: {
        pay4fun_cpf: string;
    };
    [AffPaymentMethodType.YouPayCoin]: {
        youpaycoin_name: string;
        youpaycoin_surname: string;
        youpaycoin_email: string;
    };
    [AffPaymentMethodType.Istpay]: {
        istpay_cpf: string;
    };
    [AffPaymentMethodType.PagFast]: {
        pagfast_pix_cpf: string;
        pagfast_pix_full_name: string;
    };
    [AffPaymentMethodType.EzzeBank]: {
        ezzebank_cnpj: string;
        ezzebank_email: string;
    };
    [AffPaymentMethodType.USDCERC20]: {
        usdc_erc20_wallet: string;
    };
};
```

## Build a tracking link for an affiliate

The operator can use the HTTP POST method to build a tracking link for specific affilite\_id and specific destination link\_id.&#x20;

The API key is the same as described [here](https://help.theaffiliateplatform.com/apis-and-configurations/api-keys-and-url#obtaining-api-key-for-operator)

```bash
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
        }
    }
}'
```

## Get available destination links

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

The API key is the same as described [here](https://help.theaffiliateplatform.com/apis-and-configurations/api-keys-and-url#obtaining-api-key-for-operator)

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

Example of response:

```json
[
    {
        "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](https://help.theaffiliateplatform.com/apis-and-configurations/api-keys-and-url#obtaining-api-key-for-operator).

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

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

Example of response:

```jsonp
[
    {
        // 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**

```bash
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)

```bash
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"
}'
```

## Manage promo codes

The operator can use the HTTP API to manage promo codes for affiliates. \
\
The API key is the same as described [here](https://help.theaffiliateplatform.com/apis-and-configurations/api-keys-and-url#obtaining-api-key-for-operator).

### Get a list of promo codes

Use the HTTP GET method to get a list of promo codes.

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

You can pass optional query parameters to filter the results:

```typescript
//Search by promo code name (case-insensitive). Use `@` prefix to search by ID, e.g. `@123`
    "q": string; 
//Filter by status. `true` for active, `false` for inactive  
    "status": boolean;
```

Example of a filtered request:

```bash
curl --location 'https://boapi.smartico.ai/api/af2_promo_codes_op?status=true' \
--header 'authorization: your-api-key' \
--data ''
```

Example of response:

```json
[
    {
        // unique ID of the promo code
        "id": 150,
        "promocode_id": 150,
        // the promo code string
        "promocode": "WELCOME2026",
        // internal description (visible only for operator)
        "description_internal": "Welcome bonus for new signups",
        // public description (visible to affiliates)
        "description_public": "Get 100% bonus on first deposit",
        // operator ID
        "operator_id": 2354,
        // affiliate ID to whom this promo code belongs
        "affiliate_id": 166368,
        // affiliate name
        "affiliate_name": "AffPartner",
        // deal ID assigned to this promo code
        "deal_id": 93195,
        // deal group name
        "deal_group_name": "Default deal",
        // start date from which the promo code is valid (ISO 8601)
        "start_date": "2026-01-01T00:00:00.000Z",
        // end date until which the promo code is valid (ISO 8601), null if no expiry
        "end_date": "2026-12-31T23:59:59.000Z",
        // status of the promo code
        // true - active
        // false - inactive
        "status": true,
        // back office username of the creator
        "username": "admin",
        // creation timestamp
        "create_date": "2026-01-15T10:30:00.000Z",
        // last update timestamp
        "update_date": "2026-02-01T14:20:00.000Z"
    }
]
```

### Get a single promo code by ID

Use the HTTP GET method with the promo code ID in the URL:

```bash
curl --location 'https://boapi.smartico.ai/api/af2_promo_codes_op/150' \
--header 'authorization: your-api-key' \
--data ''
```

The response will contain a single promo code object with the same structure as described above.

### Create a new promo code

Use the HTTP POST method to create a new promo code.

```bash
curl --location 'https://boapi.smartico.ai/api/af2_promo_codes_op' \
--header 'authorization: your-api-key' \
--header 'Content-Type: application/json' \
--data '{
    "promocode": "SUMMER2026",
    "description_internal": "Summer campaign promo code",
    "description_public": "Get 50% bonus on your deposit",
    "affiliate_id": 166368,
    "deal_id": 93195,
    "start_date": "2026-06-01T00:00:00.000Z",
    "end_date": "2026-08-31T23:59:59.000Z",
    "status": true
}'
```

Full list of request body fields below:

```
{
     "promocode": string; //The promo code string. Must be unique per operator. 
     "affiliate_id": number; // ID of the affiliate to whom this promo code belongs.
     "deal_id": number; //ID of the deal assigned to this promo code. Must be a valid deal for the specified affiliate.
     "status": boolean; // `true` for active, `false` for inactive.
     "description_internal": string; // Internal description visible only for the operator.
     "description_public": string //Public description visible to affiliate.
     "start_date": string // Start date from which the promo code is valid (ISO 8601).
     "end_date": string //End date until which the promo code is valid (ISO 8601).
}
```

\
**Important to know:**<br>

* The following fields are mandatory: "promocode", "affiliate\_id", "status", "start\_date"
* The "promocode" must be unique. If a promo code with the same name already exists, the API will return an error: `"The promocode with this name already exists. Please use a different promocode."`
* The "deal\_id" must be a valid deal for the specified "affiliate\_id" . If the deal does not belong to the affiliate, the API will return an error: `"Invalid deal for selected affiliate"`. If no "deal\_id" is passed, the deal assigned to the promocode will be the home deal of the affiliate.

### Update an existing promo code

Use the HTTP PUT method with the promo code ID in the URL.

```bash
curl --location --request PUT 'https://boapi.smartico.ai/api/af2_promo_codes_op/150' \
--header 'authorization: your-api-key' \
--header 'Content-Type: application/json' \
--data '{
    "promocode": "SUMMER2026-UPDATED",
    "status": false,
    "end_date": "2026-07-31T23:59:59.000Z"
}'
```

You only need to include the fields you want to update. All fields from the create request are supported except `affiliate_id` and `deal_id` , which cannot be changed independently without the other (both must be provided together for re-validation).

Full list of supported properties:

```
{
     // The promo code string.
     "promocode": string; 
     // ID of the affiliate
     "affiliate_id": number;
     // ID of the deal. If provided with "affiliate_id", the deal will be validated against the affiliate.
     "deal_id": number; 
     // "true" for active, "false" for inactive.
     "status": boolean; 
     // Internal description
     "description_internal": string; 
     // Public description
     "description_public": string 
     // Start date (ISO 8601).
     "start_date": string 
     // End date (ISO 8601).
     "end_date": string 
}
```

\
Example of an API call for deactivation of promo code:<br>

```bash
curl --location --request PUT 'https://boapi.smartico.ai/api/af2_promo_codes_op/150' \
--header 'authorization: your-api-key' \
--header 'Content-Type: application/json' \
--data '{
    "status": false
}'
```
