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¶
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:
|
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:
|
user_id optional |
Specify the user to retrieve Draft Tweets for. Defaults to the
Type: string Example:
|
Example Request¶
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets?count=1
Example Response¶
{
"request": {
"params": {
"count": 1
}
},
"data": [
{
"name" null,
"text": "hello, world",
"user_id": "756201191646691328",
"id": "994791681219231744",
"nullcast": true,
"created_at": "2018-05-11T04:09:53Z",
"card_uri": null,
"updated_at": "2018-05-11T04:09:53Z",
"media_keys": []
}
],
"next_cursor": "c-jh1g0ryb"
}
GET accounts/:account_id/draft_tweets/:draft_tweet_id¶
Retrieve a specific Draft Tweet associated with the current account.
Resource URL¶
https://ads-api.x.com/12/accounts/:account_id/draft_tweets/:draft_tweet_id
Parameters¶
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:
|
draft_tweet_id required |
A reference to the Draft Tweet you are operating with in the request. Type: string Example:
|
Example Request¶
GET https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets/994788364334325760
Example Response¶
{
"request": {
"params": {
"draft_tweet_id": "994788364334325760"
}
},
"data": {
"name": null,
"text": "#TwitterDev",
"user_id": "756201191646691328",
"id": "994788364334325760",
"nullcast": true,
"created_at": "2018-05-11T03:56:42Z",
"card_uri": "card://958225772740714496",
"updated_at": "2018-05-11T03:56:42Z",
"media_keys": []
}
}
POST accounts/:account_id/draft_tweets¶
Create a Draft Tweet for the account's full promotable user (default)
or the user specified in the as_user_id
parameter.
Resource URL¶
https://ads-api.x.com/12/accounts/:account_id/draft_tweets
Parameters¶
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:
|
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.twitter.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:
|
text sometimes required |
The text of your status update. Required if no
Type: string Example:
|
card_uri optional |
Associate a card with the Tweet using the Type: string Example: |
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:
|
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:
|
Example Request¶
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets?as_user_id=756201191646691328&text=Just setting up my Twitter.
Example Response¶
{
"request": {
"params": {
"text": "Just setting up my Twitter.",
"as_user_id": "756201191646691328"
}
},
"data": {
"name": null,
"text": "Just setting up my Twitter.",
"user_id": "756201191646691328",
"id": "994747471329873920",
"nullcast": true,
"created_at": "2018-05-11T01:14:13Z",
"card_uri": null,
"updated_at": "2018-05-11T01:14:13Z",
"media_keys": []
}
}
PUT accounts/:account_id/draft_tweets/:draft_tweet_id¶
Update the specified Draft Tweet belonging to the current account.
Resource URL¶
https://ads-api.x.com/12/accounts/:account_id/draft_tweets/:draft_tweet_id
Parameters¶
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:
|
draft_tweet_id required |
A reference to the Draft Tweet you are operating with in the request. Type: string Example:
|
card_uri optional |
Associate a card with the Tweet using the Note: Unset (remove) by specifying the parameter without a value. Type: string Example:
|
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:
|
nullcast optional |
Whether to create a nullcasted (or "Promoted-only") Tweet. Type: boolean Possible values: |
text optional |
The text of your status update. Type: string Example:
|
name optional |
The name for the Draft Tweet. Maximum length: 80 characters. Type: string Example:
|
Example Request¶
PUT https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets/994747471329873920?text=just setting up my twttr
Example Response¶
{
"request": {
"params": {
"draft_tweet_id": 994747471329873920,
"text": "just setting up my twttr"
}
},
"data": {
"name": null,
"text": "just setting up my twttr",
"user_id": "756201191646691328",
"id": "994747471329873920",
"nullcast": true,
"created_at": "2018-05-11T01:14:13Z",
"card_uri": null,
"updated_at": "2018-05-11T01:16:59Z",
"media_keys": []
}
}
DELETE accounts/:account_id/draft_tweets/:draft_tweet_id¶
Permanently delete the specified Draft Tweet belonging to the current account.
Note: We strongly recommend deleting drafts once a Tweet or Scheduled Tweet has been created using its metadata.
Note: This is a hard delete. As a result, it is not possible to retrieve deleted Draft Tweets.
Resource URL¶
https://ads-api.x.com/12/accounts/:account_id/draft_tweets/:draft_tweet_id
Parameters¶
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:
|
draft_tweet_id required |
A reference to the Draft Tweet you are operating with in the request. Type: string Example:
|
Example Request¶
DELETE https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets/994787835663155200
Example Response¶
{
"request": {
"params": {
"draft_tweet_id": "994787835663155200"
}
},
"data": {
"name": null,
"text": "hello, world",
"user_id": "756201191646691328",
"id": "994787835663155200",
"nullcast": true,
"status": "DELETED",
"created_at": "2018-05-11T03:54:36Z",
"card_uri": null,
"updated_at": "2018-05-11T04:07:31Z",
"media_keys": []
}
}
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 Twitter official apps.
Resource URL¶
https://ads-api.x.com/12/accounts/:account_id/draft_tweets/preview/:draft_tweet_id
Parameters¶
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:
|
draft_tweet_id required |
A reference to the Draft Tweet you are operating with in the request. Type: string Example:
|
Example Request¶
POST https://ads-api.x.com/12/accounts/18ce54d4x5t/draft_tweets/preview/996132315829948416
Example Response¶
{
"request": {
"params": {
"account_id": "18ce54d4x5t",
"draft_tweet_id": "996132315829948416"
}
},
"message": "See @apimctestface's notifications in the Twitter app to preview your Tweet."
}