send0
SDK

Configuration

Configure the send0 SDK client.

Constructor

const send0 = new Send0(apiKey, config?);

Config options

OptionTypeDefaultDescription
baseUrlstringAuto-detectedAPI base URL
timeoutnumber30000Request timeout in ms
maxRetriesnumber3Max 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',
});

Auto-detection

The SDK automatically selects the correct base URL based on your environment:

EnvironmentBase URL
Production (default)https://api.send0.dev/v1
Development (NODE_ENV=development)http://localhost:2525/v1

Retry behavior

  • Only retries on 5xx server errors
  • Never retries 4xx client errors
  • Uses exponential backoff
  • Configurable with maxRetries (set to 0 to 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:

PrefixMeaning
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.