Skip to main content

4.5 Customers Requests

These API calls allow creating and manipulating MollyBet accounts and to return information about either the currently logged-in account or about other MollyBet accounts (provided that the caller has the required permissions).

Available calls:

4.5.1 Create a new MollyBet account​

Method and URL:

POST /v1/customers/

Request Parameters:

password [ string ]:

The password of the new user. Must be at least 8 characters long and contain both numbers and letters.

group_id [ int ]:

The numeric group ID of the new user. You can only create users in groups which you manage.

name [ string ] (optional, default: ""):

The display name of the new user.

roles [ object{role_name -> string, assigned -> bool} ] (optional, default: {"customer": true}):

Roles to assign to the user. Available keys:

  • customer (required)

  • bet_placer

    The customer can place bets

  • group_spy

    Customer can see orders of other customers in the group

  • trade_page_viewer

    Customer can see trade page of the website

  • detailed_accounting

    Kickbacks and commissions not netted into prices

  • account_viewer

    Customer can see bookie account usernames and fetch balances

credit_limit [ list[string, float] ] (optional, minimum: 0, maximum: 1e18, default: [ccy_code, 0.]):

The credit limit of the user, as a [currency code, amount] 2-item list.

credit_limit_comment [ string ] (optional):

Optional credit limit description.

max_stake_per_event [ list[string, float] ] (optional, minimum: 0, maximum: 1e18):

The total combined stake the customer can place on a single event, as a [currency code, amount] 2-item list. Unlimited if not set.

commission_rate [ object{date_from -> string, rate_pc -> float} ] (optional):

The commission rate to apply to the user, with the date it starts being active.

active [ bool ] (optional, default: true):

If false the customer will be created in a disabled status.

locked [ bool ] (optional):

The user is locked due to multiple login failures.

expires_at [ ISO 8601 date string ] (optional):

The date after which this user won't be able to log in anymore

username [ string ]:

The username of the new user. Must be unique and only contain alphanumeric characters.

ccy_code [ string ]:

The currency of the new user, as an ISO 4217 three-letter currency code.

Return Data: Data about the customer just created, in a format similar to the input parameters.

4.5.2 List all the MollyBet accounts known by the requesting user​

Method and URL:

GET /v1/customers/

Request Parameters:

last_login [ string ] (optional, default: "true"):

if "true", returns information about the last time each user logged in

inactive [ string ] (optional, default: "true"):

if "true" include inactive accounts

permissions [ string ] (optional, default: "false"):

if "true", return a set of permissions each user possesses

customer_ids [ string ] (optional):

comma-separated list of ids of customers to return

Return Data: A list of objects representing the data about the accounts known.

4.5.3 Return information about a single MollyBet account​

Method and URL:

GET /v1/customers/<username>/

URL Parameters:

username:

MollyBet account username to return.

Return Data: An object representing the data about the account.

4.5.4 Change some of the attributes of a MollyBet account​

Method and URL:

PATCH /v1/customers/<username>/

URL Parameters:

username:

MollyBet account username to change.

Request Parameters:

The same accepted in Create Account.

Return Data: Data about the customer just updated, in a format similar to the input parameters.

4.5.5 Check if the current user can place bets with this IP​

Method and URL:

GET /v1/customers/<username>/can_place_bets/

URL Parameters:

username:

MollyBet account username to check; only the current logged in user is supported.

Return Data: An object with the following properties:

  • can_place_bets (bool):

    a boolean indicating whether the user can place bets from the IP address from which this request is made

  • reason (str):

    an optional hint about why the value of can_place_bets was selected

  • ip_address (str):

    what the API believes to be the IP address of the request

  • country (str):

    what the API believes to be the country that corresponds to the IP address of the request

4.5.6 Return the list of the bookmaker accounts available to the customer​

Method and URL:

GET /v1/customers/<username>/bookie_accounts/

URL Parameters:

username:

MollyBet account username to get info for.

Return Data: An objects as described in Group Accounts list.

4.5.7 Return the list of the bookmaker accounts according to tag rules​

Method and URL:

POST /v1/customers/<username>/bookie_accounts_preview/

URL Parameters:

username:

MollyBet account username to get info for.

Request Parameters:

tag_rules [ unknown ]:

Tag rules

env_tags [ unknown ]:

Environment tags

Return Data: An objects as described in Group Accounts list.

4.5.8 Get the accounting summary of a MollyBet account​

Method and URL:

GET /v1/customers/<username>/accounting_info/

The accounting summary includes the balances, profit/loss, and open stake of a MollyBet account.

The method returns a JSON list of objects with members:

  • key: a short string describing the entry; provided entries are currently current_balance, open_stakes, today_pl, yesterday_pl, credit_limit, commission_rate, smart_credit;

  • label: a human-readable label for the entry

  • unit: the unit of the entry: currency codes such as EUR, GBP for monetary amounts, or % for percentages;

  • value: the numeric amount of the entry

The smart_credit entry is only present when the account has smart credit.

A sample output of the function could be the following JSON message:

[{"key": "current_balance",
"label": "Current balance",
"unit": "SGD",
"value": 85024.7},
{"key": "open_stakes",
"label": "Open stakes",
"unit": "SGD",
"value": 3438.03},
{"key": "credit_limit",
"label": "Agent credit limit",
"unit": "SGD",
"value": 1000000.0},
{"key": "smart_credit",
"label": "Smart credit",
"unit": "SGD",
"value": 1200.0},
{"key": "commission_rate",
"label": "Current commission rate",
"unit": "%",
"value": 0.25}]

URL Parameters:

username:

MollyBet account username to get info for.

4.5.9 Return the history of the credit limit changes of a MollyBet account​

Method and URL:

GET /v1/customers/<username>/credit_limit_history/

URL Parameters:

username:

MollyBet account username to get info for.

Return Data: A list of objects with the previous changes to the credit limit

Output Format:

amount [ float ]:

the new credit limit; null if no limit is set;

ccy_code [ string ]:

the currency of the credit limit (usually the customer currency);

timestamp [ string ]:

the timestamp in which the credit limit was set;

comment [ text ]:

any comment set by the agent when the credit limit was set.

Example:

[{"amount": 15000.0,
"ccy_code": "GBP",
"timestamp": "2014-03-24T18:48:58.006352+00:00",
"comment": "Credit limit set by agent"}]

4.5.10 Request a refresh of the balance for a customer's bookie account​

Method and URL:

POST /v1/customers/<username>/bookie_accounts/kick_balance/

URL Parameters:

username:

ignored

Request Parameters:

account_id [ int ]:

ID of the bookie account to refresh balance for.

Return Data: an object with the attribute balance containing the bookie account's newly-fetched balance.