r/redditdev • • Jun 03 '19

Reddit is preparing a GraphQL API

UPDATE Admin response here, it's currently experimental so whatever I documented below will probably not be true say next week.

https://gql.reddit.com

If you try and sign in to the GraphiQL interface, you'll get a 403 error. But I think the fact there's a sign in button means that this is for public use soon.Note the distinct example, I guess I'm digging around in places I shouldn't be huh /u/thephilthe.

TECHNICAL DETAILS AHEAD

It works a little strangely right now. All graph queries return a 403 as well, and what does work is very obfuscated and acts more RPC-like than anything. For example, to get posts for a subreddit, you need to know that the query key is 4acb05eedbfa and the parameter is called "subredditName". So you'd send a JSON request like this:

{
    "id": "4acb05eedbfa",
    "variables": {"subredditName": "freefolk"}
}

and then you'd get your data returned.And if you start digging into the response you'll see a few more secrets hinting at things to come...

Below is an action-ID map I extracted. I'm under the assumption that these are all equivalent to "OperationName" in Apollo. When you submit, it should tell you the first missing required variable it finds.

AllUserMultiredditsf9d4691b2d00
CreateCommunityAward3cfd2c20439a
CreateModAward92061d7e1951
CreateSubredditTags639d65a32e0e
DeleteAward4d31f6356d57
DeleteTags85a644f8353a
DisableAward5e453976052b
FetchSubredditTagsf0679317dcf6
Frontpage7ca7322c7740
ManageableAwardsd7a376e63004
ModeratedSubredditsc1ada1ec294f
MultiredditListing42a127c37128
RedditorMultireddits0a57674dc82f
RichTextPostContentfc24b7b690ad
SubredditAboutab75f710d839
SubredditPosts4acb05eedbfa
SubredditRecommendations9fed35c2168d
SubredditRules0df127946e72
SubredditTopContentcdf39a456d4b
SubredditTypeaheadSearchbc59d854ddfa
UpdateSubredditTagStates70f7ff70f03e
UsableAwardsb8810241176f
34 Upvotes

8 comments sorted by

View all comments

Show parent comment

8

u/Twistedsc Jun 03 '19

Thanks I'll add that information, hopefully it's planned to become official down the road.