Overview
Sendook uses two authentication methods to secure API access:- API Keys - For programmatic API access and production environments
- Access Tokens - For dashboard login and user-specific operations
Authorization header.
API Keys
API keys are used for server-to-server communication and provide access to your organization’s resources.Getting Your API Key
- Log in to your Sendook dashboard
- Navigate to API Keys in the sidebar
- Click Generate key
- Give your key a descriptive name
- Copy the key immediately - it will only be shown once
Using API Keys
Include your API key in theAuthorization header with the Bearer scheme:
API Key Management
Creating API Keys Each API key is associated with an organization and has full access to that organization’s resources:Deleting an API key immediately revokes access for all clients using that key.
Access Tokens
Access tokens are used for user authentication in the dashboard and provide user-scoped access.Login
Exchange your email and password for an access token:Registration
Create a new account:- Creates a user account
- Creates a default organization
- Generates a default API key
- Creates an initial inbox with a random
@sendook.comemail address
Authentication Best Practices
Secure Storage
Environment Variables
Store API keys in environment variables, never in code:
Secret Management
Use secret management services like AWS Secrets Manager, HashiCorp Vault, or similar for production.
Key Rotation
- Generate a new API key in the dashboard
- Update your services to use the new key
- Verify all services are using the new key
- Delete the old API key
Multiple Environments
Create separate API keys for different environments:- Development - For local development and testing
- Staging - For pre-production testing
- Production - For live production workloads
Access Control
Passport Strategies
Sendook uses Passport.js for authentication with two strategies:Bearer Token Strategy
Used for access tokens obtained through login. The token is validated against the database and provides user-scoped access.API Key Strategy
Used for API keys created in the dashboard. The key is validated against the organization and provides organization-scoped access.Testing Authentication
Verify your authentication is working:- 401 Unauthorized - Invalid or missing credentials
- 403 Forbidden - Valid credentials but insufficient permissions
Troubleshooting
401 Unauthorized Error
401 Unauthorized Error
API Key Not Working
API Key Not Working
- Copy the full key from the dashboard
- Check for extra spaces or newlines
- Verify the key belongs to the correct organization
- Ensure the key is active
Access Token Expired
Access Token Expired
Access tokens may expire. If you receive authentication errors:
- Log in again to get a fresh token
- Implement token refresh logic in your application
Next Steps
Dashboard Guide
Learn how to use the Sendook dashboard
Sending Messages
Start sending emails with your API key
Webhooks
Set up webhooks to receive events
Billing
Understand usage-based billing