# API Get User By Associated Account ID

**URL:** https://meta.discourse.org/t/api-get-user-by-associated-account-id/184812
**Category:** Support
**Created:** [March 30, 2021, 2:56am UTC](https://meta.discourse.org/t/api-get-user-by-associated-account-id/184812 "2021-03-30T02:56:58Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![cookieman768](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cookieman768/32/118511_2.png) [@cookieman768](https://meta.discourse.org/u/cookieman768)
#### Post date: [March 30, 2021, 2:56am UTC](https://meta.discourse.org/t/api-get-user-by-associated-account-id/184812/1 "2021-03-30T02:56:58Z")

</div>

Hey everyone, I’m still pretty new to using Discourse to serve as the central form of communication for my community and was just unsure how to go about certain things.

I’ll explain what I’m trying to do so you can get a better understanding.

So, my community is gaming oriented and I want to use Discourse as a source of user management for all parts of my community. I am attempting to synchronize ranks from Discourse to a Steam game server for users that have signed in with Steam.

How would I look up a user by the Steam ID efficiently with the Discourse API, so I can get their groups? Any guidance would be appreciated! I am pretty familiar with using APIs, but I just cannot figure out if this would be readily doable or what the best approach for me is going to be.

---

<div class="post-metadata">

### Author: ![Mark\_Schmucker](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/mark_schmucker/32/124810_2.png) [@Mark\_Schmucker](https://meta.discourse.org/u/Mark_Schmucker)
#### Post date: [March 30, 2021, 8:27am UTC](https://meta.discourse.org/t/api-get-user-by-associated-account-id/184812/2 "2021-03-30T08:27:48Z")

</div>

I would like to do this also. I don’t have an answer, but see the following:

> [@Migrate FROM discourse](https://meta.discourse.org/t/migrate-from-discourse/178941/2):
>
> The Discourse user’s external\_id will match the WP user\_id.

> [@Migrate FROM discourse](https://meta.discourse.org/t/migrate-from-discourse/178941/11):
>
> I’m not interested in migrating from Discourse, but I am interested in this. Can you elaborate where this field is found? Using [Data Explorer](https://meta.discourse.org/t/32566?silent=true), I don’t see it under the users table or any other table.

> [@Migrate FROM discourse](https://meta.discourse.org/t/migrate-from-discourse/178941/12):
>
> I’m not sure in which table it’s stored, but external\_id is part of the users export file from /admin/users/list/active → Export EDIT: found it - it’s in the single\_sign\_on\_records table.

You can download a csv file that contains both user id and external id from /admin/users/list/active, Export. That’s not an API call but maybe it would help.

---

<div class="post-metadata">

### Author: ![cookieman768](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cookieman768/32/118511_2.png) [@cookieman768](https://meta.discourse.org/u/cookieman768)
#### Post date: [March 30, 2021, 3:53pm UTC](https://meta.discourse.org/t/api-get-user-by-associated-account-id/184812/3 "2021-03-30T15:53:24Z")

</div>

Yeah, that’s definitely a step in the right direction. I’m just not seeing any way to do a query via the API to look up a person via an external identified. Ideally I want to be able to do it using both Discord IDs and Steam IDs, but I’m hoping to get Steam IDs sorted out first.

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [March 30, 2021, 3:56pm UTC](https://meta.discourse.org/t/api-get-user-by-associated-account-id/184812/4 "2021-03-30T15:56:16Z")

</div>

You should be able to use this for both Discord and Steam logins:

> [@Finding a user by their identity provider 'external ID'](https://meta.discourse.org/t/find-a-user-by-their-identity-provider-external-id/169723):
>
> bookmark This guide explains how to find a Discourse user based on their external\_id from an identity provider using API calls. person_raising_hand Required user level: Administrator When using an external authentication system, Discourse keeps track of two user ids: the Discourse user\_id, and an external\_id from the identity provider. If you need to lookup a Discourse user based on the external\_id, this #howto article is for you! Below, you’ll learn how to perform this operation. API S…

---

<div class="post-metadata">

### Author: ![cookieman768](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cookieman768/32/118511_2.png) [@cookieman768](https://meta.discourse.org/u/cookieman768)
#### Post date: [March 30, 2021, 5:35pm UTC](https://meta.discourse.org/t/api-get-user-by-associated-account-id/184812/5 "2021-03-30T17:35:59Z")

</div>

Thank you so much, I just tested that, and it worked exactly as I needed it to! Now I’ll just need to write the in-game implementation.

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [April 29, 2021, 5:36pm UTC](https://meta.discourse.org/t/api-get-user-by-associated-account-id/184812/6 "2021-04-29T17:36:22Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
