# Expose external\_id in embed.js

**URL:** <https://meta.discourse.org/t/expose-external-id-in-embed-js/280834>\
**Category:** Feature\
**Tags:** embedding\
**Created:** [October 3, 2023, 5:35am UTC](https://meta.discourse.org/t/expose-external-id-in-embed-js/280834 "2023-10-03T05:35:16Z")\
**Posts on this page:** 1\
**Showing post:** 2

<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:** [October 3, 2023, 6:49am UTC](https://meta.discourse.org/t/expose-external-id-in-embed-js/280834/2 "2023-10-03T06:49:13Z")

</div>

I’m assuming you created the topics via the API and set the `external_id` parameter.

I’m not sure if this helps, but Discourse has a `t/external_id/:external_id` route. It looks like it only returns JSON data:

> <https://github.com/discourse/discourse/blob/main/config/routes.rb#L1298C10-L1298C37>

So you can get the topic’s JSON at (for example )

`/t/external_id/2023-4.json`

That would return the content and `id` of the Discourse topic. I don’t think this solves your problem though.

Testing this now, JSON data is returned, but Discourse performs an automatic redirect to the actual Discourse topic URL when you make the request. For example a `GET` request to `http://localhost:4200/t/external_id/1.json` redirects me to `http://localhost:4200/t/testing-the-external-id-param/206.json`

---

_[View the full topic](https://meta.discourse.org/t/expose-external-id-in-embed-js/280834)._
