# API Tokens

DuploCloud supports two kinds of API tokens: temporary and permanent. For normal use cases, we recommend using a temporary API token. A permanent API token is warranted for CI/CD or other DevOps automation. Permanent API tokens expire after one year.

## Temporary API Tokens

### Retrieving a Temporary API token

Every time a user logs in to DuploCloud, a temporary API token is created for that user that only lasts for their session. Any user can retrieve their temporary API token from DuploCloud:

1. Click on the user icon (<img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FJxcCEb0KQMZlHAwxU6gV%2Fperson%20icon.png?alt=media&#x26;token=52737bf5-7180-4cd6-8310-cf9da8a39f37" alt="" data-size="line">) in the upper right, and select **Profile**.&#x20;
2. Click the copy icon (![](https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FZpKItKPPIIIxTSE9RBdW%2FScreen%20Shot%202022-02-24%20at%202.19.23%20PM.png?alt=media\&token=c13b2207-766d-478c-a4cb-229b31e32025)) in the **Temporary API Token** area.
3. Click on the person icon in the upper right, and select **Profile**.&#x20;
4. Click the copy icon (

<figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FwRfT8kfJpT0rBnDQUrlb%2FScreenshot%20(924).png?alt=media&#x26;token=4329727b-62b0-4fed-960e-71c15698d506" alt=""><figcaption><p><strong>Profile</strong> page with <strong>Temporary API Token</strong> area</p></figcaption></figure>

## Permanent API Tokens

Permanent tokens can be created by Administrators from the **Users** page or the **Profile** page. These tokens are always associated with a specific DuploCloud user.&#x20;

{% hint style="warning" %}
**Note:** Permanent API tokens expire after one year.
{% endhint %}

### Creating a Permanent API Token from the Users Page

1. In the DuploCloud Portal, navigate to **Administrator** -> **Users**.&#x20;

2. Select the user from the **USERNAME** list. The user's page displays. <br>

   <figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2F3oB9nlfX8TX7I7QmxeOa%2Fpermapi.png?alt=media&#x26;token=b64bef10-99aa-4a9b-8b27-52f063f10f62" alt=""><figcaption><p><strong>Users</strong> page with <strong>Tokens</strong> tab</p></figcaption></figure>

3. Select the **Tokens** tab.

4. Click **Add**. The **Create a new token** pane displays.<br>

   <div align="left"><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FM14Y6rpoHilEU8CjmSk5%2FScreen%20Shot%202022-02-24%20at%202.27.12%20PM.png?alt=media&#x26;token=fe22229e-f4a7-4d4a-93b1-aa99fb0fcf9d" alt="Create a new token pane"></div>

5. Create a meaningful **Token Name**.

6. Click **Create**. A window containing the token displays.<br>

   ![Window with Token and Copy button](https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FbvZZoJFacMNwQ94F3lCq%2FScreen%20Shot%202022-02-24%20at%202.29.53%20PM.png?alt=media\&token=0c3c808b-5b3c-4b89-b25c-f685369b3e6f)

7. Click the **Copy** button to copy your token to the clipboard. Store it somewhere safe. You cannot retrieve it from DuploCloud.

### Creating a Permanent API Token from the Profile Page

Only administrators can access this option.

1. Click the user icon (<img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FD1e42xlkcYgNUMredccE%2Fperson%20icon.png?alt=media&#x26;token=e41a1598-c6dc-467e-b47c-eedc226164eb" alt="" data-size="line">) in the top-right corner, then select **Profile**.
2. Under **Permanent API Token**, click **Add**. The **Add User Token** screen displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2F37mx7F71y9S1qnbXyBXe%2FScreenshot%20(923).png?alt=media&#x26;token=eb6ed73e-8a72-4bf2-afb5-7005358b13e0" alt=""><figcaption><p><strong>Add User Token</strong> screen</p></figcaption></figure></div>
3. Enter a meaningful **Token Name**.
4. Click **Create**. A window containing the token displays.
5. Click **Copy** to copy your token to the clipboard. Store it somewhere safe. You cannot retrieve it from DuploCloud.

{% hint style="danger" %}
You will not be able to retrieve your token from DuploCloud after you have created it. However, if you lose your token, you can always create a new one.
{% endhint %}

## Configuring Notifications for API Tokens Nearing Expiration

You can configure DuploCloud system settings to generate faults and send notification emails when API tokens are nearing expiration.

### Generating a Fault When API Tokens are Near Expiration

1. From the DuploCloud portal, navigate to **Administrator** -> **Systems Settings**.&#x20;
2. Select the **Config** tab, and click **Add**. The **Add Config** pane displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2F5BvGP2EqB1bpDJzERLM8%2FScreenshot%20(822).png?alt=media&#x26;token=309c7962-18b4-4b3a-b74e-bcd9b07fd05a" alt=""><figcaption><p><strong>Add Config</strong> pane </p></figcaption></figure></div>
3. Complete the following fields:

<table data-header-hidden><thead><tr><th width="209.5555419921875">Field</th><th>Value/Action</th></tr></thead><tbody><tr><td><strong>Config Type</strong></td><td>Select <strong>App Config</strong></td></tr><tr><td><strong>Key</strong></td><td>Select <strong>Enable User Token Expiration Notifications</strong></td></tr><tr><td><strong>Value</strong></td><td>Enter the number of days before token expiration when faults should appear</td></tr></tbody></table>

4. Click **Submit**. DuploCloud will generate a fault when an API token is the set number of days from expiration.&#x20;

### Sending Automatic Notifications when API Tokens Near Expiration

1. From the DuploCloud portal, navigate to **Administrator** -> **Systems Settings**.&#x20;
2. Select the **Config** tab, and click **Add**. The Add **Config** pane displays.<br>

   <div align="left"><figure><img src="https://2471407984-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F68cb0s9ce5UIUKWPuYs8%2Fuploads%2FZdrorjqL361TT7W7lIpE%2Ftoken%20ex%20email.png?alt=media&#x26;token=04165f0e-77ec-4df9-825e-9db14704e2a9" alt=""><figcaption><p><strong>Add Config</strong> pane</p></figcaption></figure></div>
3. Complete the following fields:

<table data-header-hidden><thead><tr><th width="198.888916015625">Field</th><th>Value/Action</th></tr></thead><tbody><tr><td><strong>Config Type</strong></td><td>Select <strong>App Config</strong></td></tr><tr><td><strong>Key</strong></td><td>Select <strong>User Token Expiration Notification Emails</strong></td></tr><tr><td><strong>Value</strong></td><td>Enter the user email addresses (separated by semicolons) to receive notifications</td></tr></tbody></table>

4. Click **Submit**. DuploCloud will email the listed email address(es) when an API token is set to expire in a set number of days.
