Getting profile-id from battletag

Hi there,

I’m looking to make a discord bot that can surface a profile summary if given a battletag. The intent is for members of the chat to be able to quickly access their stats from chat.

I’m finding this hard to do. The user APIs are reliant the profileId parameter. The only place I can see that this get’s returned is via /oauth/userinfo which require’s the user to have gone through an OAuth flow first. Since the bot only has access to its own credentials, it’s not able to call this to get someone else’s profileId.

Is there a way that I can surface profileId given a battletag rather than via OAuth flow (I assume there’s a way since sites like rankedftw and the official Overwatch site have this kind of search)? Or is there a way to trigger and complete an OAuth flow for a user within a discord channel? I’d rather not have to host another app just for the OAuth flow.

If your bot has access to the forums, this is a workaround - the battletag can be used to look up the user’s profile, as well as get their stats from other servers. But it requires that the user has logged in to the forums of that region at least once.

Thanks for the reply! I’m not sure if that whole thing can be automated from the bot; I would be surprised if bot credentials work with forum pages - but I’ll try it out.

Interestingly, it looks like that Forum profile page has the user’s data injected in the HTML (data-preloaded div), so if the bot can call against that page you can probably skip the “View profile” step to get the profileId.


Haven’t found a way to auth against the forum pages. Looks like auth data for forums is stored cookies. Would have to do something dodgy like copy the (temporary) forum credentials and re-create the cookie on the bot. Pretty sure that goes against terms of use.

So need another solution to resolve profile-id from battlenet tag.


Idk if you’re still intrested but released a while ago, and they have an API. If you type:
curl -G "{*BattleTag Here*}&limit={1}"

into your command prompt, it returns some Json data that, along with other things, has the player’s SC2 ID.

What I do (for Python 3) is:
import subprocess
data = subprocess.get_output(command)

where data is a string. hope that helped!

Edit: This only works if the player has been placed in a 1v1 ladder. Back to the drawing board.