Skip to main content

Documentation Index

Fetch the complete documentation index at: https://generaltranslation.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through blocking and unblocking users, and retrieving your block list.
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

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

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

Mutes

Mute users instead of blocking

Follows

Manage follows

Integration guide

Key concepts and best practices

API Reference

Full endpoint documentation