DELETE /2/tweets/:id

DELETE /2/tweets/:id

Allows a user or authenticated user ID to delete a Tweet.

Endpoint URL

https://api.x.com/2/tweets/:id

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): 50 requests per 15-minute window per each authenticated user

OAuth 2.0 scopes required by this endpoint

tweet.read

tweet.write

users.read

Learn more about OAuth 2.0 Authorization Code with PKCE

Path parameters

NameTypeDescription
id
 Required 
stringThe Tweet ID you are deleting.


Example code with offical SDKs

TypeScript
Java
      (async () => {
  // The ID of the Tweet to be deleted.
  const tweetId = "1445880548472328192"
  try {          
    const deleteTweet = await twitterClient.tweets.deleteTweetById();
    console.dir(deleteTweet, {
      depth: null,
    });
  } catch (error) {
    console.log(error);
  }
})();

    
      // Set the params values

// String | The ID of the Tweet to be deleted.
String id = "1445880548472328192";

try {
    TweetDeleteResponse result = apiInstance.tweets().deleteTweetById(id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling TweetsApi#deleteTweetById");
    System.err.println("Status code: " + e.getCode());
    System.err.println("Reason: " + e.getResponseBody());
    System.err.println("Response headers: " + e.getResponseHeaders());
    e.printStackTrace();
}

    

Example responses

Successful response
      {
  "data": {
    "deleted": true
  }
}
    

Response fields

NameTypeDescription
deletedbooleanIndicates whether the specified Tweet has been deleted as a result of this request. The returned value is true for a successful delete request.