Authentication
Learn how to authenticate your API requests securely with moder8r.
API Key Format
moder8r API keys follow a specific format for easy identification and security:
m8r_sk_ identifies this as a moder8r secret key
32 characters of cryptographically secure random data
Making Authenticated Requests
Include your API key in the Authorization header using the Bearer token format:
Authorization: Bearer m8r_sk_your_actual_key_hereHere's a complete example request:
curl -X POST https://api.moder8r.app/v1/moderate/text \
-H "Authorization: Bearer m8r_sk_your_actual_key_here" \
-H "Content-Type: application/json" \
-d '{
"content": "Text content to moderate"
}'Getting Your API Key
Sign up for an account
Create your moder8r account at moder8r.app
Navigate to Dashboard
Go to the dashboard and click on "API Keys" in the sidebar
Generate API Key
Click "Generate API Key" and copy the key immediately - it will only be shown once
Security Best Practices
⚠️ Never expose API keys in client-side code
API keys should only be used in server-side applications. Never include them in:
- • Frontend JavaScript code
- • Mobile app source code
- • Public GitHub repositories
- • Browser developer tools
✅ Do
- • Store keys in environment variables
- • Use HTTPS for all requests
- • Rotate keys regularly
- • Monitor API usage
- • Use different keys per environment
❌ Don't
- • Hardcode keys in source code
- • Share keys in chat or email
- • Use HTTP (non-encrypted)
- • Commit keys to version control
- • Use production keys in development
Environment Variables
Store your API key securely using environment variables:
# .env file
MODER8R_API_KEY=m8r_sk_your_actual_key_hereUsage in different languages:
// Node.js
const apiKey = process.env.MODER8R_API_KEY;
const response = await fetch('https://api.moder8r.app/v1/moderate/text', {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ content: 'Text to moderate' })
});# Python
import os
import requests
api_key = os.getenv('MODER8R_API_KEY')
response = requests.post(
'https://api.moder8r.app/v1/moderate/text',
headers={
'Authorization': f'Bearer {api_key}',
'Content-Type': 'application/json',
},
json={'content': 'Text to moderate'}
)