# Requirements for product API

Preferred format is `CSV` (for large datasets), but `JSON` is also acceptable.

All timestamps must be in `UTC` timezone without any exceptions and must be formatted with `ISO 8601` standard. <https://en.wikipedia.org/wiki/ISO_8601>. Example: `YYYY-MM-DD HH:MM:SS`

Your web server must correctly see the space in the endpoint URL, which can be represented either by `+` or `%20`

Most endpoints receive `from` and `to` GET parameters and must respond with rows, whose `last modify timestamp` is within range `>= from` and `< to` (half-closed interval)

In each response, each row must contain the last modification timestamp. Timestamps can’t be decreased.

You can use any authorization method (md5 auth, signature, basic, OAuth, login+password). We only need examples or descriptions of how we can authorize.

### Example

Here is an example of how InTarget gets users every hour (could be changed) from your product (Let's name it "SpaceVegas"):

* At `2020-10-10 08:00:01` InTarget will request the URL: `https://space-vegas.com/api/users?from=2020-10-10+07:00:00&to=2020-10-10+08:00:00`
* SpaceVegas must return all users that registered or changed something within this hour (from 07:00 to 08:00). Example:

<table><thead><tr><th width="150">id</th><th width="207">registered_at</th><th width="206">modified_at</th><th width="150">birthday</th><th width="309">email</th></tr></thead><tbody><tr><td>58013</td><td>2020-10-06 02:02:14</td><td>2020-10-10 07:58:22</td><td>1985-07-10</td><td>kaftai1@test.com</td></tr><tr><td>51153</td><td>2020-10-06 11:43:43</td><td>2020-10-10 07:12:09</td><td>2002-09-06</td><td></td></tr><tr><td>86603</td><td>2017-05-09 02:32:24</td><td>2020-10-10 07:20:11</td><td>1985-05-27</td><td></td></tr><tr><td>28748</td><td>2016-08-07 18:37:52</td><td>2020-10-10 07:47:16</td><td>1983-07-07</td><td>mad.groeing@test.com</td></tr><tr><td>58477</td><td>2020-10-10 07:40:04</td><td>2020-10-10 07:40:39</td><td>2002-10-10</td><td>ikitchmn7@test.com</td></tr><tr><td>32135</td><td>2019-04-27 11:04:22</td><td>2020-10-10 07:23:48</td><td>1990-06-22</td><td>germaut333@test.com</td></tr><tr><td>58557</td><td>2020-10-10 07:11:32</td><td>2020-10-10 07:11:32</td><td>1996-03-12</td><td></td></tr><tr><td>58570</td><td>2020-10-07 19:34:10</td><td>2020-10-10 07:03:45</td><td>1994-09-07</td><td>loniator@test.com</td></tr><tr><td>53316</td><td>2020-06-09 04:31:30</td><td>2020-10-10 07:24:13</td><td>1983-07-02</td><td>semrg735@test.com</td></tr><tr><td>58208</td><td>2020-10-01 07:45:19</td><td>2020-10-10 07:42:08</td><td>1988-02-19</td><td>krist88.1081@test.comm</td></tr></tbody></table>

* InTarget will save these users (insert newly registered and update old ones)
* In the next hour, InTarget will go for another batch of users with datetime modification between `2020-10-10 08:00:00` and `2020-10-10 09:00:00` using URL: `https://space-vegas.com/api/users?from=2020-10-10+08:00:00&to=2020-10-10+09:00:00`
* InTarget will make the same requests for transactions, wallets, contacts, and game data from SpaceVegas every hour

## List of endpoints with fields:

### Players (Registration + Personal Info Update):

{% embed url="<https://feed.intarget.app/api/feed/players?from=2023-07-20%2013:00:00&to=2023-07-21%2018:00:00>" %}
Feed Example
{% endembed %}

```json
{
        "id": "11ecc708-32d5-423b-bd59-7d114c26c979",
        "first_name": "Aniyah",
        "last_name": "Shanahan",
        "gender": "male",
        "country": "Liberia",
        "city": "North Angusland",
        "ip": "242.236.212.175",
        "locale": "ro_MD",
        "birthday": "1974-10-17",
        "registered_at": "2023-07-20 17:15:38",
        "ref_code": "praesentium",
        "traffic_source": "Tik-Tok",
        "user_agent": "Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.0; Trident/5.1)",
        "modified_at": "2023-07-20 15:19:03",
        "is_blocked": true,
        "is_active": false,
        "status": "Normal",
        "self_excluded": "False"
}
```

* **id** — player ID — **required**
* **first\_name**  — optional
* **last\_name**  — optional
* **gender** — optional
* **country** — optional
* **city** — optional
* **ip** — optional&#x20;
* **locale** — the user's preferred language with the country (en\_US, es, etc.) Must be in `ISO639` format. <https://en.wikipedia.org/wiki/ISO_639> —optional
* **birthday** — optional
* **registered\_at** — timestamp with a user registration date — **required**
* **ref\_code** —custom string for traffic source detection — optional
* **traffic\_source** — optional
* **user\_agent** — optional
* **modified\_at** — last modified date (must be updated every time the user changes something) — **required**
* **is\_blocked** — `true` if a user was blocked and can’t log in. `false` - otherwise — optional
* **self\_excluded** — `true` if a user should be unsubscribed from all types of communications. `false` - otherwise — optional

### Custom Fields in the "Players" feed:

If you have any additional information about your player, we can import them as custom fields with the following data types:&#x20;

* Integer
* Fractional number with two decimal places
* String
* Date (`YYYY-MM-DD HH:MM:SS`)

### Contacts:

{% embed url="<https://feed.intarget.app/api/feed/contacts?from=2023-07-20%2013:00:00&to=2023-07-21%2018:00:00>" %}
Feed Example
{% endembed %}

```json
{
        "player_id": "ec6a17d4-cd16-4d47-a927-711653025f62",
        "email": "znader@yahoo.com",
        "email_confirmed_at": "2023-07-20 21:57:21",
        "email_subscribe": false,
        "phone": "1-646-244-1503",
        "phone_subscribe": true,
        "phone_confirmed_at": "2023-07-20 23:59:38",
        "push_token": "u2rX45EyFM6zcgFCQCVUNG:V8-TE5bCsEkFxVTDfY2-HJRR9BB2-K8ABrQCrczREbtkGMdOFo_tXg6FytWQHuZNkmWDOLy8cl7QoTFbgZLRaUrnlU_RO7uPBGq53VQEhCVxqbw8CJ7CP6HVBqzKaocWmjWcBwqNqwTt",
        "created_at": "2023-07-20 19:57:47",
        "modified_at": "2023-07-20 23:27:49"
 }
```

* **player\_id** — **required**
* **email** — optional
* **email\_confirmed\_at** — timestamp when the email address was confirmed — optional
* **email\_subscribe** — `true` if the email is subscribed to any communication, `false` — otherwise — optional
* **phone** — optional
* **phone\_subscribe** — `true` if the phone number is subscribed to any communication, `false` — otherwise — optional
* **phone\_confirmed\_at** — timestamp when the phone number was confirmed— optional
* **push\_token** — optional
* **created\_at** — **required**
* **modified\_at** — **required**

### Transactions (Deposits, Withdrawals, Bonuses):

{% embed url="<https://feed.intarget.app/api/feed/transactions?from=2023-07-20%2013:00:00&to=2023-07-21%2018:00:00>" %}
Feed Example
{% endembed %}

```json
{
        "id": "99a59fef-79ae-3be9-8517-0a3515b613fe",
        "player_id": "0976dfcb-0110-4d5f-af4a-01664dc54f58",
        "amount": 969,
        "currency": "CVE",
        "type": "normal",
        "status": "Success",
        "payment_system": "VISA",
        "dir": "Out",
        "created_at": "2023-07-20 20:36:43",
        "updated_at": "2023-07-20 20:36:43",
        "invoice_id": "846f0f18-9e58-3a77-8e3c-afa7c61fb507",
        "wallet_id": "8BOfUkI3VLm6HoI2b6KnKd0pyim4X6D4",
        "user_agent": "Mozilla/5.0 (Windows; U; Windows NT 5.01) AppleWebKit/532.7.4 (KHTML, like Gecko) Version/5.0.2 Safari/532.7.4",
        "ip": "157.128.175.240",
        "requisite": "4916-1553-9365-8",
        "comment": "Ullam deserunt nam eos accusantium deserunt enim magnam. Adipisci cupiditate odio pariatur ipsum velit ea. Nostrum illum aut veniam eveniet quo non."
 }
```

* **id** — unique transaction identifier **— required**
* **player\_id — required**
* **amount — required**
* **currency** — original currency (`USD`, `EUR`, `AUD`, etc.) **— required**
* **type** — operation type (`Normal` (Real Money), `Prize`(Bonus), `Compensation`, `Cash back`, `Other`) — optional
* **status** — transaction current status (`New`, `Process`, `Success`, `Fail`) — optional
* **payment\_system** — payment system name — optional
* **dir** — balance change direction (`IN` or `OUT`) **— required**
* **created\_at** — timestamp when a transaction was created **— required**
* **updated\_at** — last modified timestamp (any change in the transaction must affect this date) **— required**
* **invoice\_id** — unique invoice identifier for external payment system — optional
* **wallet\_id** — ID of the affected wallet — optional
* **user\_agent** — optional
* **ip** — optional
* **requisite** — requisite used in payment (mask card number, email, phone, external wallet, etc.)  — optional
* **comment** — optional

### Logins:

{% embed url="<https://feed.intarget.app/api/feed/logins?from=2023-07-20%2013:00:00&to=2023-07-21%2018:00:00>" %}
Feed Example
{% endembed %}

```json
{
        "id": "e3717c77-3798-3a3d-828c-af00604517b3",
        "player_id": "2dc84cf0-bd9d-4415-80a4-c8d4a63f980b",
        "ip": "71.35.116.25",
        "created_at": "2023-07-20 16:54:01",
        "ref_code": "odit",
        "traffic_source": "Email",
        "user_agent": "Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/5.0)",
        "host": "https://hessel.com/consequatur-id-quo-et-hic-sunt.html",
        "is_success": true,
        "fail_reason": null
}
```

* **id** — unique login identifier **— required**
* **player\_id — required**
* **ip** — optional
* **created\_at — required**
* **ref\_code** — custom string for referral code detection — optional
* **traffic\_source** — custom string for traffic source detection — optional
* **user\_agent** — optional
* **host** — real hostname for possible mirrors — optional
* **is\_success** — `1` if the login was successful, `0` - otherwise — optional
* **fail\_reason** — custom description of login fail reason, empty if success— optional

### Wallets (Balances):

{% embed url="<https://feed.intarget.app/api/feed/wallets?from=2023-07-20%2013:00:00&to=2023-07-21%2018:00:00>" %}
Feed Example
{% endembed %}

```json
{
        "id": "-N5xU-htd_BCgT1G-5xR1C5Zo-6POPHO",
        "player_id": "b6334f88-16bf-48b5-bf28-171342ad8a04",
        "type": "Real",
        "balance": 574,
        "currency": "UGX",
        "created_at": "2023-07-21 00:00:01",
        "modified_at": "2023-07-21 02:15:51"
}
```

* **id** — unique wallet identifier **— required**
* **player\_id — required**
* **type** — operation type, like in transactions (`Normal` (Real Money), `Prize`(Bonus), `Other`) **— required**
* **balance** — balance sum **— required**
* **currency** — the currency of the wallet **— required**
* **created\_at — required**
* **modified\_at** — last modified timestamp (any balance change must affect this date) **— required**

### Casino Game Activity:

Endpoint with game activity has its unique approach to fetch all game sessions. There are three steps of data composition:

1. Find all game session ids that have at least one action within the time range `>=from` and `<to`
2. Find all past and future actions of this session ids, disregarding time.
3. Aggregate all data for each session. There must be one row in result data per one game session.

{% embed url="<https://feed.intarget.app/api/feed/game-sessions?from=2023-07-20%2013:00:00&to=2023-07-21%2018:00:00>" %}
Feed Example
{% endembed %}

```json
{
        "player_id": "59a83d8c-edf9-461e-aa56-8887085d98a7",
        "session_id": "6d13991f-f5ec-311a-9800-e18ad5df19e7",
        "game_code": 5,
        "game_name": "Lucky Lion",
        "currency": "XAF",
        "bet_count": 13,
        "win_count": 5,
        "bet_amount": 65,
        "win_amount": 117,
        "created_at": "2023-07-20 18:29:47",
        "updated_at": "2023-07-20 18:29:47",
        "game_vendor": "PARIPLAY",
        "balance_type": "normal",
        "ip": "223.102.23.37",
        "user_agent": "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_8_6 rv:4.0; nl-NL) AppleWebKit/532.22.3 (KHTML, like Gecko) Version/4.1 Safari/532.22.3",
        "ref_code": "qui"
}
```

* **player\_id — required**
* **session\_id** — unique session identifier **— required**
* **game\_code** — unique game identifier — optional
* **game\_name — required**
* **currency — required**
* **bet\_count** — count of all bets in this game session **— required**
* **win\_count** — count of all wins in this game session **— required**
* **bet\_amount** — the amount of all bets in this game session **— required**
* **win\_amount** — the amount of all wins in this game session **— required**
* **created\_at** — first action in session timestamp **— required**
* **updated\_at** — last action in session timestamp **— required**
* **game\_vendor** — optional
* **balance\_type** — operation type, like in transactions (`Normal` (Real Money), `Prize`(Bonus), `Other`) — optional
* **ip** — optional
* **user\_agent** — optional
* **ref\_code** — optional

### Sports Betting

#### Sports Betting Tournaments

{% embed url="<https://feed.intarget.app/api/feed/betting-tournaments?from=2023-07-20%2013:00:00&to=2023-07-21%2018:00:00>" %}
Feed Example
{% endembed %}

```json
{
        "id": "vlbl-fivb-mens-world-championship",
        "name": "FIVB Men's World Championship",
        "sport_id": "vlbl",
        "sport_name": "Volleyball",
        "country_code": "International",
        "dateStart": "2023-08-28 14:44:03",
        "dateEnd": "2023-08-31 14:44:03"
}
```

* **id** **— required**
* **name** **— required**
* **sport\_id** — optional
* **sport\_name** — optional
* **country\_code** — optional
* **dateStart** **— required**
* **dateEnd** — optional

#### Sports Betting Events

{% embed url="<https://feed.intarget.app/api/feed/betting-events?from=2023-07-20%2013:00:00&to=2023-07-21%2018:00:00>" %}
Feed Example
{% endembed %}

```json
{
        "id": "iihf-match-ice-hockey-world-championship",
        "tournament_id": "iihf-ice-hockey-world-championship",
        "title": "Bolivia - Peru",
        "status": "cancelled",
        "startTime": "2023-08-28 14:47:07",
        "endTime": "2023-08-28 15:47:07",
        "type": "outright"
}
```

* **id** **— required**
* **tournament\_id** **— required**
* **title** **— required**
* **status** **— required**
* **startTime** **— required**
* **endTime** — optional
* **type** **— required**

#### Sports Betting Bets

{% embed url="<https://feed.intarget.app/api/feed/betting-bets?from=2023-07-20%2013:00:00&to=2023-07-21%2018:00:00>" %}
Feed Example
{% endembed %}

```json
{
        "id": "2b2c4cd6-0631-3698-ba04-18dc2935eeca",
        "player_id": "11ecc708-32d5-423b-bd59-7d114c26c979",
        "status": "arbitrage_accepted",
        "type": "single",
        "stake": 490,
        "win_amount": 442,
        "currency": "CUC",
        "kind": "normal",
        "created_at": "2023-07-20 14:03:48",
        "user_agent": "Mozilla/5.0 (compatible; MSIE 10.0; Windows CE; Trident/3.1)",
        "modified_at": "2023-07-20 21:10:44"
}
```

####

* **id** **— required**
* **player\_id** **— required**
* **status** — optional
* **type** **— required**
* **stake** — optional
* **win\_amount** — optional
* **currency** — optional
* **kind** — operation type, like in transactions (`Normal` (Real Money), `Prize`(Bonus), `Other`)— optional
* **created\_at**  **— required**
* **user\_agent** — optional
* **modified\_at— required**

#### Sports Betting Odds

{% embed url="<https://feed.intarget.app/api/feed/betting-odds?from=2023-07-20%2013:00:00&to=2023-07-21%2018:00:00>" %}
Feed Example
{% endembed %}

```json
{
        "id": "f29525c1-add5-3f7e-862e-a94e4d5ca0ef",
        "bet_id": "2b2c4cd6-0631-3698-ba04-18dc2935eeca",
        "event_id": "tns-match-europe-tournament",
        "ratio": 3.6,
        "status": "win",
        "market": "Match Result",
        "created_at": "2023-07-20 22:42:49",
        "updated_at": "2023-07-20 22:42:49"
}
```

* id **— required**
* bet\_id **— required**
* event\_id **— required**
* ratio — optional
* status — optional
* market **— required**
* created\_at **— required**
* updated\_at **— required**
