Creation of a Tweet

POST /2/tweets

Causes the user to create a tweet under the authorized account.

Body

  • text string

    The content of the Tweet.

  • quote_tweet_id string

    Unique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.

    Format should match the following pattern: ^[0-9]{1,19}$.

  • for_super_followers_only boolean

    Exclusive Tweet for super followers.

  • reply object

    Tweet information of the Tweet being replied to.

    Hide reply attributes Show reply attributes object
    • in_reply_to_tweet_id string

      Unique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.

      Format should match the following pattern: ^[0-9]{1,19}$.

    • exclude_reply_user_ids array[string]

      Unique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.

      Format of each should match the following pattern: ^[0-9]{1,19}$.

  • media object

    Media information being attached to created Tweet. This is mutually exclusive from Quote Tweet Id and Poll.

    Hide media attributes Show media attributes object
    • media_ids array[string]

      The unique identifier of this Media.

      Format of each should match the following pattern: ^[0-9]{1,19}$.

    • tagged_user_ids array[string]

      Unique identifier of this User. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.

      Format of each should match the following pattern: ^[0-9]{1,19}$.

  • poll object

    Poll options for a Tweet with a poll. This is mutually exclusive from Media and Quote Tweet Id.

    Hide poll attributes Show poll attributes object
    • options array[string]

      The text of a poll choice.

      Minimum length of each is 1, maximum length of each is 25.

    • duration_minutes integer(int32)

      Duration of the poll in minutes.

      Minimum value is 5, maximum value is 10080.

  • reply_settings string

    Settings to indicate who can reply to the Tweet.

    Values are following or mentionedUsers.

  • geo object

    Place ID being attached to the Tweet for geo location.

    Hide geo attribute Show geo attribute object
    • place_id string

Responses

  • 201

    The request was successful

    Hide response attributes Show response attributes object
    • data object
      Hide data attributes Show data attributes object
      • id string Required

        Unique identifier of this Tweet. This is returned as a string in order to avoid complications with languages and tools that cannot handle large integers.

        Format should match the following pattern: ^[0-9]{1,19}$.

      • text string Required

        The content of the Tweet.

    • errors array[object]

      An HTTP Problem Details object, as defined in IETF RFC 7807 (https://tools.ietf.org/html/rfc7807).

      At least 1 element.

      Hide errors attributes Show errors attributes array[object]
      • type string Required
      • title string Required
      • detail string
      • status integer
  • default

    The request has failed.

    Hide response attributes Show response attributes object
    • code integer(int32) Required
    • message string Required
POST /2/tweets
curl \
 -X POST https://api.twitter.com/2/tweets \
 -H "Authorization: Oauth $ACCESS_TOKEN" \
 -H "Content-Type: application/json" \
 -d '{"text":"Learn how to use the user Tweet timeline and user mention timeline endpoints in the Twitter API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i","direct_message_deep_link":"string","quote_tweet_id":"1346889436626259968","for_super_followers_only":true,"reply":{"in_reply_to_tweet_id":"1346889436626259968","exclude_reply_user_ids":["2244994945"]},"media":{"media_ids":["1146654567674912769"],"tagged_user_ids":["2244994945"]},"poll":{"options":["string"],"duration_minutes":42},"reply_settings":"following","geo":{"place_id":"string"}}'
Request example
{
  "text": "Learn how to use the user Tweet timeline and user mention timeline endpoints in the Twitter API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i",
  "direct_message_deep_link": "string",
  "quote_tweet_id": "1346889436626259968",
  "for_super_followers_only": true,
  "reply": {
    "in_reply_to_tweet_id": "1346889436626259968",
    "exclude_reply_user_ids": [
      "2244994945"
    ]
  },
  "media": {
    "media_ids": [
      "1146654567674912769"
    ],
    "tagged_user_ids": [
      "2244994945"
    ]
  },
  "poll": {
    "options": [
      "string"
    ],
    "duration_minutes": 42
  },
  "reply_settings": "following",
  "geo": {
    "place_id": "string"
  }
}
Request examples
{
  "direct_message_deep_link": "string",
  "text": "Learn how to use the user Tweet timeline and user mention timeline endpoints in the Twitter API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i",
  "quote_tweet_id": "1346889436626259968",
  "for_super_followers_only": true,
  "reply": {
    "in_reply_to_tweet_id": "1346889436626259968",
    "exclude_reply_user_ids": [
      "2244994945"
    ]
  },
  "media": {
    "media_ids": [
      "1146654567674912769"
    ],
    "tagged_user_ids": [
      "2244994945"
    ]
  },
  "poll": {
    "options": [
      "string"
    ],
    "duration_minutes": 42
  },
  "reply_settings": "following",
  "geo": {
    "place_id": "string"
  }
}
Response examples (201)
{
  "data": {
    "id": "1346889436626259968",
    "text": "Learn how to use the user Tweet timeline and user mention timeline endpoints in the Twitter API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i"
  },
  "errors": [
    {
      "type": "string",
      "title": "string",
      "detail": "string",
      "status": 42
    }
  ]
}
Response examples (201)
{
  "data": {
    "id": "1346889436626259968",
    "text": "Learn how to use the user Tweet timeline and user mention timeline endpoints in the Twitter API v2 to explore Tweet\\u2026 https:\\/\\/t.co\\/56a0vZUx7i"
  },
  "errors": [
    {
      "type": "string",
      "title": "string",
      "detail": "string",
      "status": 42
    }
  ]
}
Response examples (default)
{
  "code": 42,
  "message": "string"
}
Response examples (default)
{
  "code": 42,
  "message": "string"
}