POST /2/tweets
Creates a Tweet on behalf of an authenticated user.
Endpoint URL
https://api.x.com/2/tweets
Authentication and rate limits
Authentication methods supported by this endpoint |
OAuth 2.0 Authorization Code with PKCE OAuth 1.0a is also available for this endpoint. |
---|---|
Rate limit | User rate limit (User context): 100 requests per 15-minute window per each authenticated user |
OAuth 2.0 scopes required by this endpoint
|
Learn more about OAuth 2.0 Authorization Code with PKCE |
JSON body parameters
Name | Type | Description |
---|---|---|
direct_message_deep_link Optional |
string | Tweets a link directly to a Direct Message conversation with an account. Example: {"text": "Tweeting a DM deep link!", "direct_message_deep_link": "https://twitter.com/messages/compose?recipient_id=2244994945"} |
for_super_followers_only Optional |
boolean | Allows you to Tweet exclusively for Super Followers. Example: {"text": "Hello World!", "for_super_followers_only": true} |
geo Optional |
object | A JSON object that contains location information for a Tweet. You can only add a location to Tweets if you have geo enabled in your profile settings. If you don't have geo enabled, you can still add a location parameter in your request body, but it won't get attached to your Tweet |
geo.place_id Optional |
string | Place ID being attached to the Tweet for geo location. Example: {"text": "Tweeting with geo!","geo": {"place_id": "5a110d312052166f"}} |
media Optional |
object | A JSON object that contains media information being attached to created Tweet. This is mutually exclusive from Quote Tweet ID and Poll. |
media.media_ids Optional |
array | A list of Media IDs being attached to the Tweet. This is only required if the request includes the tagged_user_ids .Example: {"text": "Tweeting with media!", "media": {"media_ids": ["1455952740635586573"]}} |
media.tagged_user_ids Optional |
array | A list of User IDs being tagged in the Tweet with Media. If the user you're tagging doesn't have photo-tagging enabled, their names won't show up in the list of tagged users even though the Tweet is successfully created. Example: {"text": "Tagging users in images!", "media": {"media_ids": ["1455952740635586573"], "tagged_user_ids": ["2244994945","6253282"]}} |
poll Optional |
object | A JSON object that contains options for a Tweet with a poll. This is mutually exclusive from Media and Quote Tweet ID. |
poll.duration_minutes Optional |
number | Duration of the poll in minutes for a Tweet with a poll. This is only required if the request includes poll.options .Example: {"text": "Tweeting with polls!", "poll": {"options": ["yes", "maybe", "no"], "duration_minutes": 120}} |
poll.options Optional |
array | A list of poll options for a Tweet with a poll. For the request to be successful it must also include duration_minutes too.Example: {"text": "Tweeting with polls!", "poll": {"options": ["yes", "maybe", "no"], "duration_minutes": 120}}" |
quote_tweet_id Optional |
string | Link to the Tweet being quoted. Example: {"text": "Yay!", "quote_tweet_id": "1455953449422516226"} |
reply Optional |
object | A JSON object that contains information of the Tweet being replied to. |
reply.exclude_reply_user_ids Optional |
array | A list of User IDs to be excluded from the reply Tweet thus removing a user from a thread. Example: {"text": "Yay!", "reply": {"in_reply_to_tweet_id": "1455953449422516226", "exclude_reply_user_ids": ["6253282"]}} |
reply.in_reply_to_tweet_id Optional |
string | Tweet ID of the Tweet being replied to. Please note that in_reply_to_tweet_id needs to be in the request if exclude_reply_user_ids is present.Example: {"text": "Excited!", "reply": {"in_reply_to_tweet_id": "1455953449422516226"}} |
reply_settings Optional |
string | Settings to indicate who can reply to the Tweet. Options include "mentionedUsers" and "following". If the field isn’t specified, it will default to everyone. Example: {"text": "Tweeting with reply settings!", "reply_settings": "mentionedUsers"} |
text Optional |
string | Text of the Tweet being created. This field is required if Example:
|
Example code with offical SDKs
Example responses
Response fields
Name | Type | Description |
---|---|---|
id | string | The ID of the newly created Tweet. |
text | string | The text of the newly created Tweet. |