Skip to content

Betting Events API

This documentation describes the endpoint for registering betting-related events, fundamental for monitoring gaming activities and AML compliance.


Register Betting Event

[POST] /betting-events

Registers a new event related to betting activities in the system, with full support for single and multiple bets.

Body Parameters

Field Name Data Type Required Description
tax_id string Yes Player's tax ID (CPF). Example: "012.345.678-90".
event string Yes Event type. Options: "new_bet", "result", "cancellation".
last_player_balance number Yes Previous player balance in cents. Example: 20000 for R$ 200.00.
current_player_balance number Yes Current player balance in cents. Example: 25000 for R$ 250.00.
event_date datetime No Event date and time. If not provided, uses current moment.
bet_slip_id string Yes Unique bet slip identifier. Example: "slip_abc123def456".
bet_slip_state string No Overall slip state. Options: "open", "settled", "cancelled".
total_stake number Yes Total amount staked on the slip in cents. Example: 5000 for R$ 50.00.
total_odds number Yes Combined odds of the entire slip. Example: 2.5.
leg_count number Yes Number of selections in the slip (1 for single, >1 for multiple).
is_live boolean No Whether it's a live bet. Default: false.
is_free_bet boolean No Whether it's a free bet. Default: false.
bonus_amount number No Bonus amount used in cents. Example: 1000 for R$ 10.00.
is_each_way boolean No Whether it's an each-way bet. Default: false.
bet_legs array Yes Array with details of each selection in the slip.
meta object No Additional metadata about the event (free JSON).

Structure of bet_legs

Each object in the bet_legs array should contain:

Field Name Data Type Required Description
leg_id string Yes Unique selection identifier. Example: "leg_xyz789".
odds number Yes Specific odds for this selection. Example: 1.85.
sport_id string No Sport identifier. Example: "66".
sport_name string No Sport name. Example: "Football".
event_id string No Unique event identifier. Example: "evt_abc123".
event_name string No Event name. Example: "Inter Milan vs. Fluminense".
tournament_id string No Tournament identifier. Example: "tourn_copa_libertadores".
tournament_name string No Tournament name. Example: "Copa Libertadores 2024".
market_id string No Market identifier. Example: "mkt_winner".
market_name string No Market name. Example: "Match Winner".
selection_id string No Selection identifier. Example: "sel_inter_milan".
selection_name string No Selection name. Example: "Inter Milan".
event_start_time datetime No Real event start time. Example: "2024-01-15T20:00:00Z".
event_end_time datetime No Real event end time. Example: "2024-01-15T22:00:00Z".
leg_state string No Selection state. Options: "open", "won", "lost", "void".
result string No Selection result. Options: "won", "lost", "void", "push".
amount_won number No Amount won from this selection in cents (for results).

Request Examples

Single Bet - New Bet

curl --location 'https://aml.paag.io/betting-events' \
--header 'accept: application/json' \
--header 'x-api-key: {{ token }}' \
--header 'Content-Type: application/json' \
--header 'Origin: *' \
--data '{
  "tax_id": "012.345.678-90",
  "event": "new_bet",
  "last_player_balance": 30000,
  "current_player_balance": 25000,
  "event_date": "2024-01-15T15:30:00Z",
  "bet_slip_id": "slip_single_123",
  "bet_slip_state": "open",
  "total_stake": 5000,
  "total_odds": 2.5,
  "leg_count": 1,
  "is_live": false,
  "is_free_bet": false,
  "bonus_amount": 0,
  "is_each_way": false,
  "bet_legs": [
    {
      "leg_id": "leg_abc123",
      "odds": 2.5,
      "sport_id": "66",
      "sport_name": "Football",
      "event_id": "evt_fla_palm_001",
      "event_name": "Flamengo vs. Palmeiras",
      "tournament_id": "tourn_brasileirao_2024",
      "tournament_name": "Brazilian Championship 2024",
      "market_id": "mkt_winner",
      "market_name": "Match Winner",
      "selection_id": "sel_flamengo",
      "selection_name": "Flamengo",
      "event_start_time": "2024-01-15T21:00:00Z",
      "leg_state": "open"
    }
  ]
}'

Multiple Bet - New Bet

curl --location 'https://https://gateway.prd.pppay.cloud/betting-events' \
--header 'accept: application/json' \
--header 'x-api-key: {{ token }}' \
--header 'Content-Type: application/json' \
--header 'Origin: *' \
--data '{
  "tax_id": "012.345.678-90",
  "event": "new_bet",
  "last_player_balance": 50000,
  "current_player_balance": 40000,
  "event_date": "2024-01-15T15:30:00Z",
  "bet_slip_id": "slip_multiple_456",
  "bet_slip_state": "open",
  "total_stake": 10000,
  "total_odds": 6.25,
  "leg_count": 3,
  "is_live": false,
  "is_free_bet": false,
  "bonus_amount": 2000,
  "is_each_way": false,
  "bet_legs": [
    {
      "leg_id": "leg_001",
      "odds": 1.8,
      "sport_name": "Football",
      "event_name": "Flamengo vs. Palmeiras",
      "tournament_name": "Brazilian Championship 2024",
      "market_name": "Match Winner",
      "selection_name": "Flamengo",
      "event_start_time": "2024-01-15T21:00:00Z",
      "leg_state": "open"
    },
    {
      "leg_id": "leg_002",
      "odds": 2.1,
      "sport_name": "Football",
      "event_name": "Santos vs. Corinthians",
      "tournament_name": "Brazilian Championship 2024",
      "market_name": "Over 2.5 Goals",
      "selection_name": "Yes",
      "event_start_time": "2024-01-15T19:00:00Z",
      "leg_state": "open"
    },
    {
      "leg_id": "leg_003",
      "odds": 1.65,
      "sport_name": "Basketball",
      "event_name": "Lakers vs. Warriors",
      "tournament_name": "NBA 2023-24",
      "market_name": "Match Winner",
      "selection_name": "Lakers",
      "event_start_time": "2024-01-16T02:00:00Z",
      "leg_state": "open"
    }
  ]
}'

Multiple Bet Result

curl --location 'https://https://gateway.prd.pppay.cloud/betting-events' \
--header 'accept: application/json' \
--header 'x-api-key: {{ token }}' \
--header 'Content-Type: application/json' \
--header 'Origin: *' \
--data '{
  "tax_id": "012.345.678-90",
  "event": "result",
  "last_player_balance": 40000,
  "current_player_balance": 102500,
  "event_date": "2024-01-16T05:30:00Z",
  "bet_slip_id": "slip_multiple_456",
  "bet_slip_state": "settled",
  "total_stake": 10000,
  "total_odds": 6.25,
  "leg_count": 3,
  "is_live": false,
  "is_free_bet": false,
  "bonus_amount": 2000,
  "is_each_way": false,
  "bet_legs": [
    {
      "leg_id": "leg_001",
      "odds": 1.8,
      "event_name": "Flamengo vs. Palmeiras",
      "selection_name": "Flamengo",
      "leg_state": "won",
      "result": "won",
      "amount_won": 18000
    },
    {
      "leg_id": "leg_002",
      "odds": 2.1,
      "event_name": "Santos vs. Corinthians",
      "selection_name": "Yes",
      "leg_state": "won",
      "result": "won",
      "amount_won": 37800
    },
    {
      "leg_id": "leg_003",
      "odds": 1.65,
      "event_name": "Lakers vs. Warriors",
      "selection_name": "Lakers",
      "leg_state": "won",
      "result": "won",
      "amount_won": 62500
    }
  ]
}'

Responses

200 - Successfully Created
{
  "id": "evt_xyz789abc123"
}
400 - Invalid Data
{
  "error": {
    "message": "Invalid input data",
    "details": {
      "tax_id": ["Tax ID must be in valid format"],
      "total_stake": ["Bet amount must be greater than zero"],
      "total_odds": ["Odds must be a positive number"],
      "bet_legs": ["Must contain at least one selection"]
    },
    "status": 400
  }
}