The only way to access a user’s bit information via an API instead of PubSub is through this unsupported API with this URL format:
https://api.twitch.tv/bits/balance/{{user id}}?channel={{channel id}}
But this is only accessible with a cookie called “persistent” in the format of “user id:unknown:unknown” (and URI encoded). You can get your own by opening the developer console in your browser, opening it to the Network tab, and then load a Twitch page. You’ll need to defeat the scroll as there will be many requests and select the first one in the list. Once you click it you’ll get a new panel. Click the “Headers” tab and then look at the “Request Headers” section for “cookie:” and the big wall of text. These are your cookies. Read through the “cookie” header’s value and you’ll find a cookie labeled “persistent=…” – this is your “persistent” cookie that you can use.
Here’s an example request in cURL with a randomized cookie checking “Alca” (me) in ScufJumpn’s channel:
curl 'https://api.twitch.tv/bits/balance/7676884?channel=64284181' \
-H 'cookie: persistent=7676884%3A40vxx8f9jm4nu4j1smimc8ywu3%3A2ujx2xfhlon98gb5sad0bvz4k'
Here’s an example response:
{
"balance": 0,
"bundles": {
"B017L2UX4C": true,
"B018WMZKR0": true,
"B018WMZN5E": true,
"B018WMZSPY": true,
"B018WMZYPI": true,
"B01G4BISOS": true,
"B01LZ42ZK9": false
},
"channel_total": 3004,
"inventory_limit": 250000,
"highest_entitled_badge": 1000
}
Unfortunately this is not practical to get other users’ data.