Skip to main content
Version: v3

Authenticate Your Developer Application

You can set up your developer application to gain access to the Reddit API, letting you develop nifty applications and integrations that seamlessly interact with Reddit's ads platform.

Before you begin, you should have:

1. Authorize your application

Go to your business's developer applications and find your application's app ID. Replace the values in the following link and navigate to it:

Authorize app

url
Fill all fields
https://www.reddit.com/api/v1/authorize?client_id=&response_type=code&state=&redirect_uri=&duration=&scope=
Reference: Fields
FieldDescription
{{App ID}}The ID of your dev app
{{Random String}}This can be set to any string with no spaces or special characters, like the name of your dev app. This is used to detect cross-site request forgeries (CSRF). You can also set a signature for additional security.
{{Redirect URI registered for app}}The redirect URL you set for your dev app.
Don't change redirect_uri to redirect_url. This parameter must be used so that the application can correctly route mobile and web application redirects.
{{Duration}}The time limit that this access token will expire. You probably want to set this to permanent, but you can set it to temporary to make the access code valid for only one hour.
If you set this to temporary, you won't be able to refresh this option.
{{Scope}}A comma-separated list of the actions performable with the access token.
Reference: Scope
ScopeDescription
adsconversionsPost conversion events by enabling access to the Conversions endpoint
adseditEdit ads data
adsreadRead advertising data for your account 
historyAccess submission history
readRead posts and comments for your Reddit user account

Check that the username listed matches the account you want to authorize the app. If the username is correct, select Allow.

Check your username

If an unexpected username is displayed, you're in an active Reddit session. To fix this, log out of your account, log into the correct account, then revisit the URL.

You will be sent to the redirect URL that you provided earlier. The URL in your address bar will have 2 query parameters: the state and the code. Copy and record the code value and remove the #_ characters at the end of the value, if any.

This code should be used within the next ten minutes and only once per authorization.

Copy the code

Example: Find code value from redirect URL
Redirect URLCode value
https://notarealbrand.myshopify.com/oauth/callback?state=my-state&code=Ve49meZ9oh3lZFY35CEizm3jTsfJeA#_Ve49meZ9oh3lZFY35CEizm3jTsfJeA

2. Get your access token from the Reddit API

Open a terminal window and execute the following cURL command with your noted values:

Get access token

bash
Fill all fields
curl -X POST https://www.reddit.com/api/v1/access_token \
   -H 'content-type: application/x-www-form-urlencoded' \
   -A '' \
   -u ':' \
   -d 'grant_type=authorization_code&code=&redirect_uri='

If successful, you will receive a response that looks like this:

{
    "access_token": {{Access token}},
    "token_type": "bearer",
    "expires_in": {{Expiration time in Unix epoch}},
    "refresh_token": {{Refresh token}},
    "scope": {{Scope string}}
}

Record the value for access_token and refresh_token. You'll use access_token to access the Reddit Ads API for either one hour (3600) or one day (86400), whichever is listed for the value for expires_in.

3. (Optional) Refresh your access token

You can use an active access token to maintain continuous access to the API without requiring re-authentication. 

To refresh your token, open a terminal window and execute the following cURL command with your noted values:

Refresh access token

Use your refresh token to get a new access token
bash
Fill all fields
curl -X POST https://www.reddit.com/api/v1/access_token \
   -A '' \
   -u ':' \
   -d 'grant_type=refresh_token&refresh_token='

If successful, you will receive a response that looks like this:

{
    "access_token": {{Access token}},
    "token_type": "bearer",
    "expires_in": {{Expiration time in Unix epoch}},
    "refresh_token": {{Refresh token}},
    "scope": {{Scope string}}
}

Record the value for access_token and refresh_token. You'll use access_token to access the Reddit Ads API for either one hour (3600) or one day (86400), whichever is listed for the value for expires_in.