Introduction

Introduction

Blocking users is a core security feature on Twitter. Using the endpoints in the manage blocks endpoint group, you can build safer experiences for Twitter users or block users programmatically based on previous engagements. You can also unblock users after a given period of time, based on the criteria that you determine. Using blocks lookup, you can see who you or an authenticated user has blocked. This can be useful for determining how you can interact with a given account. 

Since you are making requests for private information with blocks lookup, and on behalf of a user with manage blocks, you must authenticate these endpoints with either OAuth 1.0a User Context or OAuth 2.0 Authorization Code with PKCE, and use the user Access Tokens associated with a user that has authorized your App, which can be generated using the 3-legged OAuth flow (OAuth 1.0a) or the Authorization Code with PKCE grant flow (OAuth 2.0).

 

Blocks lookup

The blocks lookup GET endpoint allows you to see which accounts you’ve blocked on behalf of an authorized user. This endpoint has a rate limit of 15 requests per 15 minutes per user. 
 

Manage blocks

The manage blocks endpoints enable you to block or unblock a specified user on behalf of an authenticated user. For this endpoint group, there are two methods available: POST and DELETE. The POST method allows you to block a user, and the DELETE method allows you to unblock. There is a user rate limit of 50 requests per 15 minutes per endpoint with both the POST and DELETE methods. 

Account setup

To access these endpoints, you will need:

Learn more about getting access to the Twitter API v2 endpoints in our getting started guide.