Skip to main content
This guide walks you through retrieving your block list, as well as blocking and unblocking users.
The block and unblock users endpoints are only available under the Enterprise plan. You can fill out the Enterprise interest form here.
PrerequisitesBefore you begin, you’ll need:
  • A developer account with an approved App
  • User Access Token (OAuth 1.0a or OAuth 2.0 PKCE)

Get blocked users

1

Get your user ID

You need your authenticated user’s ID to retrieve your block list. You can get it from the /2/users/me endpoint or use the ID from your tokens.
2

Request your block list

cURL
curl "https://api.x.com/2/users/123456789/blocking?\
user.fields=username,verified,created_at&\
max_results=100" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN"
3

Review the response

{
  "data": [
    {
      "id": "17874544",
      "name": "Example User",
      "username": "example_user",
      "verified": false,
      "created_at": "2008-12-04T18:51:57.000Z"
    }
  ],
  "meta": {
    "result_count": 1,
    "next_token": "abc123"
  }
}

Block a user (Enterprise only)

1

Identify the target user

Get the user ID of the account you want to block.
2

Send a block request

cURL
curl -X POST "https://api.x.com/2/users/123456789/blocking" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"target_user_id": "9876543210"}'
3

Confirm the block

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

Unblock a user (Enterprise only)

1

Send an unblock request

cURL
curl -X DELETE "https://api.x.com/2/users/123456789/blocking/9876543210" \
  -H "Authorization: Bearer $USER_ACCESS_TOKEN"
2

Confirm the unblock

{
  "data": {
    "blocking": false
  }
}

Next steps