> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dashlink.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# API Keys

> Learn how to generate and manage API keys for Dashlink

API keys are required to authenticate your requests to the Dashlink API. All API requests must include the `X-API-Key` header with your API key as the value.

To authenticate your requests, include the `X-API-Key` header in all API calls:

```bash API Request Header theme={null}
X-API-Key: dlk_live_••••••
```

<Warning>
  Keep your API key secure and never expose it in client-side code or public repositories. Treat your API key as a password.
</Warning>

## Create an API Key

Follow these steps to generate an API key from the Dashlink dashboard:

<Steps>
  <Step title="Navigate to API Settings">
    Log in to your Dashlink dashboard and navigate to the [API Settings section](https://dashlink.ai/app/settings/api-keys).

    <Frame>
      <img src="https://mintlify.s3.us-west-1.amazonaws.com/dashlink/images/api-settings-dashboard.png" alt="Dashboard showing API Settings section" style={{ borderRadius: '0.5rem' }} />
    </Frame>
  </Step>

  <Step title="Generate New API Key">
    Click on the "Generate API Key" button to create a new API key. Fill in the following fields in the form:

    **Form Fields:**

    * **Name** - A descriptive name for your API key to help you identify it later (e.g., "Production API Key", "Development Key"). This is for your reference only.

    * **Type** - Select the type of API key:
      * **Organization** - The API key is associated with your organization and can access organization-level resources
      * **Self** - The API key is associated with your personal account and can only access your personal resources

    * **Permissions** - Choose the permission level for the API key:
      * **All** - Full access to all operations (read, write, delete) for all resources
      * **Read Only** - Can only retrieve and view data, cannot create, update, or delete resources
      * **Restricted** - Limited access based on specific permissions you configure

    * **Description** - Optional field to add additional notes or context about the API key's intended use case.

    <Frame>
      <img src="https://mintlify.s3.us-west-1.amazonaws.com/dashlink/images/generate-api-key.png" alt="Generate API Key form with fields" style={{ borderRadius: '0.5rem' }} />
    </Frame>
  </Step>

  <Step title="Copy Your API Key">
    Once generated, copy your API key immediately. The key will be displayed only once for security purposes.

    <Frame>
      <img src="https://mintlify.s3.us-west-1.amazonaws.com/dashlink/images/api-key-display.png" alt="API key displayed in dashboard" style={{ borderRadius: '0.5rem' }} />
    </Frame>

    <Warning>
      If you lose your API key, you'll need to generate a new one. The old key will be invalidated.
    </Warning>
  </Step>

  <Step title="Use Your API Key">
    Include your API key in the `X-API-Key` header for all API requests:

    ```bash cURL theme={null}
    curl --location 'https://dashlink.ai/api/v1/shortlinks/get_shortlinks' \
    --header 'X-API-Key: dlk_live_••••••'
    ```
  </Step>
</Steps>

## API Key Scope

API keys in Dashlink have different scopes that determine what resources and operations they can access. Each API key is associated with specific permissions that control its capabilities.

<Info>
  API key scopes help you follow the principle of least privilege by granting only the necessary permissions for each use case.
</Info>

The scope of an API key defines:

* Which endpoints can be accessed
* What operations can be performed (read, write, delete)
* Which resources are accessible

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/dashlink/images/api-key-scope-settings.png" alt="API key scope configuration in dashboard" style={{ borderRadius: '0.5rem' }} />
</Frame>

## API Key Permissions

API keys can have different permission levels that control their access to various features and endpoints:

| Permission     | Description                                                                 |
| -------------- | --------------------------------------------------------------------------- |
| **All**        | Full access to all operations (read, write, delete) for all resources       |
| **Read Only**  | Can only retrieve and view data, cannot create, update, or delete resources |
| **Restricted** | Limited access based on specific permissions you configure                  |

<Note>
  You can configure specific permissions for each API key when generating it in the dashboard. This allows you to create keys with limited access for specific use cases.
</Note>

<Frame>
  <img src="https://mintlify.s3.us-west-1.amazonaws.com/dashlink/images/api-key-permissions.png" alt="API key permissions configuration" style={{ borderRadius: '0.5rem' }} />
</Frame>
