1(self.webpackChunkreddit_ads_api_site=self.webpackChunkreddit_ads_api_site||[]).push([[1592],{962:(e,t,n)=>{"use strict";n.r(t),n.d(t,{assets:()=>p,contentTitle:()=>h,default:()=>j,frontMatter:()=>l,metadata:()=>s,toc:()=>u});const s=JSON.parse('{"id":"api/reddit-advertising-api","title":"Reddit Advertising API (Deprecated)","description":"> **Important:** All endpoints *except* the [Conversions API (CAPI)](https://ads-api.reddit.com/docs/v2/#tag/Conversions-API) have been sunsetted. [Use v3 endpoints instead for integrations](https://ads-api.reddit.com/docs/v3/). While support for CAPI v2 will continue, we encourage [migration to CAPI v3](https://ads-api.reddit.com/docs/v3/capi-migration) to take advantage of new features and long term support.","source":"@site/versioned_docs/version-v2/api/reddit-advertising-api-deprecated.info.mdx","sourceDirName":"api","slug":"/api/reddit-advertising-api","permalink":"/docs/v2/api/reddit-advertising-api","draft":false,"unlisted":false,"editUrl":null,"tags":[],"version":"v2","sidebarPosition":0,"frontMatter":{"id":"reddit-advertising-api","title":"Reddit Advertising API (Deprecated)","description":"> **Important:** All endpoints *except* the [Conversions API (CAPI)](https://ads-api.reddit.com/docs/v2/#tag/Conversions-API) have been sunsetted. [Use v3 endpoints instead for integrations](https://ads-api.reddit.com/docs/v3/). While support for CAPI v2 will continue, we encourage [migration to CAPI v3](https://ads-api.reddit.com/docs/v3/capi-migration) to take advantage of new features and long term support.","sidebar_label":"Introduction","sidebar_position":0,"hide_title":true,"custom_edit_url":null},"sidebar":"openApiSidebar","next":{"title":"Conversions API","permalink":"/docs/v2/api/conversions-api"}}');var i=n(74848),r=n(28453),d=n(51107),o=n(23397),a=n.n(o),c=n(19365);n(69016);const l={id:"reddit-advertising-api",title:"Reddit Advertising API (Deprecated)",description:"> **Important:** All endpoints *except* the [Conversions API (CAPI)](https://ads-api.reddit.com/docs/v2/#tag/Conversions-API) have been sunsetted. [Use v3 endpoints instead for integrations](https://ads-api.reddit.com/docs/v3/). While support for CAPI v2 will continue, we encourage [migration to CAPI v3](https://ads-api.reddit.com/docs/v3/capi-migration) to take advantage of new features and long term support.",sidebar_label:"Introduction",sidebar_position:0,hide_title:!0,custom_edit_url:null},h="Model Hierarchy",p={},u=[{value:"Create a developer application",id:"create-a-developer-application",level:2},{value:"Create an application",id:"create-an-application",level:3},{value:"Migrate an application",id:"migrate-an-application",level:3},{value:"Things to know",id:"things-to-know",level:3},{value:"Authenticate your developer application",id:"authenticate-your-developer-application",level:2},{value:"1. Authorize your application",id:"1-authorize-your-application",level:3},{value:"2. Get your access token from the Reddit API",id:"2-get-your-access-token-from-the-reddit-api",level:3},{value:"3. (Optional) Refresh your access token",id:"3-optional-refresh-your-access-token",level:3}];function x(e){const t={a:"a",admonition:"admonition",br:"br",code:"code",em:"em",h1:"h1",h2:"h2",h3:"h3",header:"header",img:"img",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",table:"table",tbody:"tbody",td:"td",th:"th",thead:"thead",tr:"tr",ul:"ul",...(0,r.R)(),...e.components},{Details:s}=t;return s||function(e,t){throw new Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Details",!0),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(t.admonition,{type:"important",children:(0,i.jsxs)(t.p,{children:["All endpoints ",(0,i.jsx)(t.em,{children:"except"})," the ",(0,i.jsx)(t.a,{href:"https://ads-api.reddit.com/docs/v2/#tag/Conversions-API",children:"Conversions API (CAPI)"})," have been sunsetted. ",(0,i.jsx)(t.a,{href:"https://ads-api.reddit.com/docs/v3/",children:"Use v3 endpoints instead for integrations"}),". While support for CAPI v2 will continue, we encourage ",(0,i.jsx)(t.a,{href:"https://ads-api.reddit.com/docs/v3/capi-migration",children:"migration to CAPI v3"})," to take advantage of new features and long term support."]}
1)}),"\n",(0,i.jsxs)(t.p,{children:["By accessing or using the Ads API and/or associated Reddit Data, you are agreeing that you have\nread, and that you Agree to comply with and to be bound by, the ",(0,i.jsx)(t.a,{href:"https://www.reddithelp.com/en/categories/advertising/policy-guidelines/reddit-ads-api-terms",children:"Ads API Terms"})," and all\napplicable laws and regulations in their entirety without limitation or qualification. If you do\nnot agree to be bound by these Ads API Terms, then you may not access or otherwise use the Ads API.\nYour continued use of the Ads API shall constitute your consent to be bound by these\n",(0,i.jsx)(t.a,{href:"https://www.reddithelp.com/en/categories/advertising/policy-guidelines/reddit-ads-api-terms",children:"Ads API Terms"}),"."]}),"\n",(0,i.jsx)(t.admonition,{type:"note",children:(0,i.jsxs)(t.p,{children:["Use of the Conversions API is subject to the same agreements as the Ads API, and, also subject to the ",(0,i.jsx)(t.a,{href:"https://advertising.reddithelp.com/en/categories/policy-guidelines/advertiser-measurement-program-terms",children:"Advertiser Measurement Program Terms"}),"."]})}),"\n",(0,i.jsx)(t.header,{children:(0,i.jsx)(t.h1,{id:"model-hierarchy",children:"Model Hierarchy"})}),"\n",(0,i.jsx)(t.p,{children:"The model hierarchy of Reddit's ad platform can be seen in the diagram below."}),"\n",(0,i.jsx)(t.p,{children:(0,i.jsx)(t.img,{alt:"ads hierarchy",src:n(81501).A+"",title:"Ads Hierarchy",width:"1024",height:"768"})}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"Campaigns have many ad groups"}),"\n",(0,i.jsx)(t.li,{children:"Ad groups have many ads"}),"\n",(0,i.jsx)(t.li,{children:"Ads are linked to a promoted post"}),"\n",(0,i.jsx)(t.li,{children:"Promoted posts may be linked to many ads"}),"\n"]}),"\n",(0,i.jsx)(t.h1,{id:"data-freshness",children:"Data Freshness"}),"\n",(0,i.jsx)(t.p,{children:"All campaign management data is consistent. All reporting data is accurate up to three hours ago.\nThat means fetching all impressions for today at 6pm will pull all data up to 3pm."}),"\n",(0,i.jsx)(t.h1,{id:"rate-limits",children:"Rate Limits"}),"\n",(0,i.jsxs)(t.p,{children:["Advertisers may perform ",(0,i.jsx)(t.strong,{children:"1 request per second"}),"."]}),"\n",(0,i.jsxs)(t.p,{children:["Rate-limiting issues often occur if you haven't set your user agent to a unique descriptor. Many default user agents (like ",(0,i.jsx)(t.code,{children:"\u201cPython/urllib\u201d"})," or ",(0,i.jsx)(t.code,{children:"\u201cJava\u201d"}),") are drastically limited to encourage unique and descriptive user-agent strings. We recommend following this format for your client's user agent string:"]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"{{Target platform}}:{{Unique app ID}}:{{Version string}} (by /u/{{Your Reddit username}})\n"})}),"\n",(0,i.jsx)(t.admonition,{type:"note",children:(0,i.jsx)(t.p,{children:"Including your version number helps us block old buggy or broken versions of your app safely. Just remember to update this string when you update your version number."})}),"\n",(0,i.jsxs)(s,{children:[(0,i.jsx)("summary",{children:"Example"}),(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"User-Agent: android:com.example.myredditapp:v1.2.3 (by /u/kemitche)\n"})})]}),"\n",(0,i.jsx)(t.admonition,{type:"important",children:(0,i.jsx)(t.p,{children:"Never lie about your user agent! Don't pretend to be popular browsers or other bots. We'll ban anyone caught in the act."})}),"\n",(0,i.jsx)(t.h1,{id:"changelog",children:"Changelog"}),"\n",(0,i.jsx)(t.p,{children:"\x3c!-- Add new entries to the top --\x3e"}),"\n",(0,i.jsxs)(t.table,{children:[(0,i.jsx)(t.thead,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.th,{children:"Date"}),(0,i.jsx)(t.th,{children:"Description"})]})}),(0,i.jsxs)(t.tbody,{children:[(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:"2026-01-22"}
1),(0,i.jsxs)(t.td,{children:["Added support for ",(0,i.jsx)(t.code,{children:"PROCESSING"})," as an Effective Status for Campaigns, Ad Groups, and Ads."]})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:"2025-09-30"}),(0,i.jsxs)(t.td,{children:["Sunsetted all v2 endpoints except the Conversions API. ",(0,i.jsx)("a",{href:"https://ads-api.reddit.com/docs/v3/",target:"_",children:"Migrate to v3"})," to avoid service disruption."]})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:"2019-10-14"}),(0,i.jsxs)(t.td,{children:["Added ",(0,i.jsx)(t.code,{children:"locations"}),", ",(0,i.jsx)(t.code,{children:"platforms"})," and ",(0,i.jsx)(t.code,{children:"slots"})," to ad_group targeting model. These new fields were added for describing placements. Use these instead of ",(0,i.jsx)(t.code,{children:"placements"}),". ",(0,i.jsx)(t.code,{children:"placements"})," will be removed in the near future."]})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:"2019-07-02"}),(0,i.jsxs)(t.td,{children:["The reporting endpoint no longer provides the ",(0,i.jsx)(t.code,{children:"unique_impressions"})," and ",(0,i.jsx)(t.code,{children:"unique_video_fully_viewable_impressions"})," fields."]})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:"2019-06-24"}),(0,i.jsxs)(t.td,{children:["Post endpoints removed. Please use the main ",(0,i.jsx)(t.a,{href:"https://www.reddit.com/dev/api/",children:"Reddit APIs"})," for reading posts."]})]})]})]}),"\n",(0,i.jsx)(t.h1,{id:"quick-start",children:"Quick start"}),"\n",(0,i.jsx)("span",{id:"create-a-developer-application"}),"\n",(0,i.jsx)(t.h2,{id:"create-a-developer-application",children:"Create a developer application"}),"\n",(0,i.jsx)(t.admonition,{type:"important",children:(0,i.jsx)(t.p,{children:"Only business admins can access this interface. Contact one of your business's administrators for help."})}),"\n",(0,i.jsx)(t.p,{children:"Developer applications define the settings that determine how your app authenticates with the Ads API. These settings streamline workflows and enhance campaign management efficiency programmatically, enabling you to build custom tools to create and manage ad campaigns, generate reports, and manage custom audiences."}),"\n",(0,i.jsxs)(t.p,{children:["These settings can only be managed by business admins with a ",(0,i.jsx)(t.a,{href:"https://support.reddithelp.com/hc/en-us/articles/360043047552-Why-should-I-verify-my-Reddit-account-with-an-email-address",children:"verified account"}),". You can manage your developer applications in ",(0,i.jsx)(t.em,{children:"Business Manager > Developer Application"}),"."]}),"\n",(0,i.jsx)(t.p,{children:(0,i.jsx)(t.img,{alt:"Choose Developer Application in the menu",src:n(63662).A+"",width:"1500",height:"850"})}),"\n",(0,i.jsx)(t.p,{children:"In this interface, you can:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.strong,{children:"Add an app:"})," Create or migrate an existing developer application to define the settings for how your app authenticates with the Ads API.","\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsxs)(t.strong,{children:[(0,i.jsx)(t.a,{href:"#create-an-application",children:"Create"}),":"]})," Make new developer application credentials for your app."]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsxs)(t.strong,{children:[(0,i.jsx)(t.a,{href:"#migrate-an-application",children:"Migrate"}),":"]})," Move an existing developer app associated with your Reddit account to manage it in the Ads Manager."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.strong,{children:"Edit an app:"})," Change any setting for your application, excluding its app ID and secret."]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.strong,{children:"Delete your app:"})," Remove this app from your business.\xa0","\n",(0,i.jsx)(t.admonition,{type:"important",children:(0,i.jsx)(t.p,{children:"Deleting an app will disconnect all third-party services using it from the Ads API. This action can't be undone."})}),"\n"]}),"\n"]}),"\n",(0,i.jsx)(t.h3,{id:"create-an-application",children:"Create an application"}),"\n",(0,i.jsxs)(t.ol,{children:["\n",(0,i.jsxs)(t.li,{children:["In the developer application interface, select ",(0,i.jsx)(t.em,{children:"Add Apps > Create an app"}),".\n",(0,i.jsx)(t.img,{alt:"Select Add App > Create an app",src:n(60697).A+"",width:"1300",height:"700"})]}),"\n",(0,i.jsxs)(t.li,{children:["Set up your app.","\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.strong,{children:"App name:"})," An appropriate and descriptive title. We recommend a name that reflects your business, product, or integration purpose. Avoid generic names like ",(0,i.jsx)(t.code,{children:"Reddit Integration"})," or ",(0,i.jsx)(t.code,{children:"Test"}),".\xa0"]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.strong,{children:"Description (optional):"})," Information about your app."]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.strong,{children:"About URL:"})," The URL that provides more information about your business or application."]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.strong,{children:"Redirect URL:"})," The URL to authorize access to your application. We recommend setting a path on your business domain, like ",(0,i.jsx)(t.code,{children:"https://mybusiness.com/oauth/callback"}),"."]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.strong,{children:"Primary contact:"})," The business admin responsible for this app, who may be contacted for operational updates related to the Ads API. This must be set to a business admin. Here's how to ",(0,i.jsx)(t.a,{href:"https://business.reddithelp.com/s/article/Add-users-to-a-Reddit-Ads-account#change-a-members-role",children:"set this permission"}),"."]}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:["When ready, select ",(0,i.jsx)(t.em,{children:"Create App"}),". This will save your app and generate its secret and app ID.\n",(0,i.jsx)(t.img,{alt:"Select Create App",src:n(85911).A+"",width:"1150",height:"1250"})]}),"\n"]}),"\n",(0,i.jsx)(t.h3,{id:"migrate-an-application",children:"Migrate an application"}),"\n",(0,i.jsx)(t.admonition,{type:"note",children:(0,i.jsx)(t.p,{children:"Migration will limit your app's scope to the Ads API."})}),"\n",(0,i.jsxs)(t.ol,{children:["\n",(0,i.jsxs)(t.li,{children:["In the developer application interface, select ",(0,i.jsx)(t.em,{children:"Add Apps > Migrate an existing app"}),".\n",(0,i.jsx)(t.img,{alt:"Select Add App > Migrate an existing app",src:n(57898).A+"",width:"1300",height:"700"})]}),"\n",(0,i.jsx)(t.li,{children:"Select the app to migrate."}),"\n",(0,i.jsx)(t.li,{children:"Choose a primary contact for your app. This must be set to a business admin."}),"\n",(0,i.jsxs)(t.li,{children:["When ready, select ",(0,i.jsx)(t.em,{children:"Migrate App"}),". This will make your app only available to manage in the developer application interface and remove it from ",(0,i.jsx)(t.a,{href:"https://www.reddit.com/prefs/apps/",children:(0,i.jsx)(t.em,{children:"Preferences > Apps"})}),".\n",(0,i.jsx)(t.img,{alt:"Select migrate app",src:n(25988).A+"",width:"1141",height:"1373"})]}),"\n"]}),"\n",(0,i.jsx)(t.h3,{id:"things-to-know",children:"Things to know"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsx)(t.li,{children:"A member cannot be removed from your business if they're an active primary contact."}),"\n",(0,i.jsxs)(t.li,{children:["You agree to the ",(0,i.jsx)(t.a,{href:"https://business.reddithelp.com/s/article/REDDIT-ADVERTISING-PLATFORM-TERMS",children:"Advertising Platform Terms"}),", ",(0,i.jsx)(t.a,{href:"https://www.redditinc.com/policies/developer-terms",children:"Developer Terms"}),", and ",(0,i.jsx)(t.a,{href:"https://redditinc.com/policies/user-agreement",children:"User Agreement"})," when creating or migrating an app."]}),"\n",(0,i.jsx)(t.li,{children:"Migrating an application will limit your application's scope to only the Ads API."}),"\n",(0,i.jsxs)(t.li,{children:["After creating your application, finish setup by ",(0,i.jsx)(t.a,{href:"#authenticate-your-developer-application",children:"authenticating it"}),"."]}),"\n"]}),"\n",(0,i.jsx)("span",{id:"authenticate-your-developer-application"}),"\n",(0,i.jsx)(t.h2,{id:"authenticate-your-developer-application",children:"Authenticate your developer application"}),"\n",(0,i.jsx)(t.p,{children:"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."}),"\n",(0,i.jsx)(t.p,{children:"Before you begin, you should have:"}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.a,{href:"https://business.reddithelp.com/s/article/Create-and-manage-your-Reddit-Ads-account#N1",children:"A Reddit Ads account"}),"."]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.a,{href:"#create-a-developer-application",children:"A developer application"}),". You'll need its app ID and secret."]}),"\n",(0,i.jsx)(t.li,{children:"Access to a terminal application."}),"\n"]}),"\n",(0,i.jsx)(t.h3,{id:"1-authorize-your-application",children:"1. Authorize your application"}),"\n",(0,i.jsxs)(t.p,{children:["Go to your business's ",(0,i.jsx)(t.a,{href:"https://ads.reddit.com/business/developer-applications",children:"developer applications"})," and find your application's app ID. Replace the values in the following link and navigate to it:"]}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{children:"https://www.reddit.com/api/v1/authorize?client_id={{App ID}}&response_type=code&state={{State String}}&redirect_uri={{Redirect URL}}&duration={{Duration}}&scope={{Scope}}\n"})}),"\n",(0,i.jsxs)(t.ul,{children:["\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"{{App ID}}"}),(0,i.jsx)(t.strong,{children:":"})," The ID of your dev app"]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"{{State String}}"}),(0,i.jsx)(t.strong,{children:":"})," This value is fully generated by your application. Set it to an unguessable value (no spaces) and validate it after the redirect to ",(0,i.jsx)(t.a,{href:"https://owasp.org/www-community/attacks/csrf",children:"detect cross-site request forgeries (CSRF)"}),".","\n",(0,i.jsx)(t.admonition,{type:"tip",children:(0,i.jsxs)(t.p,{children:[(0,i.jsx)(t.code,{children:"state"})," should be a single opaque value generated by your app and validated on callback. If you need to restore user routing context (for example, post-login redirects), use a nonce-to-stored-state pattern as ",(0,i.jsx)(t.a,{href:"https://auth0.com/docs/secure/attack-protection/state-parameters#redirect-users",children:"described here"}),"."]})}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"{{Redirect URL}}"}),(0,i.jsx)(t.strong,{children:":"})," The exact redirect URL you set for your dev app. Exactly one redirect URL is supported per app; to route to a custom landing page or restore user state make use of the ",(0,i.jsx)(t.code,{children:"state"})," field as described above.","\n",(0,i.jsx)(t.admonition,{type:"note",children:(0,i.jsxs)(t.p,{children:["Don't change ",(0,i.jsx)(t.code,{children:"redirect_uri"})," to ",(0,i.jsx)(t.code,{children:"redirect_url"}),". This parameter must be used so that the application can correctly route mobile and web application redirects."]})}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"{{Duration}}"}),(0,i.jsx)(t.strong,{children:":"})," The time limit that this access token will expire. You probably want to set this to ",(0,i.jsx)(t.code,{children:"permanent"}),", but you can set it to ",(0,i.jsx)(t.code,{children:"temporary"})," to make the access code valid for only one hour.","\n",(0,i.jsx)(t.admonition,{type:"note",children:(0,i.jsxs)(t.p,{children:["If you set this to ",(0,i.jsx)(t.code,{children:"temporary"}),", you won't be able to refresh this option."]})}),"\n"]}),"\n",(0,i.jsxs)(t.li,{children:[(0,i.jsx)(t.code,{children:"{{Scope}}"}),(0,i.jsx)(t.strong,{children:":"})," A comma-separated list of actions that can be performed with the access token. Only the following scopes are accepted: ",(0,i.jsx)(t.code,{children:"adsread"}),", ",(0,i.jsx)(t.code,{children:"adsconversions"}),", ",(0,i.jsx)(t.code,{children:"adsedit"}
1),", ",(0,i.jsx)(t.code,{children:"adsleadgendownloader"}),".","\n",(0,i.jsx)(t.admonition,{type:"tip",children:(0,i.jsxs)(t.p,{children:["If you'd like your token to access everything in the Reddit Ads API, you can set this to ",(0,i.jsx)(t.code,{children:"adsread,adsconversions,adsedit,adsleadgendownloader"}),".\xa0"]})}),"\n"]}),"\n"]}),"\n",(0,i.jsxs)(t.table,{children:[(0,i.jsx)(t.thead,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.th,{children:(0,i.jsx)(t.strong,{children:"Scope"})}),(0,i.jsx)(t.th,{children:(0,i.jsx)(t.strong,{children:"Description"})})]})}),(0,i.jsxs)(t.tbody,{children:[(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"adsconversions"})}),(0,i.jsxs)(t.td,{children:["Post conversion events by enabling access to the ",(0,i.jsx)(t.a,{href:"https://ads-api.reddit.com/docs/v2/#tag/Conversions",children:"Conversions"})," endpoint"]})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"adsedit"})}),(0,i.jsx)(t.td,{children:"Edit ads data"})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"adsread"})}),(0,i.jsx)(t.td,{children:"Read advertising data for your account\xa0"})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"adsleadgendownloader"})}),(0,i.jsx)(t.td,{children:"Read Lead Gen Forms and retrieve leads"})]})]})]}),"\n",(0,i.jsxs)(s,{children:[(0,i.jsxs)("summary",{children:[(0,i.jsx)("strong",{children:"Example:"})," Get link based on credentials"]}),(0,i.jsxs)(t.table,{children:[(0,i.jsx)(t.thead,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.th,{children:(0,i.jsx)(t.strong,{children:"Field"})}),(0,i.jsx)(t.th,{children:(0,i.jsx)(t.strong,{children:"Value"})})]})}),(0,i.jsxs)(t.tbody,{children:[(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.strong,{children:"App ID"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"DnvSjQYG9t13lWWOndNqOg"})})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.strong,{children:"Redirect URL"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"https://www.reddit.com/prefs/apps"})})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.strong,{children:"Scope"})}),(0,i.jsx)(t.td,{children:"Post conversion events with the Conversions API (CAPI)"})]}),(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.strong,{children:"Link"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"https://www.reddit.com/api/v1/authorize?client_id=DnvSjQYG9t13lWWOndNqOg&response_type=code&state=4f8d7c1b9a2e6d3c5b0f7a1e8c2d9b6a&redirect_uri=https://www.reddit.com/prefs/apps&duration=permanent&scope=adsconversions"})})]})]})]})]}),"\n",(0,i.jsxs)(t.p,{children:["Check that the username listed matches the account you want to authorize the app. If the username is correct, select ",(0,i.jsx)(t.em,{children:"Allow"}),"."]}),"\n",(0,i.jsx)(t.p,{children:(0,i.jsx)(t.img,{alt:"Check your username",src:n(17194).A+"",width:"1600",height:"770"})}),"\n",(0,i.jsx)(t.admonition,{type:"important",children:(0,i.jsx)(t.p,{children:"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."})}),"\n",(0,i.jsxs)(t.p,{children:["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 ",(0,i.jsx)(t.code,{children:"#_"})," characters at the end of the value, if any."]}),"\n",(0,i.jsx)(t.admonition,{type:"important",children:(0,i.jsx)(t.p,{children:"This code should be used within the next ten minutes and only once per authorization."})}),"\n",(0,i.jsx)(t.p,{children:(0,i.jsx)(t.img,{alt:"Copy the code",src:n(75010).A+"",width:"1600",height:"142"})}),"\n",(0,i.jsxs)(s,{children:[(0,i.jsxs)("summary",{children:[(0,i.jsx)("strong",{children:"Example:"})," Find code value from redirect URL"]}),(0,i.jsxs)(t.table,{children:[(0,i.jsx)(t.thead,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.th,{children:"Redirect URL"}),(0,i.jsx)(t.th,{children:"Code value"})]})}),(0,i.jsx)(t.tbody,{children:(0,i.jsxs)(t.tr,{children:[(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"https://notarealbrand.myshopify.com/oauth/callback?state=4f8d7c1b9a2e6d3c5b0f7a1e8c2d9b6a&code=Ve49meZ9oh3lZFY35CEizm3jTsfJeA#_"})}),(0,i.jsx)(t.td,{children:(0,i.jsx)(t.code,{children:"Ve49meZ9oh3lZFY35CEizm3jTsfJeA"})})]})})]})]}),"\n",(0,i.jsx)("p",{}
1),"\n",(0,i.jsx)(t.h3,{id:"2-get-your-access-token-from-the-reddit-api",children:"2. Get your access token from the Reddit API"}),"\n",(0,i.jsx)(t.p,{children:"Open a terminal window and execute the following cURL command with your noted values:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-bash",children:"curl -X POST https://www.reddit.com/api/v1/access_token \\\n\xa0\xa0\xa0\xa0\xa0-H 'content-type: application/x-www-form-urlencoded' \\\n\xa0\xa0\xa0\xa0\xa0-A '{{Name}}' \\\n\xa0\xa0\xa0\xa0\xa0-u '{{App ID}}:{{Secret}}' \\\n\xa0\xa0\xa0\xa0\xa0-d 'grant_type=authorization_code&code={{Redirect Code}}&redirect_uri={{Redirect URL}}'\n"})}),"\n",(0,i.jsxs)(s,{children:[(0,i.jsxs)("summary",{children:[(0,i.jsx)("strong",{children:"Example:"})," Get access token"]}),(0,i.jsxs)("table",{children:[(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{children:"Field"}),(0,i.jsx)("th",{children:"Value"})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:(0,i.jsx)("strong",{children:"Name"})}),(0,i.jsx)("td",{children:(0,i.jsx)("code",{children:"SGTM-CAPI"})})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:(0,i.jsx)("strong",{children:"App ID"})}),(0,i.jsx)("td",{children:(0,i.jsx)("code",{children:"DnvSjQYG9t13lWWOndNqOg"})})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:(0,i.jsx)("strong",{children:"Secret"})}),(0,i.jsx)("td",{children:(0,i.jsx)("code",{children:"Ucr7PXIWe_OK_vAsrE0J3kvDJ0faww"})})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:(0,i.jsx)("strong",{children:"Redirect Code"})}),(0,i.jsx)("td",{children:(0,i.jsx)("code",{children:"QGRMgx3l54x0s8NT_WdcuSt_Adi9nA"})})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:(0,i.jsx)("strong",{children:"Redirect URL"})}),(0,i.jsx)("td",{children:(0,i.jsx)("code",{children:(0,i.jsx)(t.a,{href:"https://www.reddit.com/prefs/apps",children:"https://www.reddit.com/prefs/apps"})})})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:(0,i.jsx)("strong",{children:"Code"})}),(0,i.jsx)("td",{children:(0,i.jsx)("pre",{children:(0,i.jsx)("code",{children:(0,i.jsxs)(t.p,{children:["curl -X POST ",(0,i.jsx)(t.a,{href:"https://www.reddit.com/api/v1/access_token",children:"https://www.reddit.com/api/v1/access_token"})," ",(0,i.jsx)(t.br,{}),"\n","-H 'content-type: application/x-www-form-urlencoded' ",(0,i.jsx)(t.br,{}),"\n","-A 'SGTM-CAPI' ",(0,i.jsx)(t.br,{}),"\n","-u 'DnvSjQYG9t13lWWOndNqOg",":Ucr7PXIWe_OK_vAsrE0J3kvDJ0faww","' ",(0,i.jsx)(t.br,{}),"\n","-d 'grant_type=authorization_code&code=QGRMgx3l54x0s8NT_WdcuSt_Adi9nA&redirect_uri=",(0,i.jsx)(t.a,{href:"https://www.reddit.com/prefs/apps",children:"https://www.reddit.com/prefs/apps"}),"'"]})})})})]})]})]}),"\n",(0,i.jsx)(t.p,{children:"If successful, you will receive a response that looks like this:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-json",children:'{\n\xa0\xa0\xa0\xa0"access_token": {{Access token}},\n\xa0\xa0\xa0\xa0"token_type": "bearer",\n\xa0\xa0\xa0\xa0"expires_in": {{Time to expiration in seconds}},\n\xa0\xa0\xa0\xa0"refresh_token": {{Refresh token}},\n\xa0\xa0\xa0\xa0"scope": {{Scope string}}\n}\n'})}),"\n",(0,i.jsxs)(t.p,{children:["Record the value for ",(0,i.jsx)(t.code,{children:"access_token"})," and ",(0,i.jsx)(t.code,{children:"refresh_token"}),". You'll use ",(0,i.jsx)(t.code,{children:"access_token"})," to access the Reddit Ads API for either one hour (3600) or one day (86400), based on the value returned in ",(0,i.jsx)(t.code,{children:"expires_in"}),"."]}),"\n",(0,i.jsx)(t.h3,{id:"3-optional-refresh-your-access-token",children:"3. (Optional) Refresh your access token"}),"\n",(0,i.jsx)(t.p,{children:"You can use an active access token to maintain continuous access to the API without requiring re-authentication.\xa0"}),"\n",(0,i.jsx)(t.p,{children:"To refresh your token, open a terminal window and execute the following cURL command with your noted values:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-bash",children:"curl -X POST https://www.reddit.com/api/v1/access_token \\\n\xa0\xa0\xa0\xa0\xa0-A '{{Name}}' \\\n\xa0\xa0\xa0\xa0\xa0-u '{{App ID}}:{{Secret}}' \\\n\xa0\xa0\xa0\xa0\xa0-d 'grant_type=refresh_token&refresh_token={{Refresh token}}'\n"})}),"\n",(0,i.jsxs)(s,{children:[(0,i.jsxs)("summary",{children:[(0,i.jsx)("strong",{children:"Example:"})," Refresh token"]}),(0,i.jsxs)("table",{children:[(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{children:"Field"}),(0,i.jsx)("th",{children:"Value"})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:(0,i.jsx)("strong",{children:"Name"})}),(0,i.jsx)("td",{children:(0,i.jsx)("code",{children:"SGTM-CAPI"})})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:(0,i.jsx)("strong",{children:"App ID"})}),(0,i.jsx)("td",{children:(0,i.jsx)("code",{children:"kmY1CRszT3obFwYeU3uuEw"})})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:(0,i.jsx)("strong",{children:"Secret"})}),(0,i.jsx)("td",{children:(0,i.jsx)("code",{children:"rTBVO3UirF-fcwvlMNellSxqkd3wSQ"})})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:(0,i.jsx)("strong",{children:"Refresh Token"})}),(0,i.jsx)("td",{children:(0,i.jsx)("code",{children:"90773738700875-TEhY
1siu7TO6A6PIWuiweSH_PBW96lw"})})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("td",{children:(0,i.jsx)("strong",{children:"Code"})}),(0,i.jsx)("td",{children:(0,i.jsx)("pre",{children:(0,i.jsx)("code",{children:(0,i.jsxs)(t.p,{children:["curl -X POST ",(0,i.jsx)(t.a,{href:"https://www.reddit.com/api/v1/access_token",children:"https://www.reddit.com/api/v1/access_token"})," ",(0,i.jsx)(t.br,{}),"\n","-A 'SGTM-CAPI' ",(0,i.jsx)(t.br,{}),"\n","-u 'kmY1CRszT3obFwYeU3uuEw",":rTBVO3UirF-fcwvlMNellSxqkd3wSQ","' ",(0,i.jsx)(t.br,{}),"\n","-d 'grant_type=refresh_token&refresh_token=90773738700875-TEhYsiu7TO6A6PIWuiweSH_PBW96lw'"]})})})})]})]})]}),"\n",(0,i.jsx)(t.p,{children:"If successful, you will receive a response that looks like this:"}),"\n",(0,i.jsx)(t.pre,{children:(0,i.jsx)(t.code,{className:"language-json",children:'{\n\xa0\xa0\xa0\xa0"access_token": {{Access token}},\n\xa0\xa0\xa0\xa0"token_type": "bearer",\n\xa0\xa0\xa0\xa0"expires_in": {{Time to expiration in seconds}},\n\xa0\xa0\xa0\xa0"refresh_token": {{Refresh token}},\n\xa0\xa0\xa0\xa0"scope": {{Scope string}}\n}\n'})}),"\n",(0,i.jsxs)(t.p,{children:["Record the value for ",(0,i.jsx)(t.code,{children:"access_token"})," and ",(0,i.jsx)(t.code,{children:"refresh_token"}),". You'll use ",(0,i.jsx)(t.code,{children:"access_token"})," to access the Reddit Ads API for either one hour (3600) or one day (86400), based on the value returned in ",(0,i.jsx)(t.code,{children:"expires_in"}),"."]}),"\n",(0,i.jsxs)("div",{style:{marginBottom:"2rem"},children:[(0,i.jsx)(d.default,{id:"authentication",as:"h2",className:"openapi-tabs__heading",children:"Authentication"}),(0,i.jsx)(a(),{className:"openapi-tabs__security-schemes",children:(0,i.jsx)(c.default,{label:"OAuth 2.0: Reddit API Key",value:"Reddit API Key",children:(0,i.jsx)("div",{children:(0,i.jsx)("table",{children:(0,i.jsxs)("tbody",{children:[(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{children:(0,i.jsx)(t.p,{children:"Security Scheme Type:"})}),(0,i.jsx)("td",{children:(0,i.jsx)(t.p,{children:"oauth2"})})]}),(0,i.jsxs)("tr",{children:[(0,i.jsx)("th",{children:(0,i.jsx)(t.p,{children:"OAuth Flow (authorizationCode):"})}),(0,i.jsxs)("td",{children:[(0,i.jsx)("div",{children:(0,i.jsxs)(t.p,{children:["Token URL: ",(0,i.jsx)(t.a,{href:"https://www.reddit.com/api/v1/access_token",children:"https://www.reddit.com/api/v1/access_token"})]})}),(0,i.jsx)("div",{children:(0,i.jsxs)(t.p,{children:["Authorization URL: ",(0,i.jsx)(t.a,{href:"https://www.reddit.com/api/v1/authorize",children:"https://www.reddit.com/api/v1/authorize"})]})}),(0,i.jsx)("div",{children:(0,i.jsxs)(t.p,{children:["Refresh URL: ",(0,i.jsx)(t.a,{href:"https://www.reddit.com/api/v1/access_token",children:"https://www.reddit.com/api/v1/access_token"})]})}),(0,i.jsx)("span",{children:(0,i.jsx)(t.p,{children:"Scopes:"})}),(0,i.jsxs)("ul",{children:[(0,i.jsx)("li",{children:(0,i.jsx)(t.p,{children:"adsconversions: Post conversion events through the API"})}),(0,i.jsx)("li",{children:(0,i.jsx)(t.p,{children:"adsleadgendownloader: Read Lead Gen Forms and retrieve leads"})}),(0,i.jsx)("li",{children:(0,i.jsx)(t.p,{children:"adsread: Read advertising data through my account."})})]})]})]})]})})})})})]})]})}function j(e={}){const{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,i.jsx)(t,{...e,children:(0,i.jsx)(x,{...e})}):x(e)}},4213:function(e,t,n){var s,i,r;i=[],void 0===(r="function"==typeof(s=function(){"use strict";function t(e,t){return void 0===t?t={autoBom:!1}:"object"!=typeof t&&(console.warn("Deprecated: Expected third argument to be a object"),t={autoBom:!t}),t.autoBom&&/^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(e.type)?new Blob(["\ufeff",e],{type:e.type}):e}function s(e,t,n){var s=new XMLHttpRequest;s.open("GET",e),s.responseType="blob",s.onload=function(){a(s.response,t,n)},s.onerror=function(){console.error("could not download file")},s.send()}function i(e){var t=new XMLHttpRequest;t.open("HEAD",e,!1);try{t.send()}catch(e){}return 200<=t.status&&299>=t.status}function r(e){try{e.dispatchEvent(new MouseEvent("click"))}catch(s){var t=document.createEvent("MouseEvents");
1t.initMouseEvent("click",!0,!0,window,0,0,0,80,20,!1,!1,!1,!1,0,null),e.dispatchEvent(t)}}var d="object"==typeof window&&window.window===window?window:"object"==typeof self&&self.self===self?self:"object"==typeof n.g&&n.g.global===n.g?n.g:void 0,o=d.navigator&&/Macintosh/.test(navigator.userAgent)&&/AppleWebKit/.test(navigator.userAgent)&&!/Safari/.test(navigator.userAgent),a=d.saveAs||("object"!=typeof window||window!==d?function(){}:"download"in HTMLAnchorElement.prototype&&!o?function(e,t,n){var o=d.URL||d.webkitURL,a=document.createElement("a");t=t||e.name||"download",a.download=t,a.rel="noopener","string"==typeof e?(a.href=e,a.origin===location.origin?r(a):i(a.href)?s(e,t,n):r(a,a.target="_blank")):(a.href=o.createObjectURL(e),setTimeout(function(){o.revokeObjectURL(a.href)},4e4),setTimeout(function(){r(a)},0))}:"msSaveOrOpenBlob"in navigator?function(e,n,d){if(n=n||e.name||"download","string"!=typeof e)navigator.msSaveOrOpenBlob(t(e,d),n);else if(i(e))s(e,n,d);else{var o=document.createElement("a");o.href=e,o.target="_blank",setTimeout(function(){r(o)})}}:function(e,t,n,i){if((i=i||open("","_blank"))&&(i.document.title=i.document.body.innerText="downloading..."),"string"==typeof e)return s(e,t,n);var r="application/octet-stream"===e.type,a=/constructor/i.test(d.HTMLElement)||d.safari,c=/CriOS\/[\d]+/.test(navigator.userAgent);if((c||r&&a||o)&&"undefined"!=typeof FileReader){var l=new FileReader;l.onloadend=function(){var e=l.result;e=c?e:e.replace(/^data:[^;]*;/,"data:attachment/file;"),i?i.location.href=e:location=e,i=null},l.readAsDataURL(e)}else{var h=d.URL||d.webkitURL,p=h.createObjectURL(e);i?i.location=p:location.href=p,i=null,setTimeout(function(){h.revokeObjectURL(p)},4e4)}});d.saveAs=a.saveAs=a,e.exports=a})?s.apply(t,i):s)||(e.exports=r)},17194:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});const s=n.p+"assets/images/check-username-730d8ba6fa4b8147f23abe916991eb59.webp"},25988:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});const s=n.p+"assets/images/migrate-app-de03a6dae545057bf2360321c2c59c2e.webp"},57898:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});const s=n.p+"assets/images/add-app-migrate-7427a18d853771292dbaa743c75babb4.webp"},60697:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});const s=n.p+"assets/images/add-app-create-77b0b3ecceb6268927c0a2db0ac7951e.webp"},63662:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});const s=n.p+"assets/images/dev-app-menu-3db09b34a2192eafff8039ff61fc82e9.webp"},69016:function(e,t,n){"use strict";var s=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0});const i=s(n(96540)),r=s(n(4213));t.default=function({url:e,proxy:t}){return i.default.createElement("div",{style:{float:"right"},className:"dropdown dropdown--hoverable dropdown--right"},i.default.createElement("button",{className:"export-button button button--sm button--secondary"},"Export"),i.default.createElement("ul",{className:"export-dropdown dropdown__menu"},i.default.createElement("li",null,i.default.createElement("a",{onClick:t=>{t.preventDefault(),(e=>{let t;(e.endsWith("json")||e.endsWith("yaml")||e.endsWith("yml"))&&(t=e.substring(e.lastIndexOf("/")+1)),r.default.saveAs(e,t||"openapi.txt")})(`${e}`)},className:"dropdown__link",href:`${e}`},"OpenAPI Spec"))))}},75010:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});const s=n.p+"assets/images/copy-code-7529e9db824d1ea0b85628912f583ca6.webp"},81501:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});const s=n.p+"assets/images/hierarchy_overview-00ff4d200c33c712ac6b06097a2b2a99.webp"},85911:(e,t,n)=>{"use strict";n.d(t,{A:()=>s});const s=n.p+"assets/images/create-app-7d4f0c84292af7297427eb9a8871d326.webp"}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.