How to get client_id and client_secret for Python Reddit API registration ?

Reddit is a network of communities based on people’s interests. Each of these communities is called a subreddit. Users can subscribe to multiple subreddits to post, comment and interact with them.
A Reddit bot is something that automatically responds to a user’s post or automatically posts things at certain intervals. This could depend on what content the users post. It can be triggered by certain key phrases and also depends on various subreddits regarding their content.
In order to implement a Reddit bot, we will use the Python Reddit API Wrapper (PRAW). It allows us to login to the Reddit API to directly interact with the backend of the website. More information about this library can be found here – PRAW – Python Reddit API Wrapper

To create an instance of PRAW we need to run the following code:





reddit = praw.Reddit(client_id ='my client id'
                     client_secret ='my client secret'
                     user_agent ='my user agent'
                     username ='my username'
                     password ='my password'


In order to get the information for these fields:

  • Create a Reddit account.
  • The username of the reddit account will go to the username field.
  • The password of the reddit account will go to the password field.
  • user_agent is a unique identifier that helps Reddit determine the source of network requests.
  • client_id and client_secret are needed to access Reddit’s API as a script application. We can find them by:
    1. Login to your Reddit account.
    2. Open the link:
    3. The following will open up:
    4. Click on “create an app…”. The following fields will be requested:
    5. Give an appropriate name to the application and fill rest of the fields:
    6. Click on “create app”.
    7. The text in the green box is the client_id.
    8. Click on “edit”. The text in the green box is the client_secret.

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using or mail your article to See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.

Article Tags :

Be the First to upvote.

Please write to us at to report any issue with the above content.