Reddit's API documentation: https://www.reddit.com/dev/api

Description of the API's return data: https://github.com/reddit/reddit/wiki/JSON

Terminology

Reddit's API is slightly inconsistent in its naming; "id" sometimes refers to a thing's short ID, and sometimes to its fullname (the combination of its prefix and id). To avoid confusion, this guide will always refer to things in the following way:

Term Description Example
fullname A thing's complete ID with prefix. The type of thing can be determined by the first two characters ("t1" for comment, "t3" for post, etc). t1_cvp5afk
id A thing's short ID without prefix. Seen in your address bar when viewing, for example, a post or comment. Useful for constructing URLs. 3npkj4

Listings

Two notes about methods that return lists of things:

  1. All methods that return lists of things return them as a Perl list-- that is, a reference to an anonymous array. In practice this means that you get at the values with @$array instead of @array.

  2. All methods that return lists of things can accept three optional parameters: limit, before, and after. You may recognize them from your address bar when viewing anything but the front page of Reddit/a subreddit.

         
    limit integer How many things to return. Defaults to 25. If limit is present but false, this is interpreted as "no limit" and as many as possible are returned (currently 100).
    before fullname Return results that occur before fullname. Used for pagination.
    after fullname Return results that occur after fullname. Used for pagination.

Types of Thing

| :--|:-- t1| Comment t2| Account t3| Link t4| Message t5| Subreddit t6| Award t8| PromoCampaign