Troubleshooting
This guide covers common issues and their solutions when integrating with Spamidate.
Authentication Issues
Section titled “Authentication Issues”MISSING_API_KEY
Section titled “MISSING_API_KEY”Error: API key is required
Causes:
- No API key provided in the request
- API key sent with wrong header name
Solutions:
# Correct - X-API-Key headercurl -H "X-API-Key: spm_live_..." https://api.spamidate.com/validate
# Also correct - Authorization Bearercurl -H "Authorization: Bearer spm_live_..." https://api.spamidate.com/validate// Correctconst response = await fetch('https://api.spamidate.com/validate', { headers: { 'X-API-Key': process.env.SPAMIDATE_API_KEY, },});
// Verify the environment variable is setif (!process.env.SPAMIDATE_API_KEY) { throw new Error('SPAMIDATE_API_KEY is not set');}INVALID_API_KEY
Section titled “INVALID_API_KEY”Error: Invalid API key
Causes:
- API key is malformed
- API key was deleted
- Using wrong environment’s key
Solutions:
- Verify key format: API keys start with
spm_live_orspm_test_ - Check key length: Keys are 32+ characters
- Regenerate if needed: Create a new key in your dashboard
- Environment check: Ensure you’re using the correct key for your environment
// Validate key format before useconst apiKey = process.env.SPAMIDATE_API_KEY;if (!apiKey?.startsWith('spm_')) { throw new Error('Invalid API key format');}API_KEY_DISABLED
Section titled “API_KEY_DISABLED”Error: This API key has been disabled
Solutions:
- Go to your dashboard
- Navigate to API Keys
- Re-enable the key or create a new one
Rate Limiting Issues
Section titled “Rate Limiting Issues”RATE_LIMIT_EXCEEDED
Section titled “RATE_LIMIT_EXCEEDED”Error: Rate limit exceeded. 100 requests per minute allowed.
Solutions:
import { RateLimitError } from '@spamidate/sdk';
try { const result = await client.validate(email);} catch (error) { if (error instanceof RateLimitError) { // Wait for the specified time await new Promise(r => setTimeout(r, error.retryAfter * 1000)); // Retry return client.validate(email); }}Prevention:
- Use batch validation for multiple emails
- Implement request queuing
- Cache results to avoid re-validating
QUOTA_EXCEEDED
Section titled “QUOTA_EXCEEDED”Error: Monthly quota exceeded
Solutions:
- Check usage:
GET /api/usageto see current consumption - Wait for reset: Quota resets at the start of your billing period
- Upgrade plan: Increase your monthly quota
const usage = await client.getUsage();console.log(`Used: ${usage.quota.used}/${usage.quota.limit}`);console.log(`Resets: ${usage.period.daysRemaining} days`);Validation Issues
Section titled “Validation Issues”Unexpected Low Scores
Section titled “Unexpected Low Scores”Problem: Emails you expect to be valid receive low scores.
Possible causes:
-
Domain issues:
- Domain doesn’t have MX records
- DNS is misconfigured
- Recently created domain
-
Quality flags:
- Catch-all domain (reduces score)
- Role-based address (info@, support@)
- Free email provider
Debug:
const result = await client.validate(email);
// Examine individual checksfor (const [check, data] of Object.entries(result.checks)) { if (!data.passed) { console.log(`${check}: ${data.reason}`); }}False Positives on Disposable Detection
Section titled “False Positives on Disposable Detection”Problem: Legitimate domain flagged as disposable.
Solutions:
- Report false positive: Contact support with the domain
- Check the check result:
const result = await client.validate(email);
if (result.checks.disposable?.passed === false) { // Review the metadata console.log(result.checks.disposable.metadata); console.log(result.checks.disposable.confidence);}Timeout Errors
Section titled “Timeout Errors”Error: VALIDATION_TIMEOUT
Causes:
- Slow DNS resolution
- SMTP verification taking too long
- Network latency
Solutions:
- Use quick mode:
const result = await client.validate(email, { quickMode: true });- Increase timeout (SDK):
const client = new Spamidate({ apiKey: process.env.SPAMIDATE_API_KEY, timeout: 60000, // 60 seconds});Integration Issues
Section titled “Integration Issues”CORS Errors
Section titled “CORS Errors”Problem: Browser blocks requests with CORS error.
Solution: The API supports CORS, but you should validate server-side for security.
// Create a server endpointapp.post('/api/validate-email', async (req, res) => { const client = new Spamidate({ apiKey: process.env.SPAMIDATE_API_KEY }); const result = await client.validate(req.body.email); res.json(result);});SDK Not Installed
Section titled “SDK Not Installed”Error: Cannot find module '@spamidate/sdk'
Solutions:
# Ensure SDK is installednpm install @spamidate/sdk
# Check package.jsoncat package.json | grep spamidateEnvironment Variable Not Set
Section titled “Environment Variable Not Set”Problem: API key is undefined at runtime.
Debug checklist:
-
Local development:
Terminal window # .env fileSPAMIDATE_API_KEY=spm_live_...# Load with dotenvnpm install dotenvrequire('dotenv').config(); -
Production deployment:
- Verify environment variables are set in your hosting platform
- Check variable names match exactly (case-sensitive)
Webhook Issues
Section titled “Webhook Issues”Webhooks Not Received
Section titled “Webhooks Not Received”Checklist:
- URL is HTTPS: Webhooks require HTTPS endpoints
- Endpoint is accessible: No firewall blocking requests
- Returns 2xx status: Must respond within 30 seconds
- Check webhook logs: View delivery status in dashboard
Signature Verification Fails
Section titled “Signature Verification Fails”Causes:
- Wrong signing secret
- Body was modified before verification
- Timestamp mismatch
Solution:
// Use raw body, not parsed JSONapp.post('/webhooks', express.raw({ type: 'application/json' }), (req, res) => { const signature = req.headers['x-spamidate-signature']; const timestamp = req.headers['x-spamidate-timestamp'];
// req.body is the raw Buffer const isValid = verifyWebhook(req.body.toString(), signature, timestamp, secret);});Performance Issues
Section titled “Performance Issues”Slow Validation Response
Section titled “Slow Validation Response”Solutions:
- Use quick mode for real-time validation:
await client.validate(email, { quickMode: true });- Use batch validation for multiple emails:
// 1 request for 100 emailsawait client.validateBatch(emails);- Cache results to avoid re-validating:
const cache = new Map();
async function validate(email) { const cached = cache.get(email); if (cached) return cached;
const result = await client.validate(email); cache.set(email, result); return result;}High Error Rate
Section titled “High Error Rate”Debug steps:
- Check recent errors:
const usage = await client.getUsage();console.log(usage.recentErrors);- Common causes:
unauthorized: API key issuesrateLimited: Too many requestsbadRequest: Invalid email formatsserverError: Temporary API issues
Getting Help
Section titled “Getting Help”Information to Include
Section titled “Information to Include”When contacting support, include:
- Request ID: From
X-Request-Idresponse header - Timestamp: When the issue occurred
- Error code and message: Full error response
- Email(s) tested: (if not sensitive)
- Code snippet: How you’re making the request
Support Channels
Section titled “Support Channels”- Documentation: docs.spamidate.com
- Dashboard: Check status and logs
- Email: support@spamidate.com
Status Page
Section titled “Status Page”Check for known issues: status.spamidate.com