POST /2/users/:id/blocking

Causes the user (in the path) to block the target user. The user (in the path) must match the user context authorizing the request.



Endpoint URL

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

Authentication and rate limits

Authentication methods
supported by this endpoint

OAuth 1.0a User context

Rate limit

User rate limit: 50 requests per 15-minute window

Path parameters

NameTypeDescription
id
 Required 
stringThe user ID who you would like to initiate the block 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 block. The body should contain a string of the user ID inside of a JSON object.


Example requests

      curl -X POST https://api.twitter.com/2/users/6253282/blocking -H "Authorization: OAuth $OAUTH_SIGNATURE" -H "Content-type: application/json" -d '{"target_user_id": "2244994945"}'
    
      twurl -X POST /2/users/6253282/blocking  -A "Content-type: application/json" -d '{"target_user_id": "2244994945"}'
    

Example responses

      {
  "data": {
    "blocking": true
  }
}
    

Response fields

NameTypeDescription
blockingbooleanIndicates whether the user is blocking the specified user as a result of this request.