# Using a project badge

You can include dynamic SonarQube Community Build badges on your web pages to display information about your project such as the current value of specific metrics or the current quality gate status.

Markdown snippets and simple image URLs are provided to generate the badge code. A unique security token is generated for each project badge and is required to make the badge accessible from third-party tools.

{% hint style="warning" %}
Using project badges can expose sensitive information like your security rating and other metrics. You should only use them in trusted environments.
{% endhint %}

## Generating the badge code <a href="#generating-badge" id="generating-badge"></a>

To generate the code of your dynamic project badge:

1. Retrieve your project. See [Retrieving projects](/sonarqube-community-build/user-guide/viewing-projects/retrieving-projects.md) for more details.
2. In the top right corner, select **Project Information**.
3. In the **Badges** section:
   1. Select the information type you want to display: metric value or quality gate status.
   2. If you selected the metric value information type, select the metric in **Customize badge**.
   3. In Code format, select **Markdown** (markdown snippet) or **Image URL only** depending on how you want to include your badge.
   4. Select the **Copy** button to copy the code of your badge.

## Renewing the badge token <a href="#renewing-token" id="renewing-token"></a>

If a project badge URL is accessed by someone who should not have access to it, you can renew the project badge’s unique token provided you’re a project admin. This invalidates any existing project badge URLs, and you’ll have to update all locations where the badge is being used.

To renew the badge token:

1. Retrieve your project. See [Retrieving projects](/sonarqube-community-build/user-guide/viewing-projects/retrieving-projects.md) for more details.
2. In the top right corner, select **Project Information**.
3. In the **Badges** section, select **Renew token**.


---

# Agent Instructions: 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 current page URL with the `ask` query parameter:

```
GET https://docs.sonarsource.com/sonarqube-community-build/user-guide/project-badge.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
