# Discourse API Get Current Topic

**URL:** <https://meta.discourse.org/t/discourse-api-get-current-topic/174068>\
**Category:** Product Support\
**Created:** [December 23, 2020, 2:50am UTC](https://meta.discourse.org/t/discourse-api-get-current-topic/174068 "2020-12-23T02:50:53Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![renato](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/renato/32/383632_2.png) [@renato](https://meta.discourse.org/u/renato)\
**Post date:** [December 23, 2020, 3:31am UTC](https://meta.discourse.org/t/discourse-api-get-current-topic/174068/2 "2020-12-23T03:31:18Z")

</div>

I’m not sure if this is the best approach, but it’s possible to get the topic creator username like this:

```js
const controller = Discourse. __container__.lookup("controller:topic")
const username = constroller.get("model.details.created_by.username")

```

This doesn’t work directly in the `<script/>` tag, you’d probably want to use it on a `api.onPageChange` or some other event (in a quick test it also worked on a `setTimeout` with 0ms, but I don’t know if there are side effects).

---

_[View the full topic](https://meta.discourse.org/t/discourse-api-get-current-topic/174068)._
