Skip to main content

API Key Authentication

The DNSRadar API uses API keys to authenticate requests. All API requests must include your secret API key in the request header to identify your account and authorize access.
Your API keys carry significant privileges. Keep them secure and never share them in publicly accessible areas such as GitHub, client-side code, or public repositories.

Getting Your API Key

You can create and manage your API keys from the DNSRadar Dashboard:
  1. Log in to your account
  2. Navigate to Settings → API Keys
  3. Click “Generate New API Key”
  4. Copy and securely store your key
API keys have the prefix sk_ followed by a unique identifier.

Making Authenticated Requests

Include your API key in the X-Api-Key header with every request:
curl https://api.dnsradar.dev/monitors \
  -H "X-Api-Key: sk_your_api_key_here"

Authentication Errors

If authentication fails, you’ll receive one of the following error responses:
Status CodeErrorDescription
401UnauthorizedNo API key was provided in the request header
403ForbiddenThe API key provided is invalid or has been revoked

Best Practices

Generate new API keys periodically and revoke old ones to minimize security risks.
Store API keys in environment variables rather than hardcoding them in your application code.
Track which keys are being used and where to quickly identify and respond to potential security issues.
Always make API requests over HTTPS to prevent your API key from being intercepted.