> For the complete documentation index, see [llms.txt](https://docs.docontrol.io/docontrol-user-guide/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.docontrol.io/docontrol-user-guide/system-management/settings/api-keys.md).

# API keys

You can create API keys to securely access and interact with DoControl via GraphQL API.

When you create an API key, you need to assign the relevant privilege level:

* **Super admin** - API key is privileged to change any functionality in DoControl, including system configuration and Team settings.&#x20;
* **Admin** - API key is privileged to change any functionality in DoControl, including system configuration, but not Team settings.
* **Viewer** - API key can only read data in DoControl, except for all data in Settings.

{% hint style="warning" %}

* You need at least **admin** permission to create API keys.
* Viewers cannot access the **API keys** tab.
  {% endhint %}

![](https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FBMpMvcE9S8BHUl93q79N%2FAPI%20keys.png?alt=media\&token=c2697159-937d-49e9-96ea-1cdf84f6570e)

#### To create an API key:&#x20;

1. From the top-right corner in any screen, click **Settings** > **Admin** > **API keys**.&#x20;
2. Click **Add API key**.\ <br>

   <div align="left"><figure><img src="https://3236294211-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MesrnyDMZGYg1V-tOBo%2Fuploads%2FZLLrPIpi0l6jxUfhO3IV%2FAdd%20API%20key.png?alt=media&amp;token=15fc7ec9-b09b-4b07-8092-ae0d1ffe27a1" alt=""><figcaption></figcaption></figure></div>
3. Enter a name for the API key.
4. Select the relevant privilege level to apply to the API key:
   * **Super admin** - API key is privileged to change any functionality in DoControl, including system configuration and Team settings.&#x20;
   * **Admin** - API key is privileged to change any functionality in DoControl, including system configuration, but not Team settings.
   * **Viewer** - API key can only read data in DoControl, except for all data in Settings.<br>
5. When you apply privilege levels to an API key, keep in mind your own access permission:
   * **Super admin** - You can apply any privilege level to an API key
   * **Admin** - You can apply only admin or viewer privilege levels to an API key, but not the super admin privilege<br>
6. Click **Create**. A **refresh token** is shown, copy it and keep it in a safe place.
7. To receive an access token, see [API](/docontrol-user-guide/system-management/api.md).
8. To use DoControl's [API](/docontrol-user-guide/system-management/api.md), go to **Advanced** > **API**.

{% hint style="info" %}

* You can add up to 10 API keys.
* The **refresh token** is valid for 10 years.
* When adding a **Key name:**
  * You can only use the following characters: \[a-z, A-Z, 0-9, \_ ]
  * Two keys cannot have the same name
    {% endhint %}

{% hint style="warning" %}
After leaving the **API keys** page, the API key (refresh token) that you have created will not be accessible. **Make sure you copy it, and keep it in a safe place**.
{% endhint %}


---

# 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.docontrol.io/docontrol-user-guide/system-management/settings/api-keys.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.
