Skip to content

Authentication & Security

Spamidate uses a two-key authentication system (similar to Stripe) for maximum security and flexibility:

  • Secret Keys (sk_live_...) - For server-side API calls (kept private)
  • Publishable Keys (pk_live_...) - For client-side usage (can be public)

All keys are securely hashed using SHA-256 and validated on every request.

Use for: Server-side API calls, backend integrations, automated workflows

Security:

  • Stored as SHA-256 hash in database (irreversible)
  • Shown ONCE at creation (cannot be retrieved later)
  • Full access to all API operations
  • Must be kept private and secure

Example: sk_live_r4nD0mStr1ngH3r3Th4tIsS3cur3AndL0ng

Use for: Client-side validations, public-facing forms, browser JavaScript

Security:

  • Can be safely exposed in client-side code
  • Stored in plaintext (can be viewed anytime in dashboard)
  • Limited to read-only operations
  • Cannot perform sensitive actions

Example: pk_live_another_random_string_for_public_use

  1. Log in to your Dashboard
  2. Navigate to API Keys tab
  3. Click Create New API Key
  4. Enter a descriptive name (5-100 characters):
    • Good: “Production Web Server”, “Mobile App v2.1”
    • Bad: “key1”, “test”, “mykey”
  5. Save both keys immediately:
    • ⚠️ Secret key shown ONCE (cannot be retrieved)
    • ✅ Publishable key always visible in dashboard

The most secure method for production applications.

Terminal window
curl -X POST https://api.spamidate.com/validate \
-H "X-API-Key: sk_live_your_secret_key_here" \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com"}'

Standard OAuth-style bearer token authentication.

Terminal window
curl -X POST https://api.spamidate.com/validate \
-H "Authorization: Bearer sk_live_your_secret_key_here" \
-H "Content-Type: application/json" \
-d '{"email": "user@example.com"}'

3. Query Parameter (DISABLED IN PRODUCTION)

Section titled “3. Query Parameter (DISABLED IN PRODUCTION)”
Terminal window
# ❌ BLOCKED in production
# ✅ Works in development only
curl "https://api.spamidate.com/validate?api_key=sk_live_..." \
-X POST \
-d '{"email": "test@example.com"}'

Scopes & Permissions (Granular Access Control)

Section titled “Scopes & Permissions (Granular Access Control)”

Restrict API keys to specific operations using scope-based permissions:

ScopeDescriptionExample Use Case
validate:readView validation resultsAnalytics dashboard
validate:writePerform email validationContact forms
bulk:*All bulk operationsBatch processing
webhooks:readView webhook configsMonitoring tools
webhooks:writeCreate/update webhooksIntegration setup
analytics:readView usage statisticsReporting systems
keys:writeCreate/rotate keysAdmin panels
*:*Full access (admin scope)Service accounts
Terminal window
curl -X POST https://api.spamidate.com/api/keys \
-H "Authorization: Bearer YOUR_ADMIN_KEY" \
-H "Content-Type: application/json" \
-d '{
"name": "Read-Only Analytics Key",
"scopes": ["validate:read", "analytics:read"]
}'

Error Response (insufficient permissions):

{
"error": {
"code": "INSUFFICIENT_PERMISSIONS",
"message": "This operation requires the 'validate:write' permission. Your API key does not have this scope.",
"requiredScope": "validate:write",
"grantedScopes": ["validate:read"]
}
}

Restrict API keys to specific IP addresses or CIDR ranges:

  • Exact IP: 192.168.1.50
  • IPv4 CIDR: 192.168.1.0/24 (matches 192.168.1.0 - 192.168.1.255)
  • IPv6 CIDR: 2001:db8::/32
  • Multiple IPs: Array of mixed formats
Terminal window
curl -X POST https://api.spamidate.com/api/keys \
-H "Authorization: Bearer YOUR_ADMIN_KEY" \
-H "Content-Type": application/json" \
-d '{
"name": "Production Server",
"allowedIps": ["10.0.1.50", "10.0.1.51", "192.168.1.0/24"]
}'

Error Response (IP not allowed):

{
"error": {
"code": "IP_NOT_ALLOWED",
"message": "Access denied. Your IP address (203.0.113.45) is not in the API key's allowlist.",
"clientIp": "203.0.113.45",
"allowedIps": ["10.0.1.50", "192.168.1.0/24"]
}
}

Automated Key Rotation (PCI-DSS Compliance)

Section titled “Automated Key Rotation (PCI-DSS Compliance)”

90-day rotation policy enforced automatically for compliance:

DayEvent
Day 0Key created
Day 83First warning email (7 days before)
Day 86Second warning email (4 days before)
Day 89Final warning email (1 day before)
Day 90Auto-rotate (if enabled) or enter grace period
Day 97Deactivated (if not rotated during grace period)
Terminal window
curl -X POST https://api.spamidate.com/api/keys/:id/refresh \
-H "Authorization: Bearer YOUR_SECRET_KEY"

Response:

{
"success": true,
"message": "API key refreshed successfully. Old key is now invalid.",
"key": {
"id": 123,
"secretKey": "sk_live_NEW_KEY_SHOWN_ONCE",
"publishableKey": "pk_live_SAME_AS_BEFORE",
"updatedAt": "2025-01-15T10:30:00Z"
},
"warning": "Save this new key securely. You will not be able to see it again."
}

For security incidents, instantly deactivate all keys:

Terminal window
curl -X POST https://api.spamidate.com/api/keys/revoke-all \
-H "Authorization: Bearer YOUR_SECRET_KEY"

Response:

{
"success": true,
"message": "Successfully revoked 5 API key(s). All keys are now inactive.",
"revokedCount": 5,
"warning": "Create new API keys to restore access. Previous keys cannot be recovered."
}

Rate limits enforce fair usage and prevent abuse:

TierRequests/MinuteRequests/DayMonthly VolumeKey LimitPrice
Growth101675K2 keys$19/mo
Pro2333310K3 keys$49/mo
Business931,33340K5 keys$149/mo
Scale2894,167125K8 keys$399/mo
Enterprise2,00060,0001.8M20 keys$799/mo
Enterprise Plus5,000150,0004.5MUnlimited$2,499/mo

Every response includes rate limit information:

X-RateLimit-Limit: 10000
X-RateLimit-Remaining: 9542
X-RateLimit-Reset: 2025-01-16T00:00:00Z

Unique 20% grace buffer for burst traffic:

  • 0-100%: ✅ Normal operation
  • 100-120%: ⚠️ Grace period (requests allowed with warning)
  • 120%+: ❌ Hard block until reset

Example (1,000 req/day quota):

  • 0-1,000 requests: All processed normally
  • 1,001-1,200 requests: Processed with overage warning
  • 1,201+ requests: Blocked until next day

429 Response:

{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Hard limit reached (120% of plan). Usage: 1250/1000. Overage will be billed at period end.",
"retryAfter": 45
}
}
  • Store keys in environment variables (never hardcode)
  • Use secret managers (AWS Secrets Manager, Vault, Doppler)
  • Separate keys per environment (dev, staging, production)
  • Enable IP whitelisting for production keys
  • Use scoped keys for least-privilege access
  • Monitor key usage in dashboard analytics
  • Rotate keys every 90 days (automated)
  • Revoke compromised keys immediately
  • ❌ Commit keys to Git/version control
  • ❌ Expose secret keys in client-side code
  • ❌ Share keys via email/Slack/unencrypted channels
  • ❌ Use query parameters in production
  • ❌ Log API keys in application logs
  • ❌ Reuse keys across multiple applications
  • ❌ Ignore rotation warnings

All security-sensitive actions are logged:

  • API key creation, deletion, rotation
  • Failed authentication attempts
  • Permission violations (scope errors)
  • IP whitelist rejections
  • Rate limit violations
  • Emergency revocations

View audit logs: Dashboard → Security → Audit Trail

Compliance: SOC 2, PCI-DSS, GDPR Article 30

{
"error": {
"code": "INVALID_API_KEY",
"message": "Invalid or inactive API key"
}
}

Solutions:

  • Verify key copied correctly (no extra spaces)
  • Check key not revoked in dashboard
  • Ensure using correct environment’s key
  • Confirm key not expired
{
"error": {
"code": "MISSING_API_KEY",
"message": "API key is required. Provide via X-API-Key header or Authorization Bearer token."
}
}

Solutions:

  • Add X-API-Key or Authorization header
  • Verify header name spelling (case-sensitive)
  • Remove query parameter (disabled in production)
{
"error": {
"code": "INSUFFICIENT_PERMISSIONS",
"message": "This operation requires the 'validate:write' permission."
}
}

Solutions:

  • Check key scopes in dashboard
  • Create new key with required scopes
  • Use admin key (*:* scope) if appropriate
{
"error": {
"code": "IP_NOT_ALLOWED",
"message": "Your IP address is not in the API key's allowlist."
}
}

Solutions:

  • Add your IP to key’s allowlist
  • Use CIDR range for dynamic IPs
  • Temporarily remove IP restriction for testing
  • Verify using correct network/VPN

White-Label & Reseller Features (Enterprise Plus)

Section titled “White-Label & Reseller Features (Enterprise Plus)”

The Enterprise Plus tier ($2,499/month) includes comprehensive white-label and reseller capabilities for agencies, SaaS platforms, and partners.

Use your own branded domain for the API:

Example: validation.yourcompany.com instead of api.spamidate.com

Setup Steps:

  1. Contact sales to enable white-label features
  2. Add CNAME record: validation.yourcompany.comapi.spamidate.com
  3. SSL automatically provisioned via Cloudflare
  4. Test endpoint: https://validation.yourcompany.com/validate

Customize all API responses with your branding:

{
"isValid": true,
"email": "user@example.com",
"score": 95,
"metadata": {
"provider": "YourCompany", // Your company name
"support": "support@yourcompany.com", // Your support email
"documentation": "https://docs.yourcompany.com" // Your docs URL
// "Powered by Spamidate" removed
}
}

Create and manage end-customers from your dashboard:

Create Sub-User:

Terminal window
curl -X POST https://api.spamidate.com/api/sub-users \
-H "Authorization: Bearer YOUR_ENTERPRISE_PLUS_KEY" \
-H "Content-Type: application/json" \
-d '{
"email": "customer@example.com",
"name": "Customer Company",
"tier": "pro"
}'

Features:

  • Unlimited sub-users (or configure max limit)
  • Isolated API keys per customer
  • Usage tracking and analytics per customer
  • Commission tracking (default 20%)
  • Bulk customer onboarding

Automatically track revenue sharing:

Terminal window
curl -X GET https://api.spamidate.com/api/commissions \
-H "Authorization: Bearer YOUR_ENTERPRISE_PLUS_KEY"

Response:

{
"period": "2025-01",
"totalRevenue": 4500.00,
"commissionRate": 20.0,
"commissionEarned": 900.00,
"subUsers": [
{
"id": "sub_123",
"email": "customer1@example.com",
"requests": 15000,
"revenue": 1500.00,
"commission": 300.00
}
]
}

Branded documentation portal with your:

  • Company logo and colors
  • Custom domain (docs.yourcompany.com)
  • Support links and contact info
  • All Spamidate branding removed

Access: Contact sales for custom documentation setup

FeatureIncludedDescription
Custom DomainYour own API endpoint domain
Branded ResponsesCompany name, support email, docs URL
Remove BrandingHide “Powered by Spamidate”
Unlimited KeysNo limit on API keys
Sub-UsersCreate customers, track usage
Commission TrackingAutomated revenue sharing (20%)
White-Label DocsBranded documentation portal
Dedicated ManagerPersonal account manager
99.99% SLACredits for downtime
Priority Support1-hour response time

Enterprise Plus: $2,499/month

  • 4.5M validations/month (150K/day, 5,000/min)
  • Cost at capacity: $0.00055 per email
  • vs. Competitors: 86-94% cheaper at high volume
  • No setup fees: Custom domain and white-label included

Contact Sales: support@spamidate.com