r/redditdev • u/pl00h • 28d ago
Introducing new Announcements APIs
Hi devs,
We’ll be adding a new set of endpoints to our Data API for reading Reddit Announcements. These new APIs are available for you to integrate with starting today, and will start returning data in 90 days. We will share more details about this change and the exact timing in a subsequent update.
What are Reddit announcements
Announcements are non-repliable Reddit-official messages that are currently sent as private messages. This includes:
- Updates about Reddit policies and settings
- Communications about account and content status
- Marketing updates about products or events
The announcement APIs can be used to receive and read notifications sent from Reddit.
How announcements work
Announcements will appear as notifications in the notifications section of the inbox (i.e. the bell icon) on the native Reddit apps. When selected, these messages will be expandable to view in their entirety.
Why are we making this change?
We want to make it easier for users to distinguish between non-repliable messages and official updates they receive from Reddit, from repliable messages they receive from other users, subreddits, and bots on the platform.
Migrating your apps
Developers should update their integrations within 90 days. If changes aren’t made within this time frame, nothing will break, but your app will not receive Reddit announcements and may miss critical communications. Announcements API documentation can be found below.
Documentation
Scope required: announcements
GET /api/announcements/v1
→ /api/announcements/v1/unread
Fetch announcements from Reddit.
after | (beta) fullname of an announcement, prefixed ann_ |
---|---|
before | (beta) fullname of an announcement, prefixed ann_ |
limit | an integer between 1 and 100 |
POST /api/announcements/v1/hide
Accepts a list of announcement fullnames (ann_) and marks them hidden if they belong to the authenticated user
ids | (beta) comma separated list of announcement fullnames, prefixed ann_ |
---|
POST /api/announcements/v1/read
Accepts a list of announcement fullnames (ann_) and marks them hidden if they belong to the authenticated user
ids | (beta) comma separated list of announcement fullnames, prefixed ann_(beta) comma separated list of announcement fullnames, prefixed ann_ |
---|
POST /api/announcements/v1/read_all
Marks all unread announcements as read for the authenticated user
To test these endpoints, please fill out this form with your username so we can enroll you in the testing period.
r/redditdev • u/Iron_Fist351 • 1d ago
Reddit API 403 error when attempting to access a JSON feed with bearer authorization?
I'm attempting to make the following get request to a private moderator feed, the URL for which I obtained through https://old.reddit.com/prefs/feeds.
get_request:
URL: "https://old.reddit.com/r/mod/about/modqueue/.json?feed=*********&user=*********"
headers:
User-Agent: "pipedream/1"
Authorization: "Bearer {{bearer_token}}}"
My authorization for this request is a bearer token that the code obtains from https://www.reddit.com/api/v1/access_token in a previous step. A new bearer token is requested every time the code runs, so the token expiring isn't a concern.
However, the request continuously fails with a status code 403. This code worked perfectly fine up until about 3 months ago, after which this error began occuring. The bearer token I'm using is also the same token that's being outputted from my POST request to https://www.reddit.com/api/v1/access_token, which returns successfully with the bearer token every time.
Did something change with Reddit's API in the past few months? Does anyone know any troubleshooting steps I could take to try and fix this?
Note: I'm not currently working with Python. This is a raw GET request that I'm making through a Pipedream workflow.
Here's the error response body, if it helps:
<!doctype html>
<html>
<head>
<title>Blocked</title>
<style>
body {
font: small verdana, arial, helvetica, sans-serif;
width: 600px;
margin: 0 auto;
}
h1 {
height: 40px;
background: transparent url(//www.redditstatic.com/reddit.com.header.png) no-repeat scroll top right;
}
</style>
</head>
<body>
<h1>whoa there, pardner!</h1>
<p>Your request has been blocked due to a network policy.</p>
<p>Try logging in or creating an account <a href=https://www.reddit.com/login/>here</a> to get back to browsing.</p>
<p>If you're running a script or application, please register or sign in with your developer credentials <a href=https://www.reddit.com/wiki/api/>here</a>. Additionally make sure your User-Agent is not empty and is something unique and descriptive and try again. if you're supplying an alternate User-Agent string,
try changing back to default as that can sometimes result in a block.</p>
<p>You can read Reddit's Terms of Service <a href=https://www.reddit.com/wiki/api/>here</a>.</p>
<p>if you think that we've incorrectly blocked you or you would like to discuss
easier ways to get the data you want, please file a ticket <a href=https://support.reddithelp.com/hc/en-us/requests/new?ticket_form_id=21879292693140>here</a>.</p>
<p>when contacting us, please include your ip address which is: <strong>3.84.50.106</strong> and reddit account</p>
</body>
</html>
r/redditdev • u/heyyyjoo • 1d ago
Async PRAW How does ratelimit_seconds work?
I'd like to clarify the effect of configuring ratelimit_seconds
According to the docs, my understanding is that if I hit the rate limit, async praw will wait for max ratelimit_seconds
+ 1 second before raising an APIException.
So assuming that the rate limit resets every 600 seconds (which is what the current rate limit seems to be), if I set ratelimit_seconds
to 600, does that mean that async praw will never raise an APIException and always automatically retry?
Docs for reference: https://asyncpraw.readthedocs.io/en/stable/getting_started/configuration/options.html#miscellaneous-configuration-options
r/redditdev • u/Ok_Money_513 • 1d ago
General Botmanship "restrict_posting": true
Can anyone tell me what the json object in the caption means? It appears in the json response when you search a Reddit User and add /about.json at the end. I was just looking if these json responses have any good info on whether an account is shadowbanned, restricted, botted, spammy, low trust score, you get the gyst. Not much there tbh but this piece caught my eye because it's the same with every account.
Any tips on how to check this stuff and filter out potentially spammy / boted accs is appreciated, but I'm mostly just curious on what this part means.
Here's an exampe response from a random old reddit account:
{"kind": "t2", "data": {"is_employee": false, "is_friend": false, "subreddit": {"default_set": true, "user_is_contributor": false, "banner_img": "", "allowed_media_in_comments": [], "user_is_banned": false, "free_form_reports": true, "community_icon": null, "show_media": true, "icon_color": "#FFB470", "user_is_muted": null, "display_name": "u_account2", "header_img": null, "title": "", "previous_names": [], "over_18": false, "icon_size": [256, 256], "primary_color": "", "icon_img": "https://www.redditstatic.com/avatars/defaults/v2/avatar_default_1.png", "description": "", "submit_link_label": "", "header_size": null, "restrict_posting": true, "restrict_commenting": false, "subscribers": 0, "submit_text_label": "", "is_default_icon": true, "link_flair_position": "", "display_name_prefixed": "u/account2", "key_color": "", "name": "t5_473c7", "is_default_banner": true, "url": "/user/account2/", "quarantine": false, "banner_size": null, "user_is_moderator": false, "accept_followers": true, "public_description": "", "link_flair_enabled": false, "disable_contributor_requests": false, "subreddit_type": "user", "user_is_subscriber": false}, "snoovatar_size": null, "awardee_karma": 0, "id": "3pxxt", "verified": true, "is_gold": false, "is_mod": false, "awarder_karma": 0, "has_verified_email": false, "icon_img": "https://www.redditstatic.com/avatars/defaults/v2/avatar_default_1.png", "hide_from_robots": false, "link_karma": 1, "pref_show_snoovatar": false, "is_blocked": false, "total_karma": 2, "accept_chats": true, "name": "account2", "created": 1258079681.0, "created_utc": 1258079681.0, "snoovatar_img": "", "comment_karma": 1, "accept_followers": true, "has_subscribed": false, "accept_pms": true}}
r/redditdev • u/r4r_app_guy • 2d ago
redditdev meta I used the Reddit API to save myself time with my regular r4r searches. Anyone interested in this little app?
I wrote this in node js. If you're interested or have any thoughts, please let me know. I have some ideas on how to improve it--just not sure it's worth the effort. That's why I'm trying to gauge interest.
It's not pretty but you can see screenshots here: https://imgur.com/a/Iaym1a0
r/redditdev • u/DirtFit2534 • 3d ago
General Botmanship Finally Built My First Reddit Bot—Here’s What I Learned
After weeks of trial and error, I finally built my first Reddit bot, and it’s actually working! The bot pulls posts from a specific subreddit, analyzes the content, and responds automatically based on predefined criteria. Along the way, I learned some crucial lessons. First, API rate limits are no joke—you need to respect them, or your bot will get blocked quickly. Second, if you’re using Python, PRAW is an absolute lifesaver for working with Reddit’s API. Third, testing in private subreddits is essential and saved me from embarrassing public mistakes. Lastly, robust error handling is key since Redditors can be unpredictable, and your bot needs to manage unexpected inputs gracefully. My next goal is to implement a scheduler so the bot can run autonomously. If you’re working on a Reddit bot or have tips to share, I’d love to hear about your experience!
r/redditdev • u/PKtheworldisaplace • 3d ago
PRAW Is there no way to pull a full year of posts for a given subreddit?
I tried this using PRAW and it only pulled about a week and a half of posts--I assume because it hit the 1000 post-limit.
It sounds like there used to be a way using Pushshift, but that is only for reddit mods.
So is this now simply impossible?
r/redditdev • u/YourShowerHead • 3d ago
General Botmanship Bot account gets suspended for no known reason
I made a bot account weeks ago, used praw and just replied to comments where the bot username was mentioned, next day it got suspended. I submitted an appeal for days, but never got any reply, and it is still suspended.
After getting no response from reddit, I made a new account and did things on the server instead of locally but it still got suspended after few hours. I'm so annoyed, reddit really sucks, no email, no message, no warnings, just direct suspension without clarifying a reason. Is there really no way around this?
r/redditdev • u/bbb23sucks • 3d ago
PRAW Creating a Moderator Discussion in Modmail via PRAW renders your account unable to be logged into, even after resetting the password.
Title
r/redditdev • u/TomWithTime • 3d ago
Reddit API Posts deleted by API keeping coming back?
For the third time in the last month, some comments that were originally deleted via API have returned on my account. Is there something I'm missing about how this is supposed to work or is Reddit having issues recently?
I was going to post about this last time but I started to delete my comments again and after deleting about 7 the other hundred went back to being deleted - but they are back again. I could see them from a signed out browser and I can edit ones that are recent enough. I have a 4 second delay on the delete because I was getting rate limited last time. Is anyone else having issues?
r/redditdev • u/lucadi_domenico • 4d ago
Reddit API Reddit API docs
Hi, is this the only documentation website available for the Reddit API?
r/redditdev • u/AdNeither9103 • 6d ago
PRAW Fetching more than 1000 posts in batches using PRAW
Hi all, I am working on a project where I'd pull a bunch of posts every day. I don't anticipate needing to pull more than 1000 posts per individual requests, but I could see myself fetching more than 1000 posts in a day spanning multiple requests. I'm using PRAW, and these would be strictly read requests. Additionally, since my interest is primary data collection and analysis, are there alternatives that are better suited for read only applications like pushshift was? Really trying to avoid web scraping if possible.
TLDR: Is the 1000 post fetch limit for PRAW strictly per request, or does it also have a temporal aspect?
r/redditdev • u/ml-ai-enthusiast • 7d ago
Reddit API What are the community approved and maintained reddit API clients /sdk ?
Hi All , new to reddit APIs. I was looking for reddit api sdk/clients etc. The github page was archived in 2017 so I am not sure API clients listed there are still being maintained.
r/redditdev • u/BlackberryWest8402 • 9d ago
Reddit API FIX NEEDED (MAC OS): Program defaulting to LibreSSL, need to run OpenSSL.
Hi all,
New to developing programs with the reddit API. I am trying to build a simple data scraper. My first goal is to get my program to adequately log the amount of times a given keyword has occurred in a day across the platform.
My code:
import praw
import pandas as pd
# Reddit API credentials
client_id = '**REDACTED**'
client_secret = '**REDACTED**'
user_agent = 'praw:keyword_tracker:v1.0 (by u/BlackberryWest8402)'
# Set up Reddit API client
reddit = praw.Reddit(client_id=client_id,
client_secret=client_secret,
user_agent=user_agent)
# Function to search posts with a case-insensitive keyword
def search_keyword(keyword):
submission_count = 0
# Convert keyword to lowercase for case-insensitive comparison
keyword = keyword.lower()
for submission in reddit.subreddit('all').search(keyword, limit=100): # Adjust limit as needed
# Compare the submission title to the keyword (also in lowercase)
if keyword in submission.title.lower() or keyword in submission.selftext.lower():
submission_count += 1
return submission_count
# Test with a case-insensitive keyword
keyword = 'lunr' # This will match "Python", "python", "PYTHON", etc.
count = search_keyword(keyword)
print(f"The keyword '{keyword}' was mentioned {count} times.")
import ssl
print(ssl.OPENSSL_VERSION)
Here is the warning I keep receiving:
/Users/**REDACTED**/Library/Python/3.9/lib/python/site-packages/urllib3/__init__.py:35: NotOpenSSLWarning: urllib3 v2 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'LibreSSL 2.8.3'. See: https://github.com/urllib3/urllib3/issues/3020
warnings.warn(
The keyword 'lunr' was mentioned 91 times.
My concern is that with Libre, my program may not be working correctly. New to this space as a whole, would appreciate any insight anyone could provide. YES... I did start with ChatGPT garbage... (Everyone has to start somewhere)
r/redditdev • u/bugsta77 • 10d ago
Reddit API See logs and errors in node.js
I'm sure I'm doing many things wrong, but I'm trying to make a reddit app. I'm using visual studio as the IDE, and node.js to connect to and upload the app. I'm running into an issue which i assume is some kind of exception happening. Problem is I get virtually no output. I'm using console.log but hardly any of that output shows up in the node.js screen. I tried getting the logs and and actively monitor them, but there is almost no output no mater what I try.
If anyone knows how I'm supposed to properly see all the output it would be very helpful. Thanks.
r/redditdev • u/mediocre_man_online • 12d ago
Reddit API How to get a single reddit post data ?
I have used .json in the end, it works for browser urls (when reddit is opened in browser)
Eg: https://www.reddit.com/r/What/comments/1hnqze8/what_could_be_the_reason_for_my_phone_charger/
but the same post url when copied from reddit app
https://www.reddit.com/r/What/s/TbIzqL7woy , appending .json here does not work.
Is there a simple solution for this ?
r/redditdev • u/Tokipudi • 13d ago
Reddit API Is there a way to create a user (new account) via the API?
There's a browser plugin I have wanted to create for a while now which would need to create users via the Reddit API.
I have looked at the API and I haven't found any endpoint that would allow me to do that, so is there a way to do it or is it a feature that Reddit removed? (I know it was possible years ago)
r/redditdev • u/wdcu • 14d ago
Reddit API Not able to get auth token for reddit, please help.
I created a reddit app type script and used the code got in the url, below is my code for which i am not getting the auth token
import urllib.request
import urllib.parse
import base64
import json
CLIENT_ID = ""
CLIENT_SECRET = ""
RESPONSE_TYPE = "code"
STATE = "test"
REDIRECT_URI = "http://localhost:8000/redirect"
DURATION = "temporary"
SCOPE = "edit"
GRANT_TYPE = "authorization_code"
CODE = ""
code_link = f"https://www.reddit.com/api/v1/authorize?client_id={CLIENT_ID}&response_type={RESPONSE_TYPE}&state={STATE}&redirect_uri={REDIRECT_URI}&duration={DURATION}&scope={SCOPE}"""
auth_link = "https://www.reddit.com/api/v1/access_token"
# Prepare data for POST request
post_data = {
'grant_type': GRANT_TYPE,
'code': CODE,
'redirect_uri': REDIRECT_URI
}
encoded_post_data = urllib.parse.urlencode(post_data).encode()
# Prepare headers
auth_string = f'{CLIENT_ID}:{CLIENT_SECRET}'
b64_auth_string = base64.b64encode(auth_string.encode()).decode()
headers = {
'Authorization': f'Basic {b64_auth_string}',
'Content-Type': 'application/x-www-form-urlencoded'
}
# Make the request
request = urllib.request.Request(
url=auth_link,
data=encoded_post_data,
headers=headers
)
try:
with urllib.request.urlopen(request) as response:
response_data = response.read().decode()
print(f'n response data: {response_data}')
token_info = json.loads(response_data)
print(f'n token info: {token_info}')
access_token = token_info.get('access_token')
refresh_token = token_info.get('refresh_token')
print(f'Access Token: {access_token}')
print(f'Refresh Token: {refresh_token}')
except urllib.error.HTTPError as e:
print(f'HTTP Error: {e.code} - {e.reason}')
error_response = e.read().decode()
print('Error details:', error_response)
except urllib.error.URLError as e:
print(f'URL Error: {e.reason}')
r/redditdev • u/shavin47 • 14d ago
Reddit API Subreddit realtime post monitoring (how to go about it?)
Hey folks,
I am trying to build a simple app that pings me whenever a relevant post is made on a subreddit so that I can jump in on the discussion early.
How can I go about this?
r/redditdev • u/Interesting_Net_9628 • 19d ago
Async PRAW Streaming posts/comments
I am using the reddit PRAW lib.
I am generally streaming for new posts / comments in the subreddit, and see there is a limit e.g
```
Rate Limit Status:
Remaining calls: 993.0
Used calls: 7
Reset time: 2024-12-22 16:30:00.637653
Time until reset: 0:05:21.990639
```
Does this used calls refer to the number of posts/comments?
relevant code:
```
used = reddit.auth.limits.get('used')
```
I would like to stream multiple subreddits without worrying about rate limit, do I have to pay for it or is there a better way?
r/redditdev • u/TheJReesW • 19d ago
Async PRAW "TypeError: session() got an unexpected keyword argument: 'window_size'" error after updating asyncpraw
Hiya folks,
Two days ago or so my discord bot (that uses asyncpraw) stopped working, and when I tried to restart it, it told me that asyncpraw has a new version that I have to upgrade to.
So I did, upgraded asyncpraw to 7.8.0 and restarted the bot. This gave me a new error however, shown below:
Traceback (most recent call last):
File "/usr/local/lib/python3.10/site-packages/discord/client.py", line 449, in _run_event
await coro(*args, **kwargs)
File "/root/redditbot/main.py", line 56, in on_ready
self.reddot = asyncpraw.Reddit(
File "/usr/local/lib/python3.10/site-packages/asyncpraw/util/deprecate_args.py", line 60, in wrapped
return _wrapper(*args, **kwargs(
File "/usr/local/lib/python3.10/site-packages/asyncpraw/util/deprecate_args.py", line 48, in _wrapper
return func(**dict(zip(_old_args, args)), **kwargs)
File "/usr/local/lib/python3.10/site-packages/asyncpraw/reddit.py", line 326, in __init__
self.requestor = self._prepare_asyncprawcore(
File "/usr/local/lib/python3.10/site-packages/asyncpraw/reddit.py", line 597, in _prepare_asyncprawcore
self._prepare_trusted_asyncprawcore(requestor)
File "/usr/local/lib/python3.10/site-packages/asyncpraw/reddit.py", line 691, in _prepare_trusted_asyncprawcore
self._read_only_core = session(
TypeError: session() got an unexpected keyword argument 'window_size'
This seems to be an error in asyncpraw itself, even though it's the most recent version. It got triggered inside my instantiation of the Reddit object, below:
self.reddit = asyncpraw.Reddit(
client_id=config.PRAW_CLIENT,
client_secret=config.PRAW_SECRET,
user_agent=config.PRAW_USERAGENT
)
Does anyone know what is happening? My method of instantiating seems to be boilerplate, so from what I can tell it seems to be an error in asyncpraw's development, but that also sounds illogical seeing as this version has been out for almost two months already.
I managed to fix it myself by going into asyncpraw's files, where the error is thrown, and removing the window_size parameter. Obviously you shouldn't have to edit a library yourself to use it, so this shouldn't be the correct solution and/or what the devs want.
r/redditdev • u/SynAck_Network • 22d ago
General Botmanship Some problems with script API and python
Ok I'm basically using a python script and my API (as a script) to scan sub reddits like bigfoot and high strangeness... Using python with termux is (blew me away) super fast and downloads about ..we will just say allot within a few minutes...the problem I am having is it's doing images jpg jpeg PNG etc but I'm having trouble getting .MP4 etc so videos..I do remember on some videos on Reddit you can download the video others you can't my question is how wouldn't this affect my scanning via my API calls like if it's aloud to download or not I think this is my problem...does what I typed make any sense cause I. Weird like that and I can't believe I even stayed on my own topic...hehe haha errr.
Ps edit..I'll post code if anyone thinks that will help them help me
r/redditdev • u/petarstr • 22d ago
Reddit API Is it possible to create a post with an image through the API?
The ‘api/submit’ endpoint works, and I can create posts with links to images, but is it actually possible to create a post with a proper image that’s hosted on reddit?
I looked into praw code and they’re using ‘api/media/assets.json’ endpoint, I don’t see it anywhere in the docs and I get Forbidden respone from testing. I know some apps out there can do it, but does that come with a paid reddit API?
r/redditdev • u/RobertD3277 • 22d ago
PRAW Unusual log-in problem
I have a bot that I have been building and it works perfect with my personal account.
EDIT: I am verified the phone number on the secondary account and have made sure that two-factor authentication is turned off.
I created an account strictly for the bot and have verified the credentials multiple times, but every time I try to run the API through pro, it tells me that I have an invalid grant error or a 401 error.
I have double checked the credentials for both the bot itself any application setup and the username that will be used with the bot. I can log into the account on multiple devices with the username and password and the bot does work with my personal identity so I know that the bot ID and the bot secret are correct.
The new account is only a few hours old. Is that the problem that is causing me not to be allowed to connect to Reddit?
I've tried strictly posting to my own personal channel on what will be the bot account and it's not even allowing me to do that.
Any feedback is greatly appreciated.
EDIT: I do not have two-factor authentication turned on as the account in question will be used strictly by the bot itself.
EDIT2: I have definitely confirmed that it is something with the account itself. I don't understand it because it's a brand new account and only been used strictly with my intentions. I have confirmed that I can log into the account manually and I can post manually with my new account. I cannot, however, use the API at all even though everything is correct.
Thank you.
r/redditdev • u/iTsMath1000 • 23d ago
Reddit API 400 Error without changing anything
Hi, ive been running some code to get posts using the API and OAuth2 for a while, but recently, it stopped working and i've been getting 400 errors (Bad Request)
This is said code https://github.com/iTsMaaT/WD-40/blob/develop/utils/reddit/fetchRedditToken.js
Any idea why that might be?
Edit: Fixed, the issue was the /random and /random/.json endpoints being removed
r/redditdev • u/LeVraiRoiDHyrule • 25d ago
Reddit API Reddit's Oauth2 : How to get email ?
Hi,
I am trying to integrate Reddit into my OpenID / oauth2 provider. My users are linked by their email which means I need all identity providers to give me the email of the user so I can link it to the existing account. But I can't find how to get the email of the user with Reddit, I can't even find if it is possible or not.
I have read https://www.reddit.com/r/redditdev/wiki/oauth2/scopes/ https://www.reddit.com/dev/api/oauth and looked at https://www.reddit.com/api/v1/scopes , I can't find any scope that could give me the email. I have the following questions :
- 1. Is it possible to get the user's email with Reddit's oauth2 ?
- 2. If it is possible, how ? What is the matching scope ?
- 3. Is Reddit OIDC (OpenID Connect) compatible ? If yes, what is the path of /.well-known/openid-configuration ?
- 4. If you have already integrated Reddit into an OpenID solution, what did you use to link your users to existing accounts ?
Thanks in advance for any answer, have a nice day