> For the complete documentation index, see [llms.txt](https://help.theaffiliateplatform.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.theaffiliateplatform.com/apis-and-configurations/more-api-methods.md).

# More API methods

{% hint style="info" %}
This document describes how to get a list of affiliates, update affiliate details, build a tracking link for an affiliate, get a list of available destination links, and manage pixel definitions and promo codes 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, next to the operator API key (see [API Keys and URL](https://help.theaffiliateplatform.com/apis-and-configurations/api-keys-and-url.md)).
{% 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 filter the results with the `filter` URL parameter. It is a JSON object with these optional fields:

```typescript
//Filter by affiliate status
    "aff_status_id": number[]; 
//Set true to skip the balance calculation, false (default) to include it
    "without_money": boolean;
//Search text in the affiliate name, username, email, contacts, company, external ID and more. Use `@` prefix to search by ID, e.g. `@123`
    "q": string;
//Filter by the ID of the affiliate in your system
    "ext_affiliate_id": string;
//Filter by the parent affiliate
    "parent_affiliate_id": number;
```

{% 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.** In that case `balance` is 0, and `commissions_total`, `payments`, `adjustments` and `sub_affiliate_fee` are `null`.
{% endhint %}

{% hint style="warning" %}
Note that API returns up to 1000 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": "Affiliate Name",
        "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": "Someone",
            "swift_code": "XX123",
            "back_country": "XX",
            "account_number": "XX123-41231-55"
        },
        "payment_threshold_oper_currency": null,
        "bo_label_id": 3111,
        "label_name": "AFFILIATE NAME / 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": "affiliate@example.com",
        "avatar_image_url": null,
        "two_fa_enabled": false,
        "api_access_enabled": true,
        "first_name": "Affiliate",
        "last_name": "Name",
        "phone_number": "",
        "skype": "",
        "contact_fb": "",
        "contact_vk": "",
        "contact_telegram": "",
        "enabled_for_login": true,
        "language": "EN",
        "operator_currency": "EUR",
        "manager_id": 2342,
        "manager_username": "account.manager",
        "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**" represents 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,

    // No deal type
    None = 16
}
```

The field **`extra_role_ids`** represents permissions to the additional measurements that are visible for the affiliate or access to the "Registrations report". In the BackOffice, these are the **Additional permissions** of the affiliate. 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 and amount 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
    AffOperationsOrActivitiesCount = 265, // Count of activities (operations)
    AffVolumeOrBets = 266, // Volume/bet amount, as reported by platform
    AffAdminFee = 273, // Admin fee
    AffLastOperationDate = 342 // Last date of operational activity
}
```

<figure><img src="https://2789002490-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fkbip9hFgRFwIv4mXJPnz%2Fuploads%2FJIqvM8412Qx9RLPrwrqu%2Fimage.png?alt=media&amp;token=c914f91d-efbd-4ed7-8ad3-95103c7ebaa8" alt=""><figcaption><p>Additional permissions block in the affiliate's profile</p></figcaption></figure>

Possible statuses of affiliate: `aff_status_id`

```typescript
export enum AffiliateStatus {
    Pending = 1,
    Approved = 2,
    Declined = 3,
    Suspended = 4,
    ViewOnly = 5, // "View only" in the BackOffice
    Blocked = 6,
    BlockedData = 7 // "Blocked (Data Only)" in the BackOffice
}
```

### 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. If the affiliate has no parent, pass `"parent_affiliate_id": null`.
{% 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
    // after the status was changed, you cannot set it back to 1 (Pending)
    "ext_affiliate_id": "some_id_in_external_system",
    "no_carry_over": true, 
    // to enable/disable 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 the tag option with ID 33; null removes the tag
    // 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,
    // enable/disable 2FA verification
    "api_access_enabled": true,
    // enable/disable access for affiliate via API; false also deletes the API key of the affiliate
    "extra_role_ids": [103, 104, 122],
    // additional permissions, see AffExtraRoles above
    // the list replaces all current permissions of the affiliate; null removes all of them
    "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
    // always send payment_method_id together with payment_method_details
    "brand_ids": [333]
    //associate affiliate with one or more of your brands; has simply informational purpose
}
```

Possible payment methods (payment\_method\_id)

```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,
    USDC_ERC20 = 21,
}
```

Possible payment method details (payment\_method\_details). Fields marked with `?` are optional; the others are required in the BackOffice.

```typescript
export type AffPaymentMethodDetails = {
    [AffPaymentMethodType.WireTransfer]: {
        vat?: string;
        beneficary: string;
        account_number: string;
        back_country: string;
        bank_name: string;
        bank_branch?: string;
        bank_city?: string;
        swift_code: string;
        iban?: string;
        ana?: string; // ABA number
        correspondent?: string;
    };
    [AffPaymentMethodType.Netteller]: {
        netteller_vat?: string;
        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.USDC_ERC20]: {
        usdc_erc20_wallet: string;
    };
};
```

{% hint style="warning" %}
Use the field names exactly as listed above, including `beneficary`, `back_country` and `ana` for Wire Transfer. Always send `payment_method_id` together with `payment_method_details`, and only the fields of that payment method.
{% endhint %}

## Build a tracking link for an affiliate

The operator can use the HTTP POST method to build a tracking link for specific affiliate\_id and specific destination link\_id.

The API key is the same as described [here](https://help.theaffiliateplatform.com/apis-and-configurations/api-keys-and-url.md#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
        }
    }
}'
```

Example of response:

```json
{
    "errCode": 0,
    "message": null,
    "url": "https://go.aff.theaffiliateplatform.com/l0l6otqy",
    "shortUrl": null,
    "asset_type_id": null,
    "asset_content": null,
    "urlWithCustomSlug": null,
    "shortUrlWithCustomSlug": null
}
```

The tracking link is in `url`. \
The same parameters always return the same link.

**Required parameters:**

* `affiliate_id` - The affiliate the link is for. It must be one of the affiliates you can see. An affiliate who calls it gets their own ID, whatever they send.
* `link_id` - The destination link to build the tracking link for. It must belong to one of your brands.

**Optional parameters:**

* `asset_id` - A media asset (banner, HTML) to attach. The response then returns the asset's content.
* `deal_group_id` - Ties the link to one specific deal. It must be a deal of that same affiliate.
* `campaign_id` - A number uses an existing campaign. Text creates a new campaign with that name and uses it.
* `source_id` - A free-text source tag. It is also saved in the affiliate's list of sources.
* `hide_campaign_n_source` - `false` (default) puts campaign and source in the link as visible parameters. `true` keeps them out of the link and stores them on the tracking link instead.
* `afps` - Extra parameters added to the end of the link as-is, for example `afp=abc&afp2=xyz`. Write it as a ready query string without the leading `?`.
* `custom_slug` - A friendly name for the link, used instead of the random code. It is set only if the link has no slug yet. An existing slug is kept, and a slug already used elsewhere is rejected.

## Get available destination links

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

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

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

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 API to manage pixel definitions for the affiliate: HTTP GET to read them, POST to create and PUT to update.

The API key is the same as described [here](https://help.theaffiliateplatform.com/apis-and-configurations/api-keys-and-url.md#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'
```

Example of response:

```typescript
[
    {
        // 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 (S2S HTTP)
        // 7 - FB/Instagram API
        // 8 - TikTok API
        // 3 - Client image, 4 - Client iframe, 5 - Client JavaScript, 6 - Facebook: deprecated
        "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",
    "deal_id": -1,
    "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"
}'
```

Set `deal_id` to the ID of one of the affiliate's deals, or to -1 to trigger the pixel for all deals of the affiliate. -1 is also used when you do not pass `deal_id`.

For `pixel_type_id` 7 and 8, send `"pixel": ""` and pass these fields instead of a URL:

* 7 (FB/Instagram API): `meta_pixel_id` and `meta_access_token`
* 8 (TikTok API): `meta_pixel_code` and `meta_access_token`

To **update existing pixel definition** (pay attention that the ID of the definition should be passed in the URL, 2888 in our example). The **ID** column of the **Pixel Definitions** tab in the affiliate profile shows it.

```bash
curl --location --request PUT 'https://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"
}'
```

{% hint style="warning" %}
To change the `pixel` URL, also pass `pixel_type_id` in the same request. When you update a pixel of type 7 or 8, always send `pixel_type_id` and the `meta_` fields of the type in the same request.
{% endhint %}

<figure><img src="https://2789002490-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fkbip9hFgRFwIv4mXJPnz%2Fuploads%2FfxO3n2OZXuozROuDRwdW%2Fimage.png?alt=media&amp;token=2a12b5fa-4359-4dc4-87da-2a492763725f" alt=""><figcaption><p>Pixel Definitions tab in the affiliate profile</p></figcaption></figure>

## 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.md#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'
```

You can filter the results with the `filter` URL parameter. It is a JSON object with these optional fields:

```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 --globoff 'https://boapi.smartico.ai/api/af2_promo_codes_op?filter={"status":true}' \
--header 'authorization: your-api-key'
```

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

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": "SUMMER2027",
    "description_internal": "Summer campaign promo code",
    "description_public": "Get 50% bonus on your deposit",
    "affiliate_id": 166368,
    "deal_id": 93195,
    "start_date": "2027-06-01T00:00:00.000Z",
    "end_date": "2027-08-31T23:59:59.000Z",
    "status": true
}'
```

Full list of request body fields below:

```typescript
{
     "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", "description\_public", "start\_date". If "status" is not passed, the promo code is active. "description\_public" represents Notes for Affiliate field in Promocode builder in TAP Back Office
* The "promocode" must be unique. Upper and lower case letters count as the same. 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."`
* "start\_date" and "end\_date" cannot be in the past, and "end\_date" cannot be earlier than "start\_date". Otherwise the API returns an error, for example `"Start date cannot be in the past"` or `"End date cannot be earlier than Start date"`.
* 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": "SUMMER2027-UPDATED",
    "status": false,
    "end_date": "2027-07-31T23:59:59.000Z"
}'
```

You only need to include the fields you want to update. To change `affiliate_id` or `deal_id`, pass both of them in the same request.

Full list of supported properties:

```typescript
{
     // The promo code string.
     "promocode": string; 
     // ID of the affiliate
     "affiliate_id": number;
     // ID of the deal. Pass it together with "affiliate_id".
     "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
}'
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.theaffiliateplatform.com/apis-and-configurations/more-api-methods.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
