> For the complete documentation index, see [llms.txt](https://docs.sonarsource.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sonarsource.com/sonarqube-server/2025.4/ai-capabilities/autodetect-ai-code.md).

# Autodetect AI code

SonarQube Server 2025.4 can autodetect the likelihood of AI-generated code in your projects on GitHub using GitHub Copilot.

Knowing if your project contains AI-generated code helps raise awareness of code ownership and code security. To help build this awareness, SonarQube Server can autodetect AI-generated code in projects using GitHub Copilot.

* If turned on, the feature alerts Project Admins when project contributors recently used GitHub Copilot.
* If Copilot usage is detected, Project Admins can implement the tags and quality gates associated with your team’s *AI Code Assurance profile* to better call out projects that contain AI code.

**Autodetect AI-Generated Code** is turned on by default in SonarQube Server, but your GitHub App must have the appropriate permissions in order to allow communication with SonarQube Server.

For full details about the feature including instructions and requirements, see [Autodetect AI code](/sonarqube-server/2025.4/instance-administration/ai-features/autodetect-ai-code.md) page.

If you’re a GitHub Admin and want more information about the required permission levels in GitHub, see [Permissions for AI autodetect](/sonarqube-server/2025.4/instance-administration/ai-features/permissions-for-ai-autodetect.md).

## Related pages <a href="#related-pages" id="related-pages"></a>

* [AI Code Assurance](/sonarqube-server/2025.4/ai-capabilities/ai-code-assurance.md)
* [Overview](/sonarqube-server/2025.4/ai-capabilities/overview.md) of AI capabilities
* Learning about [AI CodeFix](/sonarqube-server/2025.4/ai-capabilities/ai-codefix.md) to get AI-generated fix suggestions
* An [Overview](/sonarqube-server/2025.4/instance-administration/ai-features/overview.md) to setup AI features for instance administration


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.sonarsource.com/sonarqube-server/2025.4/ai-capabilities/autodetect-ai-code.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
