Installation
Install from npm
npm install @trymellon/js
Initialize the client
import { TryMellon } from '@trymellon/js'
const client = new TryMellon({
appId: 'app_live_xxxx', // Required: application id from TreyMellon dashboard
apiKey: 'key_live_xxxx', // Required: API key for the application
apiBaseUrl: 'https://api.trymellonauth.com', // Optional, default
timeoutMs: 30000, // Optional, default 30000
maxRetries: 3, // Optional, default 3
retryDelayMs: 1000, // Optional, default 1000
})
Configuration options
| Option | Required | Description |
|---|---|---|
appId | Yes | Your application id. Sent as X-App-Id header. |
apiKey | Yes | API key for authentication. Sent as Authorization: Bearer <apiKey>. |
apiBaseUrl | No | API base URL. Default: 'https://api.trymellonauth.com'. |
timeoutMs | No | HTTP request timeout. Range 1000–300000. Default: 30000. |
maxRetries | No | Number of retries for network errors. Range 0–10. Default: 3. |
retryDelayMs | No | Delay between retries. Range 100–10000. Default: 1000. |
For register and authenticate options you can use either externalUserId (camelCase, recommended) or external_user_id (snake_case); the SDK normalizes to snake_case for the API.