Following on from this answer, I have a data extraction requirement that is not presently catered for in the API, so I've raised a feature request for that.

It has also been suggested that it would be useful to download SEDE results via a formal API, to cater generally for situations that the API does not cover. The advantage of this is that building new API features may be unnecessary, since the SEDE API would be available in cases that it does not cover; the disadvantage might be that people can run terrible queries frequently and add excessive load onto the database servers.

I understand from this answer that it is possible to programmatically download the CSV file associated with a SEDE query, so if a SEDE API is judged to not be worth implementing, there is at least another way to go about this.

  • You might consider a similar FR on MSE, taking potential duplicates into consideration. Sep 2, 2015 at 18:26
  • @BrockAdams, good idea! Done here.
    – halfer
    Sep 2, 2015 at 18:52

1 Answer 1


This is not an official API, but it is not too hard to simulate the login via OAuth2 and use the session to start executing a query, poll the job that executes it and retrieve the results in the end. I do most of my Stack Exchange development work in Java, but it should be easy to port to other languages even if you don't know Java. I'm using fairly standard libraries: Apache HTTP client, JSON parser org.json and HTML parser Jsoup.

The source code can be found here on GitHub; you'll need to provide your own email address and password which you use for logging in to Stack Exchange at the bottom. To run a query, you'll need the site ID which you can obtain from this list; the query ID (visible in the URL) and the revision ID of the query (visible when you edit the query (left), or otherwise in the HTML of the 'Run Query' form (right)).

(originally posted here)

You must log in to answer this question.

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