# Datadog API keys: find, store, rotate, and use them safely with AI agents

Source: https://botpassword.com/keys/datadog
Last checked: 2026-10-25

Datadog uses two key types: an organization-wide API key (created under Organization settings → API keys) that lets the Agent submit data, and a user-owned application key that, together with an API key, gives programmatic API access. Neither expires on its own, so rotation is manual. Application keys can be scoped; API keys cannot.

## Key types

| Type | Prefix | Secret | Scope | Expiry |
|---|---|---|---|---|
| API key | — | Yes | Unique to the organization; required by the Datadog Agent to submit metrics and events | No built-in expiration |
| Application key | — | Yes | Tied to the creating user; same permissions as the creator unless scopes are set | No built-in expiration |
| Client token | — | No | Browser, mobile and TV app data collection | — |

## How to create a Datadog key

1. For an API key open **Organization settings** → **API keys** → **New Key**, enter a unique name and click **Create API key**.
2. For an application key open **Organization Settings** → **Application Keys** → **New Key** (needs the create permission) and enter a name.
3. Optionally set scopes on the application key, in the UI or via the API.
4. Copy the key and store it securely.

## Limiting what the key can do

Only application keys can be scoped. Leave scopes unset and the key gets its creator's permissions. Setting scopes on your own keys needs the `user_app_keys` permission; on others' keys `org_app_keys_write`; on service account keys `service_account_write`. Scope names are case-sensitive, and changing a user's role does not change the scopes on existing keys. Prefer scoped keys from a service account.

## How to rotate a Datadog key

1. Create a new key (use a separate API key per deployment method so one can be rotated alone).
2. Update the Agent, CI and services that use it.
3. Revoke the old key.

## How to revoke a Datadog key

1. Revoke the key from **Organization settings** under **API keys** or **Application Keys**.
2. An API key can be unrevoked in the UI for 7 days; an application key revocation is permanent.

## If the key leaked

1. Revoke the exposed key (consider impact on running services first).
2. Remove the exposed key from code and history.
3. Create a new key and update affected services.
4. Review the account for unauthorized access.

## Environment variables

- `DD_API_KEY`
- `DD_APP_KEY`

## Gotchas

- Requests that write data need an API key; requests that read data need an application key as well.
- Keys are validated with `GET /api/v1/validate` (API key) or `/api/v2/validate_keys` (application key pair) on your site's API host.
- 401 or 403 responses right after creating or revoking a key can be propagation delay or missing permissions.
- The Datadog MCP server prefers OAuth; API and application keys sent as `DD_API_KEY` and `DD_APPLICATION_KEY` headers are for servers and CI.

## Using this key with AI agents (BotPassword)

- `list_credentials`: Lists the credentials this agent is granted and what it may do with each. Never values.
- `request_access`: Asks you for a grant, which you approve with your master password or decline in BotPassword on your desktop, never in the chat. The agent gets a receipt, never a value. Approval on your phone is planned.
- `run_with`: Runs a command with the key injected as an environment variable or a 0600 temporary file, never on the command line, and redacts the key from the output.
- `http_request`: Makes an authenticated API call after checking the destination against the hosts this key may be sent to. The response comes back with credential-shaped values redacted, and one that holds the key itself is refused.
- `rotate`: Partly built: creates a new key, stores it as pending, verifies it, promotes it, then revokes the old key after a grace period. Today it works for Cloudflare tokens and AWS IAM keys you have set up, and an agent can start it only under a grant with autopilot; other providers cannot be rotated through their API yet.
- `capture_secret`: Planned, not built yet: will read a newly created key straight from the page or command output into the vault.
- `store_secret`: Saves a value the agent already holds as a new vault item.

## FAQ

### What is the difference between a Datadog API key and an application key?

An API key is organization-wide and lets the Agent submit data. An application key belongs to a user and, with an API key, gives access to the Datadog API.

### Do Datadog API keys expire?

No. API and application keys have no built-in expiration, so rotate them manually.

### Where do I create a Datadog API key?

In **Organization settings** → **API keys** → **New Key**.

### Can I limit what a Datadog application key can do?

Yes. Application keys support scopes; API keys do not.

### Can an AI agent use my Datadog key without seeing it?

Yes, if the key never enters the agent's context. Instead of pasting the key into a chat or leaving it in a `.env` file the agent can read, keep it in a credential broker that injects it into the command or request on the agent's behalf. BotPassword does this with `list_credentials`, `run_with`, `http_request`, so the agent gets the result and never the value.

## Sources

- https://docs.datadoghq.com/account_management/api-app-keys/
- https://docs.datadoghq.com/api/latest/authentication/
- https://docs.datadoghq.com/bits_ai/mcp_server/
- https://docs.datadoghq.com/mcp_server/setup.md
