SDK
Configuration
Configure the send0 SDK client.
Constructor
const send0 = new Send0(apiKey, config?);Config options
| Option | Type | Default | Description |
|---|---|---|---|
baseUrl | string | Auto-detected | API base URL |
timeout | number | 30000 | Request timeout in ms |
maxRetries | number | 3 | Max retry attempts for 5xx errors |
Examples
// Default configuration
const send0 = new Send0('sk_live_...');
// Custom configuration
const send0 = new Send0('sk_live_...', {
timeout: 60_000, // 60 second timeout
maxRetries: 5, // 5 retry attempts
});
// Custom base URL
const send0 = new Send0('sk_live_...', {
baseUrl: 'https://custom-proxy.example.com/v1',
});Base URL
The SDK defaults to https://api.send0.dev/v1. Override with baseUrl when running against a staging or self-hosted API:
const client = new Send0('sk_test_...', {
baseUrl: 'https://staging.send0.dev/v1',
})Retry behavior
- Only retries on 5xx server errors
- Never retries 4xx client errors
- Uses exponential backoff
- Configurable with
maxRetries(set to0to disable)
// Disable retries
const send0 = new Send0('sk_live_...', {
maxRetries: 0,
});API key validation
All API keys must start with the sk_ prefix. The key prefix determines the environment and permissions:
| Prefix | Meaning |
|---|---|
sk_live_ | Production key — real sends |
sk_test_ | Test key — sandbox only, no real delivery |
sk_restr_ | Restricted key — scoped permissions |
Note: Using an
sk_test_key will never send real emails, regardless of the base URL or environment.