{"meta":{"title":"REST-API-Endpunkte zum Blockieren von Benutzern","intro":"Verwende die REST-API, um blockierte Benutzer*innen zu verwalten.","product":"REST-API","breadcrumbs":[{"href":"/de/enterprise-cloud@latest/rest","title":"REST-API"},{"href":"/de/enterprise-cloud@latest/rest/users","title":"Benutzer"},{"href":"/de/enterprise-cloud@latest/rest/users/blocking","title":"Blockieren von Benutzern"}],"documentType":"article"},"body":"# REST-API-Endpunkte zum Blockieren von Benutzern\n\nVerwende die REST-API, um blockierte Benutzer\\*innen zu verwalten.\n\n## Informationen zum Blockieren von Benutzern\n\nWenn eine Anforderungs-URL keinen `{username}`-Parameter enthält, gilt die Antwort für den*die angemeldete*n Benutzer\\*in (und Sie müssen [Authentifizierungsinformationen](/de/enterprise-cloud@latest/rest/authentication/authenticating-to-the-rest-api) mit Ihrer Anforderung übergeben). Zusätzliche private Informationen, z. B. ob ein Benutzer die zweistufige Authentifizierung aktiviert hat, werden bei der Authentifizierung über OAuth mit dem `user` Zugriffsbereich eingeschlossen.\n\n> \\[!NOTE]\n> 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.\n\n## List users blocked by the authenticated user\n\n```\nGET /user/blocks\n```\n\nList the users you've blocked on your personal account.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`per_page`** (integer)\n  The number of results per page (max 100). For more information, see \"Using pagination in the REST API.\"\n  Default: `30`\n\n* **`page`** (integer)\n  The page number of the results to fetch. For more information, see \"Using pagination in the REST API.\"\n  Default: `1`\n\n### HTTP response status codes\n\n* **200** - OK\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/user/blocks\n```\n\n**Response schema (Status: 200):**\n\nArray of `Simple User`:\n\n* `name`: string or null\n* `email`: string or null\n* `login`: required, string\n* `id`: required, integer, format: int64\n* `node_id`: required, string\n* `avatar_url`: required, string, format: uri\n* `gravatar_id`: required, string or null\n* `url`: required, string, format: uri\n* `html_url`: required, string, format: uri\n* `followers_url`: required, string, format: uri\n* `following_url`: required, string\n* `gists_url`: required, string\n* `starred_url`: required, string\n* `subscriptions_url`: required, string, format: uri\n* `organizations_url`: required, string, format: uri\n* `repos_url`: required, string, format: uri\n* `events_url`: required, string\n* `received_events_url`: required, string, format: uri\n* `type`: required, string\n* `site_admin`: required, boolean\n* `starred_at`: string\n* `user_view_type`: string\n\n## Check if a user is blocked by the authenticated user\n\n```\nGET /user/blocks/{username}\n```\n\nReturns 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.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`username`** (string) (required)\n  The handle for the GitHub user account.\n\n### HTTP response status codes\n\n* **204** - If the user is blocked\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - If the user is not blocked\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/user/blocks/USERNAME\n```\n\n**Response schema (Status: 204):**\n\n## Block a user\n\n```\nPUT /user/blocks/{username}\n```\n\nBlocks the given user and returns a 204. If the authenticated user cannot block the given user a 422 is returned.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`username`** (string) (required)\n  The handle for the GitHub user account.\n\n### HTTP response status codes\n\n* **204** - No Content\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n* **422** - Validation failed, or the endpoint has been spammed.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/user/blocks/USERNAME\n```\n\n**Response schema (Status: 204):**\n\n## Unblock a user\n\n```\nDELETE /user/blocks/{username}\n```\n\nUnblocks the given user and returns a 204.\n\n### Parameters\n\n#### Headers\n\n* **`accept`** (string)\n  Setting to `application/vnd.github+json` is recommended.\n\n#### Path and query parameters\n\n* **`username`** (string) (required)\n  The handle for the GitHub user account.\n\n### HTTP response status codes\n\n* **204** - No Content\n\n* **304** - Not modified\n\n* **401** - Requires authentication\n\n* **403** - Forbidden\n\n* **404** - Resource not found\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/user/blocks/USERNAME\n```\n\n**Response schema (Status: 204):**"}