I couldn't find any way to get, through the API, a list of all questions that are duplicate of what other question.

For example, for the question with ID 10369, I want to obtain the question with ID 10372 (or the other way around, at least).

Is there a way to do so, other than scraping the page?

  • Have you checked any of the queries here? data.stackexchange.com/stackoverflow/queries?q=duplicate
    – Aaron Bertrand Staff
    Commented Aug 15, 2013 at 16:53
  • And do you mean to restrict your search space to questions that have been explicitly closed as a duplicate of another, or include ones that have been accused of being a duplicate (e.g. there is at least one VtC but it hasn't been closed), or trying to identify ones that might be a duplicate (by similar/identical title, or some other magic)? I wouldn't try to use the API for this - this means at least one API call for every question, right? Have you seen how many questions are on SO? Yikes.
    – Aaron Bertrand Staff
    Commented Aug 15, 2013 at 16:55
  • It doesn't matter if it's closed or not. What I need is a list of questions that are supposed to be "the same" for the person who flagged them. In the example above it's 10369 and 10372, but possible many other questions are the same as these two, well, I want to know that.
    – Matt
    Commented Aug 15, 2013 at 16:57
  • By the way, a list of all duplicate questions would be great but I don't think it's possible. I can call the API multiple times for the IDs I'm interested in, if it's necessary..
    – Matt
    Commented Aug 15, 2013 at 17:06
  • If you went with scraping the page, you could get in trouble with the thousands of requests in just a few seconds.
    – Cole Tobin
    Commented Aug 15, 2013 at 17:31

2 Answers 2


Here's an example you can work with:

  [Dupe(s)] = SUBSTRING(Text,CHARINDEX('[',Text),CHARINDEX(']',Text)-CHARINDEX('[',Text)+1)
FROM dbo.PostHistory 
WHERE PostHistoryTypeID = 10 -- closed question
AND Text LIKE '{"OriginalQuestionIds":%'
--AND PostId IN (your list)

I put TOP 10 so the query returns quickly. If you don't use TOP the query will likely timeout. You can remove that entirely if your list is reasonable.

  • Oh, that's nice, thanks!
    – Matt
    Commented Aug 15, 2013 at 19:02

You can use the data dump and write your own queries, I don't think there currently exists a way to do it via SO.

Not the answer you're looking for? Browse other questions tagged .