Account information & balances

Getting User ID

To get your userID and other basic account information that might not be on the website you should use the post method of https://identity.hxro.io/api/Account.

const apiToken = "api token";
const contentLength = JSON.stringify({
    nickName: "yourUsername",
    assetType: "hxro or btc ",
});
const https = require('https');
const options = {
    hostname: 'identity.hxro.io',
    port: 443,
    path: '/api/Account',
    method: 'POST',
    headers: {
        'Content-Type': 'application/json',
        'Ocp-Apim-Subscription-Key': apiToken,
        'Content-Length': contentLength.length
    }
}

const req = https.request(options, (res) => {
    res.on('data', (d) => {
        console.log(JSON.parse(d));
    })
})

req.on('error', (error) => {
    console.error(error)
})

req.write(contentLength)
req.end()

Example of a successful response

{  
	"id": 'int',
  'nickname': 'string',
  'walletPublicAddress': 'string',
  'lastWalletReconciliation': 'string',
  'pendingWithdrawals': 'int',
  'balance': 'double',
  'assetType': 'string',
  'accountType': 'Player',
  'createdDate': 'string',
  'modifiedDate': 'string',
  'applicationUserId': 'string',
  'user': {
    'id': 'string',
    'username': 'string',
    'email': 'string',
    'twoFactorEnabled': 'boolean',
    'token': 'string',
    'refreshToken': 'string',
    'claims': 'string',
    'lastLoginDate': 'string',
    'lockoutEnd': 'string',
    'accounts': [],
    'customerWallets': [],
    'createdDate': 'string',
    'preferences': {
      'recentTransactionIds': [Array],
      'recentContestIds': [],
      'recentUserIds': [Array],
      'recentContestSeriesIds': [Array]
    },
    'dateOfBirth': 'string',
    'isInternal': 'boolean',
    'subscriptionKeys': [ [Object] ]
  },
  'gamesUntilUnlock': 'string'
}

Getting Account Balances (HXRO, Bonus, BTC)

To get your account balances you need to use the GET https://identity.hxro.io/api/Account/by-user/{userId} endpoint

const apiToken = 'your api token';
const userID = 'your userID';

const https = require('https');
const options = {
    hostname: 'identity.hxro.io',
    port: 443,
    path: '/api/Account/by-user/' + userID,
    method: 'GET',
    headers: {
        'Content-Type':'application/json',
        'Ocp-Apim-Subscription-Key': apiToken,
    }
}

const req = https.request(options, (res) => {
    var arr = "";
    res.on('data', (part) => {
        arr += part;
    });

    res.on('end', () => {
        var seriesArr = JSON.parse(arr)
        for (i = 0; i <= seriesArr.length; i++) {
            console.log(seriesArr[i]);
        }
    });
})

req.on('error', (error) => {
    console.error(error)
})

req.end()