DocumentationInit and configuration
Init and configuration
MailingCore.init — apiKey, baseUrl, and timeout options.
Call MailingCore.init() once before any SDK method. Typically at app startup or in a server module.
Basic setup
import { MailingCore } from 'mailingcore-js'
MailingCore.init({
apiKey: process.env.MAILINGCORE_API_KEY!,
})
Configuration options
| Parameter | Type | Default | Description |
|---|---|---|---|
apiKey | string | required | API key (mc_live_... or mc_test_...) |
baseUrl | string | https://api.mailingcore.com | API base URL |
timeout | number | 30000 | Request timeout in milliseconds |
Staging / local development
MailingCore.init({
apiKey: process.env.MAILINGCORE_API_KEY!,
baseUrl: 'http://localhost:3010', // local API
timeout: 60000,
})
See Environments for production vs test keys.
Tenant resolution
When using an API key, the tenant is resolved automatically from the key. You do not need X-Tenant-Id in SDK calls.
Verify initialization
if (!MailingCore.config) {
throw new Error('MailingCore not initialized')
}
Continue with Send with the SDK or Send with template.