Repository interaction restrictions

The Repository Interactions API allows people with owner or admin access to temporarily restrict which users can comment, open issues, or create pull requests in a public repository. When restrictions are enabled, only the specified group of GitHub users will be able to participate in interactions. Restrictions expire 24 hours from the time they are set. Here's more about the groups of GitHub users:

  • Existing users: When you limit interactions to existing_users, new users with accounts less than 24 hours old who have not previously contributed and are not collaborators will be temporarily restricted in the respository.
  • Contributors only: When you limit interactions to contributors_only, users who have not previously contributed and are not collaborators will be temporarily restricted in the respository.
  • Collaborators only: When you limit interactions to collaborators_only, users who are not collaborators will be temporarily restricted in the respository.

Get interaction restrictions for a repository

Note: The Interactions APIs are currently in public preview. See the blog post preview for more details. To access the API during the preview period, you must provide a custom media type in the Accept header:

application/vnd.github.sombra-preview

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.

Shows which group of GitHub users can interact with this repository and when the restriction expires. If there are no restrictions, you will see an empty response.

GET /repos/:owner/:repo/interaction-limits

Response

Status: 200 OK
{
  "limit": "collaborators_only",
  "origin": "repository",
  "expires_at": "2018-08-17T04:18:39Z"
}

Add or update interaction restrictions for a repository

Note: The Interactions APIs are currently in public preview. See the blog post preview for more details. To access the API during the preview period, you must provide a custom media type in the Accept header:

application/vnd.github.sombra-preview

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.

Temporarily restricts interactions to certain GitHub users within the given repository. You must have owner or admin access to set restrictions.

PUT /repos/:owner/:repo/interaction-limits

Parameters

Name Type Description
limit string Required. Specifies the group of GitHub users who can comment, open issues, or create pull requests for the given repository. Must be one of: existing_users, contributors_only, or collaborators_only.

Example

{
  "limit": "collaborators_only"
}

Response

Status: 200 OK
{
  "limit": "collaborators_only",
  "origin": "repository",
  "expires_at": "2018-08-17T04:18:39Z"
}

Remove interaction restrictions for a repository

Note: The Interactions APIs are currently in public preview. See the blog post preview for more details. To access the API during the preview period, you must provide a custom media type in the Accept header:

application/vnd.github.sombra-preview

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.

Removes all interaction restrictions from the given repository. You must have owner or admin access to remove restrictions.

DELETE /repos/:owner/:repo/interaction-limits

Response

Status: 204 No Content