Create and Grant FRB

Create and Grant FRB

Warning

DRAFT - Testing in Progress This endpoint is currently in draft status and undergoing testing. The API specification and behavior may change before final release. Please use with caution in production environments.

Creates a new FRB template and immediately grants it to a player in a single atomic operation.

Request endpoint: /frb/create/{version}/template-and-grant

Request Method: POST

Usage information

This unified endpoint combines template creation and player granting, eliminating the need for separate API calls and reducing the complexity of the FRB workflow. The template is created and immediately assigned to the specified player in a single transaction.

Note

Starting of 2025-12-01, authorization token is required for this request. The authorization token must be Base64-encoded as follows:
This request requires an authorization token: Bearer authorization token.
Token Format: The authorization token must be Base64-encoded as follows:
AuthorizationToken = encode(back_office_email:back_office_password)

Warning

Single Entity Constraint: This endpoint supports:

  • One provider only - You can only specify a single game provider per request
  • One game only - You can only include one game in the games array
  • One player only - The bonus is granted to a single player specified in the request

For bulk operations or multiple games/players, use the separate Create FRB Template and Grant FRB to Players endpoints.

Note
  • The specified parameters ‘operatorId’ and ‘providerName’ must already be configured in Sinatra.
  • For Playson providers, the template must contain only one game (automatically enforced by this endpoint).
Info
  • Bet amount definition is in EUR cents, so for other currencies, conversion rates are defined in the Sinatra service.
  • Bet amount definition is in cents, so if the bet amount is 1.00, the value should be 100.
  • By default, a minimum bet amount of 0.01 (1 cent) is used.
  • If useDefaultAmount is set to true, the system will use the default bet amount configured for the casino.
  • The bet amount set in the game might differ from the template bet amount (as different games have different bet amounts), the closest bet amount to the template value will be used.

Request parameters:

Parameter Data type Description
version String required The API version. Only version 1.0 is currently supported. Other version values are accepted, but are treated as 1.0.
Example: 1.0
Authorization Yes (Header) Sinatra back office user

Request Body

{
  "providerName": "Quickfire",
  "operatorId": 123,
  "playerId": "PLAYER_456",
  "playerCurrency": "USD",
  "playerCountry": "US",
  "offerName": "WELCOME_BONUS_001",
  "numberOfRounds": 5,
  "availableDuration": 30,
  "useDefaultAmount": false,
  "templateId": "TMP_9876543210fedcba",
  "transactionId": "TXN_1234567890abcdef",
  "games": [
    {
      "gameId": "GAME_123",
      "betAmount": [100]
    }
  ]
}

Request Body Fields

Field Type Required Description
providerName string Yes Name of the game provider (e.g., “Quickfire”, “EvoPlay”, “BetSoft”)
operatorId integer Yes Casino operator ID that must be configured in Sinatra
playerId string Yes Player ID to whom the FRB template will be granted
playerCurrency string Yes Player’s currency code (ISO 4217 format, e.g., “USD”, “EUR”, “GBP”)
playerCountry string Yes Player’s country code (ISO 3166-1 alpha-2 format, e.g., “US”, “GB”, “DE”)
offerName string Yes Name/identifier for this bonus offer (max 255 characters)
numberOfRounds integer Yes Number of free rounds/spins to grant (must be greater than 0)
availableDuration integer Yes Duration in days the bonus will remain available from creation time
useDefaultAmount boolean No If true, uses the default bet amount configured for the casino. If false or omitted, uses the bet amounts specified in games array. Default: false
templateId string No Optional template ID for idempotency and tracking purposes. If not provided, one will be generated automatically
transactionId string No Optional unique transaction ID for idempotency. Used to prevent duplicate processing of the same request within a 120-second window. Auto-generated if not provided
games array Yes Array containing exactly one game object (single game constraint)
games[].gameId string Yes Game identifier that must exist in the provider’s game catalog
games[].betAmount array Yes Array of bet amounts in EUR cents (e.g., [100] for 1.00 EUR). Only the first value is used when single game is specified
Note
  • availableDuration defines how many days from now the bonus will be valid. The system automatically calculates the start date (now) and expiration date (now + availableDuration days).
  • betAmount values should be specified in cents (e.g., 100 = 1.00 EUR).
  • Currency conversions are handled automatically by the Sinatra service based on configured exchange rates.
  • Even though games is an array, only ONE game is allowed per request.

Response Parameters:

The response body includes comprehensive information about both the created template and the grant operation.

Example Response:

Success response:

{
  "id": "507f1f77bcf86cd799439011",
  "status": "Success",
  "template": {
    "templateId": "TMP_1234567890",
    "providerName": "Quickfire",
    "providerId": 27,
    "operatorId": 123,
    "transactionId": "550e8400-e29b-41d4-11e8-b566-0800200c9a66",
    "numberOfRounds": 5,
    "availableFromDate": "2024-01-01 10:00:00",
    "availableDuration": 30,
    "expirationDate": "2024-01-31 10:00:00",
    "offerName": "WELCOME_BONUS_001",
    "gameInfoList": [
      {
        "gameId": "GAME_123",
        "betAmount": [100]
      }
    ],
    "players": [
      {
        "playerId": "PLAYER_456",
        "playerCurrency": "USD",
        "playerCountry": "US"
      }
    ]
  },
  "grant": {
    "templateId": "TMP_1234567890",
    "transactionId": "550e8400-e29b-41d4-11e8-b566-0800200c9a66",
    "status": "Success",
    "message": "Template awarded successfully",
    "playerId": "PLAYER_456",
    "playerCurrency": "USD",
    "playerCountry": "US",
    "exceptionResponses": []
  }
}

Response Body Fields

Field Type Description
id string MongoDB ObjectID of the response document
status string Overall operation status (“Success” or “Failed”)
template object Information about the created template
template.templateId string Generated template identifier used for tracking and future operations
template.providerName string Game provider name
template.providerId integer Internal provider ID
template.operatorId integer Casino operator ID
template.transactionId string Transaction ID (provided or auto-generated)
template.numberOfRounds integer Number of free rounds
template.availableFromDate string ISO datetime when the bonus becomes available (format: YYYY-MM-DD HH:mm:ss)
template.availableDuration integer Duration in days the bonus is valid
template.expirationDate string ISO datetime when the bonus expires (format: YYYY-MM-DD HH:mm:ss)
template.offerName string Bonus offer name
template.gameInfoList array List of games included in the template
template.gameInfoList[].gameId string Game identifier
template.gameInfoList[].betAmount array Bet amounts in cents
template.players array List of players (contains single player)
grant object Information about the grant operation
grant.templateId string Template ID that was granted (use this ID for status checks and cancellations)
grant.transactionId string Transaction ID for this grant operation
grant.status string Grant operation status
grant.message string Descriptive message about the grant result
grant.playerId string Player ID who received the bonus
grant.playerCurrency string Player’s currency
grant.playerCountry string Player’s country
grant.exceptionResponses array List of any errors or warnings during the grant process (empty on success)
Info
  • The grant.templateId returned in the response should be used for subsequent operations:
  • The response includes both template creation details and grant confirmation in a single response.
  • If exceptionResponses contains entries, review them for warnings or partial failures.

Error Response:

{
  "error": "invalid request"
}

Or for validation errors:

[
  "Game validation error: invalid game id",
  "Number of rounds must be greater than 0"
]

Response codes:

Code Status Message
200 success FRB template created and granted successfully
400 bad request Invalid JSON format or malformed request body
422 Invalid parameters One of:
• Offer name is empty
• Offer name can not be more than 255 characters
• Number of rounds must be greater than 0
• Available duration must be greater than 0
• Game info list is empty
• Only one game is allowed in create-and-grant endpoint
• Game id does not exist in provider’s catalog
• Bet amount should be an integer
• Player id is empty
• Player currency is empty
• Player country is empty
• Provider name is empty or invalid
• Operator id is empty or not configured
• User does not have access to specified operator
500 internal server error Internal server error occurred during processing

Key Features

Atomic Operation

The template creation and player granting happen in a single transaction, ensuring data consistency. If either operation fails, the entire request is rolled back.

Idempotency

Duplicate requests are prevented using a combination of templateId and transactionId. If the same request is sent within a 120-second window, the cached response is returned instead of processing the request again.

Template Reuse

The system automatically checks if an identical template already exists (based on provider, operator, games, and offer details). If found, it reuses the existing template instead of creating a duplicate.

Simplified Workflow

Instead of making two separate API calls:

  1. Create Template
  2. Grant to Player

You now make one call:

  1. Create and Grant

This reduces network overhead, processing time, and potential for errors between operations.

Use Cases

This endpoint is ideal for:

  • Welcome bonuses - Creating and immediately granting a bonus when a new player registers
  • Promotional campaigns - Instantly rewarding players with free spins during special events
  • Player incentives - Immediate bonus grants as part of VIP programs or loyalty rewards
  • One-time offers - Single-player, single-game bonuses that don’t require template reuse

Comparison with Standard Flow

Aspect Standard Flow (Create + Grant) Create and Grant
API Calls 2 separate calls 1 unified call
Complexity Medium (must manage template ID between calls) Low (single operation)
Network Overhead Higher (2 round trips) Lower (1 round trip)
Error Handling Complex (can fail at either step) Simplified (atomic operation)
Idempotency Must be managed separately for each call Built-in for entire operation
Use Case Multiple players, multiple games, bulk operations Single player, single game, instant grant
Template Reuse Manual management Automatic detection

Example Workflow

sequenceDiagram participant Client as Casino Client participant API as Sinatra FRB API participant DB as Database participant Koala as Game Provider Client->>API: POST /frb/create/1.0.0/create-and-grant Note over Client,API: Single request with player, game, and bonus details API->>API: Validate request (games, rounds, player, etc.) API->>DB: Check for existing template alt Template Exists DB-->>API: Return existing template else Template Not Found API->>Koala: Create new template Koala-->>API: Template created API->>DB: Save template end API->>Koala: Grant template to player Koala-->>API: Grant successful API->>DB: Save grant record API-->>Client: Combined response (template + grant info) Note over Client,API: Single response with all details

Best Practices

  1. Idempotency Keys - Always provide templateId and transactionId for important operations to ensure idempotency
  2. Error Handling - Check both status field and grant.exceptionResponses array for any issues
  3. Single Game Limit - Remember this endpoint only supports one game per request
  4. Bet Amounts - Specify bet amounts in cents (e.g., 100 for 1.00 EUR)
  5. Player Currency - Ensure the player’s currency matches their actual account currency
  6. Template ID Storage - Store the returned grant.templateId for future status checks and cancellations
Tip

For scenarios requiring multiple games or multiple players, use the traditional Create FRB Template and Grant FRB to Players endpoints instead.