# How to programmatically retrieve the external\_id for a topic

**URL:** <https://meta.discourse.org/t/how-to-programmatically-retrieve-the-external-id-for-a-topic/259914>\
**Category:** Development\
**Created:** [March 29, 2023, 10:44pm UTC](https://meta.discourse.org/t/how-to-programmatically-retrieve-the-external-id-for-a-topic/259914 "2023-03-29T22:44:36Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)\
**Post date:** [March 30, 2023, 7:33pm UTC](https://meta.discourse.org/t/how-to-programmatically-retrieve-the-external-id-for-a-topic/259914/5 "2023-03-30T19:33:32Z")

</div>

`external_id` is a property of the `SingleSignOnRecord` model. It’s used to link a user to an external site when [DiscourseConnect](https://meta.discourse.org/t/13045?silent=true) is used to log users into Discourse via an external site. If this is what you are trying to find, it’s not available on the Topic. As far as I know, Discourse only returns the `external_id` on the front end for the `CurrentUser`, so if you are trying to do something like get the `external_id` of the topic’s author, it could be tricky.

If you post some more details about what you are trying to accomplish, someone here might be able to help. There might be some easier ways of approaching the problem than what you are trying to do.

> [@SeanOSullivan](#):
>
> Sorry for time-wasting

Not a problem. That’s what we’re here for 🙂

---

_[View the full topic](https://meta.discourse.org/t/how-to-programmatically-retrieve-the-external-id-for-a-topic/259914)._
