PUT /2/tweets/:id/hidden

PUT /2/tweets/:id/hidden

Hides or unhides a reply to a Tweet.

Endpoint URL

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

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

users.read

tweet.moderate.write

Learn more about OAuth 2.0 Authorization Code with PKCE

Path parameters

NameTypeDescription
id
 Required 
stringUnique identifier of the Tweet to hide or unhide. The Tweet must belong to a conversation initiated by the authenticating user.


JSON body parameters

NameTypeDescription
hidden
 Required 
booleanIndicates the action to perform. Specify true to hide the Tweet, false to unhide. Trying to hide a Tweet that's already hidden (or unhide a Tweet that is not hidden) will result in a successful call.


Example code with offical SDKs

TypeScript - hide reply
TypeScript - unhide reply
Java - hide reply
Java - unhide reply
      (async () => {
  try {
    const hideReply = await twitterClient.tweets.hideReplyById(
      // The ID of the reply that you want to hide or unhide.
      "1228393702244134912",
      {
        hidden: true,
      }
    );
    console.dir(hideReply, {
      depth: null,
    });
  } catch (error) {
    console.log(error);
  }
})();

    
      (async () => {
  try {
    const unhideReply = await twitterClient.tweets.hideReplyById(
      // The ID of the reply that you want to hide or unhide.
      "1228393702244134912",
      {
        hidden: false,
      }
    );
    console.dir(unhideReply, {
      depth: null,
    });
  } catch (error) {
    console.log(error);
  }
})();

    
      HideReplyByIdRequest hideReplyByIdRequest = new HideReplyByIdRequest(); // HideReplyByIdRequest | 
hideReplyByIdRequest.hidden(true)

// String | The ID of the reply that you want to hide or unhide.
String id = "1228393702244134912";

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

    
      HideReplyByIdRequest hideReplyByIdRequest = new HideReplyByIdRequest(); 
hideReplyByIdRequest.hidden(false)

// String | The ID of the reply that you want to hide or unhide.
String id = "1228393702244134912";

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

    

Example responses

Success (reply hidden)
Success (reply unhidden)
      {
  "data": {
    "hidden": true
  }
}
    
      {
  "data": {
    "hidden": false
  }
}
    

Response fields

NameTypeDescription
hiddenbooleanIndicates if the Tweet was successfully hidden or unhidden.