media_id
, associate the video with an ads account using the POST accounts/:account_id/videos endpoint. The video’s id
, sometimes referred to as the media_key
, will be used in subsequent requests. This is a string that begins with an int, is followed by an underscore, and ends with a long value. As an example, see: 13_875943225764098048
.
id
. In this step, you can also provide a video title, description, and call-to-action (CTA). These values are user-facing.
id
and, optionally, the image’s media_id
(for the poster image).
Finally, create the Tweet using the POST accounts/:account_id/tweet endpoint. Cards are attached to Tweets using the card_uri
parameter.
media_category
parameter must be set with a value of amplify_video
for all INIT
command requests to the POST media/upload (chunked) endpoint. Using this new param ensures that the video is asynchronously pre-processed and prepared for use in promoted content. The STATUS
command can be used to check completion of asynchronous processing after video upload.id
id
)id
)id
)id
)scheduled_at
time along with the Tweet text
if no media entities are included in the Tweet. In addition, this endpoint provides a few additional options that allow you to create a scheduled Tweet on behalf of another @handle via the as_user_id
param along with the ability to add a card (card_uri
) and any media (media_ids
). Note, a Tweet can only contain entities of the same type, i.e., either Video, Gif or Image. The nullcast
param controls whether the Tweet is a “Promoted-Only” Tweet or not. All newly created Scheduled Tweets are “Promoted-Only” (nullcast=true
) by default. If nullcast=false
then an Organic Scheduled Tweet is created
Once a Scheduled Tweet is successfully created, the response will contain an id
field, which refers to the unique identifier of the Scheduled Tweet itself. In addition to this field, another field called tweet_id
is also returned. This field is null
initially, however once the Tweet goes live this field is populated with the ID of the “live” Tweet.
tweet_id
field will be populated with the “live” Tweet’s ID.
View a Scheduled Tweet
The GET accounts/:account_id/tweet_previews endpoint can then be used with the Scheduled Tweet id
from the previous step to generate a preview of the Tweet. The API response will contain an iframe URL that is ready to be used to render a preview for the Scheduled Tweet. The relevant CSS and images will be served directly via X.
nullcast=true
) Tweet either one of which can be associated with a line item. In order to facilitate this, we provide a POST accounts/:account_id/scheduled_promoted_tweets endpoint as well. This endpoint only allows a single Promoted Scheduled Tweet to be associated with a line item in a single API call. In order to associate multiple Scheduled Tweets to the same line item, multiple API calls are necessary.
Please note that it is not possible to modify an existing Scheduled Promoted Tweet.
SCHEDULED
state, and that the given Scheduled Tweet is valid for the given objective, no other validations are run. Any remaining validation rules that apply to the line item and Scheduled Tweet are run when the Tweet goes “live”
In order to ensure that there are no issues with campaign serving it is recommend that the Scheduled Tweet be scheduled_at
a time prior to the campaign/line item flight dates.
For example, let’s say the Scheduled Tweet is set to go live after the campaign start date (and that there is only a single Tweet associated with a single line item), then the campaign will be ACTIVE
, however given that the Scheduled Tweet is not live yet, there will be no creatives available for serving.
Scheduled Tweet Management
The remaining sets of endpoints allow API consumers to manage all their Scheduled Tweets and Scheduled Promoted Tweets. These APIs can be used to either return a list of all Scheduled Tweets optionally filtered by a given state as well as lookup a given Scheduled Tweet by its id
.
scheduled_at
time, the following updates are made:
tweet_id
is added to the following entities:start_time
and end_time
) align with the scheduled_at
time for the Scheduled Tweetcard_uri | preview_url |
---|---|
card://1043282691834048513 | https://cards.x.com/cards/18ce54d4x5t/68w3s |
Media ID | Media key |
---|---|
1029825579531807971 | 13_1029825579531807971 |
Resource | Identifier | Attribute(s) |
---|---|---|
Image cards | None | |
Tweet | Both | entities["media"]["id_str"] entities["media"]["media_key"] |
Scheduled Tweet | Both | media_ids and media_keys |
Draft Tweet | Both | media_ids and media_keys |
Account Media | None | |
Media Library | Both | media_id and media_key |
Resource | Attribute(s) | Format |
---|---|---|
Image cards | image | .jpg |
Tweet* | entities["media"][0]["media_url"] or extended_entities["media"][i]["media_url"] | .jpg |
Scheduled Tweet | None | |
Draft Tweet | None | |
Account Media | media_url | .jpg |
Media Library | media_url | .jpg |
Resource | Identifier | Attribute(s) |
---|---|---|
Video cards | May be either | video_content_id |
Video poll cards | None | |
Tweet | Both | entities["media"]["id_str"] entities["media"]["media_key"] |
Scheduled Tweet | Both | media_ids and media_keys |
Draft Tweet | Both | media_ids and media_keys |
Account Media | Media key | video_id |
Media Library | Both | media_id and media_key |
Resource | Attribute(s) | Format |
---|---|---|
Video cards | video_url and video_hls_url | .vmap .m3u8 |
Tweet with video | extended_entities["media"][i]["video_info"]["variants"][j]["url"] | .mp4 |
Scheduled Tweet | None | |
Draft Tweet | None | |
Account Media | None | |
Media Library | media_url | .mp4 |
Resource | In the Media Library |
---|---|
Image cards | No |
Video cards | Yes* |
Tweets (any media)** | Yes |
Scheduled Tweets | Yes |
Draft Tweets | Yes |
Account media images | No |
Account media videos (PREROLL ) | Yes |
video_content_id
is a media key. When the value is a media ID, the asset still exists in the Media Library, but retrieving it involves appending a numeric prefix and underscore to it.
** Tweets only return media IDs. While the asset is guaranteed to exist in the Media Library, fetching it involves appending a numeric prefix and underscore to it.
Interactions with Account Media
There are two cases where media assets added to the library are automatically added to the Account Media resource.
SWIPEABLE_MEDIA
component, which accepts an array of media keysDETAILS
component to specify website informationBUTTON
component to specify app informationSWIPEABLE_MEDIA
component must include a media_keys
array where you can specify between 2 and 6 images or videos. The order in which the media keys are passed in determine the order in which they will be rendered.
Website | App | |
---|---|---|
Specify the component type | "type": "DETAILS" | "type": "BUTTON" |
Title/Label | "title": "X" | "label": { "type": "ENUM", "value": "INSTALL" } |
Destination | "destination": { "type": "WEBSITE", "url": "https://www.x.com" } | "destination": { "type": "APP", ... } |
BUTTON
components require a country code and at least one app identifier. They optionally accept deep links. For a description of these fields, see the reference documentation.
Putting this together, an example app carousel JSON POST body is shown below.
media_type
request parameter to scope the results to a particular media type.
card_uri
, which will be used when creating a Tweet.
Tweet
Use the POST accounts/:account_id/tweet endpoint to create your Tweet. Use the card_uri
from the previous request. (Response truncated for readability.)
exiftool -contributor="<YOUR APP ID>" -creative_file.jpg
exiftool -date="<date>" -creative_file.jpg
The app_id can be found in the Developer Portal under Projects & Apps. Example: 16489123
The following example adds app_id as the contributor tag and date as the date tag for an image:
exiftool -xmp:all -G1 <filename>
Example:
exiftool -xmp:all -G1 eiffel_tower.jpg
https://ads-api.x.com/12/accounts/:account_id/account_media
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
account_media_ids optional | Scope the response to just the desired account media by specifying a comma-separated list of identifiers. Up to 200 IDs may be provided. Type: string Example: 3wpx |
count optional | Specifies the number of records to try and retrieve per distinct request. Type: int Default: 200 Min, Max: 1 , 1000 |
creative_types optional | Scope the response to just the account media that match the specified creative types. More than one creative type may be specified by comma-separating enum values. Type: enum Possible values: BANNER , BANNER_TABLET , INTERSTITIAL , INTERSTITIAL_LANDSCAPE , INTERSTITIAL_LANDSCAPE_TABLET , INTERSTITIAL_TABLET , MEDIUM_RECTANGLE , PREROLL , VAST_PREROLL |
cursor optional | Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example: 8x7v00oow |
sort_by optional | Sorts by supported attribute in ascending or descending order. See Sorting for more information. Type: string Example: created_at-asc |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
with_total_count optional | Include the total_count response attribute. Note: This parameter and cursor are exclusive. Note: Requests which include total_count will have lower rate limits, currently set at 200 per 15 minutes. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/account_media?account_media_ids=3wpx
https://ads-api.x.com/12/accounts/:account_id/account_media/:account_media_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
account_media_id required | A reference to the account media you are operating with in the request. Type: string Example: 2pnfd |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/account_media/2pnfd
https://ads-api.x.com/12/accounts/:account_id/account_media/:account_media_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
account_media_id required | A reference to the account media you are operating with in the request. Type: string Example: 2pnfd |
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/account_media/2pnfd
card_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.
https://ads-api.x.com/12/accounts/:account_id/cards
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_types optional | Scope the response to just the desired card types by specifying a comma-separated list of enum values. Type: enum Possible values: IMAGE_APP , IMAGE_CAROUSEL_APP , IMAGE_CAROUSEL_WEBSITE , IMAGE_MULTI_DEST_CAROUSEL_WEBSITE , IMAGE_WEBSITE , MIXED_MEDIA_MULTI_DEST_CAROUSEL_WEBSITE , MIXED_MEDIA_SINGLE_DEST_CAROUSEL_APP , MIXED_MEDIA_SINGLE_DEST_CAROUSEL_WEBSITE , VIDEO_APP , VIDEO_CAROUSEL_APP , VIDEO_CAROUSEL_WEBSITE , VIDEO_MULTI_DEST_CAROUSEL_WEBSITE , VIDEO_WEBSITE |
card_id optional | Scope the response to just the desired cards by specifying a comma-separated list of identifiers. Up to 200 card IDs may be provided. Type: string Example: 1044294149527166979,1044301099031658496 |
card_uris optional | Scope the response to just the desired cards by specifying a comma-separated list of identifiers. Up to 200 card URI values may be provided. Type: string Example: card://1044294149527166979,card://1044301099031658496 |
count optional | Specifies the number of records to try and retrieve per distinct request. Type: int Default: 100 Min, Max: 1 , 200 |
cursor optional | Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example: 8x7v00oow |
include_legacy_cards optional | Include legacy website and app cards in the response. Legacy cards are those whose resource URL has the following format: accounts/:account_id/cards/:card_type. See this developer forum post for additional context. Type: boolean Default: false Possible values: true , false |
q optional | An optional query to scope cards by name . Omit this parameter to retrieve all. Maximum length: 80 characters. Note: This performs case-insensitive prefix matching. Type: string Example: dtc |
sort_by optional | Sorts by supported attribute in ascending or descending order. See Sorting for more information. Type: string Example: created_at-asc |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards?count=1
https://ads-api.x.com/12/accounts/:account_id/cards/:card_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_id required | The id of the cards. Type: string Example: 1044294149527166979 |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/1321554298900107264
Content-Type
must be set to application/json
.
See our Carousels Guide for a detailed usage example.
https://ads-api.x.com/12/accounts/:account_id/cards
name
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).
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
name required | The name for the card. Maximum length: 80 characters. Type: string Example: component based card |
components sometimes required | Describes the components to use to create the card. Additional information below. Cannot be specified along with slides . Note: The order of the components is important. Type: array of objects |
slides sometimes required | Use this array of array to create Multi-Destination Carousels. Describes each card as a grouping of components. Each slide should be a complete representation of a card. Cannot be specified along with components . Note: The order of each slide is important. Type: array of array |
type
field which determines the object’s schema. The Ads API supports the following component types, grouped into media- and description-based components.
MEDIA
: single video or imageSWIPEABLE_MEDIA
: between 2-6 videos or imagesDETAILS
BUTTON
type
key). These are listed in the following table.
Component type | Field | Value type |
---|---|---|
MEDIA | media_key | string |
SWIPEABLE_MEDIA | media_keys | array of strings |
DETAILS | title destination | string object |
BUTTON | label destination | object object |
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
Name | Description |
---|---|
type required | The destination type, which determines its schema. Type: enum Possible values: WEBSITE |
url required | The URL of the website to redirect a user to. Type: string Example: https://devcommunity.x.com/c/advertiser-api |
Name | Description |
---|---|
type required | The destination type, which determines its schema. Type: enum Possible values: APP |
country_code required | The ISO 3166-1 alpha-2 two-letter code for the country where the app is sold. Type: string Example: US |
googleplay_app_id sometimes required | The Google Play application package name. Note: At least one of following is required: ios_app_store_identifier or googleplay_app_id . Type: string Example: com.twitter.android |
ios_app_store_identifier sometimes required | The iOS app store identifier. Note: At least one of following is required: ios_app_store_identifier or googleplay_app_id . Type: string Example: 333903271 |
googleplay_deep_link optional | A deep link into the Android app you’re promoting. Note: Can only be used if an googleplay_app_id has been provided. Type: string |
ios_deep_link optional | A deep link into the iOS app you’re promoting. Note: Can only be used if an ios_app_store_identifier has been provided. Type: string |
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/cards
Content-Type
must be set to application/json
.
https://ads-api.x.com/12/accounts/:account_id/cards/1321554298900107264
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
name optional | The name for the card. Maximum length: 80 characters. Type: string Example: component based card |
components optional | Describes the components to use to update the card. Additional information below. Cannot be specified along with slides . Note: The order of the components is important. Type: array of objects |
slides optional | Use this array of array to update Multi-Destination Carousels. Describes each card as a grouping of components. Each slide should be a complete representation of a card. Cannot be specified along with components . Note: The order of each slide is important. Type: array of array |
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/1321554298900107264
https://ads-api.x.com/12/accounts/:account_id/cards/:card_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_id required | The id of the card to be deleted. Type: string Example: 1044294149527166979 |
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/1321554298900107264
card_uri
, associated with the current account.
https://ads-api.x.com/12/accounts/:account_id/cards/all
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_uris required | Scope the response to just the desired cards by specifying a comma-separated list of identifiers. Up to 200 card URI values may be provided. Type: string Example: card://1044294149527166979,card://1044301099031658496 |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/all?card_uris=card://1044294149527166979,card://1044301099031658496
card_id
, associated with the current account.
https://ads-api.x.com/12/accounts/:account_id/cards/all/:card_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_id required | A reference to the card you are operating with in the request. Type: string Example: 508pf |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/all/508pf
https://ads-api.x.com/12/accounts/:account_id/draft_tweets
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
count optional | Specifies the number of records to try and retrieve per distinct request. Type: int Default: 100 Min, Max: 1 , 200 |
cursor optional | Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example: c-jh1g0ryb |
user_id optional | Specify the user to retrieve Draft Tweets for. Defaults to the FULL promotable user on the account when not set. Type: string Example: 756201191646691328 |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets?count=1
https://ads-api.x.com/12/accounts/:account_id/draft_tweets/:draft_tweet_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
draft_tweet_id required | A reference to the Draft Tweet you are operating with in the request. Type: string Example: 994788364334325760 |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets/994788364334325760
as_user_id
parameter.
https://ads-api.x.com/12/accounts/:account_id/draft_tweets
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
as_user_id required | The user ID of the advertiser on behalf of whom you are posting the Tweet. The advertiser must grant your handle (or handles) access to their ads account via ads.x.com. This permission allows you to call the API using the OAuth tokens of your own handle rather than the advertiser’s. Type: string Example: 756201191646691328 |
text sometimes required | The text of your status update. Required if no media_keys are specified. Type: string Example: Just setting up my X. |
card_uri optional | Associate a card with the Tweet using the card_uri value from any cards response, if available. Type: string Example: card://960880280705392541 |
media_keys optional | Associate media with the Tweet by specifying a comma-separated list of identifiers. Include up to 4 images, 1 animated GIF, or 1 video. Note: The media asset must be in the account’s Media Library. Type: string Example: 13_1153584529292270722 |
nullcast optional | Whether to create a nullcasted (or “Promoted-only”) Tweet. Type: boolean Default: true Possible values: true , false |
name optional | The name for the Draft Tweet. Maximum length: 80 characters. Type: string Example: Tweet with name |
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets?as_user_id=756201191646691328&text=Just setting up my X.
https://ads-api.x.com/12/accounts/:account_id/draft_tweets/:draft_tweet_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
draft_tweet_id required | A reference to the Draft Tweet you are operating with in the request. Type: string Example: 994747471329873920 |
card_uri optional | Associate a card with the Tweet using the card_uri value from any cards response, if available. Note: Unset (remove) by specifying the parameter without a value. Type: string Example: card://970582057284129151 |
media_keys optional | Associate media with the Tweet by specifying a comma-separated list of identifiers. Include up to 4 images, 1 animated GIF, or 1 video. Note: The media asset must be in the account’s Media Library. Note: Unset (remove) by specifying the parameter without a value. Type: string Example: 13_1153584529292270722 |
nullcast optional | Whether to create a nullcasted (or “Promoted-only”) Tweet. Type: boolean Possible values: true , false |
text optional | The text of your status update. Type: string Example: just setting up my twttr |
name optional | The name for the Draft Tweet. Maximum length: 80 characters. Type: string Example: Tweet with name |
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets/994747471329873920?text=just setting up my twttr
https://ads-api.x.com/12/accounts/:account_id/draft_tweets/:draft_tweet_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
draft_tweet_id required | A reference to the Draft Tweet you are operating with in the request. Type: string Example: 994787835663155200 |
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets/994787835663155200
https://ads-api.x.com/12/accounts/:account_id/draft_tweets/preview/:draft_tweet_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
draft_tweet_id required | A reference to the Draft Tweet you are operating with in the request. Type: string Example: 996132315829948416 |
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets/preview/996132315829948416
card_uri
parameter with either the POST accounts/:account_id/tweet, POST statuses/update, or POST accounts/:account_id/scheduled_tweets endpoints.
https://ads-api.x.com/12/accounts/:account_id/cards/image_conversation
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_ids optional | Scope the response to just the desired image conversation cards by specifying a comma-separated list of identifiers. Up to 200 IDs may be provided. Type: string Example: 59woh |
count optional | Specifies the number of records to try and retrieve per distinct request. Type: int Default: 200 Min, Max: 1 , 1000 |
cursor optional | Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example: 8x7v00oow |
q optional | An optional query to scope cards by name . Omit this parameter to retrieve all. Maximum length: 80 characters. Note: This performs case-insensitive prefix matching. Type: string Example: night |
sort_by optional | Sorts by supported attribute in ascending or descending order. See Sorting for more information. Type: string Example: created_at-asc |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
with_total_count optional | Include the total_count response attribute. Note: This parameter and cursor are exclusive. Note: Requests which include total_count will have lower rate limits, currently set at 200 per 15 minutes. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/image_conversation?card_ids=59woh
https://ads-api.x.com/12/accounts/:account_id/cards/image_conversation/:card_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_id required | A reference to the image conversation card you are operating with in the request. Type: string Example: 59woh |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/image_conversation/59woh
https://ads-api.x.com/12/accounts/:account_id/cards/image_conversation
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
first_cta required | The Call-To-Action (CTA) hashtag for the first option. Maximum length: 20 characters (not counting the #). Type: string Example: #ShareNow |
first_cta_tweet required | The Tweet text to be used when the first CTA is clicked. Type: string Example: I Heart @AdsAPI |
media_key required | The media key for an image to be used in this card. Note: The image must be in the account’s Media Library. Note: A minimum image width of 800px and a width:height aspect ratio of 1.91:1 is required. Type: string Example: 3_1151345051104991073 |
name required | The name for the card. Type: string Example: image conversation card |
thank_you_text required | The text to be displayed after the CTA is clicked. Maximum length: 23 characters. Type: string Example: Thank you |
second_cta sometimes required | The Call-To-Action (CTA) hashtag for the second option. Maximum length: 20 characters (not counting the #). Type: string Note: Required if title is not set. Example: #ShareAgain |
second_cta_tweet sometimes required | The Tweet text to be used when the second CTA is clicked. Note: Required if second_cta is set. Type: string Example: I Heart @AdsAPI Again |
title sometimes required | The title for the card, which appears below the image and above the CTAs. Maximum length: 23 characters. Type: string Note: Required if second_cta is not set. Example: Start a conversation |
third_cta optional | The Call-To-Action (CTA) hashtag for the third option. Maximum length: 20 characters (not counting the #). Type: string Example: #ShareMore |
third_cta_tweet sometimes required | The Tweet text to be used when the third CTA is clicked. Type: string Note: Required if third_cta is set. Example: I Heart @TwitterDev |
fourth_cta optional | The Call-To-Action (CTA) hashtag for the fourth option. Maximum length: 20 characters (not counting the #). Type: string Example: #ShareExtra |
fourth_cta_tweet sometimes required | The Tweet text to be used when the fourth CTA is clicked. Type: string Note: Required if fourth_cta is set. Example: I Heart @TwitterDev Again |
unlocked_image_media_key optional | A media_key of an image which will be used in the instant unlock scenario. This is a write-only field. In the response, the API will provide a X URL for this image. Note: The image must be in the account’s media library. Note: A minimum image width of 800px and a width:height aspect ratio of 5:2 is required. Type: string Example: 3_883112887618682880 |
thank_you_url optional | The URL to be displayed with the thank you text. Type: string Example: https://example.com/thankyou |
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
https://ads-api.x.com/12/accounts/:account_id/cards/image_conversation/:card_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_id required | A reference to the image conversation card you are operating with in the request. Type: string Example: 4i0qg |
first_cta optional | The Call-To-Action (CTA) hashtag for the first option. Maximum length: 20 characters (not counting the #). Type: string Example: #ShareNow |
first_cta_tweet optional | The Tweet text to be used when the first CTA is clicked. Type: string Example: I Heart @AdsAPI |
second_cta optional | The Call-To-Action (CTA) hashtag for the second option. Maximum length: 20 characters (not counting the #). Type: string Note: Required if title is not set. Example: #ShareAgain |
second_cta_tweet optional | The Tweet text to be used when the second CTA is clicked. Note: Required if second_cta is set. Type: string Example: I Heart @AdsAPI Again |
third_cta optional | The Call-To-Action (CTA) hashtag for the third option. Maximum length: 20 characters (not counting the #). Type: string Example: #ShareMore |
third_cta_tweet optional | The Tweet text to be used when the third CTA is clicked. Type: string Note: Required if third_cta is set. Example: I Heart @TwitterDev |
fourth_cta optional | The Call-To-Action (CTA) hashtag for the fourth option. Maximum length: 20 characters (not counting the #). Type: string Example: #ShareExtra |
fourth_cta_tweet optional | The Tweet text to be used when the fourth CTA is clicked. Type: string Note: Required if fourth_cta is set. Example: I Heart @TwitterDev Again |
media_key optional | The media key for an image to be used in this card. Note: The image must be in the account’s Media Library. Note: A minimum image width of 800px and a width:height aspect ratio of 1.91:1 is required. Type: string Example: 3_1151345051104991073 |
name optional | The name for the card. Type: string Example: moon card |
thank_you_text optional | The text to be displayed after the CTA is clicked. Maximum length: 23 characters. Type: string Example: Thank you |
thank_you_url optional | The URL to be displayed with the thank you text. Type: string Example: https://example.com/thankyou |
title optional | The title for the card, which appears below the image and above the CTAs. Maximum length: 23 characters. Type: string Note: Required if second_cta is not set. Example: Start a conversation |
unlocked_image_media_key optional | A media_key of an image which will be used in the instant unlock scenario. This is a write-only field. In the response, the API will provide a X URL for this image. Note: The image must be in the account’s media library. Note: A minimum image width of 800px and a width:height aspect ratio of 5:2 is required. Type: string Example: 3_883112887618682880 |
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/image_conversation/59woh?name=moon card
https://ads-api.x.com/12/accounts/:account_id/cards/image_conversation/:card_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_id required | A reference to the image conversation card you are operating with in the request. Type: string Example: 4i0qe |
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/image_conversation/4i0qe
https://ads-api.x.com/12/accounts/:account_id/media_library
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
count optional | Specifies the number of records to try and retrieve per distinct request. Type: int Default: 20 Min, Max: 1 , 50 |
cursor optional | Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example: c-1 |
media_type optional | Scope the response to just the desired media type. Type: enum Possible values: GIF , IMAGE , VIDEO |
q optional | An optional query to scope resource by name , title , file_name , and description fields. Note: This performs case-insensitive term matching. Type: string Min, Max length: 1 , 255 |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/media_library?count=1
https://ads-api.x.com/12/accounts/:account_id/media_library/:media_key
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
media_key required | A reference to the media library object you are operating with in the request. Type: string Example: 13_909110614026444802 |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/media_library/13_909110614026444802
AMPLIFY_VIDEO
media category to the Media Library, it is automatically available as a PREROLL
account_media asset.
https://ads-api.x.com/12/accounts/:account_id/media_library
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
media_key required | The media_key for the uploaded content. A media_key is returned in the POST media/upload response when a media_category is specified. Type: string Example: 3_931236738554519552 |
description optional | The description that appears under the video when Tweeted. Maximum length: 200 characters. This is not rendered in the Tweet by default. To display the video’s description , use the video_description parameter with the POST accounts/:account_id/tweet endpoint. Note: Can only be used with videos. Type: string Example: This is the description under the video. |
file_name optional | The file name for the media library object. Maximum length: 255. The file name can be seen in the media detail of every media asset in the Media Library UI on ads.x.com. This will be empty when the file_name is not set. Type: string Example: coffee.jpeg |
name optional | The name for the media library object. Maximum length: 100. This is the label under every media asset in the Media Library UI on ads.x.com. The label will be “Untitled” when the name is not set. Type: string Example: Latte |
poster_media_key optional | Specify a poster image for the video using the media_key of an uploaded image. If not specified, the first frame will be used. Note: Can only be used with videos. Type: string Example: 3_890599134483242005 |
title optional | The title (headline) that appears under the video when Tweeted. Maximum length: 70 characters. This is not rendered in the Tweet by default. To display the video’s title , use the video_title parameter with the POST accounts/:account_id/tweet endpoint. Note: Can only be used with videos. Type: string Example: Video title |
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/media_library?media_key=3_931236738554519552
https://ads-api.x.com/12/accounts/:account_id/media_library/:media_key
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
media_key required | A reference to the media library object you are operating with in the request. Type: string Example: 16_844800354743074820 |
description optional | The description that appears under the video when Tweeted. Maximum length: 200 characters. This is not rendered in the Tweet by default. To display the video’s description , use the video_description parameter with the POST accounts/:account_id/tweet endpoint. Note: Can only be used with videos. Type: string Example: This is the description under the video. |
file_name optional | The file name for the media library object. Maximum length: 255. The file name can be seen in the media detail of every media asset in the Media Library UI on ads.x.com. This will be empty when the file_name is not set. Type: string Example: coffee.jpeg |
name optional | The name for the media library object. Maximum length: 100. This is the label under every media asset in the Media Library UI on ads.x.com. The label will be “Untitled” when the name is not set. Type: string Example: Latte |
poster_media_key optional | Specify a poster image for the video using the media_key of an uploaded image. Note: Can only be used with videos. Type: string Example: 3_885003359340375465 |
title optional | The title (headline) that appears under the video when Tweeted. Maximum length: 70 characters. This is not rendered in the Tweet by default. To display the video’s title , use the video_title parameter with the POST accounts/:account_id/tweet endpoint. Note: Can only be used with videos. Type: string Example: Video title |
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/media_library/16_844800354743074820?title=cat GIF&description=in space
https://ads-api.x.com/12/accounts/:account_id/media_library/:media_key
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
media_key required | A reference to the media library object you are operating with in the request. Type: string Example: 7_860318603387600896 |
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/media_library/7_860318603387600896
https://ads-api.x.com/12/accounts/:account_id/cards/poll
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_ids optional | Scope the response to just the desired poll cards by specifying a comma-separated list of identifiers. Up to 200 IDs may be provided. Type: string Example: 57i77 |
count optional | Specifies the number of records to try and retrieve per distinct request. Type: int Default: 200 Min, Max: 1 , 1000 |
cursor optional | Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example: 8x7v00oow |
q optional | An optional query to scope cards by name . Omit this parameter to retrieve all. Maximum length: 80 characters. Note: This performs case-insensitive prefix matching. Type: string Example: night |
sort_by optional | Sorts by supported attribute in ascending or descending order. See Sorting for more information. Type: string Example: created_at-asc |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
with_total_count optional | Include the total_count response attribute. Note: This parameter and cursor are exclusive. Note: Requests which include total_count will have lower rate limits, currently set at 200 per 15 minutes. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/poll?card_ids=57i77
https://ads-api.x.com/12/accounts/:account_id/cards/poll/:card_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_id required | A reference to the poll card you are operating with in the request. Type: string Example: 57i8t |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/poll/57i8t
PROMOTED_MEDIA_POLLS
account feature.
Note: It is not possible to update (PUT) poll cards.
https://ads-api.x.com/12/accounts/:account_id/cards/poll
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
duration_in_minutes required | The amount of time (in minutes) the poll will remain open. After the specified duration_in_minutes , the poll will close and votes will no longer be accepted. This corresponds to end_time in the response. Note: This starts as soon as the card is created and not when it is added to a Tweet. Type: int Min, Max: 5 , 10080 |
first_choice required | The first poll choice. Maximum length: 25 characters. Type: string Example: One |
name required | The name for the card. Type: string Example: poll card |
second_choice required | The second poll choice.Maximum length: 25 characters. Type: string Example: Two |
fourth_choice optional | The fourth poll choice. Maximum length: 25 characters. Note: The first, second, and third choices must be set when using this parameter. Type: string Example: Four |
media_key optional | The media_key of a media library image or video which will be used in this card. This is a write-only field. In the response, the API will provide a X URL for this media. Note: The image or video must be in the account’s media library. Note: A minimum image width of 800px and a width:height aspect ratio of 1.91:1 is required. |
third_choice optional | The third poll choice. Maximum length: 25 characters. Note: The first and second choices must be set when using this parameter. Type: string Example: Three |
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
https://ads-api.x.com/12/accounts/:account_id/cards/poll/:card_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_id required | A reference to the poll card you are operating with in the request. Type: string Example: 57i9t |
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/poll/57i9t
https://ads-api.x.com/12/accounts/:account_id/preroll_call_to_actions
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
line_item_ids optional | Scope the response to just the preroll CTAs associated with the specified line items by specifying a comma-separated list of identifiers. Up to 200 IDs may be provided. Type: string Example: 8v53k |
count optional | Specifies the number of records to try and retrieve per distinct request. Type: int Default: 200 Min, Max: 1 , 1000 |
cursor optional | Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example: 8x7v00oow |
preroll_call_to_action_ids optional | Scope the response to just the desired preroll CTAs by specifying a comma-separated list of identifiers. Up to 200 IDs may be provided. Type: string Example: 8f0 |
sort_by optional | Sorts by supported attribute in ascending or descending order. See Sorting for more information. Type: string Example: created_at-asc |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
with_total_count optional | Include the total_count response attribute. Note: This parameter and cursor are exclusive. Note: Requests which include total_count will have lower rate limits, currently set at 200 per 15 minutes. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/preroll_call_to_actions?line_item_ids=8v53k
https://ads-api.x.com/12/accounts/:account_id/preroll_call_to_actions/:preroll_call_to_action_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
preroll_call_to_action_id required | A reference to the preroll call to action you are operating with in the request. Type: string Example: 8f0 |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/preroll_call_to_actions/8f0
PREROLL_VIEWS
line item.
https://ads-api.x.com/12/accounts/:account_id/preroll_call_to_actions
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
call_to_action required | The CTA text for the displayed button within the ad. Type: enum Possible values: GO_TO , SEE_MORE , SHOP , VISIT_SITE , WATCH_NOW |
call_to_action_url required | The URL to redirect the user to when the CTA button is clicked. Type: string Example: https://www.x.com |
line_item_id required | A reference to the line item you are operating with in the request. Type: string Example: 8v53k |
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
PREROLL_VIEWS
line item.
https://ads-api.x.com/12/accounts/:account_id/preroll_call_to_actions/:preroll_call_to_action_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
preroll_call_to_action_id required | A reference to the preroll CTA you are operating with in the request. Type: string Example: 8f0 |
call_to_action optional | The CTA text for the displayed button within the ad. Type: enum Possible values: GO_TO , SEE_MORE , SHOP , VISIT_SITE , WATCH_NOW |
call_to_action_url optional | The URL to redirect the user to when the CTA button is clicked. Type: string Example: https://www.x.com |
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/preroll_call_to_actions/8f0?call_to_action=WATCH_NOW
https://ads-api.x.com/12/accounts/:account_id/preroll_call_to_actions/:preroll_call_to_action_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
preroll_call_to_action_id required | A reference to the preroll CTA you are operating with in the request. Type: string Example: 8f0 |
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/preroll_call_to_actions/8f0
https://ads-api.x.com/12/accounts/:account_id/scheduled_tweets
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
count optional | Specifies the number of records to try and retrieve per distinct request. Type: int Default: 100 Min, Max: 1 , 200 |
cursor optional | Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example: c-j3cn6n40 |
user_id optional | Specify the user to retrieve Scheduled Tweets for. Defaults to the FULL promotable user on the account when not set. Type: long Example: 756201191646691328 |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_tweets?count=1
https://ads-api.x.com/12/accounts/:account_id/scheduled_tweets/:scheduled_tweet_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
scheduled_tweet_id required | A reference to the Scheduled Tweet you are operating with in the request. Type: string Example: 917438609065623552 |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_tweets/917438609065623552
as_user_id
parameter.
https://ads-api.x.com/12/accounts/:account_id/scheduled_tweets
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
scheduled_at required | The time, expressed in ISO 8601, that the Tweet should be published (or go live). Note: Tweets can only be scheduled up to one year in the future. Note: Tweets should only be scheduled at minute-granularity; seconds will be ignored. Type: string Example: 2017-12-31T23:59:00Z |
as_user_id required | The user ID of the advertiser on behalf of whom you are posting the Tweet. The advertiser must grant your handle (or handles) access to their ads account via ads.x.com. This permission allows you to call the API using the OAuth tokens of your own handle rather than the advertiser’s. Type: long Example: 756201191646691328 |
text sometimes required | The text of your status update. Required if no media_keys are specified. Type: string Example: just setting up my twttr |
card_uri optional | Associate a card with the Tweet using the card_uri value from any cards response, if available. Type: string Example: card://855591459410511943 |
media_keys optional | Associate media with the Tweet by specifying a comma-separated list of identifiers. Include up to 4 images, 1 animated GIF, or 1 video. Note: The media asset must be in the account’s Media Library. Type: string Example: 13_1153584529292270722 |
nullcast optional | Whether to create a nullcasted (or “Promoted-only”) Tweet. Type: boolean Default: true Possible values: true , false |
name optional | The name for the Scheduled Tweet. Maximum length: 80 characters. Type: string Example: Tweet with name |
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_tweets?as_user_id=756201191646691328&media_keys=3_917438348871983104&scheduled_at=2018-01-01
https://ads-api.x.com/12/accounts/:account_id/scheduled_tweets/:scheduled_tweet_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
scheduled_tweet_id required | A reference to the Scheduled Tweet you are operating with in the request. Type: string Example: 870321875435442177 |
card_uri optional | Associate a card with the Tweet using the card_uri value from any cards response, if available. Note: Unset (remove) by specifying the parameter without a value. Type: string Example: card://875146925316386347 |
media_keys optional | Associate media with the Tweet by specifying a comma-separated list of identifiers. Include up to 4 images, 1 animated GIF, or 1 video. Note: The media asset must be in the account’s Media Library. Note: Unset (remove) by specifying the parameter without a value. Type: string Example: 13_1153584529292270722 |
nullcast optional | Whether to create a nullcasted (or “Promoted-only”) Tweet. Type: boolean Possible values: true , false |
scheduled_at optional | The time, expressed in ISO 8601, that the Tweet should be published (or go live). Type: string Example: 2017-12-31T23:59:59Z |
text optional | The text of your status update. Type: string Example: just setting up my twttr |
name optional | The name for the Scheduled Tweet. Maximum length: 80 characters. Type: string Example: Tweet with name |
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_tweets/875057751231037440?text=winter solstice
https://ads-api.x.com/12/accounts/:account_id/scheduled_tweets/:scheduled_tweet_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
scheduled_tweet_id required | A reference to the Scheduled Tweet you are operating with in the request. Type: string Example: 870321875435442177 |
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/scheduled_tweets/875064008595787776
https://ads-api.x.com/12/accounts/:account_id/tweet_previews
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
tweet_ids required | A comma-separated list of identifiers. Up to 200 IDs may be provided. Note: The IDs should correspond to the specified tweet_type . For example, if a Scheduled Tweet ID is passed in and tweet_type=PUBLISHED is specified, a preview for that ID will not be returned. Type: long Example: 1122911801354510336,1102836745790316550 |
tweet_type required | The Tweet type for the specified tweet_ids . Type: enum Possible values: DRAFT , PUBLISHED , SCHEDULED |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/tweet_previews?tweet_ids=1122911801354510336,1102836745790316550&tweet_type=PUBLISHED
user_id
parameter. This can be any of the promotable users under the account.
https://ads-api.x.com/12/accounts/:account_id/tweets
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
tweet_type required | The Tweet type for the specified tweet_ids . Type: enum Possible values: DRAFT , PUBLISHED , SCHEDULED |
count optional | Specifies the number of records to try and retrieve per distinct request. Type: int Default: 200 Min, Max: 1 , 1000 |
cursor optional | Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example: AAAAAFhLRpQLNF-sGBSgAA |
include_mentions_and_replies optional | Whether to filter out mentions and replies from the list of available Tweets. Type: boolean Default: false Possible values: true , false |
name optional | An optional query to scope Tweets by name . Omit this parameter to retrieve all. Maximum length: 80 characters. Note: This performs case-insensitive prefix matching. Type: string Example: dtc |
timeline_type optional | Whether to return nullcasted (a.k.a. “Promoted-only”) Tweets, organic Tweets, or both. Type: enum Default: NULLCAST Possible values: ALL , NULLCAST , ORGANIC |
trim_user optional | Whether to exclude the user object in the Tweet response. When enabled, the only part of the user object that will be returned is the Tweet’s author’s user ID. Type: boolean Default: false Possible values: true , false |
tweet_ids optional | A comma-separated list of identifiers. Up to 200 IDs may be provided. Note: The IDs should correspond to the specified tweet_type . For example, if a Scheduled Tweet ID is passed in, then the tweet_type must be SCHEDULED in order for that Tweet to be returned in the response. Type: long Example: 1122911801354510336,1102836745790316550 |
user_id optional | Specifies the user to scope Tweets to. Defaults to the FULL promotable user on the account when not set. Type: long Example: 756201191646691328 |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/tweets?tweet_ids=1166476031668015104&tweet_type=PUBLISHED&trim_user=true
as_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.
https://ads-api.x.com/12/accounts/:account_id/tweet
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
as_user_id required | The user ID of the advertiser on behalf of whom you are posting the Tweet. The advertiser must grant your handle (or handles) access to their ads account via ads.x.com. This permission allows you to call the API using the OAuth tokens of your own handle rather than the advertiser’s. Type: long Example: 756201191646691328 |
text sometimes required | The text of your status update. Required if no media_keys are specified. Type: string Example: hello, world |
card_uri optional | Associate a card with the Tweet using the card_uri value from any cards response, if available. Type: string Example: card://853503245793641682 |
conversation_settings optional | Choose who can reply to this Tweet. Anyone mentioned can always reply. Note: This field will not be returned in the POST request response, but will be returned when making a GET request. Note: This parameter only works in Ads API v8 and above. Type: enum Default: EVERYONE Possible values: EVERYONE , FOLLOWING , MENTIONED_USERS |
media_keys optional | Associate media with the Tweet by specifying a comma-separated list of identifiers. Include up to 4 images, 1 animated GIF, or 1 video. Type: string Example: 13_1153584529292270722 |
name optional | The name for the Tweet. Maximum length: 80 characters. Type: string Example: Tweet with name |
nullcast optional | Whether to create a nullcasted (or “Promoted-only”) Tweet. Note: Organic Tweets (nullcast=false ) can only be created for the authenticated user. Type: boolean Default: true Possible values: true , false |
trim_user optional | Whether to exclude the user object in the Tweet response. When enabled, the only part of the user object that will be returned is the Tweet’s author’s user ID. Type: boolean Default: false Possible values: true , false |
tweet_mode optional | Whether the response should be in compatibility or extended mode. See this for additional information. Type: string Possible values: compat , extended |
video_cta optional | The CTA for the video. Type: enum Possible values: VISIT_SITE , WATCH_NOW |
video_cta_value optional | The value for the corresponding CTA on the video. Type: string Example: https://dev.x.com |
video_description optional | The description that appears under the video. Maximum length: 200 characters. Type: string Example: Integrate with the X advertising platform |
video_title optional | The title (headline) that appears under the video. Maximum length: 70 characters. Type: string Example: X Ads API |
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/tweet?text=hello, world&as_user_id=756201191646691328&trim_user=true
name
belonging to the current account.
https://ads-api.x.com/12/accounts/:account_id/tweets/:tweet_id/name
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
tweet_id required | A reference to the Tweet you are operating with in the request. Type: long Example: 994747471329873920 |
name optional | The name for the Tweet. Maximum length: 80 characters. Type: string Example: Tweet with name |
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/tweets/994747471329873920/name?name=new Tweet name
card_uri
parameter with either the POST accounts/:account_id/tweet, POST statuses/update, or POST accounts/:account_id/scheduled_tweets endpoints.
https://ads-api.x.com/12/accounts/:account_id/cards/video_conversation
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_ids optional | Scope the response to just the desired video conversation cards by specifying a comma-separated list of identifiers. Up to 200 IDs may be provided. Type: string Example: 5a86h |
count optional | Specifies the number of records to try and retrieve per distinct request. Type: int Default: 200 Min, Max: 1 , 1000 |
cursor optional | Specifies a cursor to get the next page of results. See Pagination for more information. Type: string Example: 8x7v00oow |
q optional | An optional query to scope cards by name . Omit this parameter to retrieve all. Maximum length: 80 characters. Note: This performs case-insensitive prefix matching. Type: string Example: night sky |
sort_by optional | Sorts by supported attribute in ascending or descending order. See Sorting for more information. Type: string Example: created_at-asc |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
with_total_count optional | Include the total_count response attribute. Note: This parameter and cursor are exclusive. Note: Requests which include total_count will have lower rate limits, currently set at 200 per 15 minutes. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/video_conversation?card_ids=5a86h
https://ads-api.x.com/12/accounts/:account_id/cards/video_conversation/:card_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_id required | A reference to the video conversation card you are operating with in the request. Type: string Example: 4i0ya |
with_deleted optional | Include deleted results in your request. Type: boolean Default: false Possible values: true , false |
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/video_conversation/5a86h
https://ads-api.x.com/12/accounts/:account_id/cards/video_conversation
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
first_cta required | The Call-To-Action (CTA) hashtag for the first option. Maximum length: 20 characters (not counting the #). Type: string Example: #APIs |
first_cta_tweet required | The Tweet text to be used when the first CTA is clicked. Type: string Example: Ads API |
media_key required | The media key for a video to be used in this card. Note: The video must be in the account’s Media Library. Note: An aspect ratio of 16:9 is required. Type: string Example: 13_1168079965037467209 |
name required | The name for the card. Type: string Example: video conversation card |
thank_you_text required | The text to be displayed after the CTA is clicked. Maximum length: 23 characters. Type: string Example: Build it |
title sometimes required | The title for the card, which appears below the video and above the CTAs. Maximum length: 23 characters. Type: string Note: Required if second_cta is not set. Example: Developers |
second_cta sometimes required | The Call-To-Action (CTA) hashtag for the second option. Maximum length: 20 characters (not counting the #). Type: string Note: Required if title is not set. Example: #ShareAgain |
second_cta_tweet sometimes required | The Tweet text to be used when the second CTA is clicked. Note: Required if second_cta is set. Type: string Example: I Heart @AdsAPI Again |
poster_media_key optional | The media key for a poster image to be used in this card. If not specified, the first frame will be used. Note: The video must be in the account’s Media Library. Type: long Example: 3_882726458191298561 |
third_cta optional | The Call-To-Action (CTA) hashtag for the third option. Maximum length: 20 characters (not counting the #). Type: string Example: #ShareMore |
third_cta_tweet sometimes required | The Tweet text to be used when the third CTA is clicked. Type: string Note: Required if third_cta is set. Example: I Heart @TwitterDev |
fourth_cta optional | The Call-To-Action (CTA) hashtag for the fourth option. Maximum length: 20 characters (not counting the #). Type: string Example: #ShareExtra |
fourth_cta_tweet sometimes required | The Tweet text to be used when the fourth CTA is clicked. Type: string Note: Required if fourth_cta is set. Example: I Heart @TwitterDev Again |
thank_you_url optional | The URL to be displayed with the thank you text. Type: string Example: https://example.com/thankyou |
unlocked_image_media_key optional | A media_key of an image which will be used in the instant unlock scenario. This is a write-only field. In the response, the API will provide a X URL for this image. Note: The image must be in the account’s media library. Type: string Example: 3_883112887618682880 |
unlocked_video_media_key optional | The identifier of a video from the GET accounts/:account_id/media_library endpoint which will be used in the instant unlock scenario. Type: string Example: 13_867520357225418752 |
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
https://ads-api.x.com/12/accounts/:account_id/cards/video_conversation/:card_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_id required | A reference to the video conversation card you are operating with in the request. Type: string Example: 5a86h |
first_cta optional | The Call-To-Action (CTA) hashtag for the first option. Maximum length: 20 characters (not counting the #). Type: string Example: #APIs |
first_cta_tweet optional | The Tweet text to be used when the first CTA is clicked. Type: string Example: Ads API |
second_cta optional | The Call-To-Action (CTA) hashtag for the second option. Maximum length: 20 characters (not counting the #). Type: string Note: Required if title is not set. Example: #ShareAgain |
second_cta_tweet optional | The Tweet text to be used when the second CTA is clicked. Note: Required if second_cta is set. Type: string Example: I Heart @AdsAPI Again |
third_cta optional | The Call-To-Action (CTA) hashtag for the third option. Maximum length: 20 characters (not counting the #). Type: string Example: #ShareMore |
third_cta_tweet optional | The Tweet text to be used when the third CTA is clicked. Type: string Note: Required if third_cta is set. Example: I Heart @TwitterDev |
fourth_cta optional | The Call-To-Action (CTA) hashtag for the fourth option. Maximum length: 20 characters (not counting the #). Type: string Example: #ShareExtra |
fourth_cta_tweet optional | The Tweet text to be used when the fourth CTA is clicked. Type: string Note: Required if fourth_cta is set. Example: I Heart @TwitterDev Again |
media_key optional | The media key for a video to be used in this card. Note: The video must be in the account’s Media Library. Note: An aspect ratio of 16:9 is required. Type: string Example: 13_1168079965037467209 |
name optional | The name for the card. Type: string Example: developers card |
poster_media_key optional | The media key for a poster image to be used in this card. If not specified, the first frame will be used. Note: The video must be in the account’s Media Library. Type: long Example: 3_882726458191298561 |
thank_you_text optional | The text to be displayed after the CTA is clicked. Maximum length: 23 characters. Type: string Example: Build it |
thank_you_url optional | The URL to be displayed with the thank you text. Type: string Example: https://example.com/thankyou |
title optional | The title for the card, which appears below the video and above the CTAs. Maximum length: 23 characters. Type: string Note: Required if second_cta is not set. Example: Start a conversation |
unlocked_image_media_key optional | A media_key of an image which will be used in the instant unlock scenario. This is a write-only field. In the response, the API will provide a X URL for this image. Note: The image must be in the account’s media library. Type: string Example: 3_883112887618682880 |
unlocked_video_media_key optional | The identifier of a video from the GET accounts/:account_id/media_library endpoint which will be used in the instant unlock scenario. Type: string Example: 13_867520357225418752 |
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/video_conversation/5a86h?name=developers card
https://ads-api.x.com/12/accounts/:account_id/cards/video_conversation/:card_id
Name | Description |
---|---|
account_id required | The identifier for the leveraged account. Appears within the resource’s path and is generally a required parameter for all Advertiser API requests excluding GET accounts. The specified account must be associated with the authenticated user. Type: string Example: 18ce54d4x5t |
card_id required | A reference to the video conversation card you are operating with in the request. Type: string Example: 4i0ya |
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/cards/video_conversation/4i0ya