API Reference
Account Media
GET accounts/:account_id/account_media
Retrieve details for some or all account media associated with the current account.Resource URL
https://ads-api.x.com/12/accounts/:account_id/account_media
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/account_media?account_media_ids=3wpx
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/account_media/:account_media_id
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/account_media/2pnfd
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/account_media/:account_media_id
Parameters
Example Request
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/account_media/2pnfd
Example Response
Cards
Note: To associate a card with a Tweet, use thecard_uri parameter with either the POST accounts/:account_id/tweet, POST statuses/update, POST accounts/:account_id/scheduled_tweets, or the POST accounts/:account_id/draft_tweets endpoints.
Retrieve details for some or all cards associated with the current account.
Note: This only returns cards that were created using the POST accounts/:account_id/cards endpoint. Cards created using other endpoints are not returned.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards?count=1
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/:card_id
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/1321554298900107264
Example Response
POST accounts/:account_id/cards
Create a new card associated to the specified account. Card create requests only accept JSON POST bodies. TheContent-Type must be set to application/json.
See our Carousels Guide for a detailed usage example.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards
Parameters
The JSON POST body must include a cardname and an array of components. Components are represented as objects and describe the advertiser-facing attributes of the card.
The following example shows the general structure of the payload (but includes non-working information).
Components
Every component must include atype field which determines the object’s schema. The Ads API supports the following component types, grouped into media- and description-based components.
- Media:
MEDIA: single video or imageSWIPEABLE_MEDIA: between 2-6 videos or images- Description:
DETAILSBUTTON
type key). These are listed in the following table.
The following is an example of a
BUTTON component in the context of the components array (intentionally omitting the name key). (The ellipses indicate places where more information would need to be specified.)
DETAILS or BUTTON component. Description-based components are rendered under media and have associated destinations, either URLs or mobile apps.
Label
Labels define the text shown on buttons and, therefore, only apply to the BUTTON component. Label objects have two required keys: type and value. The type must be set to ENUM and the value can be one of: BOOK, CONNECT, INSTALL, OPEN, ORDER, PLAY, or SHOP.
Building on the previous example, the following shows the label object within the BUTTON component.
DETAILS or BUTTON components. There are two destination types: WEBSITE or APP.
Note: Website destinations can only be used with DETAILS components and app destinations can only be used with BUTTON components.
Website Destination
App Destination
Example Request
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/cards
Example Response
Content-Type must be set to application/json.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/1321554298900107264
Parameters
The JSON POST body must include the parameters that will be updated. The request will replace each field with the parameters specified within the payload. Components are represented as objects and describe the advertiser-facing attributes of the card. The following example shows the general structure of the payload (but includes non-working information).Example Request
This example updates both the name and removes one of the media_keys from the components field from the example above.PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/1321554298900107264
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/:card_id
Parameters
Example Request
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/1321554298900107264
Example Response
Cards Fetch
Retrieve multiple cards, bycard_uri, associated with the current account.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/all
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/all?card_uris=card://1044294149527166979,card://1044301099031658496
Example Response
card_id, associated with the current account.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/all/:card_id
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/all/508pf
Example Response
Draft Tweets
GET accounts/:account_id/draft_tweets
Retrieve details for some or all Draft Tweets associated with the current account.Resource URL
https://ads-api.x.com/12/accounts/:account_id/draft_tweets
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets?count=1
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/draft_tweets/:draft_tweet_id
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets/994788364334325760
Example Response
POST accounts/:account_id/draft_tweets
Create a Draft Tweet for the account’s full promotable user (default) or the user specified in theas_user_id parameter.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/draft_tweets
Parameters
Example Request
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets?as_user_id=756201191646691328&text=Just setting up my X.
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/draft_tweets/:draft_tweet_id
Parameters
Example Request
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets/994747471329873920?text=just setting up my twttr
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/draft_tweets/:draft_tweet_id
Parameters
Example Request
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets/994787835663155200
Example Response
POST accounts/:account_id/draft_tweets/preview/:draft_tweet_id
Preview a Draft Tweet on a mobile device. A successful request sends a notification to every device the authenticated user is logged in to. Clicking on the notification opens a timeline that allows the user to see and interact with the Draft Tweet, enabling them to test auto-play, volume, fullscreen, video website card docking, and other behaviors. Note: On-device previews are only visible to the user who receives the notification. Note: Notifications only get sent to X official apps.Resource URL
https://ads-api.x.com/12/accounts/:account_id/draft_tweets/preview/:draft_tweet_id
Parameters
Example Request
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets/preview/996132315829948416
Example Response
Image Conversation Cards
Note: To associate a card with a Tweet, use thecard_uri parameter with either the POST accounts/:account_id/tweet, POST statuses/update, or POST accounts/:account_id/scheduled_tweets endpoints.
GET accounts/:account_id/cards/image_conversation
Retrieve details for some or all image conversation cards associated with the current account.Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/image_conversation
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/image_conversation?card_ids=59woh
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/image_conversation/:card_id
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/image_conversation/59woh
Example Response
POST accounts/:account_id/cards/image_conversation
Create a new image conversation card associated with the specified account. See Uploading Media for useful information on uploading images to our endpoints.Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/image_conversation
Parameters
Example Request
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/image_conversation?media_key=3_957113581522141184&name=image conversation card&first_cta=#moon&first_cta_tweet=stars&thank_you_text=thanks&title=Full moon
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/image_conversation/:card_id
Parameters
Example Request
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/image_conversation/59woh?name=moon card
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/image_conversation/:card_id
Parameters
Example Request
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/image_conversation/4i0qe
Example Response
Media Library
GET accounts/:account_id/media_library
Retrieve details for some or all media library objects associated with the current account.Resource URL
https://ads-api.x.com/12/accounts/:account_id/media_library
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/media_library?count=1
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/media_library/:media_key
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/media_library/13_909110614026444802
Example Response
AMPLIFY_VIDEO media category to the Media Library, it is automatically available as a PREROLL account_media asset.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/media_library
Parameters
Example Request
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/media_library?media_key=3_931236738554519552
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/media_library/:media_key
Parameters
Example Request
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/media_library/16_844800354743074820?title=cat GIF&description=in space
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/media_library/:media_key
Parameters
Example Request
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/media_library/7_860318603387600896
Example Response
Poll Cards
GET accounts/:account_id/cards/poll
Retrieve details for some or all poll cards associated with the current account.Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/poll
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/poll?card_ids=57i77
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/poll/:card_id
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/poll/57i8t
Example Response
POST accounts/:account_id/cards/poll
Create a new poll card associated with the specified account. This endpoint supports creating poll cards with either an image, a video, or no media. Polls with media are referred to as Media Forward Polls. Note: The Media Forward Polls product is in beta and requires thePROMOTED_MEDIA_POLLS account feature.
Note: It is not possible to update (PUT) poll cards.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/poll
Parameters
Example Request
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/poll?duration_in_minutes=10080&first_choice=East&second_choice=West&media_key=13_950589518557540353&name=best coast poll
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/poll/:card_id
Parameters
Example Request
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/poll/57i9t
Example Response
Preroll Call To Actions
GET accounts/:account_id/preroll_call_to_actions
Retrieve details for some or all preroll Call-To-Actions (CTAs) associated with line items under the current account.Resource URL
https://ads-api.x.com/12/accounts/:account_id/preroll_call_to_actions
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/preroll_call_to_actions?line_item_ids=8v53k
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/preroll_call_to_actions/:preroll_call_to_action_id
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/preroll_call_to_actions/8f0
Example Response
POST accounts/:account_id/preroll_call_to_actions
Set the optional Call-to-Action (CTA) for aPREROLL_VIEWS line item.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/preroll_call_to_actions
Parameters
Example Request
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/preroll_call_to_actions?line_item_id=8v53k&call_to_action=VISIT_SITE&call_to_action_url=https://www.x.com
Example Response
PREROLL_VIEWS line item.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/preroll_call_to_actions/:preroll_call_to_action_id
Parameters
Example Request
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/preroll_call_to_actions/8f0?call_to_action=WATCH_NOW
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/preroll_call_to_actions/:preroll_call_to_action_id
Parameters
Example Request
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/preroll_call_to_actions/8f0
Example Response
Scheduled Tweets
GET accounts/:account_id/scheduled_tweets
Retrieve details for some or all Scheduled Tweets associated with the current account.Resource URL
https://ads-api.x.com/12/accounts/:account_id/scheduled_tweets
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_tweets?count=1
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/scheduled_tweets/:scheduled_tweet_id
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_tweets/917438609065623552
Example Response
POST accounts/:account_id/scheduled_tweets
Create a Scheduled Tweet for the account’s full promotable user (default) or the user specified in theas_user_id parameter.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/scheduled_tweets
Parameters
Example Request
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_tweets?as_user_id=756201191646691328&media_keys=3_917438348871983104&scheduled_at=2018-01-01
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/scheduled_tweets/:scheduled_tweet_id
Parameters
Example Request
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_tweets/875057751231037440?text=winter solstice
Example Response
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_tweets/875064008595787776
Example Response
Tweet Previews
GET accounts/:account_id/tweet_previews
Preview published, scheduled, or draft Tweets.- Supports previewing multiple Tweets—up to 200—in a single API request
- Accurate, up-to-date rendering of Tweet layout and style
- Supports all the latest formats and card types
- Returns an iframe
Resource URL
https://ads-api.x.com/12/accounts/:account_id/tweet_previews
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/tweet_previews?tweet_ids=1122911801354510336,1102836745790316550&tweet_type=PUBLISHED
Example Response
Tweets
GET accounts/:account_id/tweets
Retrieve Tweet details for the account’s full promotable user (default) or the user specified in theuser_id parameter. This can be any of the promotable users under the account.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/tweets
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/tweets?tweet_ids=1166476031668015104&tweet_type=PUBLISHED&trim_user=true
Example Response
POST accounts/:account_id/tweet
Create a Tweet for the account’s full promotable user (default) or the user specified in theas_user_id parameter. Both nullcasted (default) and organic Tweet creation is supported. Nullcasted Tweets do not appear in the public timeline and are not served to followers. Either type can be used in campaigns.
If the authenticated user is not the FULL promotable user on this account, determine if they have permission to Tweet on behalf this user by making a request to the GET accounts/:account_id/authenticated_user_access endpoint. A permission of TWEET_COMPOSER indicates that the user may use this endpoint to create nullcasted Tweets on behalf of the FULL promotable user.
When using the upload.x.com endpoint for media, pass in the same user_id value for the additional_owners parameter as the as_user_id value that you pass in to this endpoint.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/tweet
Parameters
Example Request
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/tweet?text=hello, world&as_user_id=756201191646691328&trim_user=true
Example Response
name belonging to the current account.
Resource URL
https://ads-api.x.com/12/accounts/:account_id/tweets/:tweet_id/name
Parameters
Example Request
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/tweets/994747471329873920/name?name=new Tweet name
Example Response
Video Conversation Cards
Note: To associate a card with a Tweet, use thecard_uri parameter with either the POST accounts/:account_id/tweet, POST statuses/update, or POST accounts/:account_id/scheduled_tweets endpoints.
GET accounts/:account_id/cards/video_conversation
Retrieve details for some or all video conversation cards associated with the current account.Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/video_conversation
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/video_conversation?card_ids=5a86h
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/video_conversation/:card_id
Parameters
Example Request
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/video_conversation/5a86h
Example Response
POST accounts/:account_id/cards/video_conversation
Create a new video conversation card associated with the specified account. See Uploading Media for useful information on uploading images to our endpoints.Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/video_conversation
Parameters
Example Request
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/video_conversation?first_cta=#APIs&first_cta_tweet=Ads API&name=video conversation card&thank_you_text=Build it&title=Developers&media_key=13_958388276489895936
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/video_conversation/:card_id
Parameters
Example Request
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/video_conversation/5a86h?name=developers card
Example Response
Resource URL
https://ads-api.x.com/12/accounts/:account_id/cards/video_conversation/:card_id
Parameters
Example Request
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/video_conversation/4i0ya