99.9% API

Want to make your own dice betting bot? Want to earn money while doing it? That is what we are offering.

On this page, you will find information about creating your own bot using the API provided by 999dice.

Making Money

New players are automatically attached as one of your referrals on 999dice. That means you earn 0.05% of the value of every bet they make, win or lose.

Rules

We do not care if you make a bot and call it "Bob's Super-Dice Site". You do not need to mention our website at all. We do not care if you pass it off as your own site, even. To extend that idea, you could even create your own website, and have our API serve as your back-end.

What we DO care about is: PLAY FAIR. Be open and honest about what your bot does and doesn't do. We are keeping a close eye on the API usage.

Github

The source to both the C# & Java API are now available on github.

Sample Bot

A sample bot has been created using the .NET 4.5 API. Its purpose is to demonstrate to programmers some of the capabilities of the API.

These bot downloads have been updated to work with the 999-dice/999doge/notdicelol mirror

Download the sample 999dice.com bot (Build 2016-11-21, Requires .NET 4.5, which comes with Windows 8, or can be downloaded here)

Download the sample 999dice.com bot [.NET 3.5] (Build 2016-11-21, Requires .NET 3.5, which comes with Windows 7, or can be downloaded here)

Download the source code (Build 2016-11-21, Visual studio project). Contains source for both the .NET 3.5 and .NET 4.5 versions.

The .NET API

Display

An implementation of the API is available in .NET (for C#, VB, F#...).

Download the .NET API for .NET 4.5 (Build 2016-11-21, includes Async and Begin/End methods)

Download the .NET API for .NET 3.5 (Build 2016-11-21, includes Begin/End methods)

Here's a brief overview of how it works. All classes are in the Dice.Client.Web namespace.

First, you call BeginSession(...), which gives you a SessionInfo object. This object contains everything about your user, and everything else in the API requires you to have one.

Once you've got your SessionInfo object, you can make any other call, such as PlaceBet, CreateUser, or Withdraw.

Here's a brief rundown on the essential classes and methods.

Starting a session...

SessionInfo (implements INotifyPropertyChanged)
Contains information about your user, such as their balance, email, deposit address, and betting statistics. You must get one of these from calling DiceWebAPI.BeginSession(...).
DiceWebAPI.BeginSession(ApiKey)
Creates a new account. You should save the AccountCookie for your user!
DiceWebAPI.BeginSession(ApiKey, AccountCookie)
Starts a new session for an existing user. Will return LoginRequired=true if the user has set up a username and password.
DiceWebAPI.BeginSession(ApiKey, Username, Password)
Starts a new session for an existing user who is protected by a username and password.
DiceWebAPI.BeginSession(ApiKey, Username, Password, Totp)
Starts a new session for an existing user who is protected by a username, password, and totp (ie Google Authenticator).

Handling user information...

DiceWebAPI.CreateUser(Session, Username, Password)
Creates a username and password for a user. Accounts with a username and password do not require (and cannot be accessed using) an AccountCookie.
DiceWebAPI.ChangePassword(Session, OldPassword, NewPassword)
Changes a user's password.
DiceWebAPI.UpdateEmail(Session, Email)
Updates the client's email address.
DiceWebAPI.UpdateEmergencyAddress(Session, EmergencyAddress)
Updates the client's emergency withdrawal address.

Funds...

DiceWebAPI.Withdraw(Session, Amount, Address/AccountID, [Totp], Currency)
Withdraws funds to a bitcoin address (or all funds, if Amount == 0), minus the 0.0001 BTC bitcoin transaction fee. Check the WithdrawalPending return value.
DiceWebAPI.WithdrawAll(Session, Address/AccountID, [Totp], Currency)
Withdraws all funds to a bitcoin address, minus the 0.0001 BTC bitcoin transaction fee. Check the WithdrawalPending return value.
DiceWebAPI.GetDepositAddress(Session, Currency)
Gets a new deposit address for the user. This only gives a new address if a deposit has been made, otherwise SessionInfo.DepositAddress will probably be returned unchanged.
DiceWebAPI.GetBalance(Session, Currency)
Gets the user's current balance. This is only required if the user makes a deposit. If you are polling this value, once per 60 seconds is recommended, and should not be more frequently than once per 15 seconds. Ideally, this should be manually checked by the user clicking a button (they know when they've deposited!).

Betting Calculations...

DiceWebAPI.CalculateChanceToWin(GuessLow, GuessHigh)
Returns the user's chance to win based on a guess range (0.0 - 1.0)
DiceWebAPI.CalculatePayoutMultiplier(GuessLow, GuessHigh)
Returns the payout multiplier for a winning bet based on a guess range.
DiceWebAPI.CalculateWinPayout(PayIn, GuessLow, GuessHigh)
Returns the payout for a winning bet based on the bet amount and guess range.
DiceWebAPI.CalculateWinProfit(PayIn, GuessLow, GuessHigh)
Returns the profit for a winning bet based on the bet amount and guess range.

Betting...

DiceWebAPI.GetServerSeedHash(Session)
Retrieves the server seed hash for the next bet.
DiceWebAPI.SetClientSeed(Session, Seed)
Sets the client's seed for future bets.
DiceWebAPI.PlaceBet(Session, PayIn, GuessLow, GuessHigh, ClientSeed, Currency)
Places a bet for PayIn BTC on the numbers GuessLow-GuessHigh (0-999999), inclusive. Minimum bet chance is 5%, and maximum bet chance is 95%. Bets for 0 to 0.00001 BTC are delayed 0.5-3 seconds.
DiceWebAPI.PlaceAutomatedBets(Session, Settings)
Place a batch of automated bets.
  • Session: The user's SessionInfo object.
  • Settings:
    • BasePayIn: The amount of the base bet.
    • GuessLow, GuessHigh: The user's guess, between 0-999999, inclusive. Minimum bet chance is 5%, and maximum bet chance is 95%.
    • MaxBets: The maximum number of bets to place. Cannot be more than SessionInfo.MaxBetBatchSize
    • ResetOnWin: If true, then after a winning bet, the next bet amount will be BasePayIn.
    • ResetOnLose: If true, then after a losing bet, the next bet amount will be BasePayIn.
    • IncreaseOnWinPercent: If ResetOnWin=false, then after a winning bet, increase the next bet amount by IncreaseOnWinPercent. 0 is no increase. 0.5 is 50% increase. 1.0 is 100% increase (doubled). 2.0 is 200% increase (tripled). Cannot be negative.
    • IncreaseOnLosePercent: If ResetOnLose=false, then after a losing bet, increase the next bet amount by IncreaseOnLosePercent. 0 is no increase. 0.5 is 50% increase. 1.0 is 100% increase (doubled). 2.0 is 200% increase (tripled). Cannot be negative.
    • MaxAllowedPayIn: The maximum bet amount, or 0 for no maximum.
    • ResetOnLoseMaxBet: If true, then after a losing bet where the bet amount is equal to MaxAllowedPayIn, the next bet amount will be BasePayIn.
    • StopOnLoseMaxBet: If true, then after a losing bet where the bet amount is equal to MaxAllowedPayIn, betting will end.
    • StopMaxBalance: After a bet, if your balance is at least this amount, then stop betting. 0 for no maximum.
    • StopMaxBalance: After a bet, if your balance is at least this amount, then stop betting. 0 for no maximum.
    • StopMaxBalance: After a bet, if your balance is at least this amount, then stop betting. 0 for no maximum.
    • StopMinBalance: After a bet, if your balance is less than this amount, then stop betting.
    • StartingPayIn: The first bet's amount (Overrides BasePayIn as the first bet's size).
    • ClientSeed: The client seed to use for these bets.
    • Currency: The currency for these bets.

The Java API

Display

An implementation of the API is available in Java.

Download the Java API (Build 3)

It is nearly identical to the .NET API (See above!). All classes are in the dice.client.web package.

The Raw Web API

Display

If you aren't using a language that already has an implementation of the API, you can still access it using web requests.

All requests must include the action you wish to perform as the "a" parameter.

All requests other than CreateAccount, BeginSession, and Login must include a session cookie as the "s" parameter.

For example: a=GetServerSeedHash&s=1a2b3c4d5f6 is requesting the action "GetServerSeedHash" for the user with the session cookie "1a2b3c4d5f6".

Responses

All requests can receive error responses instead of the normal response.

There are some standard error responses that may be generated for any request:

Starting a session...

CreateAccount BeginSession Login

Handling user information...

CreateUser ChangePassword UpdateEmail UpdateEmergencyAddress

Funds...

Withdraw GetDepositAddress GetBalance

Betting...

GetServerSeedHash SetClientSeed

The client seed is now sent along with every call to PlaceBet or PlaceAutomatedBets.

PlaceBet PlaceAutomatedBets

General Information...

GetCurrencies

Samples

Request: a=UpdateEmergencyAddress&s=1a2b3c4d5e6f&Address=1BitcoinAddress123
Response: {success: 1}

Request: a=Withdraw&s=1a2b3c4d5e6f&Amount=5000000&Address=1BitcoinAddress123&Currency=btc
Response: {Pending: 5000000}
or Response: {InsufficientFunds: 1}

Request: a=GetBalance&s=1a2b3c4d5e6f
Response: {Balance: 123450000}
or Response: {TooFast: 1}

Request: a=PlaceBet&s=1a2b3c4d5e6f&PayIn=1000&Low=0&High=499499&ClientSeed=12345678&Currency=doge
Response: {BetId:123, PayOut: 2000, Secret: 222222, StartingBalance: 5000, ServerSeed: "a1b2c3d4e5f60708a1b2c3d4e5f60708a1b2c3d4e5f60708a1b2c3d4e5f60708"}
or Response: {BetId:123, PayOut: 0, Secret: 888888, StartingBalance: 5000, ServerSeed: "a1b2c3d4e5f60708a1b2c3d4e5f60708a1b2c3d4e5f60708a1b2c3d4e5f60708"}
or Response: {InsufficientFunds: 1}
or Response: {TooFast: 1}

Request: a=PlaceAutomatedBets&s=1a2b3c4d5e6f&BasePayIn=1000&Low=0&High=499499&MaxBets=3&ResetOnWin=1&ResetOnLose=0&IncreaseOnWinPercent=0&IncreaseOnLosePercent=1.0&MaxPayIn=2500&ResetOnLoseMaxBet=0&StopOnLoseMaxBet=0&StopMaxBalance=0&ClientSeed=987654321&Currency=doge
Response: {BetId:123, PayIns: [-1000, -2000, -2500], PayOuts: [0, 0, 5000], Secrets: [777777, 888888, 222222], StartingBalance: 5000, Seed: "a1b2c3d4e5f60708a1b2c3d4e5f60708a1b2c3d4e5f60708a1b2c3d4e5f60708"}
or Response: {BetId:123, PayIns: [-1000, -1000, -1000], PayOuts: [2000, 2000, 0], Secrets: [222222, 333333, 777777], StartingBalance: 5000, Seed: "a1b2c3d4e5f60708a1b2c3d4e5f60708a1b2c3d4e5f60708a1b2c3d4e5f60708"}
or Response: {InsufficientFunds: 1}
or Response: {TooFast: 1}

Request: a=PlaceAutomatedBets&s=1a2b3c4d5e6f&BasePayIn=1000&Low=0&High=499499&MaxBets=200&ResetOnWin=1&ResetOnLose=1&IncreaseOnWinPercent=0&IncreaseOnLosePercent=0&MaxPayIn=2500&ResetOnLoseMaxBet=0&StopOnLoseMaxBet=0&StopMaxBalance=0&ClientSeed=987654321&Currency=btc&Compact=1
Response: {BetId: 123, BetCount: 200, PayIn: -200000, PayOut: 300000, Seed: "a1b2c3d4e5f60708a1b2c3d4e5f60708a1b2c3d4e5f60708a1b2c3d4e5f60708", StartingBalance: 5000}
or Response: {InsufficientFunds: 1}
or Response: {TooFast: 1}