openapi: 3.0.3
info:
version: 1.1.4
title: GitHub Application About Code API
description: 'Use the REST API to retrieve information about GitHub Apps and GitHub App
installations.'
license:
name: MIT
url: https://spdx.org/licenses/MIT
termsOfService: https://docs.github.com/articles/github-terms-of-service
contact:
name: Support
url: https://support.github.com/contact?tags=dotcom-rest-api
x-github-plan: ghes
x-github-release: 3.9
servers:
- url: '{protocol}://{hostname}/api/v3'
variables:
hostname:
description: Self-hosted Enterprise Server hostname
default: HOSTNAME
protocol:
description: Self-hosted Enterprise Server protocol
default: http
tags:
- name: Code
paths:
/codes_of_conduct/{key}:
get:
summary: GitHub Get Code of Conduct
description: The GitHub Code of Conduct API endpoint `/codes_of_conduct/{key}` using the GET method retrieves detailed information about a specific code of conduct available on GitHub. By providing a unique key identifier in the path parameter, this operation returns comprehensive details about the selected code of conduct, including its name, full text content, URL, and other relevant metadata. This endpoint is useful for developers who want to programmatically access and display code of conduct information for their repositories, helping them understand the specific guidelines and behavioral expectations associated with a particular conduct policy that GitHub supports and makes available to the community.
tags:
- Code
operationId: getCodeOfConduct
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/codes-of-conduct/codes-of-conduct#get-a-code-of-conduct
parameters:
- name: key
in: path
required: true
schema:
type: string
example: example_value
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/code-of-conduct'
examples:
default:
$ref: '#/components/examples/code-of-conduct'
'304':
$ref: '#/components/responses/not_modified'
'404':
$ref: '#/components/responses/not_found'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: codes-of-conduct
subcategory: codes-of-conduct
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/orgs/{org}/code-scanning/alerts:
get:
summary: GitHub List Code Scanning Alerts for an Organization
description: 'Lists code scanning alerts for the default branch for all eligible repositories in an organization. Eligible repositories are repositories that are owned by organizations that you own or for which you are a security manager. For more information, see "[Managing security managers in your organization](https://docs.github.com/enterprise-server@3.9/organizations/managing-peoples-access-to-your-organization-with-roles/managing-security-managers-in-your-organization)."
The authenticated user must be an owner or security manager for the organization to use this endpoint.
OAuth app tokens and personal access tokens (classic) need the `security_events` or `repo`s cope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.'
tags:
- Code
operationId: listCodeScanningAlertsForAnOrganization
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-an-organization
parameters:
- $ref: '#/components/parameters/org'
- $ref: '#/components/parameters/tool-name'
- $ref: '#/components/parameters/tool-guid'
- $ref: '#/components/parameters/pagination-before'
- $ref: '#/components/parameters/pagination-after'
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/per-page'
- $ref: '#/components/parameters/direction'
- name: state
description: If specified, only code scanning alerts with this state will be returned.
in: query
required: false
schema:
$ref: '#/components/schemas/code-scanning-alert-state-query'
example: open
- name: sort
description: The property by which to sort the results.
in: query
required: false
schema:
type: string
enum:
- created
- updated
default: created
example: created
- name: severity
description: If specified, only code scanning alerts with this severity will be returned.
in: query
required: false
schema:
$ref: '#/components/schemas/code-scanning-alert-severity'
example: example_value
responses:
'200':
description: Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/code-scanning-organization-alert-items'
examples:
default:
$ref: '#/components/examples/code-scanning-organization-alert-items'
headers:
Link:
$ref: '#/components/headers/link'
'404':
$ref: '#/components/responses/not_found'
'503':
$ref: '#/components/responses/service_unavailable'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: code-scanning
subcategory: code-scanning
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/repos/{owner}/{repo}/code-scanning/alerts:
get:
summary: GitHub List Code Scanning Alerts for Repository
description: Lists code scanning alerts. The response includes a `most_recent_instance` object.
tags:
- Code
operationId: listCodeScanningAlertsForRepository
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/code-scanning/code-scanning#list-code-scanning-alerts-for-a-repository
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- $ref: '#/components/parameters/tool-name'
- $ref: '#/components/parameters/tool-guid'
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/per-page'
- $ref: '#/components/parameters/git-ref'
- $ref: '#/components/parameters/direction'
- name: sort
description: The property by which to sort the results.
in: query
required: false
schema:
type: string
enum:
- created
- updated
default: created
example: created
- name: state
description: If specified, only code scanning alerts with this state will be returned.
in: query
required: false
schema:
$ref: '#/components/schemas/code-scanning-alert-state-query'
example: open
- name: severity
description: If specified, only code scanning alerts with this severity will be returned.
in: query
required: false
schema:
$ref: '#/components/schemas/code-scanning-alert-severity'
example: example_value
- in: header
name: Authorization
schema:
type: string
example: example_value
- in: header
name: X-GitHub-Api-Version
schema:
type: string
default: '2022-11-28'
example: example_value
- in: header
name: Accept
schema:
type: string
default: application/vnd.github+json
example: example_value
responses:
'200':
description: Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/code-scanning-alert-items'
examples:
default:
$ref: '#/components/examples/code-scanning-alert-items'
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/code_scanning_forbidden_read'
'404':
$ref: '#/components/responses/not_found'
'503':
$ref: '#/components/responses/service_unavailable'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: code-scanning
subcategory: code-scanning
x-api-evangelist-certified: '2025-07-16'
x-api-naftiko-published: '2025-07-25'
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/repos/{owner}/{repo}/code-scanning/alerts/{alert_number}:
get:
summary: GitHub Get Code Scanning Alert
description: 'Gets a single code scanning alert.
OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.'
tags:
- Code
operationId: getCodeScanningAlert
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/code-scanning/code-scanning#get-a-code-scanning-alert
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- $ref: '#/components/parameters/alert-number'
- in: header
name: Authorization
schema:
type: string
example: example_value
- in: header
name: X-GitHub-Api-Version
schema:
type: string
default: '2022-11-28'
example: example_value
- in: header
name: Accept
schema:
type: string
default: application/vnd.github+json
example: example_value
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/code-scanning-alert'
examples:
default:
$ref: '#/components/examples/code-scanning-alert'
'304':
$ref: '#/components/responses/not_modified'
'403':
$ref: '#/components/responses/code_scanning_forbidden_read'
'404':
$ref: '#/components/responses/not_found'
'503':
$ref: '#/components/responses/service_unavailable'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: code-scanning
subcategory: code-scanning
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
patch:
summary: GitHub Update Code Scanning Alert
description: 'Updates the status of a single code scanning alert.
OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.'
operationId: updateCodeScanningAlert
tags:
- Code
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/code-scanning/code-scanning#update-a-code-scanning-alert
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- $ref: '#/components/parameters/alert-number'
- in: header
name: Authorization
schema:
type: string
example: example_value
- in: header
name: X-GitHub-Api-Version
schema:
type: string
default: '2022-11-28'
example: example_value
- in: header
name: Accept
schema:
type: string
default: application/vnd.github+json
example: example_value
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
state:
$ref: '#/components/schemas/code-scanning-alert-set-state'
dismissed_reason:
$ref: '#/components/schemas/code-scanning-alert-dismissed-reason_2'
dismissed_comment:
$ref: '#/components/schemas/code-scanning-alert-dismissed-comment_2'
required:
- state
examples:
default:
value:
state: dismissed
dismissed_reason: false positive
dismissed_comment: This alert is not actually correct, because there's a sanitizer included in the library.
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/code-scanning-alert'
examples:
default:
$ref: '#/components/examples/code-scanning-alert-dismissed'
'403':
$ref: '#/components/responses/code_scanning_forbidden_write'
'404':
$ref: '#/components/responses/not_found'
'503':
$ref: '#/components/responses/service_unavailable'
x-github:
enabledForGitHubApps: true
githubCloudOnly: false
category: code-scanning
subcategory: code-scanning
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/instances:
get:
summary: GitHub List Instances of Code Scanning Alert
description: 'Lists all instances of the specified code scanning alert.
OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.'
tags:
- Code
operationId: listInstancesOfCodeScanningAlert
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/code-scanning/code-scanning#list-instances-of-a-code-scanning-alert
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- $ref: '#/components/parameters/alert-number'
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/per-page'
- $ref: '#/components/parameters/git-ref'
- in: header
name: Authorization
schema:
type: string
example: example_value
- in: header
name: X-GitHub-Api-Version
schema:
type: string
default: '2022-11-28'
example: example_value
- in: header
name: Accept
schema:
type: string
default: application/vnd.github+json
example: example_value
responses:
'200':
description: Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/code-scanning-alert-instance'
examples:
default:
$ref: '#/components/examples/code-scanning-alert-instances'
'403':
$ref: '#/components/responses/code_scanning_forbidden_read'
'404':
$ref: '#/components/responses/not_found'
'503':
$ref: '#/components/responses/service_unavailable'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: code-scanning
subcategory: code-scanning
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/repos/{owner}/{repo}/code-scanning/analyses:
get:
summary: GitHub List Code Scanning Analyses for Repository
description: 'Lists the details of all code scanning analyses for a repository,
starting with the most recent.
The response is paginated and you can use the `page` and `per_page` parameters
to list the analyses you''re interested in.
By default 30 analyses are listed per page.
The `rules_count` field in the response give the number of rules
that were run in the analysis.
For very old analyses this data is not available,
and `0` is returned in this field.
**Deprecation notice**:
The `tool_name` field is deprecated and will, in future, not be included in the response for this endpoint. The example response reflects this change. The tool name can now be found inside the `tool` field.
OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.'
operationId: listCodeScanningAnalysesForRepository
tags:
- Code
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/code-scanning/code-scanning#list-code-scanning-analyses-for-a-repository
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- $ref: '#/components/parameters/tool-name'
- $ref: '#/components/parameters/tool-guid'
- $ref: '#/components/parameters/page'
- $ref: '#/components/parameters/per-page'
- name: ref
in: query
description: The Git reference for the analyses you want to list. The `ref` for a branch can be formatted either as `refs/heads/<branch name>` or simply `<branch name>`. To reference a pull request use `refs/pull/<number>/merge`.
required: false
schema:
$ref: '#/components/schemas/code-scanning-ref'
example: main
- name: sarif_id
in: query
description: Filter analyses belonging to the same SARIF upload.
required: false
schema:
$ref: '#/components/schemas/code-scanning-analysis-sarif-id'
example: '12345678'
- $ref: '#/components/parameters/direction'
- name: sort
description: The property by which to sort the results.
in: query
required: false
schema:
type: string
enum:
- created
default: created
example: created
- in: header
name: Authorization
schema:
type: string
example: example_value
- in: header
name: X-GitHub-Api-Version
schema:
type: string
default: '2022-11-28'
example: example_value
- in: header
name: Accept
schema:
type: string
default: application/vnd.github+json
example: example_value
responses:
'200':
description: Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/code-scanning-analysis'
examples:
default:
$ref: '#/components/examples/code-scanning-analysis-items'
'403':
$ref: '#/components/responses/code_scanning_forbidden_read'
'404':
$ref: '#/components/responses/not_found'
'503':
$ref: '#/components/responses/service_unavailable'
x-github:
enabledForGitHubApps: true
githubCloudOnly: false
category: code-scanning
subcategory: code-scanning
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/repos/{owner}/{repo}/code-scanning/analyses/{analysis_id}:
get:
summary: GitHub Get Code Scanning Analysis for Repository
description: 'Gets a specified code scanning analysis for a repository.
The default JSON response contains fields that describe the analysis.
This includes the Git reference and commit SHA to which the analysis relates,
the datetime of the analysis, the name of the code scanning tool,
and the number of alerts.
The `rules_count` field in the default response give the number of rules
that were run in the analysis.
For very old analyses this data is not available,
and `0` is returned in this field.
This endpoint supports the following custom media types. For more information, see "[Media types](https://docs.github.com/enterprise-server@3.9/rest/using-the-rest-api/getting-started-with-the-rest-api#media-types)."
- **`application/sarif+json`**: Instead of returning a summary of the analysis, this endpoint returns a subset of the analysis data that was uploaded. The data is formatted as [SARIF version 2.1.0](https://docs.oasis-open.org/sarif/sarif/v2.1.0/cs01/sarif-v2.1.0-cs01.html). It also returns additional data such as the `github/alertNumber` and `github/alertUrl` properties.
OAuth app tokens and personal access tokens (classic) need the `security_events` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.'
operationId: getCodeScanningAnalysisForRepository
tags:
- Code
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/code-scanning/code-scanning#get-a-code-scanning-analysis-for-a-repository
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- name: analysis_id
in: path
description: The ID of the analysis, as returned from the `GET /repos/{owner}/{repo}/code-scanning/analyses` operation.
required: true
schema:
type: integer
example: 42
- in: header
name: Authorization
schema:
type: string
example: example_value
- in: header
name: X-GitHub-Api-Version
schema:
type: string
default: '2022-11-28'
example: example_value
- in: header
name: Accept
schema:
type: string
default: application/vnd.github+json
example: example_value
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/code-scanning-analysis'
examples:
response:
$ref: '#/components/examples/code-scanning-analysis-default'
application/json+sarif:
schema:
type: object
additionalProperties: true
examples:
response:
$ref: '#/components/examples/code-scanning-analysis-sarif'
'403':
$ref: '#/components/responses/code_scanning_forbidden_read'
'404':
$ref: '#/components/responses/not_found'
'503':
$ref: '#/components/responses/service_unavailable'
x-github:
enabledForGitHubApps: true
githubCloudOnly: false
category: code-scanning
subcategory: code-scanning
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
delete:
summary: GitHub Delete Code Scanning Analysis from Repository
description: "Deletes a specified code scanning analysis from a repository.\n\nYou can delete one analysis at a time.\nTo delete a series of analyses, start with the most recent analysis and work backwards.\nConceptually, the process is similar to the undo function in a text editor.\n\nWhen you list the analyses for a repository,\none or more will be identified as deletable in the response:\n\n```\n\"deletable\": true\n```\n\nAn analysis is deletable when it's the most recent in a set of analyses.\nTypically, a repository will have multiple sets of analyses\nfor each enabled code scanning tool,\nwhere a set is determined by a unique combination of analysis values:\n\n* `ref`\n* `tool`\n* `category`\n\nIf you attempt to delete an analysis that is not the most recent in a set,\nyou'll Get 400 response with the message:\n\n```\nAnalysis specified is not deletable.\n```\n\nThe response from a successful `DELETE` operation provides you with\ntwo alternative URLs for deleting the next analysis in the set:\n`next_analysis_url` and `confirm_delete_url`.\nUse the `next_analysis_url` URL if you want to avoid accidentally deleting the final analysis\nin a set. This is a useful option if you want to preserve at least one analysis\nfor the specified tool in your repository.\nUse the `confirm_delete_url` URL if you are content to remove all analyses for a tool.\nWhen you delete the last analysis in a set, the value of `next_analysis_url` and `confirm_delete_url`\nin the 200 response is `null`.\n\nAs an example of the deletion process,\nlet's imagine that you added a workflow that configured a particular code scanning tool\nto analyze the code in a repository. This tool has added 15 analyses:\n10 on the default branch, and another 5 on a topic branch.\nYou therefore have two separate sets of analyses for this tool.\nYou've now decided that you want to remove all of the analyses for the tool.\nTo do this you must make 15 separate deletion requests.\nTo start, you must find an analysis that's identified as deletable.\nEach set of analyses always has one that's identified as deletable.\nHaving found the deletable analysis for one of the two sets,\ndelete this analysis and then continue deleting the next analysis in the set until they're all deleted.\nThen repeat the process for the second set.\nThe procedure therefore consists of a nested loop:\n\n**Outer loop**:\n* List the analyses for the repository, filtered by tool.\n* Parse this list to find a deletable analysis. If found:\n\n\n\n\n\n\n\n\n\n\n\n **Inner loop**:\n * Delete the identified analysis.\n * Parse the response for the value of `confirm_delete_url` and, if found, use this in the next iteration.\n\nThe above process assumes that you want to remove all trace of the tool's analyses from the GitHub user interface, for the specified repository, and it therefore uses the `confirm_delete_url` value. Alternatively, you could use the `next_analysis_url` value, which would leave the last analysis in each set undeleted to avoid removing a tool's analysis entirely.\n\nOAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories."
operationId: deleteCodeScanningAnalysisFromRepository
tags:
- Code
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/code-scanning/code-scanning#delete-a-code-scanning-analysis-from-a-repository
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- name: analysis_id
in: path
description: The ID of the analysis, as returned from the `GET /repos/{owner}/{repo}/code-scanning/analyses` operation.
required: true
schema:
type: integer
example: 42
- name: confirm_delete
in: query
description: 'Allow deletion if the specified analysis is the last in a set. If you attempt to delete the final analysis in a set without setting this parameter to `true`, you''ll Get 400 response with the message: `Analysis is last of its type and deletion may result in the loss of historical alert data. Please specify confirm_delete.`'
required: false
schema:
type: string
example: example_value
- in: header
name: Authorization
schema:
type: string
example: example_value
- in: header
name: X-GitHub-Api-Version
schema:
type: string
default: '2022-11-28'
example: example_value
- in: header
name: Accept
schema:
type: string
default: application/vnd.github+json
example: example_value
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/code-scanning-analysis-deletion'
examples:
default-response:
$ref: '#/components/examples/code-scanning-analysis-deletion'
'400':
$ref: '#/components/responses/bad_request'
'403':
$ref: '#/components/responses/code_scanning_forbidden_write'
'404':
$ref: '#/components/responses/not_found'
'503':
$ref: '#/components/responses/service_unavailable'
x-github:
enabledForGitHubApps: true
githubCloudOnly: false
category: code-scanning
subcategory: code-scanning
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
/repos/{owner}/{repo}/code-scanning/default-setup:
get:
summary: GitHub Get Code Scanning Default Setup Configuration
description: 'Gets a code scanning default setup configuration.
OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.'
tags:
- Code
operationId: getCodeScanningDefaultSetupConfiguration
externalDocs:
description: API method documentation
url: https://docs.github.com/enterprise-server@3.9/rest/code-scanning/code-scanning#get-a-code-scanning-default-setup-configuration
parameters:
- $ref: '#/components/parameters/owner'
- $ref: '#/components/parameters/repo'
- in: header
name: Authorization
schema:
type: string
example: example_value
- in: header
name: X-GitHub-Api-Version
schema:
type: string
default: '2022-11-28'
example: example_value
- in: header
name: Accept
schema:
type: string
default: application/vnd.github+json
example: example_value
responses:
'200':
description: Response
content:
application/json:
schema:
$ref: '#/components/schemas/code-scanning-default-setup'
examples:
default:
$ref: '#/components/examples/code-scanning-default-setup'
'403':
$ref: '#/components/responses/code_scanning_forbidden_read'
'404':
$ref: '#/components/responses/not_found'
'503':
$ref: '#/components/responses/service_unavailable'
x-github:
githubCloudOnly: false
enabledForGitHubApps: true
category: code-scanning
subcategory: code-scanning
security:
- bearerHttpAuthentication: []
x-microcks-operation:
delay: 0
dispatcher: FALLBACK
patch:
summary: GitHub Update Code Scanning Default Setup Configuration
description: 'Updates a code scanning default setup configuration.
OAuth app tokens and personal access tokens (classic) need the `repo` scope to use this endpoint with private or public repositories, or the `public_repo` scope to use this endpoint with only public repositories.'
tags:
- Code
operationId: updateCodeScanningDefaultSetupConfiguration
# --- truncated at 32 KB (724 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/github/refs/heads/main/openapi/github-code-api-openapi.yml