REST API endpoints for blocking users

Use the REST API to block and unblock users in an organization.

About blocking users

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.

Note

Most endpoints use Authorization: Bearer <YOUR-TOKEN> and Accept: application/vnd.github+json headers, plus X-GitHub-Api-Version: 2026-03-10. Curl examples below omit these standard headers for brevity.

List users blocked by an organization

GET /orgs/{org}/blocks

List the users blocked by an organization.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X GET \
  https://api.github.com/orgs/ORG/blocks

Response schema (Status: 200):

Array of Simple User:

Check if a user is blocked by an organization

GET /orgs/{org}/blocks/{username}

Returns a 204 if the given user is blocked by the given organization. Returns a 404 if the organization is not blocking the user, or if the user account has been identified as spam by GitHub.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X GET \
  https://api.github.com/orgs/ORG/blocks/USERNAME

Response schema (Status: 204):

Block a user from an organization

PUT /orgs/{org}/blocks/{username}

Blocks the given user on behalf of the specified organization and returns a 204. If the organization cannot block the given user a 422 is returned.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X PUT \
  https://api.github.com/orgs/ORG/blocks/USERNAME

Response schema (Status: 204):

Unblock a user from an organization

DELETE /orgs/{org}/blocks/{username}

Unblocks the given user on behalf of the specified organization.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

curl -L \
  -X DELETE \
  https://api.github.com/orgs/ORG/blocks/USERNAME

Response schema (Status: 204):