> 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-community-build/instance-administration/analysis-functions/setting-new-code-definition-at-global-level.md).

# New code definition

The global-level new code definition option is applied by default to all new projects. Project administrators can select a specific setting for their project.

The global-level new code definition is called *baseline for new code*:

* It applies by default to all projects. A specific new code definition can be applied to the project instead.
* If it applies to a project, the project consistently uses the baseline for new code. Consequently, any modifications to the baseline will automatically be applied to the project.

The default baseline for new code is the Previous version option. With the Administer System permission, you can change it to the Number of days option, either in the UI or via the Web API.

For more information about the new code options, see [Quality standards and new code](/sonarqube-community-build/user-guide/about-new-code.md).

## In the UI <a href="#in-the-ui" id="in-the-ui"></a>

1. In the top navigation bar, select **Administration** > **Configuration** > **General settings** > **New code**.
2. Select the new code option.
3. Select **Save**.

<figure><img src="broken://spaces/KXW79zfYFiA8incTvwZK/files/qZp7bzsWBsPybVw33oQk" alt="Configuring the new code definition for your instance"><figcaption></figcaption></figure>

## Via the Web API <a href="#via-the-web-api" id="via-the-web-api"></a>

Use the [api/new\_code\_periods/set](https://next.sonarqube.com/sonarqube/web_api/api/new_code_periods/set) endpoint without specifying a branch or a project.

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

* [Quality standards and new code](/sonarqube-community-build/user-guide/about-new-code.md)
* [Configuring new code calculation](/sonarqube-community-build/project-administration/adjusting-analysis/configuring-new-code-calculation.md)


---

# 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 dynamically 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-community-build/instance-administration/analysis-functions/setting-new-code-definition-at-global-level.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 `build a script that syncs our docs to a CMS` 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.
