Sample - GitHub REST API
GET/orgs/{org}/code-scanning/ai-scan

Get the AI Scan setting for an organization

[!NOTE] This endpoint is in public preview and is subject to change.

Gets the AI Scan setting stored on an organization.

The response reports the value stored on the organization. Organization respects enterprise policy.

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 admin:org, repo, or write:org scope to use this endpoint. Organization owners can use admin:org or repo; security managers need write:org.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

1 parameter
orgstringrequired
The organization name. The name is not case sensitive.

3 status codes
200Response
pr_scanstringrequired
Whether AI Scan on pull requests is enabled for the organization. The organization setting respects enterprise policy, and repositories inherit it: when disabled, repositories cannot enable AI Scan; when enabled, repositories can still opt out.
Allowed:enableddisabled
403Forbidden
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional
404Resource not found
messagestringoptional
documentation_urlstringoptional
urlstringoptional
statusstringoptional

Error handling

A 403 is returned: Forbidden. A 404 is returned: Resource not found.