An API for querying reddit data.
No uptime or performance guarantees :)
Base URL: https://arctic-shift.photon-reddit.com
Status page: https://status.arctic-shift.photon-reddit.com
Search UI: https://arctic-shift.photon-reddit.com/search
/api/posts/ids
/api/comments/ids
/api/subreddits/ids
/api/users/ids
(see notes)- Examples
- Retrieve 2 posts with the IDs ei30r4 and eitwb3
/api/posts/ids?ids=ei30r4,eitwb3
- Retrieve 2 posts with the IDs ei30r4 and eitwb3
Retrieve things based on their ID
Parameter | Type | Default | Notes |
---|---|---|---|
ids |
ID[] |
Comma separated list. Limit: 500 | |
md2html |
boolean |
false |
If true , adds auto generated selftext_html /body_html field |
fields |
string |
Comma separated list of fields to return (more info) |
/api/posts/search
/api/comments/search
- Examples:
- Search in r/worldnews for 10 posts with "wuhan" in the title, posted after 2019-12-30, sorted by ascending date
/api/posts/search?sort=asc&after=2019-12-30&subreddit=worldnews&title=wuhan&limit=10
- Search for up to 100 comments from u/PresidentObama under the post z1c9z
/api/comments/search?author=PresidentObama&link_id=z1c9z&limit=100
- Search in r/worldnews for 10 posts with "wuhan" in the title, posted after 2019-12-30, sorted by ascending date
Common parameters:
Parameter | Type | Default | Notes |
---|---|---|---|
author |
string |
||
subreddit |
string |
||
author_flair_text |
string |
(full text search) for limitations see title or body below |
|
after |
Date |
Time when thing was posted | |
before |
Date |
Time when thing was posted | |
limit |
int (1 - 100) | "auto" |
25 | With "auto" between 100 and 1000 results are returned, depending on the capacity of the server |
sort |
asc | desc |
Results are sorted by created_utc |
|
md2html |
boolean |
false |
If true , adds auto generated selftext_html /body_html field |
fields |
string |
Comma separated list of fields to return (more info) |
Post search parameters:
Parameter | Type | Default | Notes |
---|---|---|---|
crosspost_parent_id |
ID |
||
over_18 |
boolean |
||
spoiler |
boolean |
||
title |
string |
(full text search) Only in use with author or subreddit parameter (not supported with very active users or subreddits) |
|
selftext |
string |
(full text search) ... | |
link_flair_text |
string |
(full text search) ... | |
query |
string |
Search in both title and selftext (full text search) ... |
|
url |
string |
prefix match, example: https://www.youtube.com/xyz will return https://www.youtube.com/xyz?p=abc or also https://www.youtube.com/xyz?t=15s | |
url_exact |
boolean |
false |
if true , url queries will only return exact matches |
Comment search parameters:
Parameter | Type | Default | Notes |
---|---|---|---|
body |
string (full text search) |
Only in use with author , subreddit , link_id or parent_id parameter (not supported with very active users or subreddits) |
|
link_id |
ID |
ID of post | |
parent_id |
ID | empty |
Parent comment id. Empty means top level comment |
/api/comments/tree
- Examples
- Get a comment tree for the post t3_7cff0b, with t1_dppum98 as the top level comment, and generate HTML for the body
/api/comments/tree?link_id=t3_7cff0b&parent_id=t1_dppum98&md2html=true
- Get all comments underneath the post x8i09x
/api/comments/tree?link_id=t3_x8i09x&limit=9999
- Get a comment tree for the post t3_7cff0b, with t1_dppum98 as the top level comment, and generate HTML for the body
Retrieve comments in a tree structure, similar to how they are displayed on reddit.
If limit
is exceeded, comments are collapsed. Collapsed comments use "kind": "more"
and have a children
field
containing the IDs of the comments that are collapsed, the same way the reddit API does it. start_breadth
and start_depth
decrease by 1 for each depth level. Comments outside the current breadth or depth are collapsed.
Parameter | Type | Default | Notes |
---|---|---|---|
link_id |
ID |
ID of post (required) | |
parent_id |
ID |
If unset, all comments under the post are returned | |
limit |
int (>= 1) |
50 | Something like 999999 returns all comments |
start_breadth |
int (>= 0) |
4 | For comment collapsing |
start_depth |
int (>= 0) |
4 | For comment collapsing |
md2html |
boolean |
false |
If true , adds auto generated body_html field |
/api/posts/search/aggregate
/api/comments/search/aggregate
- Examples
- Comment frequency of u/spez since 2006
/api/comments/search/aggregate?aggregate=created_utc&frequency=year&author=spez&after=2006-01-01
- Most active posters in r/announcements
/api/posts/search/aggregate?aggregate=author&subreddit=announcements
- Comment frequency of u/spez since 2006
Aggregate results based on date, author or subreddit.
All filtering related parameters from the search endpoints are supported.
Very active users or subreddits have a high chance of timing out.
Parameter | Type | Default | Notes |
---|---|---|---|
aggregate |
created_utc | author | subreddit |
||
frequency |
string (interval) |
Required with aggregate=created_utc |
|
limit |
int (>= 1) | empty |
empty | empty means no limit (limit= ) |
min_count |
int (>= 0) |
Not used with aggregate=created_utc |
|
sort |
asc | desc |
asc with aggregate=created_utc , otherwise desc |
/api/subreddits/search
- Examples:
- Search for subreddits starting with "r/ask" sorted by number of subscribers (default)
/api/subreddits/search?subreddit_prefix=ask
- Search for oldest subreddits with more that 1000 subscribers
/api/subreddits/search?min_subscribers=1000&sort_type=created_utc&sort=asc
- Search for subreddits starting with "r/ask" sorted by number of subscribers (default)
Note: List of subreddits and their data is only updated infrequently. Aggregate _meta
data is updated more frequently.
Parameter | Type | Default | Note |
---|---|---|---|
subreddit |
string |
||
subreddit_prefix |
string |
||
after |
Date |
Subreddit creation date | |
before |
Date |
Subreddit creation date | |
min_subscribers |
int |
||
max_subscribers |
int |
||
over18 |
boolean |
nsfw | |
limit |
int (1 - 1000) |
25 | |
sort |
asc | desc |
desc |
|
sort_type |
created_utc | subscribers | subreddit |
subscribers |
|
fields |
Comma separated list of fields to return (more info) |
/api/users/search
- Examples:
- Search for users with the most karma
/api/users/search?sort_type=total_karma
- Search for users starting with u/mod with at least 1000 comments sorted alphabetically
/api/users/search?author_prefix=mod&min_num_comments=1000&sort_type=author&sort=asc
- Search for users with the most karma
Note: This is endpoint only contains aggregate data of user names, ids, number of posts/comments, earliest/latest posts/comments, karma, etc.
It is only updated infrequently. _meta
data is updated more frequently.
Ids might be null
if the user hasn't been active in recent years.
Parameter | Type | Default | Note |
---|---|---|---|
author |
string |
||
author_prefix |
string |
||
min_num_posts |
int |
||
min_num_comments |
int |
||
active_since |
Date |
Date of first post or comment | |
min_karma |
int |
||
limit |
int (1 - 1000) |
25 | |
sort |
asc | desc |
desc |
|
sort_type |
author | total_karma |
total_karma |
Karma is the sum of post/comment scores |
Note: For very active users (especially bots), this has a high chance of timing out. In that case, try narrowing the time range using the after
and before
parameters.
/api/users/interactions/users
- Example:
- Get all interactions of u/spez, with more than 10 interactions, up until 2017
/api/users/interactions/users?author=spez&before=2017-01-01&min_count=10
- Get all interactions of u/spez, with more than 10 interactions, up until 2017
Aggregates number of interactions between users.
/api/users/interactions/users/list
Lists all individual interactions between users.
As an interactions counts:
- author commented under a post
- author commented under a comment
- someone replied to author's post
- someone replied to author's comment
Parameter | Type | Default | Notes |
---|---|---|---|
author |
string |
required | |
subreddit |
string |
||
after |
Date |
||
before |
Date |
||
min_count |
int (>= 0) |
Minimum number of interactions | |
limit |
int (>= 1) | empty |
100 | empty means no limit (limit= ) |
/api/users/interactions/subreddits
See in which subreddits a user has been active. Similar to the above /api/posts/search/aggregate
and /api/comments/search/aggregate
endpoints, but both are combined into one, with weighting and
limiting options.
Parameter | Type | Default | Notes |
---|---|---|---|
author |
string |
required | |
weight_posts |
float |
1.0 | |
weight_comments |
float |
1.0 | |
before |
Date |
||
after |
Date |
||
min_count |
int (>= 0) |
Minimum number of interactions | |
limit |
int (>= 1) | empty |
100 | empty means no limit (limit= ) |
/api/users/aggregate_flairs
- Examples:
Aggregates all author_flair_text
values of a user and groups them by subreddit.
Parameter | Type | Default | Notes |
---|---|---|---|
author |
string |
required |
By only selecting the fields you need, you can potentially reduce the response time and size.
Both posts & comments: author
, author_fullname
, author_flair_text
, created_utc
, distinguished
, id
, retrieved_on
, subreddit
, subreddit_id
, score
Posts: crosspost_parent
, link_flair_text
, num_comments
, over_18
, post_hint
, selftext
, spoiler
, title
, url
Comments: body
, link_id
, parent_id
Subreddits: created_utc
, description
, public_description
, display_name
, id
, over18
, retrieved_on
, subscribers
, title
, (and _meta fields)
True values: true
, 1
, yes
, y
False values: false
, 0
, no
, n
Base 36 encoded number. Can optionally start with a t3_/t1_ prefix for posts/comments. The ID is part of the link to a post/comment. (reddit.com/.../comments/<post_id>/.../<comment_id>).
Example valid IDs: sphocx
, t3_sphocx
, dppum98
, t1_dppum98
If you include the u/
or r/
prefix, it will be ignored.
Dates can be specified in the following formats:
- Epoch time in seconds
- Epoch time in milliseconds
- ISO 8601 (partial)
2020-01-01T00:00:00.000Z
2020-01-01 00:00:00
2020-01-01
- Offset from current time (e.g.
1year
,3m
,2d
,1hour
,5min
or10s
)
For details, see here, specifically the websearch_to_tsquery
function.
But in short:
Word1 Word2
searches forWord1
andWord2
, regardless of order"Word1 Word2"
searches forWord1
followed byWord2
, possibly with other words in betweenWord1 OR Word2
searches forWord1
orWord2
Word1 -Word2
searches forWord1
but notWord2
If you're a normal user and only make a couple requests per second, you have nothing to worry about.
But if you make excessive requests, you might get rate limited. Look at the X-RateLimit-Remaining
header to see how many request are remaining. X-RateLimit-Reset
shows when the rate limit is reset. Rate limits can change at any time.
Remember, this is a free service, so be considerate. If you want to process massive amounts of data, use the monthly dumps instead.
If you receive the message "Query timed out"
, you probably used a parameter combination that I haven't optimized.
Try reducing the limit
parameter or use a more specific filter (after
, before
, subreddit
, author
).
This usually happens with body
, selftext
or title
parameters.
Sometimes the database needs to warm up, so if you try again a second time, it might work.
After roughly 36 hours, all data is updated and should then be the same as that released in .zst dumps.
Before that, score
, num_comments
, etc. will be 1 or 0, since data is archived initially the moment it was posted.