Skip to main content

Advertiser API

Programatically schedule campaigns and manage ads on X through this suite of APIs.

What Can You Promote?

  • Promoted Ads are ordinary ads purchased by advertisers who want to reach a wider group of users or to spark engagement from their existing followers.
  • Promoted Ads are clearly labeled as Promoted when an advertiser is paying for their placement on X. In every other respect, Promoted Ads act just like regular ads and can be reposted, replied to, liked and more. They have typical delivery rules and are created using POST statuses/update.
  • “Promoted-only” Tweets, created via POST accounts/:account_id/tweet, can be used in Promoted Tweets campaigns but will not serve to followers or appear on the public timeline. To retrieve a list of promoted-only tweets for a certain account, use GET accounts/:account_id/scoped_timeline.
  • Promoted Accounts are part of Who to Follow, which suggests accounts that people don’t currently follow and may find interesting. Promoted Accounts help introduce an even wider variety of accounts people may enjoy.
  • Promoted Accounts for Timeline, associate a Promoted Tweet with a Promoted Account campaign and will display in user timelines.
Promoted Trends are not available in the Ads API.

Campaigns and Ad Groups (Line Items)

Campaigns define the schedule and budget of an ad. The advertiser specifies a daily and overall budget. The campaign can be bound to a specific start and end time or run continuously until the budget is spent. The budget comes from one of the Funding Instruments of the advertising account. Campaign identifiers (:campaign_id) are the base-36 representation of the base-10 value we present in the X Ads UI. Advertising accounts are limited to a maximum of 200 active campaigns. This limit can be raised to 4,000 active campaigns manually by the advertiser’s X Account Manager upon request. A campaign is considered active until it reaches its end time or gets deleted. Paused campaigns are considered active until their designated end times. Line items spend the budget defined by a campaign. Line items pull together the per-engagement bid, the Tweet or account to promote, and the targeting rules.

Analytics

The X Ads API offers a set of analytics endpoints to track and optimize ad performance. Please see Analytics and Analytics Best Practices for more information. For the billing metric, the data may not be finalized until three days after the event. Before that point, the data should be considered speculative. The final billable number will always be less than the speculative amount. The billable number is corrected for spam and related low-quality traffic. See Timezones for other considerations regarding time.

Creating a Campaign - Step-by-Step

The following example assumes you have installed, configured, and authorized your app and user using twurl. twurl is a command-line tool in the spirit of cURL that gracefully handles X OAuth authentication. twurl is a great tool for quickly testing and debugging Ads API (and REST API) functionality. To see the full headers of the request and response, use -t to trace the call, roughly equivalent to cURL’s -v option. For this example, we will create a Promoted Ads campaign that will be targeted by keyword.
  1. Retrieve the account id.
  1. Retrieve the funding instrument id.
Hit the GET accounts/:account_id/funding_instruments API using the account id retrieved in the previous command.
  1. Create a campaign and associate it with the funding instrument.
Specify a start time and a budget for the campaign. For the purpose of this example, we will use a budget of $500 and for the daily limit, $50.
  1. Create a line item associated with the campaign.
Now that we have a campaign id, we can create a line item to associate with it. The line item wraps the bid price, targeting, and actual creative portion of the campaign. For this line item, we will be promoting tweets with a bid of $1.50.
  1. Create a targeting profile associated with the line item.
With the line item created, we can assign targeting criteria. We want to target the phrase keywords “grumpy cat” in the San Francisco Bay Area location. This is going to require a location id lookup and two targeting_criteria POST requests.
  1. Finally, un-pause the line item.
That’s it! We now have an active, targeted, and funded Promoted Tweets in Timelines campaign which is running.

Objective Based Campaigns

Objective-based campaigns and pricing allow advertisers to pay for the actions that are aligned with their marketing objectives. To support these, set the appropriate objective on line items. The parameter used on the line item write endpoints and returned on the read endpoints, is objective. This field has the following possible values as of today:
  • APP_ENGAGEMENTS
  • APP_INSTALLS
  • FOLLOWERS
  • ENGAGEMENTS
  • REACH
  • VIDEO_VIEWS
  • PREROLL_VIEWS
  • WEBSITE_CLICKS
Objectives impact how we optimize campaigns in our auctions and how we bill on those campaigns. We enable pricing based on objective, such as CPAC for APP_ENGAGEMENTS, CPAC or CPI for APP_INSTALLS, CPLC for WEBSITE_CLICKS, CPF for FOLLOWERS, CPE for ENGAGEMENTS, and CPM for REACH. Mobile app promotion campaigns are required to contain either the APP_ENGAGEMENTS or APP_INSTALLS objective. Note: Line items with different objectives are not allowed under the same campaign.

Funding Instruments

Funding Instruments are the source of campaign budget. Funding Instruments can not be created via the Ads API, they have to be already established by the advertiser’s account manager at X (for credit lines) or via ads.x.com (for credit cards) to be available. To get a list of all funding_instruments on an account, see GET accounts/:account_id/funding_instruments and GET accounts/:account_id/funding_instruments/:funding_instrument_id for the details of a specific one.

Funding Instrument Attributes

Descriptive: account_id, funding instrument id, funding instrument typedescription, and io_header(insertion order header ID). Note that a single io_header may be associated with multiple funding instruments. Funding ability: able_to_fund and reasons_not_able_to_fund. Time: created_atupdated_atstart_time, and end_time represented by a string, formatted as “%Y-%m-%dT%l:%M:%S%z”. Boolean status: pauseddeleted, and cancelled (true or false). Financial: currency (ISO-4217 format), credit_limit_local_microcredit_remaining_local_micro, and funded_amount_local_micro. The value of a currency is represented in micros. For USD, $5.50 is encoded as 5.50*1e6, or 5,500,000. To represent a “whole value”, you need to multiply the local micro by 1e6 (1_000_000) for all currencies.

Attribute Details

credit_limit_local_micro is only valid for CREDIT_CARD or CREDIT_LINE type funding instruments and represents the credit limit for that instrument. funded_amount_local_micro is only valid for INSERTION_ORDER type funding instruments and represents the allocated budget. credit_remaining_local_micro is valid for CREDIT_LINE and AGENCY_CREDIT_LINE type funding instruments. It represents the credit_limit_local_micro minus the amount already spent on that funding instrument. It does not represent the difference between funded_amount_local_micro and the amount spent. We draw a distinction between credit limit and funded amount because they represent different underlying funding methods and spending agreements we have with advertisers.

Types of Funding Instruments

Credit Cards Typically used by self-serve advertisers (without an account manager). Credit Lines These are in the form of insertion orders (IOs) and are set by account managers. Multi-Handle Credit Lines Advertisers can fund campaigns across multiple handles with this type of credit line. This feature is enabled by their X Account Manager, associating the different @handles to a specific credit line. For example, @NikeSB and @NikeFuel can both have access to the @Nike credit line. This funding instrument is available just like any other. You retrieve the data by submitting a GET request to the funding_instrument endpoint. Here is a sample response (note the CREDIT_LINE type).
The only thing particular about this funding instrument is the type and the fact that it is available to all the accounts that were associated to it. Of course, the remaining credit is impacted by all campaigns funded by this instrument, across all accounts sharing it. The details of what accounts are associated to a specific credit line are not available via the API (nor via ads.x.com). For more information on Funding Instrument enumerations, please click here.

Targeting

Targeting is a core concept of the Ads API. Targeting is set at the line item level and options vary across placements. To set new targeting criteria you need to use POST accounts/:account_id/targeting_criteria and PUT accounts/:account_id/targeting_criteria to update them. Use GET accounts/:account_id/line_items for a list of all line items and GET  accounts/:account_id/line_items/:line_item_id to retrieve a specific line item.

Targeting options by placement

Promoted Tweets and Promoted Accounts products can be made available on a variety of placements. Promoted Trends (PTr) are not available via the API. For possible placement combinations, refer to the GET line_items/placements endpoint. Each placement has different options for targeting. Location, Platform and Gender are available for all. The other options are contextual to the type of placement.
  • X Search: Age Targeting, Devices, Events, Gender, Keyword Types (All), Language, Locations, Network Activation, Network Operators, Platform, Platform Version, Tailored Audiences, WiFi Only
  • X Timeline: Age Targeting, Devices, Events, Followers Of, Similar to Followers Of, Gender, Interest, Language, Locations, Network Activation, Network Operators, Non-exact Keyword Types, Partner Audience Types, Platform, Platform Version, Retargeting Types, Tailored Audiences, TV Targeting Types, WiFi Only
  • X Profiles & Tweet Details: Age Targeting, Devices, Events, Followers Of, Similar to Followers Of, Gender, Interest, Language, Locations, Network Activation, Network Operators, Non-exact Keyword Types, Partner Audience Types, Platform, Platform Version, Retargeting Types, Tailored Audiences, TV Targeting Types, WiFi Only

Understanding targeting types

Age Targeting: Target users based on specific age buckets. A list of age bucket enums can be found on the Enumerations page. Events: Specify an event for targeting. Only one event can be used for targeting (per line item). Use the GET targeting_criteria/events endpoint to find events available for targeting. Gender: Target males (1) or females (2). Leave null to target all. Installed App Store Categories: use this targeting type to target users based on the categories of apps they have installed or have indicated interest in. See GET targeting_criteria/app_store_categories. Interests: Target users by interest. Get the interests list from GET targeting_criteria/interests. You can target up to 100 interests. Followers Of: Target the followers of any fully promotable users for the current account (note, currently the primary account holder is the only fully-promotable user of that account). GET accounts/:account_id/promotable_users to get a list of promotable users. Similar to Followers Of: Target people with the same interests as followers of specific users. You can use up to 100 Users. Locations: Specify up to 2,000 locations to target. Get list from GET targeting_criteria/locations. There are additional requirements for ads that target certain countries. See Country Targeting and Display Requirements for more information. Keywords: Keyword targeting options are specific by type of placement. You can use up to 1000 keywords for targeting (per line item). See the Keyword Types section for options. Language Targeting: Target users who understand specific languages. Mobile Network Operator Targeting: Enables advertisers to target users based on mobile carrier, using the targeting type NETWORK_OPERATOR from GET targeting_criteria/network_operators. New Mobile Device Targeting: Reach users based on the date that they first accessed X via their device, using the targeting type NETWORK_ACTIVATION_DURATION using operator_type of LT for less than and  GTE for greater than or equal. Platforms, Platform Versions, Devices, and Wifi-Only: Allows targeting of mobile devices across a variety of vectors. Platforms is a high-level targeting type that can hit broad categories of phone. Example values are iOS and Android. Devices allow you to target users of specific mobile devices, for example the iPhone 5s, Nexus 4, or Samsung Galaxy Note. Platform versions allow you to target users of versions of specific mobile operating systems, down to the point release. Examples include iOS 7.1 and Android 4.4. Wifi-Only allows you to target only those users who are using their devices on a WiFi network; if this is not set, users using the carrier connection as well as WiFi will be targeted.
  • Users can target platforms and devices if there is no overlap. I can target Blackberry as a platform and iPad Air as a device simultaneously.
  • Users can target devices and os versions simultaneously. I can target iPad Air and iOS >= 7.0.
  • Users cannot target platforms that are broader than devices. I cannot target iOS and iPad Air.
[Tailored Audiences]/x-ads-api/audiences: Reach users through an approved ads partner to target groups of customers and connect with them on X. TV Targeting TV Show Targeting: reach people that engage with specific TV programs. This targeting criteria can be configured to continuously target while a campaign is active with the TV_SHOW targeting type. Use the GET targeting_criteria/tv_markets and GET targeting_criteria/tv_shows endpoints to determine TV shows available. Tweet Engager Retargeting Tweet engager retargeting enables advertisers to target audiences across devices who have previously been exposed to or engaged with their promoted or organic Tweets on X. With this targeting advertisers can follow up with people who saw or engaged with an advertiser’s content on X and are most likely to further engage or convert with subsequent messaging or offers. Users will be eligible for targeting within minutes of exposure or engagement and will remain eligible for up to 90 days afterwards for engagements and 30 days for exposures. Tweet Engager Targeting Types:
  • ENGAGEMENT_TYPE which accepts either IMPRESSION or ENGAGEMENT as a targeting value. This specifies whether you wish to target exposed users (IMPRESSION) or engaged users (ENGAGEMENT).
  • CAMPAIGN_ENGAGEMENT uses a campaign ID as the targeting value. Users who engaged with or were exposed to this campaign (depending on ENGAGEMENT_TYPE) are the ones who will be targeted.
  • USER_ENGAGEMENT which uses the promoted user ID as the targeting value to target users who were exposed to or engaged with an advertiser’s organic content (depending on ENGAGEMENT_TYPE). This must be the promoted user ID associated with the Ads account.
Note: ENGAGEMENT_TYPE is required in addition to at least one valid CAMPAIGN_ENGAGEMENT or USER_ENGAGEMENT value. Both tweet engager targeting types may be present and multiple campaigns may be targeted on a given line item. Video Viewer Targeting: Video viewer targeting builds on Tweet engager targeting to enable advertisers to target audiences who have previously watched part or all of a video on X. Advertisers can target organic videos, promoted videos, or both. Promoted videos are not limited to video view objective campaigns or line items. Video Viewer Targeting Types:
  • VIDEO_VIEW for users who have clicked to play the video or have viewed 3 seconds of autoplay
  • VIDEO_VIEW_PARTIAL for users who have viewed 50% of the video
  • VIDEO_VIEW_COMPLETE for users who have viewed at least 95% of the video
As with Tweet engager targeting, one or both of the following must also be present in targeting criteria for the line item when ENGAGEMENT_TYPE is used:
  • CAMPAIGN_ENGAGEMENT uses a campaign ID as the targeting value. Users who watched a video (based on ENGAGEMENT_TYPE) in this campaign are the ones who will be targeted.
  • USER_ENGAGEMENT which uses the promoted user ID as the targeting value to target users who watched a video (based on ENGAGEMENT_TYPE) in an advertiser’s organic content. This must be the promoted user ID associated with the Ads account.
Keyword Types See our support document on keyword targeting for a conceptual overview.
  • Broad (default value): match all words, independent of order. Not sensitive to capitalization, plurals or tense. Will automatically be expanded when possible (i.e. “car repair” would also match “automobile fix”). If you want to target without expansion, you need to add a + sign before the keywords, like “+boat +jet”. Using keywords without the + will default to Broad Match.
  • Unordered (deprecated): match all words, independent of order. Not sensitive to capitalization, plurals or tense.
  • Phrase: match the exact keywords string, other keywords can be present.
  • Exact: match exactly the keywords string, not any others.
  • Negative: avoid matching searches that include all of these keywords somewhere in the query, regardless of the order in which they are written, even if other words are present.
  • Negative Phrase: avoid matching searches that include this exact keywords string somewhere in the query, even if other words are present.
  • Negative Exact: avoid matching searches that exactly match these keywords and contain no other words.  
Emoji targeting Emoji targeting is supported via keyword targeting. To use emoji targeting, simply create keyword targeting for Unicode codepoints representing that emoji such as U+1F602 (xF0x9Fx98x82 in UTF-8) for the ‘face with tears of joy’ emoji (😂). Emoji which we accept can be confirmed with the twemoji list. Targeting an emoji targets all variations. For a summary of all values with required/optional and specific details for each, see PUT accounts/:account_id/targeting_criteria.

Targeting Criteria Combinations

Updated Campaign Workflow Create campaigns which target broadly with geo, gender, language, and device/platform criteria. Advertisers can then combine the broad targeting with additional targeting criteria (e.g. interests, keywords, followers, tailored audiences, TV). If no targeting criteria is specified for a line item, the line item will target all users worldwide. Targeting criteria will be combined for your ad group such that:
  • “Primary” Targeting Types will get ‘d (i.e. put in a logical union).
  • Other Targeting Types will get AND‘d.
  • Same types will get OR‘d.
Some examples At a glance: [(Followers) ∪ (Tailored Audiences) ∪ (Interests) ∪ (Keywords)] AND (Location) AND (Gender) AND (Languages) AND (Devices and Platforms) A Geo example: Let’s say we want an ad group for our campaign to serve targeting:
  • X users in the U.S., England, and Canada (Location)
  • who are Women (Gender)
  • derived from Tailored Audiences list (“Primary”)
  • with Keywords (“Primary”)
The targeting criteria will be: [US OR GB OR CA] AND [Female] AND [Tailored AudiencesKeyword]

Additional examples

  • Select Gender and Geo but no primary: (Male) AND (US OR GB)
  • Select Gender, Geo, Interest: (Female) AND (CA) AND (Computers OR Technology OR Startups)
  • Select Gender, Geo, Interest, Tailored Audiences, Keywords: (Male) AND (GB) AND (CarsTailored Audiences for CRMautocross)

Budget Pacing

Advertisers now have more control over how fast their daily budgets are spent on your Promoted Tweet and Account campaigns. Enabling standard delivery, which is the default, ensures an even spend rate throughout the day. By turning off standard delivery, we will serve impressions and generate engagements as quickly as possible until your daily budget is exhausted, which may be quite early on in the day depending on targeting and competition. This is called accelerated delivery. Getting Started Standard delivery is the default option for all campaigns, so no action is required unless you wish to turn it off. To spend through your daily budget on a campaign as fast as possible set the standard_delivery parameter to false to set the pace to accelerated delivery (see GET accounts/:account_id/campaigns). Notes
  • “Day” is respective to X advertiser account timezone (eg. America/Los_Angeles).
  • Early results indicate that standard delivery will improve eCPE/CPF for advertisers, with more consistent coverage throughout the day.
For more additional information about budgets and pacing please see the Bidding and Auctions FAQ.

Target Bidding

Campaign management

Bid Strategy

We have introduced the concept of Bid Strategy to simplify campaign creation workflow and reduce confusion about combinations of multiple parameters. All previous (marked as legacy) combinations of parameters can be achieved by setting an equivalent goal parameter. Further information can be found in the announcement here. As example:

Target Bidding

Using target bidding, you can specify a target cost you want to pay and the X Ads platform will optimize your campaign for performance while staying near or below your target cost. This feature gives you the flexibility to reach users who are especially likely to take the desired action (such as a link click, a lead or a follow) while maintaining cost control. This is a powerful feature for advertisers who desire more options for campaign setup and optimization (including bidding options). For line items with compatible campaign objectives, we’ve introduced a new pricing mechanism for bid amount that lets you specify a target cost you want to pay. Our ad platform dynamically bids on your behalf to help you drive more results, while working to keep your average cost within 20% of your specified target. The bid_strategy setting on line items may be set with a value of TARGET to enable target bidding on relevant campaign objectives, such as:
  • WEBSITE_CLICKS
  • WEBSITE_CONVERSIONS 
  • APP_INSTALLS 
  • APP_ENGAGEMENTS
  • REACH

Country Targeting and Display Requirements

Campaign management Country-specific targeting and display requirements are contained on this page. These requirements must be adhered to by all partners.

Russia

X’s Ads Policies prohibit advertisers from targeting Russia with advertisements that are not in the Russian language. When your users specifically target Russia, you must display the following warning message to your users: Ads targeting Russia must be in the Russian language.

Partner Managed Funding Instruments

The onboarding flow configures an ads.x.com account for the X account, which can be managed by the partner through the Ads API, and whose advertising spend is billed to the partner.  

Partner Initial Set-up

The process to initially set-up a new PMFI Ads API partner takes up to 3-weeks from exchange of required information. The following must be shared with your technical contacts at X, as well as the X contact managing the integration with the partner in order to get the process started:
  • The partner must share their PGP/GPG public key. A shared secret key needs to be exchanged between the Ads API partner and X. This will be used to verify data during the onboarding flow.
  • The app_id or consumer_secret for the X app that will be used for Ads API access. You can view and edit your existing X apps via the app dashboard if you are logged into your X account on developer.x.com. If you need to create a X app, you will need to have an approved developer account. X allows one app for production+sandbox and one optional app for sandbox-only access. The X app must be created on a corporate, partner-controlled X handle.  

Advertiser Onboarding Flow

The advertiser onboarding flow occurs via a web browser in the following way:
  1. The user starts the onboarding flow on the partner’s website and enters the handle they want to onboard.
  2. The partner redirects the user to a URL on ads.x.com with a signed payload. This payload contains the partner’s API app_id, the X user_id of the X handle which is to be onboarded and a callback URL and other fields documented below.
  3. The user is asked to sign into ads.x.com using the standard x.com login page.
  4. Once the user is logged in, the onboarding process is initiated. This step includes ad review, account validation and other checks.
  5. When all onboarding tasks are completed, the user is redirected to the callback URL that was provided by the Ads API partner, with a payload that indicates success or failure. This includes the 3-legged authorization process.  

Onboarding redirect payload

URL for redirect: https://ads.x.com/link\_managed\_account The redirect URL will be called with the following parameters:

Callback URL payload

The base redirect URL is provided using the callback_url parameter on the account link request (see above). The parameters added by ads.x.com are: To make sure the callback URL is only valid for the X user_id that the account link process was intended for, the X user_id is to be appended to the shared secret (using &) when signing the request.  

Signing the request and callback URLs

In order to ensure that the requests to /link_managed_account and the callback url are valid, the requests need to be signed at the source and verified by the recipient before the recipient takes action on them. Signing the request with a secret that is shared between X and the managing partner ensures that each party only accepts requests sent by the authorized counterpart. The signature generation algorithm is similar to the one used in OAuth. Create a signature base string as follows:
  • Convert the HTTP Method to uppercase and set the base string equal to this value.
  • Append the ‘&’ character to the base string.
  • Percent encode the URL (without parameters) and append it to the base string.
  • Append the ‘&’ character to the base string.
  • Append the percent encoded query string, which is built as follows:
  • Percent encode every key and value that will be signed.
  • Sort the list of parameters alphabetically by key.
  • For each key/value pair (and with primary_promotable_user_id for the partner redirect url):
  • Append the percent encoded key to the query string.
  • Append the ‘=’ character to the base string.
  • Append the percent encoded value to the query string.
  • Separate the percent encoded key=value pairs with the ‘&’ character.
  • Use the HMAC-SHA1 algorithm, using the previously exchanged shared secret, as the key, and the base string as the value to generate the signature.
  • Base64 encode the output of Step 2, drop the trailing newline character percent encode the signature generated in Step 3 and add it to the url in a signature parameter  

Signing examples

Signing a link account request Url to sign, assuming a GET request: https://ads.x.com/link\_managed\_account?callback\_url=https%3A%2F%2Fmanagingpartner.com%2Flink\_account\_callback&client\_app\_id=12345&fi\_description=some%20name&promotable\_user\_id=1 This url has the following parameters: callback_url = https://managingpartner.com/link\_account_callback client_app_id = 12345 fi_description = some name promotable_user_id = 1 The base string consisting of http method and url without parameters, steps a - d, looks like: GET https://ads.x.com/link\_managed\_account The query string, produced by the substeps of e, looks like: callback_url=https://managingpartner.com/link\_account\_callback&client\_app\_id=12345&fi\_description=some name&promotable_user_id=1 Note that the key-value pairs are sorted by key name. The percent encoded query string looks like: callback_url%3Dhttps%253A%252F%252Fmanagingpartner.com%252Flink_account_callback%26client_app_id%3D12345%26fi_description%3Dsome%2520name%26promotable_user_id%3D1 The complete base string, combining steps a - d and e: GET https://ads.x.com/link\_managed\_account&callback\_url%3Dhttps%253A%252F%252Fmanagingpartner.com%252Flink\_account\_callback%26client\_app\_id%3D12345%26fi\_description%3Dsome%2520name%26promotable\_user\_id%3D1 Using the hmac-sha1 algorithm we will sign this with the word “secret” as the key. The result is Base64 encoded, and presented without the final “\n” (steps 2 and 3): KBxQMMSpKRrtg9aw3qxK4fTXvUc= This signature is then added (percent encoded) to the end of the original url in the signature parameter (step 4): https://ads.x.com/link\_managed\_account?callback\_url=https%3A%2F%2Fmanagingpartner.com%2Flink\_account\_callback&client\_app\_id=12345&fi\_description=some%20name&promotable\_user\_id=1&signature=KBxQMMSpKRrtg9aw3qxK4fTXvUc%3D Signing a partner redirect url (account link request callback) The URL to sign, assuming a GET request: https://managingpartner.com/link\_account\_callback?status=OK&account\_id=ABC&funding\_instrument_id=DEF This url has the following parameters: account_id = ABC, funding_instrument_id = DEF and status = OK The base string consisting of http method and url without parameters, steps a - d, looks like: GET https%3A%2F%2Fmanagingpartner.com%2Flink_account_callback&“ The query string, produced by the substeps of e, looks like: account_id=ABC&funding_instrument_id=DEF&status=OK The percent encoded query string looks like: account_id%3DABC%26funding_instrument_id%3DDEF%26status%3DOK The complete base string, combining steps a - d and e: GET https%3A%2F%2Fmanagingpartner.com%2Flink_account_callback&account_id%3DABC%26funding_instrument_id%3DDEF%26status%3DOK Using the hmac-sha1 algorithm we will sign this with the word “secret” and the X user id for which the original link request was made, 1 (promotable_user_id = 1 from above) as the key, “secret&1”. The result is Base64 encoded, and presented without the final “\n” (steps 2 and 3): jDSHDkHJIFXpPLVxtA3a9d4bPjM= This signature is then added (percent encoded) to the end of the original url in the signature parameter (step 4): https://managingpartner.com/link\_account\_callback?&status=OK&account\_id=ABC&funding\_instrument_id=DEF&signature=jDSHDkHJIFXpPLVxtA3a9d4bPjM%3D

Shared Key use / renewal

The signing algorithm should have the ability to repeat itself with multiple keys. This will allow multiple shared keys to be used, and enables cycling shared keys on a periodic basis.  

partner_managed_funding_instrument creation

If the fi_description parameter is given, and no existing partner_managed_funding_instrument with the same name exists in the account, a new partner_managed_funding_instrument will be created, and all existing partner_managed_funding_instruments will be paused. If a partner_managed_funding_instrument with the same name exists, no new one will be created.  

Repeated on-boarding flow calls / token refresh

The on-boarding flow can be repeated in case the API access token was lost. The on-boarding flow implementation will require the user is logged in. If the user matches the promotable_user_id, and the associated ads account is found, and everything looks good, the user will be redirected back to the callback url, and the partner can initiate the OAuth flow to obtain an access token.  

Non-redirectable error flow

If the account link url is invoked with invalid parameters, the user will be shown a page similar to the one shown in the OAuth flow when invalid or expired parameters are given.  

Ongoing updates to the PMFI

Once the advertiser has been onboarded, the funding instrument can be managed using the PUT accounts/:account_id/funding_instruments/:funding_instrument_id endpoint by only the partner who manages it.

Placements

There are several places where X ads can be displayed. This is set at the line item using the placements parameter. The possible values are:
  • ALL_ON_TWITTER
  • PUBLISHER_NETWORK
  • TWITTER_PROFILE
  • TWITTER_SEARCH
  • TWITTER_TIMELINE
  • SPOTLIGHT
  • TREND
The line item’s product_type and objective determine which placements are allowed. The GET line_items/placements endpoint can be used to retrieve the valid placement options for each product type. Additionally, the following table lists the valid placement and objective combinations. Note: It is not possible to specify only TWITTER_PROFILE placement. Note: TWITTER_SEARCH requires keyword targeting. Note: The REACH objective must include TWITTER_TIMELINE placement. It can have either ALL_ON_TWITTER, any combination of placements that include TWITTER_TIMELINE, or TWITTER_TIMELINE on its own.

Ad groups FAQ

This document is meant to be a collection of commonly asked questions about Ad Groups in X’s Ads API.

What is an Ad Group?

Ad groups, known as line items in the Ads API, exist under campaigns and are used for targeting and bidding against a set of X users. Advertisers promote Tweets or media (e.g., videos that are promoted as In-stream ads) by associating them with a line item.

How do we create an Ad Group?

Ad Groups are created by calling POST accounts/:account_id/line_items multiple times for the same campaign ID, and keeping (possibly completely different) targeting and Tweets associated with those line items. There is a limit of 100 line items per campaign and a limit of 200 active campaigns for a single ads account. Across all campaigns, there is a limit of and 8,000 active line items per ads account.

Why should we add support for Ad Groups?

Ad Groups are intended to make it easier for advertisers to organize, optimize and manage their campaigns. The advantage of Ad Groups is to compare and control different strategies across bid, budget, creative, and targeting. Upon associating multiple Promoted Tweets to a single line item, the auction would select the best Tweet from that group and then select the best Tweet for that campaign from all of the line items. If you have multiple Ad Groups with single Tweets, it would effectively select the Tweet that would likely perform better from that Ad Group. Using Ad Groups enables an advertiser to split up targeting and bidding into a much greater number of possible combinations, and in general allows splitting up targeting into logical groups. Ads API tools in particular could be built around fine tuned optimization rules with Ad Groups that would be more difficult to do via manual edits due to the larger scale of line item and creative combinations.

How does the line item budget relate to campaign budget in an Ad Groups campaign?

The total_budget_amount_local_micro for a line item cannot exceed the total budget for its parent campaign. Similarly, the line item’s bid_amount_local_micro value should not exceed daily_budget_amount_local_micro or total_budget_amount_local_micro of the parent campaign. Setting these values incorrectly may put the overall campaign into a paused and unservable state. Note that the total campaign budget can be less than the sum of the budgets of its child line items, and distribution of budget between line items is partially up to the Ads API tool to effectively optimize and change as daily performance of targeting (line item) could differ significantly day to day due to X’s realtime nature.

Do Ad Groups perform better than single line items?

The performance of a campaign depends upon many factors and effectively a Tweet is the final deciding factor of performance. A Line Item will be treated as a factor of whether or not a Tweet is even in the running to be served to a user. Line items that target the same sets of users are considered to have overlap of users. It is considered a best practice to reduce this overlap of targeting between line items so that the highest performing sets of users can be clearly identified.

Guides

Video Views Preroll Objective

The following guide outlines the steps required to set up a PREROLL_VIEWS campaign on the Ads API. Broadly speaking these campaigns are split into two types, Curated Categories and Content Categories (referred to as Standard Categories on the Ads UI).  

Endpoints Required

Steps

Upload the video

Uploading the video involves 2 steps:

Upload the video media

First, using the Chunked media upload endpoint, you will upload the video to X for processing. You must pass the media_category=amplify_video on the initial INIT using this endpoint. You’ll upload the video in chunks. Once the STATUS returns a state of succeeded you may continue with the next steps. More on the uploading of media using the chunked endpoint can be found in our Promoted Video Overview.

Add the video to the ads account

Once the state returned using the STATUS command is succeeded, you’ll use the media_key returned from that endpoint to add the video to the advertiser’s media library, using the POST accounts/:account_id/media_library endpoint.

Setup the campaign

Campaign Creation

Create the campaign and line item/ad group. Line items should be created with an objective of VIDEO_VIEWS_PREROLL, and a product_type of MEDIA. The categories parameter must also be set to the appropriate advertiser business categories.

Line Item Creation

Line items must have the categories parameter set to the appropriate set of IAB categories, retrieved via the GET content_categories endpoint. These content categories each correspond to one or more IAB categories. In order to use these values, partners must select an appropriate content category and use the entire set of iab_categories returned in the response, to set the categories parameter on the line items endpoint. Any partial application of the iab_categories will result in the entire group being set on the line item. For example,
Now, in order to set the categories parameter to “Science & Education”, the entire set of iab_categories i.e., "IAB5", "IAB15" must be set for the line item, like so:

Publisher Selection

An advertiser may choose to target either a Content Category or a Curated Category, with additional details described below.  Note:  Line items may target either Curated or Content  Categories but not both. 

Curated Categories

Curated Categories allow advertisers to target a preset group of publishers and can be retrieved using the  GET curated_categories endpoint. These categories are country specific, and therefore require that the line item target the appropriate country based on the country_code of the category. In order to use one of these categories, the following steps are required in the specific order listed:
  1. The line item needs to target the appropriate country based on the country_code of the Curated Category
  2. The POST line_item_curated_categories endpoint must be used to associate the line item with a specific curated_category_id. 
Note: Associating a line item with a curated category will also limit the number of publishers that can be denylisted to 5. The full list of user_id used to denylist specific publishers can be retrieved from the GET publishers endpoint. Additionally, a given line item may target no more than one Curated Category at a time. The following example illustrates how to associate a curated category id: b0xt which is only available in the US, with the line item created in the previous step. First, the line item’s targeting criteria is set to the the value 96683cc9126741d

Content Categories

Content categories, also referred to as Standard Categories can be retrieved from the GET curated_categories endpoint. These categories can then be targeted by the line item using the batch targeting criteria endpoints. The following example illustrates how to select a particular content category, id: sr which maps to “News & Current Events” and apply it to the line item.
Note: The entire set of iab_categories in the GET curated_categories response must be targeted via the targeting criteria endpoint. Failing to do so will result in a validation error. 
Associate the account media (video) with the line item
Use the POST accounts/:account_id/media_creatives endpoint to associate the video with an ad group.

Set the CTA and destination URL

It is important to note that unlike most other campaigns on X, the VIDEO_VIEWS_PREROLL objective does not utilize Promoted Tweets or Cards. Instead, the video creative is associated with your ad group (line item) and the CTA information is associated with a preroll_call_to_action entity. The POST accounts/:account_id/preroll_call_to_action endpoint allows you to control the button CTA and the destination URL.

Set targeting criteria

The targetting criterion utilized for pre-roll video ads is only avaialble using our batch targeting criteria endpoint POST batch/accounts/:account_id/targeting_criteria. Use CONTENT_PUBLISHER_USER as negated targeting to exclude the ad from being paired with a set of users. Provide the X user_id  or publisher_user_id for the handles to exclude. The GET publishers endpoint can be used to retrieve the list of user_id to exclude for Content Categories. The publisher_user_id returned in the GET curated_categories response can be used to retrieve a similar exclusion list for Curated Categories. Note: A maximum of 5 publisher_user_id can be excluded for Curated Categories and 50 user_id for Content Categories.

Launch campaign

When you’re ready to launch your campaign, simply un-pause using PUT accounts/:account_id/campaigns/:id. PUT https://ads-api.x.com/8/accounts/55w3kv/campaigns/f2rp3? entity_status=ACTIVE

Analytics

Analytics for VIDEO_VIEWS_PREROLL campaigns are available using our stats endpoints.

Keyword Targeting in Timelines

Keyword targeting is fundamental to our Promoted Tweets products, giving campaigns better reach. Keyword targeting in timeline enables platforms to target X users based on keywords in their recent Tweets. For example, if an advertiser is targeting the unordered keyword combination “plan + trip”, and a user Tweets, “I’m starting to plan my trip to Cabo, any suggestions?” while the campaign is running, that user may soon afterward see the advertiser’s Promoted Tweet.

How does it work?

TL;DR: from an API standpoint, this change is quite simple: you can now target keywords on Promoted Tweets in Timeline. Just set the targeting_type to unordered_keywords or phrase_keywords for line items.

Quick Start Guide

API Reference

Accounts

GET accounts

Retrieve details for some or all advertising-enabled accounts the authenticating user has access to. Resource URL https://ads-api.x.com/12/accounts Parameters

Example Request

Example Response

GET accounts/:account_id

Retrieve a specific account that the authenticating user has access to. Resource URL https://ads-api.x.com/12/accounts/:account_id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t Example Response

POST accounts

Note: SANDBOX ONLY Create an ads account in the sandbox environment. Resource URL https://ads-api-sandbox.x.com/12/accounts Parameters None Example Request POST https://ads-api-sandbox.x.com/12/accounts Example Response

PUT accounts/:account_id

Updates the account name and/or industry type. Resource URL https://ads-api.x.com/12/accounts/:account_id Parameters Example Request PUT https://ads-api.x.com/12/accounts/18ce54d4x5t?name='API McTestface 2'&industry_type=TECHNOLOGY Example Response

DELETE accounts/:account_id

Note: SANDBOX ONLY Delete an ads account in the sandbox environment. Resource URL https://ads-api-sandbox.x.com/12/accounts/:account_id Parameters Example Request DELETE https://ads-api-sandbox.x.com/12/accounts/gq12fh Example Response

Account Apps

Run in Postman ❯

GET account_apps

Retrieve details for all mobile apps that are associated with the specified ad account. Resource URL https://ads-api.x.com/12/accounts/:account_id/account_apps Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/account_apps Example Response

Account History

GET accounts/:account_id/account_history

Retrieve a summary of changes made to the entity_id specified in the request. Note: This endpoint is currently in beta and requires allowlisting. Resource URL https://ads-api.x.com/12/accounts/:account_id/account_history Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/account_history?entity_type=CAMPAIGN&entity_id=fc3h5&count=1 Example Response

Advertiser Business Categories

GET advertiser_business_categories

Request the valid advertiser business categories for Ad Groups (line_items) to describe an advertiser’s brand to publishers. Note: These categories apply only to line_items with the PREROLL_VIEWS objective and are separate from the content_categories used for targeting criteria. Each advertiser_business_categories represents a collection of IAB Categories. When creating an Ad Group with the PREROLL_VIEWS objective, one or two advertiser_business_categories must be set for the Ad Group. This can be done by setting the value of the categories request parameter on the line item endpoint to the set of corresponding iab_categories available through this endpoint. Additional details can be found in the Video Views Preroll Objective Guide Resource URL https://ads-api.x.com/12/advertiser_business_categories Parameters No request parameters Example Request GET https://ads-api.x.com/12/advertiser_business_categories Example Response

Audience Estimate

POST accounts/:account_id/audience_estimate

Determine the approximate audience size of your campaigns.

This endpoint accepts an array of JSON objects containing the parameters for the targeting criteria objects. A list of required and optional targeting criteria parameters are available on the POST accounts/:account_id/targeting_criteria endpoint. Requests must be HTTP POST with a JSON content body with a Content-Type: application/json header. Note: It is required that you specify at least one primary targeting criterion; you can see a list of all primary targeting criteria in our campaigns targeting page. Resource URL https://ads-api.x.com/12/accounts/:account_id/audience_estimate Parameters Example Request POST https://ads-api.x.com/12/accounts/18ce54d4x5t/audience_estimate
Example Response

Authenticated User Access

GET accounts/:account_id/authenticated_user_access

Retrieve the permissions of the currently authenticated user (access_token) as they relate to the specified ads account. These permissions match those exposed on ads.x.com. Possible values include:
  • ACCOUNT_ADMIN: Full access to modify campaigns and view stats, including the ability to add or remove users and change settings
  • AD_MANAGER: Full access to modify campaigns and view stats, but cannot add or remove users or change settings
  • CREATIVE_MANAGER: Access to modify creatives and view previews, but no access to create or modify campaigns
  • CAMPAIGN_ANALYST: Access to view campaigns and view stats, but no access to create or modify campaigns
  • ANALYST (“Organic Analyst” on ads.x.com): Access to view organic analytics and audience insights, but no access to create, modify, or view campaigns
  • PARTNER_AUDIENCE_MANAGER: API-only access to view and modify data partner audiences, but no access to campaigns, creatives, or other audience types.
In addition, the TWEET_COMPOSER permission indicates that the authenticated user can create nullcasted (or “Promoted-only”) Tweets on behalf of the advertiser. This is only available for users with ACCOUNT_ADMIN, AD_MANAGER, or CREATIVE_MANAGER access. Resource URL https://ads-api.x.com/12/accounts/:account_id/authenticated_user_access Parameters None Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/authenticated_user_access Example Response

Bidding Rules

GET bidding_rules

Retrieve the bidding rules for some or all currencies. The response will indicate the minimum and maximum CPE (cost-per-engagement) bids. While these bidding rules change rarely, it is suggested that your systems refresh from these endpoints at least monthly. Resource URL https://ads-api.x.com/12/bidding_rules Parameters Example Request GET https://ads-api.x.com/12/bidding_rules?currency=USD Example Response

Campaigns

GET accounts/:account_id/campaigns

Retrieve details for some or all campaigns associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/campaigns Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/campaigns?campaign_ids=8wku2 Example Response

GET accounts/:account_id/campaigns/:campaign_id

Retrieve a specific campaign associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/campaigns/:campaign_id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/campaigns/8wku2 Example Response

POST accounts/:account_id/campaigns

Create a new campaign associated with the current account. Note: There is a default limit of 200 active campaigns per account. However, there is no limit to the number of inactive campaigns. This limit can be raised to 8,000 active campaigns. To enable the higher limit, the advertiser must make the request to their X Account Manager. Resource URL https://ads-api.x.com/12/accounts/:account_id/campaigns Parameters Example Request POST https://ads-api.x.com/12/accounts/18ce54d4x5t/campaigns?funding_instrument_id=lygyi&name=demo&daily_budget_amount_local_micro=140000000&entity_status=PAUSED&budget_optimization=CAMPIAGN&standard_delivery=false Example Response

POST batch/accounts/:account_id/campaigns

Allows the batch creation of new campaigns with a single request. Batch Requests
  • The current maximum batch size is 40.
  • All parameters are sent in the request body and a Content-Type of application/json is required.
  • Batch requests fail or succeed together as a group and all API responses for both error and success preserve the item order of the initial request.
Batch Responses Batch API responses return an ordered collection of items. Otherwise, they are identical in structure to their corresponding single-item endpoints. Batch Errors
  • Request-level errors (eg. max batch size exceeded) are shown in the response under the errors object.
  • Item-level errors (eg. missing required campaign parameter) are shown in the response under the operation_errors object.
Resource URL https://ads-api.x.com/12/batch/accounts/:account_id/campaigns Parameters Example Request POST 'Content-Type: application/json' https://ads-api.x.com/12/batch/accounts/18ce54d4x5t/campaigns
Example Response

PUT accounts/:account_id/campaigns/:campaign_id

Update the specified campaign associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/campaigns/:campaign_id Parameters Example Request PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/campaigns/8wku2?total_budget_amount_local_micro=140000000 Example Response

DELETE accounts/:account_id/campaigns/:campaign_id

Delete the specified campaign belonging to the current account. Note: Deleting a campaign is not reversible and subsequent attempts to delete the resource will return HTTP 404. Resource URL https://ads-api.x.com/12/accounts/:account_id/campaigns/:campaign_id Parameters Example Request DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/campaigns/8yn7m Example Response

Content Categories

GET content_categories

Request the valid content categories to be set as targeting_criteria for a line item. Each content_category maps to one or more IAB Categories. This can be done by setting the targeting_type to IAB_CATEGORY on the batch targeting_critera endpoint to include the set of corresponding iab_categories returned by the content_categories request. Failure to do so will result in a validation error. Publisher details for each of these content categories can be retrieved using the GET publishers endpoint. Additional details can be found in the Video Views Pre-roll Objective Guide. Resource URL https://ads-api.x.com/12/content_categories Parameters No request parameters Example Request GET https://ads-api.x.com/12/content_categories Example Response

Curated Categories

GET accounts/:account_id/curated_categories

Retrieve a list of available Curated Categories for the given country_codes Each curated_category is only available in specific countries specified by the country_codes in the response. Additional details can be found in the Video Views Pre-roll Objective Guide. Resource URL https://ads-api.x.com/12/accounts/:account_id/curated_categories Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/curated_categories?country_codes=US Example Response

GET accounts/:account_id/curated_categories/:curated_category_id

Retrieve details for a specific curated_category_id Each curated_category is only available in specific countries specified by the country_codes in the response. Resource URL https://ads-api.x.com/12/accounts/:account_id/curated_categories/:curated_category_id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/curated_categories/9ddrgesiap6o Example Response

Features

GET accounts/:account_id/features

Retrieve the collection of granted features accessible by this ads account. Features are indicated by a descriptive feature key and are only exposed on this endpoint if they are introduced in beta or an otherwise limited release and are available in the Ads API. Features that do not meet this criteria will not be exposed on this endpoint. Note: This endpoint serves to aid Ads API ecosystem development by improving visibility into client access to beta releases. API developers can not request access to features on behalf of an advertiser. These requests can only be made by the advertiser to their X account manager. Resource URL https://ads-api.x.com/12/accounts/:account_id/features Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/features Example Response

POST accounts/:account_id/features

SANDBOX ONLY Add a feature to a sandbox account. The up to date list of account features may be retrieved via the GET accounts/:account_id/features endpoint. Resource URL https://ads-api-sandbox.x.com/12/accounts/:account_id/features Parameters Example Request POST https://ads-api-sandbox.x.com/12/accounts/gq180y/features?feature_keys=VALIDATED_AGE_TARGETING Example Response

DELETE accounts/:account_id/features

SANDBOX ONLY Remove a feature from a sandbox account. The up to date list of account features may be retrieved via the GET accounts/:account_id/features endpoint. Resource URL https://ads-api-sandbox.x.com/12/accounts/:account_id/features Parameters Example Request DELETE https://ads-api-sandbox.x.com/12/accounts/gq180y/features?feature_keys=PREROLL_VIEWS_OBJECTIVE Example Response

Funding Instruments

GET accounts/:account_id/funding_instruments

Retrieve details for some or all funding instruments associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/funding_instruments Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/funding_instruments Example Response

GET accounts/:account_id/funding_instruments/:funding_instrument_id

Retrieve a specific funding instrument associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/funding_instruments/:id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/funding_instruments/lygyi Example Response

POST accounts/:account_id/funding_instruments

SANDBOX ONLY Create a funding instrument in the sandbox environment. There is no risk of incurring costs while using a sandbox funding instrument. Resource URL https://ads-api-sandbox.x.com/12/accounts/:account_id/funding_instruments Parameters Example Request POST https://ads-api-sandbox.x.com/12/accounts/gq1844/funding_instruments?currency=USD&start_time=2017-07-10T00:00:00Z&type=INSERTION_ORDER&end_time=2018-01-10T00:00:00Z&funded_amount_local_micro=140000000000 Example Response

DELETE accounts/:account_id/funding_instruments/:funding_instrument_id

SANDBOX ONLY Delete a funding instrument in the sandbox environment. Resource URL https://ads-api-sandbox.x.com/12/accounts/:account_id/funding_instruments/:funding_instrument_id Parameters Example Request DELETE https://ads-api-sandbox.x.com/12/accounts/gq1844/funding_instruments/hxt82 Example Response

IAB Categories

GET iab_categories

Request the valid app categories for ad groups (line_items). Resource URL https://ads-api.x.com/12/iab_categories Parameters Example Request GET https://ads-api.x.com/12/iab_categories?count=2 Example Response

Line Items

GET accounts/:account_id/line_items

Retrieve details for some or all line items associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/line_items Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/line_items?line_item_ids=itttx Example Response

GET accounts/:account_id/line_items/:line_item_id

Retrieve a specific line item associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/line_items/:line_item_id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/line_items/itttx Example Response

POST accounts/:account_id/line_items

Create a line item associated with the specified campaign belonging to the current account. All line items within a campaign must be of the same product_type and objective. When using the PROMOTED_ACCOUNT product type, associating a Tweet with the line_item will add timeline placements on mobile in addition to the standard PROMOTED_ACCOUNT placement. Setting either android_app_store_identifier or ios_app_store_identifier will automatically add the targeting criteria for the line item matching the mobile app being promoted; for example, passing in ios_app_store_identifier would add PLATFORM targeting criteria for iOS. Note: There is a limit of 100 line items per campaign and 256 active line items across all campaigns. Resource URL https://ads-api.x.com/12/accounts/:account_id/line_items Parameters Example Request POST https://ads-api.x.com/12/accounts/18ce54d4x5t/line_items?campaign_id=hwtq0&objective=ENGAGEMENTS&product_type=PROMOTED_TWEETS&placements=ALL_ON_TWITTER&bid_amount_local_micro=3210000&entity_status=PAUSED&daily_budget_amount_local_micro=1000000&start_time=2022-06-15 Example Response

POST batch/accounts/:account_id/line_items

Allows the batch creation of new line items with a single request. Batch Requests
  • The current maximum batch size is 40.
  • All parameters are sent in the request body and a Content-Type of application/json is required.
  • Batch requests fail or succeed together as a group and all API responses for both error and success preserve the item order of the initial request.
Batch Responses Batch API responses return an ordered collection of items. Otherwise, they are identical in structure to their corresponding single-item endpoints. Batch Errors
  • Request-level errors (eg. max batch size exceeded) are shown in the response under the errors object.
  • Item-level errors (eg. missing required line item parameter) are shown in the response under the operation_errors object.
Resource URL https://ads-api.x.com/12/batch/accounts/:account_id/line_items Parameters Example Request POST 'Content-Type: application/json' https://ads-api.x.com/12/batch/accounts/18ce54d4x5t/line_items
Example Response

PUT accounts/:account_id/line_items/:line_item_id

Update the specified line item associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/line_items/:line_item_id Parameters Example Request PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/line_items/9cqi0?bid_amount_local_micro=140000 Example Response

DELETE accounts/:account_id/line_items/:line_item_id

Delete the specified line item belonging to the current account. Note: Deleting a line item is not reversible and subsequent attempts to delete the resource will return HTTP 404. Note: When a line item is deleted, its child promoted_tweets are only returned in the GET accounts/:account_id/promoted_tweets and GET accounts/:account_id/promoted_tweets/:promoted_tweet_id endpoints if with_deleted=true is specified in the request. These promoted_tweets are not actually deleted, though ("deleted": false in the response). We do not cascade deletes. Resource URL https://ads-api.x.com/12/accounts/:account_id/line_items/:line_item_id Parameters Example Request DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/line_items/9f2ix Example Response

Line Item Curated Categories

Additional details on usage can be found at the Video Views Pre-roll Objective Guide

GET accounts/:account_id/line_item_curated_categories

Retrieve details for some or all line item curated categories associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/line_item_curated_categories Parameters Example Request GET https://ads-api.x.com/12/accounts/abc1/line_item_curated_categories Example Response

GET accounts/:account_id/line_item_curated_categories/:line_item_curated_category_id

Retrieves details for a specific line item curated category associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/line_item_curated_categories/:line_item_curated_category_id Parameters Example Request GET https://ads-api.x.com/12/accounts/abc1/line_item_curated_categories/yav Example Response

POST accounts/:account_id/line_item_curated_categories

Associate a curated category object with the specified line item. Resource URL https://ads-api.x.com/12/accounts/:account_id/line_item_curated_categories Parameters Example Request POST https://ads-api.x.com/12/accounts/18ce54d4x5t/line_item_curated_categories?line_item_id=iqwka&curated_category_id=9ddrgesiap6o Example Response

PUT accounts/:account_id/line_item_curated_categories/:line_item_curated_category_id

Update the specified line item curated category. Resource URL https://ads-api.x.com/12/accounts/:account_id/line_item_curated_categories/:line_item_curated_category_id Parameters Example Request PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/line_item_curated_categories/xq?curated_category_id=8tujl1p3yn0g Example Response

DELETE accounts/:account_id/line_item_curated_categories/:line_item_curated_category_id

Delete the specified line item curated category. Resource URL https://ads-api.x.com/12/accounts/:account_id/line_item_curated_categories/:line_item_curated_category_id Parameters Example Request DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/line_item_curated_categories/xq Example Response

Line Item Placements

GET line_items/placements

Retrieve valid placement and product_type combinations. Resource URL https://ads-api.x.com/12/line_items/placements Parameters Example Request GET https://ads-api.x.com/12/line_items/placements?product_type=PROMOTED_ACCOUNT Example Response

Media Creatives

GET accounts/:account_id/media_creatives

Retrieve details for some or all media creatives associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/media_creatives Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/media_creatives?media_creative_ids=1bzq3 Example Response

GET accounts/:account_id/media_creatives/:media_creative_id

Retrieves details for a specific media creative associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/media_creatives/:media_creative_id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/media_creatives/1bzq3 Example Response

POST accounts/:account_id/media_creatives

Associate an account media object with the specified line item. Use this endpoint to promote in-stream ads (when the account media creative_type is PREROLL) or image ads (such as BANNER or INTERSTITIAL) on the Twitter Audience Platform. Note: In order to add media assets to the Account Media resource, use the POST accounts/:account_id/media_library endpoint. Resource URL https://ads-api.x.com/12/accounts/:account_id/media_creatives Parameters Example Request POST https://ads-api.x.com/12/accounts/18ce54d4x5t/media_creatives?line_item_id=8v7jo&account_media_id=10miy Example Response

DELETE accounts/:account_id/media_creatives/:media_creative_id

Delete the specified media creative belonging to the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/media_creatives/:media_creative_id Parameters Example Request DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/media_creatives/1bzq3 Example Response

GET accounts/:account_id/promoted_accounts

Retrieve details for some or all promoted accounts associated with one or more line items under the current account. Use GET users/lookup to obtain user data for the user accounts identified by user_id in the response. An HTTP 400 will be returned if none of the specified line items are configured to contain promoted accounts. Resource URL https://ads-api.x.com/12/accounts/:account_id/promoted_accounts Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/promoted_accounts?promoted_account_ids=19pl2 Example Response

GET accounts/:account_id/promoted_accounts/:promoted_account_id

Retrieve a specific reference to an account associated with a line item under the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/promoted_accounts/:promoted_account_id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/promoted_accounts/19pl2 Example Response

POST accounts/:account_id/promoted_accounts

Associate an account (user_id) with the specified line item. If the specified line item is not configured to be associated with Promoted Accounts, a HTTP 400 INCOMPATIBLE_LINE_ITEM error will be returned. If the specified user is ineligible for promotion, a HTTP 400 will be returned and no users will be promoted. If the provided user is already promoted, the request will be ignored. For more information on Promoted Accounts, see our campaign management page. Note: It is not possible to update (PUT) promoted accounts entities. Resource URL https://ads-api.x.com/12/accounts/:account_id/promoted_accounts Parameters Example Request POST https://ads-api.x.com/12/accounts/18ce54d4x5t/promoted_accounts?line_item_id=9bpb2&user_id=756201191646691328 Example Response

DELETE accounts/:account_id/promoted_accounts/:promoted_account_id

Disassociate an account from the specified line item. Resource URL https://ads-api.x.com/12/accounts/:account_id/promoted_accounts/:promoted_account_id Parameters Example Request DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/promoted_accounts/19pl2 Example Response

GET accounts/:account_id/promoted_tweets

Retrieve references to Tweets associated with line items under the current account. Use the GET accounts/:account_id/tweets endpoint to fetch the Tweet objects. Use the tweet_id values for each promoted_tweets object. Note: When parent line items are deleted, promoted_tweets are only returned if with_deleted=true is specified in the request. These promoted_tweets are not actually deleted, though ("deleted": false in the response). Resource URL https://ads-api.x.com/12/accounts/:account_id/promoted_tweets Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/promoted_tweets?promoted_tweet_ids=1efwlo Example Response

GET accounts/:account_id/promoted_tweets/:promoted_tweet_id

Retrieve a specific reference to a Tweet associated with a line item under the current account. Note: When parent line items are deleted, promoted_tweets are only returned if with_deleted=true is specified in the request. These promoted_tweets are not actually deleted, though ("deleted": false in the response). Resource URL https://ads-api.x.com/12/accounts/:account_id/promoted_tweets/:promoted_tweet_id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/promoted_tweets/1efwlo Example Response

POST accounts/:account_id/promoted_tweets

Associate one or more Tweets with the specified line item. Not all Tweets are appropriate for promotion, depending on the campaign objective. Please see Objective-based Campaigns for more information. When using the PROMOTED_ACCOUNT product type, associating a Tweet with the line_item will add timeline placements on mobile in addition to the standard PROMOTED_ACCOUNT placement. Note: It is not possible to update (PUT) promoted Tweet entities. Resource URL https://ads-api.x.com/12/accounts/:account_id/promoted_tweets Parameters Example Request POST https://ads-api.x.com/12/accounts/18ce54d4x5t/promoted_tweets?line_item_id=8v7jo&tweet_ids=822333526255120384 Example Response

DELETE accounts/:account_id/promoted_tweets/:promoted_tweet_id

Disassociate a Tweet from the specified line item. Note: A deleted promoted_tweets entity will be displayed as “Paused” in the ads.x.com UI. Similarly, “pausing” from the UI will disassociate the Tweet from its line item. Resource URL https://ads-api.x.com/12/accounts/:account_id/promoted_tweets/:promoted_tweet_id Parameters Example Request DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/promoted_tweets/1gp8a5 Example Response

Promotable Users

GET accounts/:account_id/promotable_users

Retrieve details for some or all promotable users associated with the current account. The promotable user type is either FULL or RETWEETS_ONLY. This controls the type of content that is allowed to be promoted by the account. Advertisers must obtain permission to promote another user’s content and contact Twitter to get them added to your account as a RETWEETS_ONLY promotable user. Provided the permissions are set correctly, you can make requests to the promoted product endpoints that directly reference the Tweet ID of the Tweet you’d like to promote. You can use the POST accounts/:account_id/promoted-tweets endpoint to promote published Tweets and the POST accounts/:account_id/scheduled-promoted-tweets endpoint to promote another Twitter Ads account’s Scheduled Tweets. You do not have to retweet the target Tweet. When you promote a Tweet with this approach, the tweet_id that is returned will be different from the Tweet ID that was provided. Behind the scenes, the Tweet is being retweeted as a nullcasted Tweet and then promoted. The tweet_id that is returned corresponds to this new Tweet. Resource URL https://ads-api.x.com/12/accounts/:account_id/promotable_users Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/promotable_users?promotable_user_ids=l310s Example Response

GET accounts/:account_id/promotable_users/:promotable_user_id

Retrieve a specific promotable user associated with the current account. The promotable user type is either FULL or RETWEETS_ONLY. This controls the type of content that is allowed to be promoted by the account. Advertisers must obtain permission to promote another user’s content. Provided the permissions are set correctly, you can make requests to the promoted product endpoints that directly reference the Tweet ID of the Tweet you’d like to promote. You do not have to retweet the target Tweet. When you promote a Tweet with this approach, the tweet_id that is returned will be different from the Tweet ID that was provided. Behind the scenes, the Tweet is being retweeted as a nullcasted Tweet and then promoted. The tweet_id that is returned corresponds to this new Tweet. Resource URL https://ads-api.x.com/12/accounts/:account_id/promotable_users/:promotable_user_id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/promotable_users/l310s Example Response

Publishers

GET publishers

Retrieve a list of Content Category publishers’ details Additional details can be found in the Video Views Preroll Objective Guide Resource URL https://ads-api.x.com/12/publishers Parameters No request parameters Example Request GET https://ads-api.x.com/12/publishers Example Response

Recommendations

GET accounts/:account_id/recommendations

Status: Closed Beta Retrieve campaign recommendations associated with this ads account. Currently there is a limit of 1 recommendation per funding instrument. Resource URL https://ads-api.x.com/5/accounts/:account_id/recommendations Parameters Example Request GET https://ads-api.x.com/5/accounts/18ce54d4x5t/recommendations Example Response

GET accounts/:account_id/recommendations/:recommendation_id

Status: Closed Beta Retrieve a specific campaign recommendation associated with this ads account. The campaign recommendation contains a full set of changes suggested for the campaign structure represented as an object tree. The response tree is intended to work in conjunction with the Batch API endpoints, but it can also be mapped to single update endpoints as appropriate (Create for POST, Update for PUT, Delete for DELETE). Resource URL https://ads-api.x.com/5/accounts/:account_id/recommendations/:recommendation_id Parameters Example Request GET https://ads-api.x.com/5/accounts/18ce54d4x5t/recommendations/62ce8zza1q0w Example Response

Scheduled Promoted Tweets

GET accounts/:account_id/scheduled_promoted_tweets

Retrieve details for some or all scheduled promoted Tweets associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/scheduled_promoted_tweets Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_promoted_tweets?scheduled_promoted_tweet_ids=1xboq Example Response

GET accounts/:account_id/scheduled_promoted_tweets/:scheduled_promoted_tweet_id

Retrieve a specific scheduled promoted Tweet associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/scheduled_promoted_tweets/:scheduled_promoted_tweet_id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_promoted_tweets/1xboq Example Response

POST accounts/:account_id/scheduled_promoted_tweets

Associate a scheduled Tweet with the specified line item. Note: It is not possible to update (PUT) scheduled promoted Tweet entities. Resource URL https://ads-api.x.com/12/accounts/:account_id/scheduled_promoted_tweets Parameters Example Request POST https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_promoted_tweets?line_item_id=8xdpe&scheduled_tweet_id=870358555227860992 Example Response

DELETE accounts/:account_id/scheduled_promoted_tweets/:scheduled_promoted_tweet_id

Disassociate a scheduled Tweet from the specified line item. Note: scheduled_promoted_tweets can only be deleted before the scheduled Tweet’s scheduled_at time. Resource URL https://ads-api.x.com/12/accounts/:account_id/scheduled_tweets/:scheduled_tweet_id Parameters Example Request DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_promoted_tweets/1xtfl Example Response

Targeting Criteria

GET accounts/:account_id/targeting_criteria

Retrieve details for some or all of the targeting criteria associated with line items under the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/targeting_criteria Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/targeting_criteria?line_item_ids=8u94t Example Response

GET accounts/:account_id/targeting_criteria/:targeting_criterion_id

Retrieve a specific targeting criterion associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/targeting_criteria/:targeting_criterion_id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/targeting_criteria/eijd4y Example Response

POST accounts/:account_id/targeting_criteria

See the Targeting Options page to find targeting_values for specific targeting types. We recommend that you refresh all data weekly, to ensure that you are working with the latest set of targeting type values. We change values and available targeting criteria from time to time; while the majority of these don’t change often, some do. There is no guarantee that these values will not change. Use the BROAD_KEYWORD, EXACT_KEYWORD, PHRASE_KEYWORD, or UNORDERED_KEYWORD targeting types with the keywords specified in the targeting_value. Exclude keywords by using the operator_type request parameter set to NE. See targeting keyword types for a detailed description of each type. Note: It is only possible to target a single age bucket per line item. Note: To target a Custom Audience, that audience must be targetable. i.e., targerable must equal true. Note: When using targeting type TV_SHOW, there must be at least one LOCATION targeting criterion on the line item prior to setting the TV_SHOW targeting and all LOCATION must be within the same locale as the TV_SHOW being targeted. Resource URL https://ads-api.x.com/12/accounts/:account_id/targeting_criteria Parameters Example Request POST https://ads-api.x.com/12/accounts/18ce54d4x5t/targeting_criteria?line_item_id=619jl&targeting_type=BROAD_KEYWORD&targeting_value=technology Example Response

POST batch/accounts/:account_id/targeting_criteria

Allows the batch creation of new Targeting Criteria with a single request. Batch Requests
  • The current maximum batch size is 500.
  • All parameters are sent in the request body and a Content-Type of application/json is required.
  • Batch requests fail or succeed together as a group and all API responses for both error and success preserve the item order of the initial request.
Batch Responses Batch API responses return an ordered collection of items. Otherwise, they are identical in structure to their corresponding single-item endpoints. Batch Errors
  • Request-level errors (eg. max batch size exceeded) are shown in the response under the errors object.
  • Item-level errors (eg. missing required Targeting Criteria parameter) are shown in the response under the operation_errors object.
Resource URL https://ads-api.x.com/12/batch/accounts/:account_id/targeting_criteria Parameters Example Request POST https://ads-api.x.com/12/batch/accounts/18ce54d4x5t/targeting_criteria
Example Response

DELETE accounts/:account_id/targeting_criteria/:targeting_criterion_id

Delete the specified targeting criterion belonging to the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/targeting_criteria/:targeting_criterion_id Parameters Example Request DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/targeting_criteria/dpl3a6 Example Response

Targeting Options

GET targeting_criteria/app_store_categories

Discover available app store category-based targeting criteria for Promoted Products. App store categories are available for the iOS App Store and the Google Play store only. Installed app category targeting allows targeting of users based on the categories of apps they have installed or have indicated interest in. Resource URL https://ads-api.x.com/12/targeting_criteria/app_store_categories Parameters Example Request GET https://ads-api.x.com/12/targeting_criteria/app_store_categories?q=music&os_type=IOS Example Response

GET targeting_criteria/conversations

Discover available conversation-based targeting criteria for Promoted Products. Resource URL https://ads-api.x.com/12/targeting_criteria/conversations Parameters Example Request GET https://ads-api.x.com/12/targeting_criteria/conversations?count=2 Example Response

GET targeting_criteria/devices

Discover available device-based targeting criteria for Promoted Products. Device targeting is available for Promoted Tweets. Resource URL https://ads-api.x.com/12/targeting_criteria/devices Parameters Example Request GET https://ads-api.x.com/12/targeting_criteria/devices?count=2&q=iphone Example Response

GET targeting_criteria/events

Discover available event-based targeting criteria for Promoted Products. Only one event can be targeted per line item. Note: Events often exist across timezones, leading to complications when considering event times from cross-timezone perspectives. To simplify this, all event start_time and end_time values on this endpoint are represented in UTC±00:00, irrespective of the event’s locale and timezone. This design should be kept in mind when querying and interacting with event start_time and end_time values. For example, Independence Day for the US is represented as start_time=2017-07-04T00:00:00Z and end_time=2017-07-05T00:00:00Z in UTC±00:00, and thus avoids the issue of this holiday existing across multiple timezones within the US. Resource URL https://ads-api.x.com/12/targeting_criteria/events Parameters Example Request GET https://ads-api.x.com/12/targeting_criteria/events?count=1 Example Response

GET targeting_criteria/interests

Discover available interest-based targeting criteria for Promoted Products. Interests change infrequently, however we suggest you refresh this list at least once weekly. Resource URL https://ads-api.x.com/12/targeting_criteria/interests Parameters Example Request GET https://ads-api.x.com/12/targeting_criteria/interests?q=books Example Response

GET targeting_criteria/languages

Discover languages available for targeting. Resource URL https://ads-api.x.com/12/targeting_criteria/languages Parameters Example Request GET https://ads-api.x.com/12/targeting_criteria/languages?q=english Example Response

GET targeting_criteria/locations

Discover available location-based targeting criteria for Promoted Products. Geo-targeting is available for Promoted Accounts and Promoted Tweets at the country level, state/region level, city level, and postal code level. Postal code targeting must be used if you wish to retrieve analytics at the postal code level. Note: To retrieve specific targetable cities, such as San Francisco or New York, use the CITIES enum with the location_type request parameter. To target Designated Market Areas (DMAs), use the METROS enum. Resource URL https://ads-api.x.com/12/targeting_criteria/locations Parameters Example Request GET https://ads-api.x.com/12/targeting_criteria/locations?location_type=CITIES&q=los angeles Example Response

GET targeting_criteria/network_operators

Discover available network operator-based targeting criteria for Promoted Products. This endpoint enables you to lookup targetingable carriers, such as AT&T, Verizon, Sprint, T-Mobile, etc., in multiple countries. Resource URL https://ads-api.x.com/12/targeting_criteria/network_operators Parameters Example Request GET https://ads-api.x.com/12/targeting_criteria/network_operators?count=5&country_code=US Example Response

GET targeting_criteria/platform_versions

Discover available mobile OS version-based targeting criteria for Promoted Products. Platform version targeting is available for Promoted Accounts and Promoted Tweets. This allows targeting down to the point release of a mobile operating system version, such as Android 8.0 or iOS 10.0. Resource URL https://ads-api.x.com/12/targeting_criteria/platform_versions Parameters Example Request GET https://ads-api.x.com/12/targeting_criteria/platform_versions Example Response

GET targeting_criteria/platforms

Discover available platform-based targeting criteria for Promoted Products. Resource URL https://ads-api.x.com/12/targeting_criteria/platforms Parameters Example Request GET https://ads-api.x.com/12/targeting_criteria/platforms Example Response

GET targeting_criteria/tv_markets

Discover available TV markets where TV shows can be targeted. Returns markets by locale that can used to query the GET targeting_criteria/tv_shows endpoint. Resource URL https://ads-api.x.com/12/targeting_criteria/tv_markets Parameters None Example Request GET https://ads-api.x.com/12/targeting_criteria/tv_markets Example Response

GET targeting_criteria/tv_shows

Discover available TV show-based targeting criteria for Promoted Products. TV show targeting is available for Promoted Tweets in certain markets. See the GET targeting_criteria/tv_markets endpoint for available markets. Note: Any audience that contains fewer than 1,000 users will appear with an estimated_users value of 1000. Note: TV channel and genre targeting options are no longer supported. Resource URL https://ads-api.x.com/12/targeting_criteria/tv_shows Parameters Example Request GET https://ads-api.x.com/12/targeting_criteria/tv_shows?locale=en-US&q=news&count=1 Example Response

Targeting Suggestions

GET accounts/:account_id/targeting_suggestions

Get up to 50 keyword or user targeting suggestions to complement your initial selection. Resource URL https://ads-api.x.com/12/accounts/:account_id/targeting_suggestions Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/targeting_suggestions?suggestion_type=KEYWORD&targeting_values=developers&count=2" Example Response

Tax Settings

GET accounts/:account_id/tax_settings

Retrieve tax setting details associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/tax_settings Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/tax_settings Example Response

PUT accounts/:account_id/tax_settings

Update the tax settings for the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/tax_settings Parameters Example Request PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/tax_settings?address_name=ABC, Co. Example Response

Tracking Tags

GET accounts/:account_id/tracking_tags

Retrieve details for some or all tracking tags associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/tracking_tags Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/tracking_tags?tracking_tag_ids=3m82 Example Response

GET accounts/:account_id/tracking_tags/:tracking_tag_id

Retrieve a specific tracking tag associated with the current account. Resource URL https://ads-api.x.com/12/accounts/:account_id/tracking_tags/:tracking_tag_id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/tracking_tags/555j Example Response

POST accounts/:account_id/tracking_tags

Associate a tracking tag with the specified line item. Resource URL https://ads-api.x.com/12/accounts/:account_id/tracking_tags Parameters Example Request POST https://ads-api.x.com/12/accounts/18ce54d4x5t/tracking_tags?line_item_id=fdwcl&tracking_tag_type=IMPRESSION_TAG&tracking_tag_url=https://ad.doubleclick.net/ddm/trackimp/N1234.2061500TWITTER-OFFICIAL/B9156151.125630439;dc_trk_aid=1355;dc_trk_cid=8675309 Example Response

PUT accounts/:account_id/tracking_tags/:tracking_tag_id

Associate a tracking tag with the specified line item. Resource URL https://ads-api.x.com/12/accounts/:account_id/tracking_tags/:tracking_tag_id Parameters Example Request PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/tracking_tags/3m82?tracking_tag_url=https://ad.doubleclick.net/ddm/trackimp/N1234.2061500TWITTER-OFFICIAL/B9156151.125630439;dc_trk_aid=1355;dc_trk_cid=8675309 Example Response

DELETE accounts/:account_id/tracking_tags/:tracking_tag_id

Disassociate a tracking tag from the specified line item. Resource URL https://ads-api.x.com/12/accounts/:account_id/tracking_tags/:tracking_tag_id Parameters Example Request DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/tracking_tags/555j Example Response

User Settings

(https://app.getpostman.com/run-collection/1d12b9fc623b8e149f87)

GET accounts/:account_id/user_settings/:user_id

Retrieves user settings. Resource URL https://ads-api.x.com/12/accounts/:account_id/user_settings/:user_id Parameters Example Request GET https://ads-api.x.com/12/accounts/18ce54d4x5t/user_settings/756201191646691328 Example Response

PUT accounts/:account_id/user_settings/:user_id

Updates user settings. Requires user context. Not accessible by account admins. Resource URL https://ads-api.x.com/12/accounts/:account_id/user_settings/:user_id Parameters Example Request PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/user_settings/756201191646691328?notification_email='user@domain.com'&subscribe_email_types=ACCOUNT_PERFORMANCE,PERFORMANCE_IMPROVEMENT" Example Response