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:
application/vnd.github.giant-sentry-fist-preview+json
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
Response
Status: 200 OK
[
{
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
}
]
Check whether you've blocked a user
GET /user/blocks/:username
Response
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
Response
Status: 204 No Content
Unblock a user
DELETE /user/blocks/:username
Response
Status: 204 No Content