Coinroll API Reference
Introduction

The Coinroll API is a stateless interface which works over HTTPS. Requests are made using POST variables (application/x-www-form-urlencoded) while responses are encoded in JSON (application/json). A HTTPS connection is required for accessing the API. Requests are rate limited to 5 per second.

The API can be used to deposit funds, place bets, process withdrawals and query various account items.

Creating an account

Accounts can be created using the /deposit method. Actual account insertion into the database happens when the first unconfirmed deposit transaction is received. User ID and password must be set manually and have to be 14 characters in length.

Request POST variables
user
Username; 14 hexadecimal characters plus dash (0-9, a-f, -)
password
Password; 14 alpharithmetic characters (a-z, A-Z, 0-9)
Response JSON object
result
1 is success; 0 is error
address
Bitcoin deposit address

The account will be created when an unconfirmed transaction is received on the returned address.

Placing bets

Once you have sent a Bitcoin payment and /getbalance returns a valid balance, you can begin placing bets by using /bet.

Request POST variables
user
Username used on account creation
password
Password used on account creation
lessthan
Target number; a number 1 to 65535
amount
Bet amount in satoshi
Response JSON object
result
1 is success; 0 is error
id
Bet ID
lessthan
Target number
amount
Bet amount in satoshi
lucky
Lucky number
nonce
Incremental nonce
win
boolean; true if lucky number was less than the target number
diff
Account balance delta
balance
New account balance
date
Bet timestamp (UTC)
profit
Total profit
bets
Total bets
wins
Total wins
Requesting balance

Balance and other statistics can be requested via /getbalance

Request POST variables
user
Username used on account creation
password
Password used on account creation
Response JSON object
result
1 is success; 0 is error
balance
Account balance
profit
Total profit
bets
Total bets
wins
Total wins
Withdrawing funds

You can withdraw Bitcoin using the /withdraw endpoint. If your deposits are still unconfirmed then the withdrawal will be queued for later execution.

Request POST variables
user
Username used on account creation
password
Password used on account creation
address
Destination address
amount
Withdrawal amount in satoshi
Response JSON object
result
1 is success; 0 is error
deferred
boolean; true if the withdrawal has been deferred until deposit confirmation
amount
Withdrawal amount in satoshi
txid
(optional) transaction ID if a withdrawal was performed
balance
(optional) new balance in satoshi if a withdrawal was performed
Deposit status

Deposit confirmation status can be checked via /depositstatus.

Request POST variables
user
Username used on account creation
password
Password used on account creation
Response JSON object
result
1 is success; 0 is error
confirmed
boolean; true if all deposits have been confirmed
deferred
boolean; true if the withdrawal has been deferred until deposit confirmation
amount
(optional) withdrawal amount in satoshi if a withdrawal is queued
Querying bets

/getbets will return 5 past bets based on the offset.

Request POST variables
user
Username used on account creation
password
Password used on account creation
offset
Bet offset
Response JSON object
result
1 is success; 0 is error
count
Number of total bets
bets
An array of 5 bets

For more details on bet data see the next item. Not all of the bet properties are populated.

Querying by bet ID

/querybet will return information on a bet ID.

Request POST variables
id
Bet ID
Response JSON object
result
1 is success; 0 is error
id
Bet ID
user
User ID
lessthan
Target number
amount
Bet amount in satoshi
lucky
Lucky number
multiplier
Win multiplier
nonce
Incremental nonce
win
boolean; true if lucky number was less than the target number
delta
Account balance delta
timestamp
Bet timestamp (UTC)
txid
Last deposit transaction ID
released
boolean; true if secret has been released
secret
Secret if it has been released; time until release otherwise
secretHash
Secret SHA256 hash
Game information

/getgameinfo returns information on a game.

Request POST variables
lessthan
Target number
Response JSON object
result
1 is success; 0 is error
lessthan
Target number
minbet
Minimum bet in satoshi
maxbet
Maximum bet in satoshi
multiplier
Win multiplier
odds
Win odds
houseedge
House edge