Block Another User

Note: The User Blocking API on GitHub is currently available for developers to preview. To access the API, you must provide a custom media type in the Accept header:


Warning: The API may change without advance notice during the preview period. Preview features are not supported for production use. If you experience any issues, contact GitHub Support or GitHub Premium Support.

List blocked users

List the users you've blocked on your personal account.

GET /user/blocks


Status: 200 OK
    "login": "octocat",
    "id": 1,
    "node_id": "MDQ6VXNlcjE=",
    "avatar_url": "",
    "gravatar_id": "",
    "url": "",
    "html_url": "",
    "followers_url": "",
    "following_url": "{/other_user}",
    "gists_url": "{/gist_id}",
    "starred_url": "{/owner}{/repo}",
    "subscriptions_url": "",
    "organizations_url": "",
    "repos_url": "",
    "events_url": "{/privacy}",
    "received_events_url": "",
    "type": "User",
    "site_admin": false

Check whether you've blocked a user

GET /user/blocks/:username


If the user is blocked:

Status: 204 No Content

If the user is not blocked:

Status: 404 Not Found

Block a user

PUT /user/blocks/:username


Status: 204 No Content

Unblock a user

DELETE /user/blocks/:username


Status: 204 No Content