Blocking Organizations Users
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' .
The token used to authenticate the call must have the admin:org scope in order to make any blocking calls for an organization. Otherwise, the response returns HTTP 404.
List blocked users
List the users blocked by an organization.
GET /orgs/:org/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 a user is blocked from an organization
GET /orgs/:org/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 /orgs/:org/blocks/:username
Response
Status: 204 No Content
Unblock a user
DELETE /orgs/:org/blocks/:username
Response
Status: 204 No Content

