All API requests require authentication using an API key.
API Keys
Unosend uses API keys to authenticate requests. You can create and manage API keys in your dashboard under API Keys.API Key Format
All Unosend API keys are prefixed withun_ for easy identification:
Using the Authorization Header
Include your API key in theAuthorization header as a Bearer token:
HTTP Header
Example Request
cURL
Code Examples
Here’s how to authenticate in different languages:Creating API Keys
To create a new API key:- Go to your Dashboard → API Keys
- Click “Create API Key”
- Give your key a descriptive name (e.g., “Production Server”)
- Select permissions and restrictions if needed
- Click “Create” and copy your key immediately
Key Management
| Permission | Description |
|---|---|
| Full Access | Read and write access to all resources |
| Read Only | View-only access to resources |
| Send Only | Can only send emails, no other operations |
Security Best Practices
Use Environment Variables
Store API keys in environment variables, not in code
Rotate Keys Regularly
Create new keys periodically and revoke old ones
Limit Permissions
Use keys with minimal required permissions
Monitor Usage
Review API usage logs for unusual activity
Do’s and Don’ts
- ✅ Do
- ❌ Don't
- Store keys in environment variables
- Use different keys for development and production
- Rotate keys after team member departures
- Monitor API usage regularly
Error Responses
If authentication fails, you’ll receive one of these errors:401 Unauthorized
403 Forbidden