← All tags

Code-Security API Reference

Endpoints to manage Code security using the REST API.

20 endpoints tagged code-security, each listing its parameters and possible responses. Search or scroll the index below to jump to a specific endpoint.

No endpoints match your search.

Get code security configurations for an enterprise

GET /enterprises/{enterprise}/code-security/configurations

Lists all code security configurations available in an enterprise.

Parameters

NameInRequiredDescription
enterprisepathyesThe slug version of the enterprise name.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
beforequerynoA cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
afterquerynoA cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
403Forbiddenyes
404Resource not foundyes

Create a code security configuration for an enterprise

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

Creates a code security configuration in an enterprise.

Parameters

NameInRequiredDescription
enterprisepathyesThe slug version of the enterprise name.

Responses

StatusDescriptionHas JSON body
201Successfully created code security configurationyes
400Bad Requestyes
403Forbiddenyes
404Resource not foundyes

Get default code security configurations for an enterprise

GET /enterprises/{enterprise}/code-security/configurations/defaults

Lists the default code security configurations for an enterprise.

Parameters

NameInRequiredDescription
enterprisepathyesThe slug version of the enterprise name.

Responses

StatusDescriptionHas JSON body
200Responseyes

Retrieve a code security configuration of an enterprise

GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}

Gets a code security configuration available in an enterprise.

Parameters

NameInRequiredDescription
enterprisepathyesThe slug version of the enterprise name.
configuration_idpathyesThe unique identifier of the code security configuration.

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
403Forbiddenyes
404Resource not foundyes

Update a custom code security configuration for an enterprise

PATCH /enterprises/{enterprise}/code-security/configurations/{configuration_id}

Updates a code security configuration in an enterprise.

Parameters

NameInRequiredDescription
enterprisepathyesThe slug version of the enterprise name.
configuration_idpathyesThe unique identifier of the code security configuration.

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
403Forbiddenyes
404Resource not foundyes
409Conflictyes

Delete a code security configuration for an enterprise

DELETE /enterprises/{enterprise}/code-security/configurations/{configuration_id}

Deletes a code security configuration from an enterprise.

Parameters

NameInRequiredDescription
enterprisepathyesThe slug version of the enterprise name.
configuration_idpathyesThe unique identifier of the code security configuration.

Responses

StatusDescriptionHas JSON body
204A header with no content is returned.no
400Bad Requestyes
403Forbiddenyes
404Resource not foundyes
409Conflictyes

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.

Parameters

NameInRequiredDescription
enterprisepathyesThe slug version of the enterprise name.
configuration_idpathyesThe unique identifier of the code security configuration.

Responses

StatusDescriptionHas JSON body
202Acceptedyes
403Forbiddenyes
404Resource not foundyes
409Conflictyes

Set a code security configuration as a default for an enterprise

PUT /enterprises/{enterprise}/code-security/configurations/{configuration_id}/defaults

Sets a code security configuration as a default to be applied to new repositories in your enterprise.

Parameters

NameInRequiredDescription
enterprisepathyesThe slug version of the enterprise name.
configuration_idpathyesThe unique identifier of the code security configuration.

Responses

StatusDescriptionHas JSON body
200Default successfully changed.yes
403Forbiddenyes
404Resource not foundyes

Get repositories associated with an enterprise code security configuration

GET /enterprises/{enterprise}/code-security/configurations/{configuration_id}/repositories

Lists the repositories associated with an enterprise code security configuration in an organization.

Parameters

NameInRequiredDescription
enterprisepathyesThe slug version of the enterprise name.
configuration_idpathyesThe unique identifier of the code security configuration.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
beforequerynoA cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
afterquerynoA cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."
statusquerynoA comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned.

Responses

StatusDescriptionHas JSON body
200Responseyes
403Forbiddenyes
404Resource not foundyes

Get code security configurations for an organization

GET /orgs/{org}/code-security/configurations

Lists all code security configurations available in an organization.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
target_typequerynoThe target type of the code security configuration
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
beforequerynoA cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
afterquerynoA cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."

Responses

StatusDescriptionHas JSON body
200Responseyes
403Forbiddenyes
404Resource not foundyes

Create a code security configuration

POST /orgs/{org}/code-security/configurations

Creates a code security configuration in an organization.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
201Successfully created code security configurationyes

Get default code security configurations

GET /orgs/{org}/code-security/configurations/defaults

Lists the default code security configurations for an organization.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
403Forbiddenyes
404Resource not foundyes

Detach configurations from repositories

DELETE /orgs/{org}/code-security/configurations/detach

Detach code security configuration(s) from a set of repositories.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
204A header with no content is returned.no
400Bad Requestyes
403Forbiddenyes
404Resource not foundyes
409Conflictyes

Get a code security configuration

GET /orgs/{org}/code-security/configurations/{configuration_id}

Gets a code security configuration available in an organization.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
configuration_idpathyesThe unique identifier of the code security configuration.

Responses

StatusDescriptionHas JSON body
200Responseyes
304Not modifiedno
403Forbiddenyes
404Resource not foundyes

Update a code security configuration

PATCH /orgs/{org}/code-security/configurations/{configuration_id}

Updates a code security configuration in an organization.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
configuration_idpathyesThe unique identifier of the code security configuration.

Responses

StatusDescriptionHas JSON body
200Response when a configuration is updatedyes
204Response when no new updates are madeno

Delete a code security configuration

DELETE /orgs/{org}/code-security/configurations/{configuration_id}

Deletes the desired code security configuration from an organization.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
configuration_idpathyesThe unique identifier of the code security configuration.

Responses

StatusDescriptionHas JSON body
204A header with no content is returned.no
400Bad Requestyes
403Forbiddenyes
404Resource not foundyes
409Conflictyes

Attach a configuration to repositories

POST /orgs/{org}/code-security/configurations/{configuration_id}/attach

Attach a code security configuration to a set of repositories. If the repositories specified are already attached to a configuration, they will be re-attached to the provided configuration.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
configuration_idpathyesThe unique identifier of the code security configuration.

Responses

StatusDescriptionHas JSON body
202Acceptedyes

Set a code security configuration as a default for an organization

PUT /orgs/{org}/code-security/configurations/{configuration_id}/defaults

Sets a code security configuration as a default to be applied to new repositories in your organization.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
configuration_idpathyesThe unique identifier of the code security configuration.

Responses

StatusDescriptionHas JSON body
200Default successfully changed.yes
403Forbiddenyes
404Resource not foundyes

Get repositories associated with a code security configuration

GET /orgs/{org}/code-security/configurations/{configuration_id}/repositories

Lists the repositories associated with a code security configuration in an organization.

Parameters

NameInRequiredDescription
orgpathyesThe organization name. The name is not case sensitive.
configuration_idpathyesThe unique identifier of the code security configuration.
per_pagequerynoThe number of results per page (max 100). For more information, see "Using pagination in the REST API."
beforequerynoA cursor, as given in the Link header. If specified, the query only searches for results before this cursor. For more information, see "Using pagination in the REST API."
afterquerynoA cursor, as given in the Link header. If specified, the query only searches for results after this cursor. For more information, see "Using pagination in the REST API."
statusquerynoA comma-separated list of statuses. If specified, only repositories with these attachment statuses will be returned.

Responses

StatusDescriptionHas JSON body
200Responseyes
403Forbiddenyes
404Resource not foundyes

Get the code security configuration associated with a repository

GET /repos/{owner}/{repo}/code-security-configuration

Get the code security configuration that manages a repository's code security settings.

Parameters

NameInRequiredDescription
ownerpathyesThe account owner of the repository. The name is not case sensitive.
repopathyesThe name of the repository without the .git extension. The name is not case sensitive.

Responses

StatusDescriptionHas JSON body
200Responseyes
204A header with no content is returned.no
304Not modifiedno
403Forbiddenyes
404Resource not foundyes