> ## 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

> Create a key, scope it to what it needs, and rotate it without downtime.

Every request needs an API key. There is no session or OAuth flow.

## Creating one

**1. Open Settings -> API Keys**

In the [Dashlink dashboard](https://app.dashlink.ai).

**2. Name it after where it will run**

`zapier-production`, `warehouse-etl`, `staging-tests`. When you need to revoke one in a hurry, the name is what tells you which.

**3. Pick a type**

**REST API** for dashboard endpoints (`create_shortlink`, analytics export). **Dynamic Link** for the native SDK (`dlk_sdk_…`). A Dynamic Link key cannot call REST; a REST key (`dlk_live_`) cannot authenticate JSON resolve.

**4. Pick a scope**

`organization` for almost everything. `self` only when the key should see one person's links and nobody else's. Dynamic Link keys are always org-bound for edge matching.

**5. Pick permissions**

Narrow beats convenient for REST keys. Dynamic Link keys are locked to **All** for resolve and tracking only.

**6. Copy the key**

It is shown once and stored only as a hash. There is no way to recover it later.

## Choosing permissions

> [tab] read\_only
>
> Reads everything, writes nothing. The right choice for reporting, dashboards, exports, and anything that only observes. A bug in code holding this key cannot delete your links.

> [tab] restricted
>
> Per-module grants at `read`, `write` or `all`. The right choice for most integrations, because most integrations touch two or three resources rather than all of them.

> [tab] all
>
> Everything. Appropriate when an integration genuinely manages the whole account.

A key for a tool that creates links and reads how they performed, and should not be able to touch domains or members:

```json theme={null}
{
  "permission_type": "restricted",
  "permissions": [
    { "module": "shortlinks", "permission_level": "write" },
    { "module": "analytics", "permission_level": "read" }
  ]
}
```

Modules are `shortlinks`, `qrcode`, `campaigns`, `analytics`, `domains`, `utm_templates`, `dynamic_link_templates`, `tags` and `organization`. App dynamic links fall under `shortlinks`. `analytics` accepts only `read`.

## Storing keys

> [accordion] Environment variables, not source
>
> A key in a repository is a key in every clone, every fork, and every CI log that echoes the environment. Use your platform's secret store.

> [accordion] REST keys never in apps
>
> A dashboard REST key (`dlk_live_`) in a browser or APK can mutate the workspace. Call REST from your backend. The exception is a **Dynamic Link** key (`dlk_sdk_…`): it must live in the app so JSON resolve can authenticate, and it cannot call REST.

> [accordion] One key per integration
>
> Shared keys mean revoking one breaks everything. Separate keys also make it clear from access patterns which system is doing what.

## Rotating without downtime

Create the replacement before retiring the old one:

**1. Create a new key**

Same scope and permissions as the one it replaces.

**2. Deploy it**

Update the secret wherever the integration reads it from.

**3. Confirm traffic moved**

Watch for errors, and check the old key's last-used time in the dashboard has stopped advancing.

**4. Revoke the old key**

Only now. Revoking first guarantees an outage.

## If a key leaks

Revoke it first and investigate second — revocation is immediate, and every minute spent working out the blast radius is a minute the key still works.

**1. Revoke it in the dashboard**

**2. Create a replacement and deploy it**

**3. Review what it could reach**

Its scope and permissions bound the damage. A `read_only` key that leaked exposed data; a key with `all` could have changed things.

**4. Find out how it escaped**

Committed to a repository, pasted into a ticket, logged by a proxy. Fixing the route matters more than fixing the key.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.