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:
- A Reddit Ads account.
- A developer application. You’ll need its app ID and secret.
- Access to a terminal application.
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:
https://www.reddit.com/api/v1/authorize?client_id={{App ID}}&response_type=code&state={{Random String}}&redirect_uri={{Redirect URL}}&duration={{Duration}}&scope={{Scope}}
{{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 URL}}: The redirect URL you set for your dev app.Don’t change
redirect_uritoredirect_url. This parameter must be used so that the application can correctly route mobile and web application redirects.{{Duration}}: How long the access token lasts. You probably want to set this topermanent, but set this totemporaryfor a one-hour token.If you set this to
temporary, you won’t be able to refresh this token.{{Scope}}: A comma-separated list of the actions performable with the access token. Only the following scopes are accepted:adsread,adsconversions,history,adsedit,read.If you’d like your token to access everything in the Reddit Ads API, use
adsread,adsconversions,history,adsedit,read.
| Scope | Description |
|---|---|
adsconversions | Post conversion events |
adsedit | Edit ads data |
adsread | Read ads data |
history | Access submission history |
read | Read posts and comments for your Reddit user account |
Example: Get link based on credentials
| Field | Value |
|---|---|
| App ID | DnvSjQYG9t13lWWOndNqOg |
| Redirect URL | https://www.reddit.com/prefs/apps |
| Scope | Post conversion events with the Conversions API (CAPI) |
| Link | https://www.reddit.com/api/v1/authorize?client_id=DnvSjQYG9t13lWWOndNqOg&response_type=code&state=sgtm-capi&redirect_uri=https://www.reddit.com/prefs/apps&duration=permanent&scope=adsconversions |
Check that the username listed matches the account you want to authorize the app. If the username is correct, select Allow.

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’ll be sent to the redirect URL that you provided earlier. The URL will have state and code parameters. Copy the code value and remove any trailing #_ characters.
This code should be used within the next ten minutes and only once per authorization.

Example: Find code value from redirect URL
| Redirect URL | Code 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.
Example: Get access token
| Field | Value |
|---|---|
| Name | SGTM-CAPI |
| App ID | DnvSjQYG9t13lWWOndNqOg |
| Secret | Ucr7PXIWe_OK_vAsrE0J3kvDJ0faww |
| Redirect Code | QGRMgx3l54x0s8NT_WdcuSt_Adi9nA |
| Redirect URL | https://www.reddit.com/prefs/apps |
| Code | |
If successful, you'll 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 in expires_in.
3. (Optional) Refresh your access token
You can refresh an 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.
Example: Refresh token
| Field | Value |
|---|---|
| Name | SGTM-CAPI |
| App ID | kmY1CRszT3obFwYeU3uuEw |
| Secret | rTBVO3UirF-fcwvlMNellSxqkd3wSQ |
| Refresh Token | 90773738700875-TEhYsiu7TO6A6PIWuiweSH_PBW96lw |
| Code | |