Tabs & options


About the API
How do I use it?

You must simply make HTTP GET and POST requests to the following URL:

https://coinmillions.com/api/1</THE/ACTION>

The available actions can be found on this very page, and on each of our games' API tab. All of them share the following characteristics:

  1. They are usually parametrized via GET or POST params, and always return JSON strings.
  2. If successful they return an HTTP 200 OK status code; otherwise they return the HTTP status code that best describes the situation.
  3. Authentication, when required, is handled with the Authorization HTTP Header, which must be set to "Bearer <SECRET API KEY>".
    You can find your secret Api Key in the account menu. If you are acting on behalf of another user (e.g. placing bets for him), this must be his API Key.
    Please, bear in mind that in the absence of an API Key the system will try to identify you using your session cookie. This is usually safe, but means that you should be careful when doing tests from a browser where you are signed in.
  4. If you are acting on behalf of another user and want to take part in our affiliation program, you can pass your affiliate id in a HTTP Header named X-Affiliate-ID.
  5. Many of the non-integer numbers are returned as strings, because we use arbitrary precision decimals internally to avoid common rounding issues.

Example using jQuery (CORS is enabled for the whole API):

$.ajax({
		url: 'https://coinmillions.com/api/1/site/supported-currencies',
		method: 'GET',
		data: {
			// Any params required by the action would be added here
		},
		beforeSend: function (xhr) {
			xhr.setRequestHeader('Authorization', 'Bearer ' + '<SECRET API KEY>');
			// xhr.setRequestHeader('X-Affiliate-ID', <YOUR AFFILIATE ID>); // Optional
		},
		success: function(data) {
			// Successful request
			// Process the response, e.g.:
			console.log(data);
		},
		error: function(jqXHR, textStatus, errorThrown) {
			// Connection or client error
			// jqXHR.responseJSON.details *might* be an array of reasons (e.g. ['api_key', 'affiliate_id', 'user_is_banned'])
		}
	});
Can it process a batch of actions in a single request?

Yes; there is a special URL that allows you to benefit from less HTTP overhead:

https://coinmillions.com/api/1/multi

Note that:

  1. Both GET and POST requests are supported, and they always return JSON strings.
  2. The server expects a parameter named actions, which must hold an URL-encoded, JSON-encoded array of objects.
    Each object must have a property named action with the action to execute (a string including the initial "/"), plus a property for every parameter it requires.
  3. The optional API Key and Affiliate ID are per-request, not per action; take it into account if you manage multiple users each with a different API Key.
  4. The actions are executed in the order they are listed in the array.
  5. The response is an array of objects, one for each of the actions in order.
  6. Unless the connection fails, requests to this endpoint always return an HTTP 200 OK status code; if any of the actions has failed, its result will consist of an object with the properties error_code (the HTTP status code) and details (a possibly empty array of reasons, like ['api_key', 'affiliate_id', 'user_is_banned']).

Example using jQuery:

$.ajax({
		url: 'https://coinmillions.com/api/1/multi',
		method: 'GET', // 'POST' actions are also supported
		data: {
			'actions': JSON.stringify([ // We convert the actions to a JSON string
				{
					'action': '/site/supported-currencies'
					// Any params would be added to the object after the action
				},
				{
					'action': '/site/supported-currencies/exchange-rates'
				},
				{
					'action': '/site/bankrolls'
				}
			])
		},
		beforeSend: function (xhr) {
			xhr.setRequestHeader('Authorization', 'Bearer ' + '<SECRET API KEY>');
			// xhr.setRequestHeader('X-Affiliate-ID', <YOUR AFFILIATE ID>); // Optional
		},
		success: function(data) {
			// We process the first action, /site/supported-currencies
			if(!data[0].error_code) {
				// Process the response
			}
			// We process the second action, /site/supported-currencies/exchange-rates
			if(!data[1].error_code) {
				// Process the response
			}
			// We process the third action, /site/bankrolls
			if(!data[2].error_code) {
				// Process the response
			}
		},
		error: function(jqXHR, textStatus, errorThrown) {
			// Connection error
		}
	});
Is it rate-limited?

Yes: if you make too many requests too fast, you will start receiving TOO_MANY_QUEUED_BETS responses.

May I use it to develop my own bots?

Absolutely. Remember, though, to test your bots thoroughly before running them against our site; we do not refund coins lost due to faulty bots.

Should I download or purchase a bot from a third party?

It depends; do you trust that third party with your coins?

Remember that whomever knows your API Key can act on your behalf. Besides, even if their intentions are good, downloaded programs may contain bugs, trojans, backdoors and other attack vectors that could compromise your coins.

We strongly advice against using third-party bots or websites, and under no circumstance will be held accountable for any coins lost in this manner.

What do I do if my API Key gets compromised?

You must request a new one from the box above. The old one will stop working immediately.

Why should I use my API Key instead of hard-coding my username and password?

There are a number of reasons:

  1. There is no sign-in functionality built into the API; you would have to sign-in manually and copy the session cookie.
  2. Each time you sign-in a unique token is created for the session, which must be sent along the cookie for the authentication to work. This is a security measure that helps us prevent CSRF attacks.
  3. You can't withdraw coins using only the API and API Key, but you can do it with the session credentials. If you compromised that info in your bots or elsewhere, you would be creating an unnecessary attack vector.
  4. It is easier to reset a compromised API Key - which are random and typically stored in a settings file -, than it is to change your session credentials - which are typically remembered by heart and maybe even shared across other sites.

API Specifications

General user information

User information
/api/v1/user [GET]

Parameters:

  • api_key=your-api-key

Response:

  • {
      'uname': 'username',
      'balance': 123.45, # Balance in bits
      'hash': 'next-mp-betting-hash'
    }


Generate new moneypot hash
/api/v1/new_hash [POST]

Request:

  • {
      'api_key': 'your-api-key'
    }

Response:

  • {
      'hash': 'new-mp-betting-hash'
    }

General game information

Get user bets (last 50 bets)
/api/v1/games/bets [GET]

Parameters:

  • api_key=your-api-key

Response:

  • {
      'success': true,
      'bets': [
        {
          'created_at': '2015-07-10T20:52:33+00:00',
          'id': 123, # Look up more details using /api/v1/games/[game]/bets/[id]
          'game': 'ducks' # Name of game bet was placed on
          'wager': 123.45,
          'payout: 123.45, # Bet profit, negative on loss (bits)
        },
        [...]
      ]
    }


Generic bet info for all games
/api/v1/games/[...]/bets/[id] [GET]

Parameters:

  • api_key=your-api-key

Response:

  • {
      'success': true,
      'created_at': '2015-07-10T20:52:13.444Z',
      'id': 123,
      'hash': 12345, # Moneypot bet has used
      'wager': 123.45, # Amount wagered (bits)
      'moneypot_id': 123, # Bet ID from moneypot
      'payout': 123.45, # Bet payout (bits)
      'outcome': 12345, # Moneypot bet outcome
      'secret': 12345, # Moneypot secret value (for provable fair)
      'salt': 'hash-value', # Moneypot salt value (for provable fair)
      # Plus game specific data
    }


Generic betting return for all games
/api/v1/games/[...]/bet [POST]

Response (error):

  • {
      'success': false,
      'error': 'error message'
    }

Response (success):

  • {
      'success': true,
      'id': 123, # VegasCasinoBits bet ID
      'moneypot_id': 123, # Bet ID from moneypot
      'balance': 123.45, # New user balance (bits)
      'payout': 123.45, # Bet payout (bits)
      'outcome': 12345, # Moneypot bet outcome
      'secret': 12345, # Moneypot secret value (for provable fair)
      'salt': 'hash-value', # Moneypot salt value (for provable fair)
      'hash': 'next-mp-betting-hash',
      # Plus game specific data
    }

Dice

Get details about dice bet
/api/v1/games/dice/bets/[id] [GET]

Parameters:

  • api_key=your-api-key

Response:

  • {
      # Generic bet response data plus:
      'range': 1000,  # Bet range
      'target': 0,  # High or Low (0: low, 1: high)
      'result': 400 # Result of roll (0 - (2^32-1))
    }


Place bet
/api/v1/games/dice/bet [POST]

Request:

  • {
      'api_key': 'your-api-key',
      'clientseed': 0, # Client seed for moneypot (unsigned 32bit integer, -1 for random)
      'wager': 500, # Amount to wager (bits)
      'range': 1000,  # Bet range
      'target': 0  # High or Low (0: low, 1: high)
    }

Response (success):

  • {
      # Generic betting response data plus:
      'result': 400 # Result of roll (0 - (2^32-1))
    }

Video Poker

Cards

Cards are returned as a string in the format RsRsRsRsRs (Rank/Suit x5)

As5hTdKsQc = Ace of Spades, 5 of Hearts, 10 of Diamonds, King of Spades, Queen of Clubs


Get details about videopoker bet
/api/v1/games/videopoker/bets/[id] [GET]

Parameters:

  • api_key=your-api-key

Response

  • {
      # Generic bet response data plus:
      'cards': 'As2s3d4h5s'  # Cards dealt
      'name': 'Straight'  # Name of hand
    }


Place bet
/api/v1/games/videopoker/bet [POST]

Request:

  • {
      'api_key': 'your-api-key',
      'clientseed': 0, # Client seed for moneypot (unsigned 32bit integer, -1 for random)
      'wager': 500 # Amount to wager (bits)
    }

Response (success):

  • {
      # Generic betting response data plus:
      'cards': 'As2s3d4h5s',  # Cards dealt
      'name': 'Straight'  # Name of hand
    }

Shell

Get details about shell bet
/api/v1/games/shell/bets/[id] [GET]

Parameters:

  • api_key=your-api-key

Response

  • {
      # Generic bet response data plus:
      'weights': [16.202,1,1,1,1,0,0,0,0],  # Weight of the payout fields (0, 2, 3, 5, 10, 25, 100, 1K, 10K)
      'picked': 0,  # Picked bucket (0-2)
      'payouts': [2, 10, 0]  # Payout for each bucket
    }


Place bet
/api/v1/games/shell/bet [POST]

Request:

  • {
      'api_key': 'your-api-key',
      'clientseed': 0, # Client seed for moneypot (unsigned 32bit integer, -1 for random)
      'wager': 500, # Amount to wager (bits)
      'weights': [0,1,1,1,1,0,0,0,0],  # Weight of the payout fields (0, 2, 3, 5, 10, 25, 100, 1K, 10K),
      'picked': 0  # Picked bucket (0-2)
    }

Response (success):

  • {
      # Generic betting response data plus:
      'payouts': [2, 10, 0]  # Payout for each bucket
    }

Slot Machine

Get details about slot machine bet
/api/v1/games/slots/bets/[id] [GET]

Parameters:

  • api_key=your-api-key

Response

  • {
      # Generic bet response data plus:
      'row': [1,2,3],  # Result of the wheels
      'result': 0  # payout line
    }


Place bet
/api/v1/games/slots/bet [POST]

Request:

  • {
      'api_key': 'your-api-key',
      'clientseed': 0, # Client seed for moneypot (unsigned 32bit integer, -1 for random)
      'wager': 500 # Amount to wager (bits)
    }

Response (success):

  • {
      # Generic betting response data plus:
      'row': [1,2,3],  # Result of the wheels
      'result': 0  # payout line
    }