Skip to content

Create template

This method helps create a new bonus template.

NOTE: This method is optional. The PartnerBoard is the most reasonable way to create new templates.

POST https://{S2S_API_URL}/bonuses/templates/add

A request examples:

An example using firebase/php-jwt and guzzlehttp/guzzle packages:

php
use Firebase\JWT\JWT;
use GuzzleHttp\Client;
$PARTNER_SECRET = 'testdemo';
$payload = [
    "name" => "Bonus freebet",
    "type" => "freebet_standart",
    "enable" => true,
    "betCount" => 1,
    "cid" => "fbet",
    "stage" => 1,
    "fromTime" => 1608664515,
    "toTime" => 1608833444,
    "daysToUse" => 1,
    "betAmount" => 5,
    "maxWin" => 4,
    "currency" => "USD",
    "minSelection" => 1,
    "maxSelection" => 2,
    "minOdd" => 1,
    "maxOdd" => 3,
    "disciplines" => [
    "csgo"
    ],
    "maxWinCurrency" => "USD",
    //availableCountries:["UA", "US"],
    //availableTournaments: ["123123", "2313132"],
];

$jwtParts = explode('.', JWT::encode($payload, $PARTNER_SECRET, 'HS256'));
$signature = implode('.', [$jwtParts[0], '', $jwtParts[2]]);

// x-sign-jws=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9..u9GyBh2rywlZb1arI76ffSq_hcrOkSqTZG4SXFQ0yhw
echo "x-sign-jws=$signature";

// send the request
$body = json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);

$url = 'https://{S2S_API_URL}/bonuses/templates/add';

$client = new Client();
$response = $client->request('POST', $url, [
    'body' => $body,
    'headers' => [
        "Content-type" => "application/json",
        "x-sign-jws" => $signature
    ]
]);

echo $response->getBody()->getContents();

The table below describes the following parameters:

ParameterTypeDescription
namestringName of the bonus (assigned by the Partner and displayed in the Partnerboard in the template list). Max length 255.
typestringBonus template type (freebet_standart). 
enablebooleanIndicator of the fact that the template is enabled when giving bonuses to users.
betCountintegerThe number of bonuses that can be given to one player by the current bonus template. Max number 1000.
cidstringPartner API Key.
stageintegerStage of bet:
1 - prematch
2 - live
3 - prematch and live
fromTimeintegerTimestamp in Unix Time defines the start date of the template to issue bonuses.
toTimeintegerTimestamp in Unix Time defines the end date of the template to issue bonuses. After this date, it will not be possible to use the bonus: the apply method will cause an error.
daysToUseintegerThe number of days after the bonus activation when the player has to use the bonus.Max number days 201.
betAmountfloatThe bet amount of bonuses can be issued per player according to the bonus template.
currencystringCurrency code. Sets the template’s currency.
maxWinfloatThe maximum possible amount of winnings in the currency specified in the maxWinCurrency value. maxWin = (betAmount*coefficient) - betAmount 
minSelectionintegerA minimum number of ticket (regular or combined) outcomes for one freebet issued on the current template.
maxSelectionintegerA maximum outcomes number in the ticket (regular or combined) per one freebet issued on the current template.
minOddfloatMinimum odds of the outcome to use the freebet.
maxOddfloatMaximum odds of the outcome to use the freebet.
disciplinesarray of stringList of allowed disciplines. Use discipline id from Available Disciplines
maxWinCurrencystringCurrency code for the maxWin value. Optional value, default USD
availableCountriesarray of stringList of allowed countries ISO 3166-1 alpha-2. Use the ISO countries if you want to limit the bonus to players from these countries only
availableTournamentsarray of stringList of allowed tournaments. Use tournament id from Available tournaments

A response examples:

HTTP status code: 200

json
{
  "id":1,
  "name":"Bonus freebet",
  "isEnable":true,
  "type":"freebet_standart",
  "cid":"fbet",
  "stage":2,
  "fromTime":1607558400,
  "toTime":1639094400,
  "daysToUse":5,
  "disciplines":[
    "csgo"
  ],
  "freebetData":{
    "minSelection":1,
    "maxSelection":2,
    "minOdd":1.01,"maxOdd":3,
    "betAmount":5,
    "betCount":5,
    "maxWin":100,
    "currency":"USD",
    "maxWinCurrency": "USD"
  },
  "availableCountries": null,
  "availableTournaments": null
}