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

Attach an enterprise configuration to repositories

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.

  • IdempotentThe SDK sends Idempotency-Key, so a retried request is only applied once.

2 parameters · 1 body field
enterprisestringrequired
The slug version of the enterprise name.
configuration_idintegerrequired
The unique identifier of the code security configuration.
scopestringrequired
The type of repositories to attach the configuration to.
Allowed:allall_without_configurations

5 status codes
202Accepted
403Forbidden
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
409Conflict because security configuration work is already in progress.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Validation failed because the request does not match the request schema.
messagestringrequired
documentation_urlstringrequired
errorsarray<string>optional

Error handling

A 403 is returned: Forbidden. A 404 is returned: Resource not found. A 409 is returned: Conflict because security configuration work is already in progress. A 422 is returned: Validation failed because the request does not match the request schema.