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.
Datadog key types
| Type | Prefix | Secret? | Scope | Expiry |
|---|---|---|---|---|
| API key Up to 50 per organization by default; names must be unique. Do not use client-side. Revoked keys show Revoked for 7 days and can be unrevoked in the UI. | — | Yes | Unique to the organization; required by the Datadog Agent to submit metrics and events | No built-in expiration |
| Application key Revocation is permanent. If a user's account is disabled, their application keys are revoked but their API keys stay valid. | — | Yes | Tied to the creating user; same permissions as the creator unless scopes are set | No built-in expiration |
| Client token Separate from API keys; removal cannot be undone. | — | No | Browser, mobile and TV app data collection | — |
How to create a Datadog key
- For an API key open Organization settings → API keys → New Key, enter a unique name and click Create API key.
- For an application key open Organization Settings → Application Keys → New Key (needs the create permission) and enter a name.
- Optionally set scopes on the application key, in the UI or via the API.
- 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
- Create a new key (use a separate API key per deployment method so one can be rotated alone).
- Update the Agent, CI and services that use it.
- Revoke the old key.
Creation and revocation can take a few seconds to propagate, so use retries with short exponential backoff. Revoking an active key can disrupt services.
How to revoke a Datadog key
- Revoke the key from Organization settings under API keys or Application Keys.
- An API key can be unrevoked in the UI for 7 days; an application key revocation is permanent.
If your Datadog key leaked
- Revoke the exposed key (consider impact on running services first).
- Remove the exposed key from code and history.
- Create a new key and update affected services.
- Review the account for unauthorized access.
Environment variables and CLI
Datadog's SDKs and docs read the key from DD_API_KEY or DD_APP_KEY.
Things that catch people out
- 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_KEYandDD_APPLICATION_KEYheaders are for servers and CI.
Using your Datadog key with AI agents
A coding agent that can read your .env file or your shell history can read the key, and anything in its context can end up in logs, transcripts or a prompt-injected request. The safer pattern is to keep the key in a credential broker that performs the authenticated step for the agent and hands back only the result.
BotPassword works this way. For a Datadog key, these intents fit:
| Intent | What BotPassword does |
|---|---|
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. |
Datadog also publishes its own MCP server. Whatever server the agent uses, keep the credential it authenticates with out of the agent's context.
Set it up in your agent: Aider · Amp · Claude Code · Claude Desktop · Cline · OpenAI Codex CLI · all agents
Frequently asked questions
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.