# Can I send an external URL to the Discourse API for it to return topics linking to that URL?

**URL:** https://meta.discourse.org/t/can-i-send-an-external-url-to-the-discourse-api-for-it-to-return-topics-linking-to-that-url/392361
**Category:** Support
**Tags:** rest-api
**Created:** [29 december 2025 om 21:57 UTC](https://meta.discourse.org/t/can-i-send-an-external-url-to-the-discourse-api-for-it-to-return-topics-linking-to-that-url/392361 "2025-12-29T21:57:37Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [29 december 2025 om 21:57 UTC](https://meta.discourse.org/t/can-i-send-an-external-url-to-the-discourse-api-for-it-to-return-topics-linking-to-that-url/392361/1 "2025-12-29T21:57:37Z")

</div>

Would it be possible, on an external non-Discourse website, to have a “Forum topics that discuss this page” section containing links to the relevant Discourse forum topics?

If the API can take a URL and return a list of topic IDs/URLs that would be perfect.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [29 december 2025 om 22:15 UTC](https://meta.discourse.org/t/can-i-send-an-external-url-to-the-discourse-api-for-it-to-return-topics-linking-to-that-url/392361/2 "2025-12-29T22:15:53Z")

</div>

Do you know about [Embed Discourse comments on another website via Javascript](https://meta.discourse.org/t/embed-discourse-comments-on-another-website-via-javascript/31963)?

But if you think that multiple topics link to a page then you might be able to use the TopicLink table to do a search of topics that link that URL (probably with the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) plugin) and then you’d have the topic and post IDs so you could link to them.

I don’t think there’s an endpoint to get them. A plugin could make one available, I think. Also, [Discourse GitHub](https://meta.discourse.org/t/discourse-github/99895) doess something sort-of similar, so that might help.

---

<div class="post-metadata">

### Author: ![Jonathan5](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jonathan5/32/197134_2.png) [@Jonathan5](https://meta.discourse.org/u/Jonathan5)
#### Post date: [30 december 2025 om 00:16 UTC](https://meta.discourse.org/t/can-i-send-an-external-url-to-the-discourse-api-for-it-to-return-topics-linking-to-that-url/392361/3 "2025-12-30T00:16:52Z")

</div>

> [@pfaffman](#):
>
> you might be able to use the TopicLink table to do a search of topics that link that URL (probably with the [Data Explorer](https://meta.discourse.org/t/32566?silent=true) plugin) and then you’d have the topic and post IDs so you could link to them

Do you think I could create a query with a URL parameter and run it via the API using this? [Run Data Explorer queries with the Discourse API](https://meta.discourse.org/t/run-data-explorer-queries-with-the-discourse-api/120063).

---

<div class="post-metadata">

### Author: ![merefield](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/merefield/32/176214_2.png) [@merefield](https://meta.discourse.org/u/merefield)
#### Post date: [30 december 2025 om 10:30 UTC](https://meta.discourse.org/t/can-i-send-an-external-url-to-the-discourse-api-for-it-to-return-topics-linking-to-that-url/392361/4 "2025-12-30T10:30:02Z")

</div>

Yes I think so, kinda.

Try this, e.g.:

`https://meta.discourse.org/search.json?q=https%3A%2F%2Fnews.bbc.co.uk`

Tidy results in JavaScript.

If anon can use search you perhaps don’t need an API key even (then you can put this client side)

However you might want to cache the results on the external server for best results and avoid poor Discourse get overwhelmed with search queries.

So this probably involves writing server side code on your external website for best outcome.

---

<div class="post-metadata">

### Author: ![Andrew\_Rowe](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/andrew_rowe/32/445877_2.png) [@Andrew\_Rowe](https://meta.discourse.org/u/Andrew_Rowe)
#### Post date: [30 december 2025 om 13:13 UTC](https://meta.discourse.org/t/can-i-send-an-external-url-to-the-discourse-api-for-it-to-return-topics-linking-to-that-url/392361/5 "2025-12-30T13:13:25Z")

</div>

> [@merefield](#):
>
> Try this, e.g.:
> 
> `https://meta.discourse.org/search.json?q=https%3A%2F%2Fnews.bbc.co.uk`
> 
> Tidy results in JavaScript.

Wow, thanks Robert, this does work, I just tried on my own server.

> [@merefield](#):
>
> writing server side code on your external website for best outcome.

This sounds really similar to something I was trying to do earlier. My other server uses PHP and I figured out how to use Curl commands in a PHP module to hit the API and return json results to an ajax call from the client. Here is that topic

> [@Embed a list of Discourse topics onto an external site](https://meta.discourse.org/t/embed-a-list-of-discourse-topics-onto-an-external-site/293709/28):
>
> Since I didn’t get any hints I figured I’d answer a few of my own questions for anyone who looks just for reference YES, self hosted [official install](https://meta.discourse.org/t/install-discourse-in-production-with-the-official-supported-instructions/142537?silent=true) included the REST API Got hints from [api example thread](https://meta.discourse.org/t/discourse-rest-api-comprehensive-examples/274354) how to make cURL calls from the terminal. Once the cURL commands worked I used this website to convert the command line version to PHP My other server runs PHP as backend and I make ajax calls from web page to function on the server. The Discourse spits out json and javascript it built fo…

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [30 december 2025 om 15:21 UTC](https://meta.discourse.org/t/can-i-send-an-external-url-to-the-discourse-api-for-it-to-return-topics-linking-to-that-url/392361/6 "2025-12-30T15:21:28Z")

</div>

> [@merefield](#):
>
> Try this, e.g.:
> 
> `https://meta.discourse.org/search.json?q=https%3A%2F%2Fnews.bbc.co.uk`

Oh! Of course. A regular search will find the URL! 🤦
