Authentication & Error Troubleshooting
Diagnose and fix common API authentication errors. Find solutions for 401, 403, rate limiting, and other issues.
Quick Diagnostic Checklist
The request did not include valid authentication credentials.
Common Causes
- •Missing Authorization header
- •Invalid or revoked API key
- •Incorrect header format (missing 'Bearer' prefix)
- •Extra whitespace or invisible characters in the key
- •Using a test/sandbox key in production or vice versa
Solutions
Check your Authorization header format
- 1.Ensure the header is exactly: Authorization: Bearer YOUR_API_KEY
- 2.There should be exactly one space between 'Bearer' and your key
- 3.The header name is case-sensitive on some servers
// Correct format
headers: {
'Authorization': 'Bearer om_live_xxxxxxxxxxxx',
'Content-Type': 'application/json'
}
// Common mistakes
'Authorization': 'om_live_xxxx' // Missing 'Bearer '
'Authorization': 'Bearer om_live_xxxx' // Double space
'Authorization': ' Bearer om_live_xxxx' // Leading space
'authorization': 'Bearer om_live_xxxx' // Lowercase (may work, but not guaranteed)Verify your API key is valid
- 1.Log in to your ObituaryMonitor dashboard
- 2.Go to Settings → API Keys
- 3.Check that your key exists and hasn't been revoked
- 4.If unsure, create a new API key and update your application
Check for invisible characters
- 1.Copy your API key fresh from the dashboard
- 2.Check for trailing newlines or spaces
- 3.If using environment variables, verify the value is correct
# Debug: Print your API key to verify (remove after debugging!)
echo "Key: [$OBITUARYMONITOR_API_KEY]"
# In Node.js
console.log('Key length:', process.env.OBITUARYMONITOR_API_KEY?.length);
console.log('Key:', JSON.stringify(process.env.OBITUARYMONITOR_API_KEY));Common Authentication Issues
API key not working after copy-paste
Symptom: Invisible characters or formatting issues
Solution: Re-copy the key from the dashboard, ensuring no extra spaces or newlines. Use a plain text editor to verify.
Works in Postman but not in code
Symptom: Environment variable or header formatting issue
Solution: Log the actual header being sent. Check that environment variables are loaded correctly.
Authentication works locally but fails in production
Symptom: Environment variable not set in production
Solution: Verify the API key environment variable is set in your production environment (Vercel, Netlify, AWS, etc.).
Intermittent 401 errors
Symptom: Race condition or caching issue
Solution: Check if you're rotating API keys or if there's request caching that's sending stale headers.
403 after subscription change
Symptom: API key cache not updated
Solution: API key permissions may take a few minutes to update after plan changes. Wait 5 minutes and retry.
Debug Your Request
Use this template to verify your authentication is working correctly:
# Use -v flag for verbose output to see headers
curl -v "https://api.obituarymonitor.com/v1/watches" \
-H "Authorization: Bearer $OBITUARYMONITOR_API_KEY" \
-H "Content-Type: application/json"
# Check your environment variable
echo "API Key: $OBITUARYMONITOR_API_KEY"
echo "Key length: ${#OBITUARYMONITOR_API_KEY}"