{"meta":{"title":"Конечные точки REST API для ролей организации","intro":"Используйте REST API для взаимодействия с ролями организации.","product":"REST API","breadcrumbs":[{"href":"/ru/rest","title":"REST API"},{"href":"/ru/rest/orgs","title":"Организации"},{"href":"/ru/rest/orgs/organization-roles","title":"Роли организации"}],"documentType":"article"},"body":"# Конечные точки REST API для ролей организации\n\nИспользуйте REST API для взаимодействия с ролями организации.\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## Get all organization roles for an organization\n\n```\nGET /orgs/{org}/organization-roles\n```\n\nLists the organization roles available in this organization. For more information on organization roles, see \"Using organization roles.\"\nTo use this endpoint, the authenticated user must be one of:\n\nAn administrator for the organization.\nAn organization member (or a member of a team) assigned a custom organization role that includes the View organization roles (read_organization_custom_org_role) permission. For more information, see \"Permissions for organization access.\"\n\nOAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.\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- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n### HTTP response status codes\n\n- **200** - Response - list of organization roles\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 GET \\\n  https://api.github.com/orgs/ORG/organization-roles\n```\n\n**Response schema (Status: 200):**\n\n* `total_count`: integer\n* `roles`: array of `Organization Role`:\n  * `id`: required, integer, format: int64\n  * `name`: required, string\n  * `description`: string or null\n  * `base_role`: string or null, enum: `read`, `triage`, `write`, `maintain`, `admin`, `null`\n  * `source`: string or null, enum: `Organization`, `Enterprise`, `Predefined`, `null`\n  * `permissions`: required, array of string\n  * `organization`: required, any of:\n    * **null**\n    * **Simple User**\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  * `created_at`: required, string, format: date-time\n  * `updated_at`: required, string, format: date-time\n\n## Remove all organization roles for a team\n\n```\nDELETE /orgs/{org}/organization-roles/teams/{team_slug}\n```\n\nRemoves all assigned organization roles from a team. For more information on organization roles, see \"Using organization roles.\"\nThe authenticated user must be an administrator for the organization to use this endpoint.\nOAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.\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- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n- **`team_slug`** (string) (required)\n  The slug of the team name.\n\n### HTTP response status codes\n\n- **204** - No Content\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/orgs/ORG/organization-roles/teams/TEAM_SLUG\n```\n\n**Response schema (Status: 204):**\n\n## Assign an organization role to a team\n\n```\nPUT /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}\n```\n\nAssigns an organization role to a team in an organization. For more information on organization roles, see \"Using organization roles.\"\nThe authenticated user must be an administrator for the organization to use this endpoint.\nOAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.\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- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n- **`team_slug`** (string) (required)\n  The slug of the team name.\n\n- **`role_id`** (integer) (required)\n  The unique identifier of the role.\n\n### HTTP response status codes\n\n- **204** - No Content\n\n- **404** - Response if the organization, team or role does not exist.\n\n- **422** - Response if the organization roles feature is not enabled for the organization, or validation failed.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/orgs/ORG/organization-roles/teams/TEAM_SLUG/ROLE_ID\n```\n\n**Response schema (Status: 204):**\n\n## Remove an organization role from a team\n\n```\nDELETE /orgs/{org}/organization-roles/teams/{team_slug}/{role_id}\n```\n\nRemoves an organization role from a team. For more information on organization roles, see \"Using organization roles.\"\nThe authenticated user must be an administrator for the organization to use this endpoint.\nOAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.\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- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n- **`team_slug`** (string) (required)\n  The slug of the team name.\n\n- **`role_id`** (integer) (required)\n  The unique identifier of the role.\n\n### HTTP response status codes\n\n- **204** - No Content\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/orgs/ORG/organization-roles/teams/TEAM_SLUG/ROLE_ID\n```\n\n**Response schema (Status: 204):**\n\n## Remove all organization roles for a user\n\n```\nDELETE /orgs/{org}/organization-roles/users/{username}\n```\n\nRevokes all assigned organization roles from a user. For more information on organization roles, see \"Using organization roles.\"\nThe authenticated user must be an administrator for the organization to use this endpoint.\nOAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.\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- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\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### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/orgs/ORG/organization-roles/users/USERNAME\n```\n\n**Response schema (Status: 204):**\n\n## Assign an organization role to a user\n\n```\nPUT /orgs/{org}/organization-roles/users/{username}/{role_id}\n```\n\nAssigns an organization role to a member of an organization. For more information on organization roles, see \"Using organization roles.\"\nThe authenticated user must be an administrator for the organization to use this endpoint.\nOAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.\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- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n- **`username`** (string) (required)\n  The handle for the GitHub user account.\n\n- **`role_id`** (integer) (required)\n  The unique identifier of the role.\n\n### HTTP response status codes\n\n- **204** - No Content\n\n- **404** - Response if the organization, user or role does not exist.\n\n- **422** - Response if the organization roles feature is not enabled enabled for the organization, the validation failed, or the user is not an organization member.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X PUT \\\n  https://api.github.com/orgs/ORG/organization-roles/users/USERNAME/ROLE_ID\n```\n\n**Response schema (Status: 204):**\n\n## Remove an organization role from a user\n\n```\nDELETE /orgs/{org}/organization-roles/users/{username}/{role_id}\n```\n\nRemove an organization role from a user. For more information on organization roles, see \"Using organization roles.\"\nThe authenticated user must be an administrator for the organization to use this endpoint.\nOAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.\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- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n- **`username`** (string) (required)\n  The handle for the GitHub user account.\n\n- **`role_id`** (integer) (required)\n  The unique identifier of the role.\n\n### HTTP response status codes\n\n- **204** - No Content\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X DELETE \\\n  https://api.github.com/orgs/ORG/organization-roles/users/USERNAME/ROLE_ID\n```\n\n**Response schema (Status: 204):**\n\n## Get an organization role\n\n```\nGET /orgs/{org}/organization-roles/{role_id}\n```\n\nGets an organization role that is available to this organization. For more information on organization roles, see \"Using organization roles.\"\nTo use this endpoint, the authenticated user must be one of:\n\nAn administrator for the organization.\nAn organization member (or a member of a team) assigned a custom organization role that includes the View organization roles (read_organization_custom_org_role) permission. For more information, see \"Permissions for organization access.\"\n\nOAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.\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- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n- **`role_id`** (integer) (required)\n  The unique identifier of the role.\n\n### HTTP response status codes\n\n- **200** - OK\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 GET \\\n  https://api.github.com/orgs/ORG/organization-roles/ROLE_ID\n```\n\n**Response schema (Status: 200):**\n\n* `id`: required, integer, format: int64\n* `name`: required, string\n* `description`: string or null\n* `base_role`: string or null, enum: `read`, `triage`, `write`, `maintain`, `admin`, `null`\n* `source`: string or null, enum: `Organization`, `Enterprise`, `Predefined`, `null`\n* `permissions`: required, array of string\n* `organization`: required, any of:\n  * **null**\n  * **Simple User**\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* `created_at`: required, string, format: date-time\n* `updated_at`: required, string, format: date-time\n\n## List teams that are assigned to an organization role\n\n```\nGET /orgs/{org}/organization-roles/{role_id}/teams\n```\n\nLists the teams that are assigned to an organization role. For more information on organization roles, see \"Using organization roles.\"\nTo use this endpoint, you must be an administrator for the organization.\nOAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.\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- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n- **`role_id`** (integer) (required)\n  The unique identifier of the role.\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** - Response - List of assigned teams\n\n- **404** - Response if the organization or role does not exist.\n\n- **422** - Response if the organization roles feature is not enabled or validation failed.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/orgs/ORG/organization-roles/ROLE_ID/teams\n```\n\n**Response schema (Status: 200):**\n\nArray of `A Role Assignment for a Team`:\n  * `assignment`: string, enum: `direct`, `indirect`, `mixed`\n  * `id`: required, integer\n  * `node_id`: required, string\n  * `name`: required, string\n  * `slug`: required, string\n  * `description`: required, string or null\n  * `privacy`: string\n  * `notification_setting`: string\n  * `permission`: required, string\n  * `permissions`: object:\n    * `pull`: required, boolean\n    * `triage`: required, boolean\n    * `push`: required, boolean\n    * `maintain`: required, boolean\n    * `admin`: required, boolean\n  * `url`: required, string, format: uri\n  * `html_url`: required, string, format: uri\n  * `members_url`: required, string\n  * `repositories_url`: required, string, format: uri\n  * `parent`: required, any of:\n    * **null**\n    * **Team Simple**\n      * `id`: required, integer\n      * `node_id`: required, string\n      * `url`: required, string, format: uri\n      * `members_url`: required, string\n      * `name`: required, string\n      * `description`: required, string or null\n      * `permission`: required, string\n      * `privacy`: string\n      * `notification_setting`: string\n      * `html_url`: required, string, format: uri\n      * `repositories_url`: required, string, format: uri\n      * `slug`: required, string\n      * `ldap_dn`: string\n      * `type`: required, string, enum: `enterprise`, `organization`\n      * `organization_id`: integer\n      * `enterprise_id`: integer\n  * `type`: required, string, enum: `enterprise`, `organization`\n  * `organization_id`: integer\n  * `enterprise_id`: integer\n\n## List users that are assigned to an organization role\n\n```\nGET /orgs/{org}/organization-roles/{role_id}/users\n```\n\nLists organization members that are assigned to an organization role. For more information on organization roles, see \"Using organization roles.\"\nTo use this endpoint, you must be an administrator for the organization.\nOAuth app tokens and personal access tokens (classic) need the admin:org scope to use this endpoint.\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- **`org`** (string) (required)\n  The organization name. The name is not case sensitive.\n\n- **`role_id`** (integer) (required)\n  The unique identifier of the role.\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** - Response - List of assigned users\n\n- **404** - Response if the organization or role does not exist.\n\n- **422** - Response if the organization roles feature is not enabled or validation failed.\n\n### Code examples\n\n#### Example\n\n**Request:**\n\n```curl\ncurl -L \\\n  -X GET \\\n  https://api.github.com/orgs/ORG/organization-roles/ROLE_ID/users\n```\n\n**Response schema (Status: 200):**\n\nArray of `A Role Assignment for a User`:\n  * `assignment`: string, enum: `direct`, `indirect`, `mixed`\n  * `inherited_from`: array of `Team Simple`:\n    * `id`: required, integer\n    * `node_id`: required, string\n    * `url`: required, string, format: uri\n    * `members_url`: required, string\n    * `name`: required, string\n    * `description`: required, string or null\n    * `permission`: required, string\n    * `privacy`: string\n    * `notification_setting`: string\n    * `html_url`: required, string, format: uri\n    * `repositories_url`: required, string, format: uri\n    * `slug`: required, string\n    * `ldap_dn`: string\n    * `type`: required, string, enum: `enterprise`, `organization`\n    * `organization_id`: integer\n    * `enterprise_id`: integer\n  * `name`: string or null\n  * `email`: string or null\n  * `login`: required, string\n  * `id`: required, integer\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"}