REST API endpoints for blocking users

Use the REST API to manage blocked users.

About blocking users

If a request URL does not include a {username} parameter then the response will be for the signed-in user (and you must pass authentication information with your request). Additional private information, such as whether a user has two-factor authentication enabled, is included when authenticated through OAuth with the user scope.

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 the authenticated user

GET /user/blocks

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

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

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

Response schema (Status: 200):

Array of Simple User:

Check if a user is blocked by the authenticated user

GET /user/blocks/{username}

Returns a 204 if the given user is blocked by the authenticated user. Returns a 404 if the given user is not blocked by the authenticated user, or if the given 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/user/blocks/USERNAME

Response schema (Status: 204):

Block a user

PUT /user/blocks/{username}

Blocks the given user and returns a 204. If the authenticated user 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/user/blocks/USERNAME

Response schema (Status: 204):

Unblock a user

DELETE /user/blocks/{username}

Unblocks the given user and returns a 204.

Parameters

Headers

Path and query parameters

HTTP response status codes

Code examples

Example

Request:

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

Response schema (Status: 204):