Skip to content

Attach an enterprise configuration to repositories

POST
/enterprises/{enterprise}/code-security/configurations/{configuration_id}/attach

Attaches an enterprise code security configuration to repositories. If the repositories specified are already attached to a configuration, they will be re-attached to the provided configuration.

If insufficient GHAS licenses are available to attach the configuration to a repository, only free features will be enabled.

The authenticated user must be an administrator for the enterprise to use this endpoint.

OAuth app tokens and personal access tokens (classic) need the admin:enterprise scope to use this endpoint.

API method documentation

enterprise
required
string

The slug version of the enterprise name.

configuration_id
required
integer

The unique identifier of the code security configuration.

Media typeapplication/json
object
scope
required

The type of repositories to attach the configuration to.

string
Allowed values: all all_without_configurations
Examples
Exampledefault

Example for attaching a configuration to some repositories

{
"scope": "all"
}

Accepted

Media typeapplication/json
object
Examples
Exampledefault
null

Forbidden

Media typeapplication/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Examplegenerated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Resource not found

Media typeapplication/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Examplegenerated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}

Conflict

Media typeapplication/json
Basic Error

Basic Error

object
message
string
documentation_url
string
url
string
status
string
Examplegenerated
{
"message": "example",
"documentation_url": "example",
"url": "example",
"status": "example"
}