Authentication
Blocks endpoints require user authentication:| Method | Description |
|---|---|
| OAuth 2.0 Authorization Code with PKCE | Recommended for new applications |
| OAuth 1.0a User Context | Legacy support |
Required scopes (OAuth 2.0)
| Scope | Required for |
|---|---|
block.read | Retrieving blocked accounts |
block.write | Blocking and unblocking accounts |
users.read | Required with block scopes |
Endpoints overview
| Method | Endpoint | Description |
|---|---|---|
| GET | /2/users/:id/blocking | Get list of blocked accounts |
| POST | /2/users/:id/blocking | Block an account |
| DELETE | /2/users/:source_user_id/blocking/:target_user_id | Unblock an account |
Fields and expansions
Default response
Available fields
user.fields
user.fields
| Field | Description |
|---|---|
created_at | Account creation date |
description | User bio |
profile_image_url | Avatar URL |
public_metrics | Follower/following counts |
verified | Verification status |
expansions
expansions
| Expansion | Description |
|---|---|
pinned_tweet_id | User’s pinned Post |
What happens when you block
They can't
- See your Posts (unless logged out)
- Follow you
- Send you DMs
- Add you to Lists
- Tag you in photos
You can't
- See their Posts
- Follow them
- Send them DMs
When you block someone who follows you, they are automatically unfollowed.
Pagination
For users with large block lists, results are paginated:cURL
Error handling
| Status | Error | Solution |
|---|---|---|
| 400 | Invalid request | Check user ID format |
| 401 | Unauthorized | Verify access token |
| 403 | Forbidden | Check scopes and permissions |
| 404 | Not Found | User doesn’t exist |
| 429 | Too Many Requests | Wait and retry |