Reddit’s Secret API

John Musser, November 25th, 2008

RedditEvery now and then a sharp developer uncovers a clue that leads to discovery of an undocumented, but quite real, web API. A case in point is the folks over at SEO services company Indexed Content, who noted in their blog yesterday that the popular social news web site Reddit has an API. But don’t go looking for any documentation, because it doesn’t look like there is any, at least not yet (for reference we’ve created a Reddit API summary in our directory and will update it if/when this becomes an officially supported API).

How did they find it?

Over the past few weeks I have been working on creating a tool to gather some social media metrics to track social media optimization campaigns. Friendfeed is your friend if you’re embarking on the same project. While looking for a native reddit API however I stumbled across a post on code.reddit.com that mentioned an API endpoint.

The post in question at code.reddit.com gives essentially all the documentation there is at this point:

In many applications, such as Socialite, it is valuable to look up information about a link on reddit. Currently, there are two good ways to do this using the JSON API:

Info call
Example: http://www.reddit.com/api/info.json?count=1&url=STORYURL

The API “info” call is an ideal way to look up reddit stories by URL. However, in some cases, looking up stories by URL alone presents problems:

1. URLs are not mapped to stories on a one-to-one basis. Since the same URL can be posted to many subreddits, when looking up stories by a URL, it becomes necessary to constrain the search by subreddit, e.g.: http://www.reddit.com/r/subreddit/api/info.json?count=1&url=STORYURL

This summary sufficies in many ways given how simple the REST-based API itself appears to be. It returns data in JSON and requires no authentication. Clicking on this link will get you the JSON-formatted version of Reddit’s page to A list of average IQ’s per occupation.

Are there other endpoints? A couple of quick tests to api.reddit.com, a url not documented anywhere, does indeed return a JSON-formatted representation of the current home page HTML contents. There may be more here from Reddit coming soon? In the meantime, guessing the wrong parameters gives the message below.

And in the world of Web mashups this type of discovery is part of a time honored tradition. Two years ago Niall Kennedy reverse engineered the Google Reader API. And it dates all the way back to the prototypical mashup HousingMaps in which Paul Rademacher reverse engineered the Google Maps service back in early 2005 before there was an “official API”. At the time it was just a set of underlying JavaScript functions that he dug through and built on. Google ultimately turned this hacking to their advantage, both by hiring Paul and turning those JavaScript functions into what’s become the most famous and successful of web APIs.

Both comments and pings are currently closed.

12 Responses to “Reddit’s Secret API”

November 26th, 2008
at 9:08 am
Comment by: Иван Бегтин - Ссылки. Подборки данных для анализа

[...] Reddit Secret API – всё тайное становится явным, у Reddit есть своё API [...]

December 8th, 2008
at 2:36 am
Comment by: The Unofficial Chicago Transit Authority API

[...] Reverse engineering an API requires a lot of creative investigation into the source code that is publicly available in mashups that apply the undocumented API. For example, we recently reported on Index Content’s discovery of “Reddit’s Secret API”. [...]

January 2nd, 2009
at 1:28 pm
Comment by: Monkey Vs Robot - My Weekly Idealist post Brokekid.net

[...] news aggregators that I use, Reddit and Google Reader, both apparently have secret APIs. A [...]

January 20th, 2009
at 8:19 pm
Comment by: Brian

Take any URL at reddit and append .json to it. E.G. http://www.reddit.com/r/Libertarian/new/.json

March 19th, 2009
at 1:27 pm
Comment by: Eli | Link Builder

While it’s not terribly unusual for a web API to be developed in the background, outside of users’ eyes, I do find it somewhat strange that Reddit Admins are ok with people poking around in their “secret” development zone. Perhaps they’re not even trying to keep it a secret and it’s meant for public use, but freely allowing anyone to access and potentially reverse engineer it.

July 17th, 2009
at 6:22 pm
Comment by: Jason404

I would really like to be able to type in a comment URL in the command line and get the .json file decoded so that I can see how many up and down votes the comment has had. I do not want to use the user javascript extensions for FF. Could anybody write something like this??

February 7th, 2010
at 2:35 pm
Comment by: Mats Svensson

Seems like a nice little API, fun to play with =)

This post also prompted me to seek out this great add-on for Firefox:
https://addons.mozilla.org/en-US/firefox/addon/10122
Witch display json prettified in the browser instead of downloading it.
Very handy.

October 30th, 2010
at 6:00 am
Comment by: commercial flooring

commercial flooring

April 6th, 2011
at 12:14 am
Comment by: Notes about reddit « The Ubuntu Incident

[...] is a post about Reddit’s (secret) API. In a comment there it is pointed out that you can add [...]

October 24th, 2012
at 12:56 pm
Comment by: E-Cigarette Festival

It’s a shame you don’t have a donate button!
I’d without a doubt donate to this excellent blog! I guess for now i’ll settle
for bookmarking and adding your RSS feed to my Google account.
I look forward to brand new updates and will share this website with my Facebook group.
Chat soon!

November 23rd, 2012
at 3:55 pm
Comment by: Jade

It’s an awesome paragraph in support of all the online viewers; they will obtain benefit from it I am sure.

December 17th, 2012
at 11:06 am
Comment by: ears

Hello there! I know this is kinda off topic but I was wondering if you knew where I could
locate a captcha plugin for my comment form? I’m using the same blog platform as yours and I’m having problems finding
one? Thanks a lot!

Follow the PW team on Twitter

ProgrammableWeb
APIs, mashups and code. Because the world's your programmable oyster.

John Musser
Founder, ProgrammableWeb

Adam DuVander
Executive Editor, ProgrammableWeb. Author, Map Scripting 101. Lover, APIs.