Draft Tweets
draft-tweets

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: 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

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: 18ce54d4x5t

draft_tweet_id
required

A reference to the Draft Tweet you are operating with in the request.

Type: string

Example: 994788364334325760

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: 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.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: 756201191646691328

text
sometimes required

The text of your status update. Required if no media_keys are specified.

Type: string

Example: Just setting up my Twitter.

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

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: 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

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: 18ce54d4x5t

draft_tweet_id
required

A reference to the Draft Tweet you are operating with in the request.

Type: string

Example: 994787835663155200

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: 18ce54d4x5t

draft_tweet_id
required

A reference to the Draft Tweet you are operating with in the request.

Type: string

Example: 996132315829948416

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."
}