Documentation » HTTP API (Beta)

Using the Crypto-Loot API

Intro

With the CryptoLoot HTTP API you can fetch the numerical value of hashes solved for a user account on your website, game, or app. You can also withdraw Monero, verify tokens and create shortlinks (tokens/shortlinks/captcha coming soon!).

Using this API requires a secret key (see Manage Sites). This key should be kept secret and should never be exposed to your anybody, including your users. The HTTP API should only ever be called from the server side, i.e. from PHP, NodeJS, Ruby, Python scripts running on your own server.

You should never call the CryptoLoot HTTP API from the client side!

Your secret key can be passed with each API call as a GET or POST parameter, depending on the required method for the endpoints.

The API returns a JSON encoded object for each request. All responses contain a boolean success property. In case success is false, an error property will be present, describing why the operation failed.

Global Errors

Each API request may result in any of these global errors

invalid_secret The secret provided as GET or POST parameter is invalid.
bad_request A malformed request was received.
wrong_method The API expected a POST request but a GET request was performed.
not_found The API endpoint could not be found. Check the URL for your API call.
internal_error Something bad happened on our side. Contact us if the issue persists.

API Reference

Users

Stats

/user/balance

URL: https://api.crypto-loot.com/user/balance

Method: GET

Get the total number of hashes, the withdrawn hashes and the current balance for a user name. Think of it as the balance of a bank account. Hashes can be paid in through mining, and withdrawn through /user/withdraw.

Parameters

secret Your private Secret-Key. See Manage Sites.
name The user's name, analogous to the name specified for the CRLT.User miner. This can be anything that is unique to the user on your website. E.g. a user name, id, the md5 hash of their name or their email address.

Response

                            {
                            	"success": true|false, 	// whether the user's balance could be obtained
                            	"name": string, 		// the user's name
                            	"total": number, 		// the number of accepted hashes
                            	"withdrawn": number, 	// the number of withdrawn XMR
                            	"balance": number, 		// the number of (accepted - withdrawn) XMR
                            	"error": string 		// optional
                            }
                            

Possible Errors

missing_input No name provided as GET parameter
unknown_user The user name is not known (has never connected to the pool).

In addition, any of the global errors might occur.

Example

                            curl "https://api.crypto-loot.com/user/balance?name=johnd&secret=<secret-key>"

                            # {success: true, name: "maria", total: "318801685", withdrawn: "0.02", balance: "0.03689529"}
                            

/user/withdraw

URL: https://api.crypto-loot.com/user/withdraw

Method: POST

Withdraw Feature coming soon. Balances will still be added to your account.

/user/top

URL: https://api.crypto-loot.com/user/top

Method: GET

Get a list of top users ordered by total number of hashes, balance or hashes withdrawn.

Parameters

secret Your private Secret-Key. See Manage Sites.
count Optional. The number of users to return. Default 128, min 1, max 1024.
order Optional. Either total, balance or withdrawn. The default is total.

Response

                            {
                            	"success": true|false,
                            	"users": [
                            		{
                            			"name": string,
                            			"total": number,
                            			"withdrawn": number,
                            			"balance": number
                            		},
                            		…
                            	],
                            	"error": string // optional
                            }
                            

Any of the global errors might occur.

/user/list

URL: https://api.crypto-loot.com/user/list

Method: GET

Get a paginated list of all users in alphabetical order. Note that this will only return users with a total number of hashes greater than 0.

Parameters

secret Your private Secret-Key. See Manage Sites.
count Optional. The number of users to return. Default 4096, min 32, max 8192.
page Optional. The page of users to return, obtained from the previous request's nextPage property. Leave out or specify an empty string for the first page.

Response

                            {
                            	"success": true|false,
                            	"users": [
                            		{
                            			"name": string,
                            			"total": number,
                            			"withdrawn": number,
                            			"balance": number
                            		},
                            		…
                            	],
                            	"nextPage": string|null, // the name of the next page of users
                            	"error": string // optional
                            }
                            

Possible Errors

invalid_page The page of users could not be found.

In addition, any of the global errors might occur.

/user/reset

URL: https://api.crypto-loot.com/user/reset

Method: POST

Reset Feature coming soon.

/user/reset-all

URL: https://api.crypto-loot.com/user/reset-all

Method: POST

Reset Feature coming soon.

/stats/payout

URL: https://api.crypto-loot.com/stats/payout

Method: GET

Get the current payout rate and stats about the network.

Parameters

secret Your private Secret-Key. See Manage Sites.

Response

                            {
                            	"success": true|false,
                            	"diff": number,
                            	"value": number,
                            	"payout": number,
                            	"payoutPer1MHashes": number,
                            	"synctime": number,
                            	"error": string // optional
                            }
                            

Possible Errors

Any of the global errors might occur.

/stats/history

URL: https://api.crypto-loot.com/stats/history

Method: GET

Get the hourly history of total hashes and hashes/s for the last 7 days for the site.

Parameters

secret Your private Secret-Key. See Manage Sites.

Response

                            {
                            	"success": true|false,
                            	"history": [
                            		{
                            			"synctime": number, // unix timestamp
                            			"hashes": number, //total hashes
                            			"hashrate": number //hashrate at the time
                            		},
                            		…
                            	],
                            	"error": string // optional
                            }
                            

Possible Errors

Any of the global errors might occur.