POST /2/users/:id/muting

POST /2/users/:id/muting

Allows an authenticated user ID to mute the target user.

Endpoint URL

https://api.twitter.com/2/users/:id/muting

Authentication and rate limits

Authentication methods
supported by this endpoint

OAuth 1.0a is also available for this endpoint.

OAuth 2.0 Authorization Code with PKCE

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

mute.write

Learn more about OAuth 2.0 Authorization Code with PKCE

Path parameters

NameTypeDescription
id
 Required 
stringThe user ID who you would like to initiate the mute on behalf of. It must match your own user ID or that of an authenticating user, meaning that you must pass the Access Tokens associated with the user ID when authenticating your request.


JSON body parameters

NameTypeDescription
target_user_id
 Required 
stringThe user ID of the user that you would like the id to mute. The body should contain a string of the user ID inside of a JSON object.


Example code with offical SDKs

TypeScript
Java
      (async () => {
  try {
    const muteUser = await twitterClient.users.usersIdMute(
      //The ID of the user that is requesting to mute the target user
      "6253282",
      {
        //The ID of the user that the source user is requesting to mute
        target_user_id: "2244994945",
      }
    );
    console.dir(muteUser, {
      depth: null,
    });
  } catch (error) {
    console.log(error);
  }
})();

    
      // Set the params values

UsersIdMuteRequest usersIdMuteRequest = new UsersIdMuteRequest(); 
//The ID of the user that the source user is requesting to mute
usersIdMuteRequest.targetUserId("2244994945");

// String | The ID of the user that is requesting to mute the target user
String id = "6253282";

try {
    UsersMutingMutationResponse result = apiInstance.users().usersIdMute(usersIdMuteRequest, id);
    System.out.println(result);
} catch (ApiException e) {
    System.err.println("Exception when calling UsersApi#usersIdMute");
    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": {
    "muting": true
  }
}
    

Response fields

NameTypeDescription
mutingbooleanIndicates whether the user is muting the specified user as a result of this request.