Overview
The Checkly API uses Bearer token authentication to secure all endpoints. Every request requires both an API key and your Account ID to authenticate and authorize access to your monitoring data.API authentication is required for all endpoints except public status pages. All requests must include both Authorization and X-Checkly-Account headers.
Authentication Headers
All API requests must include these two headers:Header | Description | Example |
---|---|---|
Authorization | Bearer token with your API key | Bearer cu_1234567890abcdef |
X-Checkly-Account | Your Checkly Account ID | 550e8400-e29b-41d4-a716-446655440000 |
Getting Your Credentials
API Key Setup
- Navigate to API Keys Settings in your Checkly dashboard
- Click “Create API Key”
- Provide a descriptive name for your key (e.g., “Production Monitoring”, “CI/CD Pipeline”)
- Select appropriate scopes for your use case:
- Full Access: Complete read/write access to all resources
- Read Only: View checks, results, and analytics
- Custom: Specific permissions for checks, alerts, or analytics
- Copy the generated API key immediately and store it securely
API keys are only shown once during creation. Store them securely in environment variables or credential management systems.
Account ID Location
Your Account ID can be found in multiple places: Dashboard URL: Look for the UUID in your dashboard URLURL Bar
550e8400-e29b-41d4-a716-446655440000
Environment Variables
Set up authentication credentials securely using environment variables:.env
- Never commit credentials to version control
- Use different API keys for different environments
- Set appropriate scopes for each key
- Rotate keys regularly (every 90 days recommended)
Testing & Validation
Quick Authentication Test
Quick Authentication Test
Validate your credentials with a simple health check:Response Codes:
Terminal
200 OK
: Authentication successful401 Unauthorized
: Invalid API key or missing auth403 Forbidden
: Valid key but insufficient permissions400 Bad Request
: Missing Account ID header
Permission Validation
Permission Validation
Test specific permissions for your API key:Test your API key permissions using the manual code provided below.Manual Testing Code:
permission-test.js
Connection Diagnostics
Connection Diagnostics
Diagnose common connection issues:
connection-diagnostics.pys
Examples
Authentication Errors
Missing Authentication
Missing Authentication
HTTP 401 Unauthorized
error-response.json
Invalid API Key
Invalid API Key
HTTP 401 Unauthorized
error-response.json
Missing Account ID
Missing Account ID
HTTP 400 Bad Request
error-response.json
Access Denied
Access Denied
HTTP 403 Forbidden
error-response.json
Security & Best Practices
Secure Credential Management
Secure Credential Management
Environment Variables:Secure Storage Options:
.env
- AWS Secrets Manager, Azure Key Vault, Google Secret Manager
- HashiCorp Vault, Kubernetes Secrets
- CI/CD platform secret management (GitHub Secrets, GitLab Variables)
- Never commit to version control or expose in client-side code
API Key Lifecycle Management
API Key Lifecycle Management
Rotation Schedule:Scope Management:
- Rotate keys every 90 days minimum
- Generate new keys before revoking old ones
- Use overlapping validity periods during rotation
checkly-api-example.js
- Use principle of least privilege
- Create specific keys for specific purposes
- Read-only keys for monitoring dashboards
- Full access keys only for administrative tasks
Rate Limiting & Performance
Rate Limiting & Performance
Default Limits:Caching Strategies:
- 100 requests per minute per API key
- 5,000 requests per hour per API key
- Burst allowance of 200 requests
checkly-api-example.py
- Cache check configurations (TTL: 5 minutes)
- Cache location data (TTL: 1 hour)
- Cache account information (TTL: 15 minutes)
Error Handling & Debugging
Error Handling & Debugging
Comprehensive Error Handling:Debug Headers:
checkly-api-example.js
X-Request-ID
: Unique identifier for request tracingX-RateLimit-Remaining
: Remaining requests in current windowX-RateLimit-Reset
: When rate limit window resets