POST/repos/{owner}/{repo}/code-scanning/alerts/{alert_number}/autofix

Create an autofix for a code scanning alert

Creates an autofix for a code scanning alert using the repository's default branch. If an autofix already exists, the response returns it; if one is being generated, the response confirms the request was accepted. OAuth app tokens and personal access tokens (classic) require the security_events scope for public or private repositories, or the public_repo scope for public repositories only.

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

3 parameters
ownerstringrequired
The account that owns the repository. The name is not case sensitive.
repostringrequired
The repository name without the `.git` extension. The name is not case sensitive.
alert_numberintegerrequired
The number identifying the code scanning alert, available in the alert URL and the `number` field returned by the code scanning alerts list operation.

7 status codes
200Returns the existing autofix with its status, description, and start time.
statusstringrequired
The status of an autofix.
Allowed:pendingerrorsuccessoutdated
descriptionstringrequired
The description of an autofix.
started_atstringrequired
The start time of an autofix in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
202Returns the autofix status, description, and start time when a new autofix is created or is being generated.
statusstringrequired
The status of an autofix.
Allowed:pendingerrorsuccessoutdated
descriptionstringrequired
The description of an autofix.
started_atstringrequired
The start time of an autofix in ISO 8601 format: `YYYY-MM-DDTHH:MM:SSZ`.
400Returned when the request is invalid.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
403Returned when the repository is archived, GitHub Advanced Security is not enabled for the repository, or the rate limit is exceeded.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Returned when the requested resource is not found.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
422Returned when the request cannot be processed.
500Returned when an internal error occurs.
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional

Error handling

A 400 is returned when the request is invalid; a 403 is returned if the repository is archived, GitHub Advanced Security is not enabled, or the rate limit is exceeded; a 404 is returned when the repository or alert is not found. A 422 indicates the request cannot be processed, and a 500 indicates an internal error. The owner and repo path parameters must identify the repository, alert_number must identify the alert, and the token must have the applicable scope.