Skip to content

Send player's activity

The internal architecture of Affiliate Control is based on an event-driven approach. This means that you should send us separate messages about each event that occurs on your side, e.g. new player registration, new deposit or bet coupon calculation, etc. We process these events with the lowest possible delay, so you'll typically see report updates within seconds of the message being sent.

Events Service

We accept events from your iGaming platform via dedicated HTTP service.
This service accepts POST requests with JSON object (one event per request) or array of JSON objects (multiple events per one request) in body.

Tip

We recommend to batch events in packets (send them as array of objects) and use gzip compression to reduce network traffic and speedup uploads.

Warning

Maximum allowed POST body size is 32MB.

Service Endpoints

Test environment
https://events-gw.internal.test.affiliatecontrol.net/events/SITE_ID
Production environment
https://events-gw.internal.production.affiliatecontrol.net/events/SITE_ID

Note

SITE_ID should be replaced with actual ID which we will assign to each of your site.

Authorization

Each request to events service should contain Authorization HTTP header. This header must contain Base64-encoded basic auth token. We will provide you username and password.

Basic Auth header generation
echo -n 'username:password' | base64

dXNlcm5hbWU6cGFzc3dvcmQ=
Example header
Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=

Handling response

In case of successful upload service responds with 200 OK HTTP status code.

If any error is occured, you will need to retry your request.

Request example

cURL request example
curl 'https://events.svc/' \ # (1)
  -X POST \
  -H "Content-Type: application/json" \
  -H "Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ=" \ # (2)
  -d '[{"meta":{"timestamp":1515489534,"eventType":1,"brand":"test","btag":"d_1m_1c_ts_Ro9drDPaiXNrea9HZ93bTn","playerId":"123"},"data":{}},{"meta":{"timestamp":1515489534,"eventType":1,"brand":"test","btag":null,"playerId":"456"},"data":{}}]' 
  1. events.svc is just an example hostname. You need to replace it with the actual service hostname from the section above.
  2. Base64 encoded string username:password.

Event Structure

Each event is a JSON object with meta and data fields in it. Fields with mark REQUIRED can't be undefined. OPTIONAL fields can be completely omitted from object. null value of field can be used to say us "delete saved value".

For meta there is:

{
  "timestamp": 1672412396,
  "eventType": 0,
  "btag": null,
  "playerId": "1234567890",
  "signature": "3770fc321aa701ece6454b873c9f8506"
}
  • (REQUIRED): timestamp (Number) - Event timestamp (seconds).
  • (REQUIRED): eventType (Number) - Event type ID (described below).
  • (REQUIRED): playerId (String) - Player identifier. This is highly recommended to send ID that user can see in his profile, because some of your partners may ask his players for this ID.
  • (REQUIRED): signature (String) - Signature is used to verify received data. This is a md5-hash of the string which contains timestamp, salt and playerId with pipe-symbol | as a splitter. e.g.: 1672412396|your-secret-salt|12345678903770fc321aa701ece6454b873c9f8506. If signature verification fails, your request won't be accepted.
  • (OPTIONAL): btag (String | null) - Btag. This field is required only for registration event (but can be null). For other event types you can omit this field because playerId is sufficient to identify player.

data contains specific fields for each event as described below.

Event Types

Player Account

Registration (eventType = 1)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 1,
    "btag": null,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "firstName": "Firstname",
    "lastName": "Lastname",
    "email": "[email protected]",
    "phoneNumber": "+15555551234",
    "countryCode": "US",
    "cityName": "New York",
    "registrationType": "Website",
    "domain": "example.com",
    "promoCode": "abc",
  }
}
  • (OPTIONAL): firstName (String) - First name.
  • (OPTIONAL): lastName (String) - Last name.
  • (OPTIONAL): email (String) - Email.
  • (OPTIONAL): phoneNumber (String) - Phone number in international format (E.164).
  • (OPTIONAL): countryCode (String) - Country code (ISO 3166-1 alpha-2). Although this field is optional, it is highly recommended that you set it as the offer country rules will not work without this attribute.
  • (OPTIONAL): cityName (String) - City name.
  • (OPTIONAL): registrationType (String) - Registration type (e.g.: Website, Mobile App).
  • (OPTIONAL): domain (String) - Product domain where registration event happened (e.g. example.com)
  • (OPTIONAL): promoCode (String) - Player registration promo code.

Phone number changed (eventType = 2)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 2,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "phoneNumber": "+15555551234"
  }
}
  • (REQUIRED): phoneNumber (String | null) - Phone number in international format (E.164). null means to delete saved phone number.

Email changed (eventType = 3)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 3,
    "btag": null,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "email": "[email protected]"
  }
}
  • (REQUIRED): email (String | null) - Email. null means to delete saved email.

Location changed (eventType = 4)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 4,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "countryCode": "US",
    "cityName": "New York"
  }
}
  • (REQUIRED): countryCode (String | null) - Country code (ISO 3166-1 alpha-2). null means to delete saved country code.
  • (REQUIRED): cityName (String | null) - City name. null means to delete saved city name.

Name changed (eventType = 5)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 5,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "firstName": "Firstname",
    "lastName": "Lastname"
  }
}
  • (REQUIRED): firstName (String | null) - First name. null means to delete saved first name.
  • (REQUIRED): lastName (String | null) - Last name. null means to delete saved last name.

Balance Operations

Deposit (eventType = 7)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 7,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "id": "1",
    "sum": 1.23,
    "currencyCode": "USD",
    "paymentSystem": "Visa",
    "paymentAgent": "HSBC"
  }
}
  • (REQUIRED): id (String) - Operation ID.
  • (REQUIRED): sum (Number) - Deposit amount.
  • (REQUIRED): currencyCode (String) - Currency code (ISO 4217).
  • (OPTIONAL): paymentSystem (String) - Name of payment system.
  • (OPTIONAL): paymentAgent (String) - Name of payment agent.

Withdrawal (eventType = 8)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 8,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "id": "1",
    "sum": 1.23,
    "currencyCode": "USD",
    "paymentSystem": "Visa",
    "paymentAgent": "HSBC"
  }
}
  • (REQUIRED): id (String) - Operation ID.
  • (REQUIRED): sum (Number) - Withdrawal amount.
  • (REQUIRED): currencyCode (String) - Currency code (ISO 4217).
  • (OPTIONAL): paymentSystem (String) - Name of payment system.
  • (OPTIONAL): paymentAgent (String) - Name of payment agent.

Bonus Wagering (eventType = 15)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 15,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "id": "1",
    "toBalanceSum": 1.23,
    "currencyCode": "USD"
  }
}
  • (REQUIRED): id (String) - Operation ID.
  • (REQUIRED): toBalanceSum (Number) - Amount credited to player main balance.
  • (REQUIRED): currencyCode (String) - Currency code (ISO 4217).

Bonus Recalculated (eventType = 20)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 20,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "id": "1",
    "previousToBalanceSum": 1.23,
    "newToBalanceSum": 4.38,
    "currencyCode": "USD"
  }
}
  • (REQUIRED): id (String) - Operation ID.
  • (REQUIRED): previousToBalanceSum (Number) - Amount credited to player's balance that should be rolled back.
  • (REQUIRED): newToBalanceSum (Number) - New amount that will be credited to player's balance.
  • (REQUIRED): currencyCode (String) - Currency code (ISO 4217).

Sports

New Bet Coupon (eventType = 9)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 9,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "couponId": "1",
    "betSum": 1.23,
    "currencyCode": "USD",
    "isBonus": false,
    "promoCode": null,
    "odd": 4.56,
    "source": "Web",
    "coupon": [
      {
        "gameId": "1",
        "type": "Line",
        "category": "Basketball",
        "league": "NBA",
        "team1": "Golden State Warriors",
        "team2": "Los Angeles Lakers"
      }
    ]
  }
}
  • (REQUIRED): couponId (String) - Coupon ID.
  • (REQUIRED): betSum (Number) - Bet amount.
  • (REQUIRED): currencyCode (Number) - Currency code (ISO 4217).
  • (OPTIONAL): isBonus (Boolean) - Bet should be treated as a "free bet".
  • (OPTIONAL): promoCode (String | null) - Promo code used in bet slip (if promo code is provided, the bet is also treated as a "free bet").
  • (OPTIONAL): odd (Number) - Total odd of bet slip.
  • (OPTIONAL): source (String) - Bet source (e.g. Web, Mobile App).
  • (OPTIONAL): coupon (Array) - Array containing bet slip.
  • (OPTIONAL): coupon[].gameId (String) - ID.
  • (OPTIONAL): coupon[].type (String) - Type (Live or Line).
  • (OPTIONAL): coupon[].category (String) - Category (e.g. Basketball).
  • (OPTIONAL): coupon[].league (String) - League (e.g. NBA).
  • (OPTIONAL): coupon[].team1 (String) - Name of first team.
  • (OPTIONAL): coupon[].team2 (String) - Name of second team.

Bet Coupon Calculation (eventType = 10)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 10,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "couponId": "1",
    "betSum": 1.23,
    "winSum": 5.6088,
    "currencyCode": "USD",
    "isBonus": false,
    "promoCode": null,
    "odd": 4.56,
    "source": "Web",
    "coupon": [
      {
        "gameId": "1",
        "type": "Line",
        "category": "Basketball",
        "league": "NBA",
        "team1": "Golden State Warriors",
        "team2": "Los Angeles Lakers"
      }
    ]
  }
}
  • (REQUIRED): couponId (String) - Bet slip ID.
  • (REQUIRED): betSum (Number) - Bet slip amount.
  • (REQUIRED): winSum (Number) - Amount to be credited to player's balance (winnings).
  • (REQUIRED): currencyCode (String) - Currency code (ISO 4217).
  • (OPTIONAL): isBonus (Boolean) - Bet should be treated as a "free bet".
  • (OPTIONAL): promoCode (String) - Promo code used in bet slip (if promo code is provided, the bet is also treated as a "free bet").
  • (OPTIONAL): odd (Number) - Total odd of bet slip.
  • (OPTIONAL): source (String) - Bet source (e.g. Web, Mobile App).
  • (OPTIONAL): coupon (Array) - Array containing bet slip.
  • (OPTIONAL): coupon[].gameId (String) - ID.
  • (OPTIONAL): coupon[].type (String) - Type (Live or Line).
  • (OPTIONAL): coupon[].category (String) - Category (e.g. Basketball).
  • (OPTIONAL): coupon[].league (String) - League (e.g. NBA).
  • (OPTIONAL): coupon[].team1 (String) - Name of first team.
  • (OPTIONAL): coupon[].team2 (String) - Name of second team.

Bet Sell (eventType = 11)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 11,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "couponId": "1",
    "toBalanceSum": 1.23,
    "newBetSum": 0,
    "commissionSum": 0,
    "currencyCode": "USD",
    "isBonus": false,
    "promoCode": null,
    "odd": 4.56,
    "source": "Web",
    "coupon": [
      {
        "gameId": "1",
        "type": "Line",
        "category": "Basketball",
        "league": "NBA",
        "team1": "Golden State Warriors",
        "team2": "Los Angeles Lakers"
      }
    ]
  }
}
  • (REQUIRED): couponId (String) - Bet slip ID.
  • (REQUIRED): toBalanceSum (Number) - Amount credited to player main balance.
  • (REQUIRED): newBetSum (Number) - New bet slip amount.
  • (REQUIRED): commissionSum (Number) - Sell fee.
  • (REQUIRED): currencyCode (String) - Currency code (ISO 4217).
  • (OPTIONAL): isBonus (Boolean) - Bet should be treated as a "free bet".
  • (OPTIONAL): promoCode (String) - Promo code used in bet slip (if promo code is provided, the bet is also treated as a "free bet").
  • (OPTIONAL): odd (Number) - Total odd of bet slip.
  • (OPTIONAL): source (String) - Bet source (e.g. Web, Mobile App).
  • (OPTIONAL): coupon (Array) - Array containing bet slip.
  • (OPTIONAL): coupon[].gameId (String) - ID.
  • (OPTIONAL): coupon[].type (String) - Type (Live or Line).
  • (OPTIONAL): coupon[].category (String) - Category (e.g. Basketball).
  • (OPTIONAL): coupon[].league (String) - League (e.g. NBA).
  • (OPTIONAL): coupon[].team1 (String) - Name of first team.
  • (OPTIONAL): coupon[].team2 (String) - Name of second team.

Buying Bet Insurance (eventType = 13)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 13,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "couponId": "1",
    "insuranceCost": 1.23,
    "currencyCode": "USD"
  }
}
  • (REQUIRED): id (String) - Operation ID.
  • (REQUIRED): insuranceCost (Number) - Cost of the insurance.
  • (REQUIRED): currencyCode (String) - Currency code (ISO 4217).

Bet Insurance Payout (eventType = 14)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 14,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "couponId": "1",
    "paymentSum": 1.23,
    "currencyCode": "USD"
  }
}
  • (REQUIRED): id (String) - Operation ID.
  • (REQUIRED): paymentSum (String) - Amount credited to player main balance.
  • (REQUIRED): currencyCode (String) - Currency code (ISO 4217).

Bet Coupon Recalculated (eventType = 18)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 18,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "couponId": "1",
    "betSum": 1.23,
    "previousWinSum": 5.6088,
    "newWinSum": 0,
    "currencyCode": "USD",
    "isBonus": false,
    "promoCode": null,
    "source": "Web"
  }
}
  • (REQUIRED): couponId (String) - Bet slip ID.
  • (REQUIRED): betSum (Number) - Bet slip amount.
  • (REQUIRED): previousWinSum (Number) - Winnings amount that should be rolled back.
  • (REQUIRED): newWinSum (Number) - New winnings amount that will be credited to player's balance.
  • (REQUIRED): currencyCode (String) - Currency code (ISO 4217).
  • (OPTIONAL): isBonus (Boolean) - Bet should be treated as a "free bet".
  • (OPTIONAL): promoCode (String) - Promo code used in bet slip (if promo code is provided, the bet is also treated as a "free bet").
  • (OPTIONAL): source (String) - Bet source (e.g. Web, Mobile App).

Casino & Games

Spin (eventType = 16)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 16,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "id": "1",
    "betSum": 1.23,
    "currencyCode": "USD",
    "providerId": "1",
    "gameId": "1"
  }
}
  • (REQUIRED): id (String) - Operation ID.
  • (REQUIRED): betSum (Number) - Bet slip amount.
  • (REQUIRED): currencyCode (String) - Currency code (ISO 4217).
  • (OPTIONAL): providerId (String) - Game provider ID.
  • (OPTIONAL): gameId (String) - Game ID.

Win (eventType = 17)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 17,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "id": "1",
    "winSum": 4.56,
    "currencyCode": "USD",
    "providerId": "1",
    "gameId": "1"
  }
}
  • (REQUIRED): id (String) - Operation ID.
  • (REQUIRED): winSum (Number) - Amount to be credited to player's balance (winnings).
  • (REQUIRED): currencyCode (String) - Currency code (ISO 4217).
  • (OPTIONAL): providerId (String) - Game provider ID.
  • (OPTIONAL): gameId (String) - Game ID.

Winning recalculated (eventType = 19)

{
  "meta": {
    "timestamp": 1672412396,
    "eventType": 19,
    "playerId": "1234567890",
    "signature": "3770fc321aa701ece6454b873c9f8506"
  },
  "data": {
    "id": "1",
    "previousWinSum": 5.6088,
    "newWinSum": 0,
    "currencyCode": "USD",
    "providerId": "1",
    "gameId": "1"
  }
}
  • (REQUIRED): id (String) - Operation ID.
  • (REQUIRED): previousWinSum (Number) - Winnings amount that should be rolled back.
  • (REQUIRED): newWinSum (Number) - New winnings amount that will be credited to player's balance.
  • (REQUIRED): currencyCode (String) - Currency code (ISO 4217).
  • (OPTIONAL): providerId (String) - Game provider ID.
  • (OPTIONAL): gameId (String) - Game ID.

Last update: August 30, 2024