Skip to main content
Pass options as the second argument to BlnkInit:
OptionTypeDefaultDescription
baseUrlstringRequired. Core base URL. A trailing / is appended if missing.
timeoutnumber10000HTTP timeout in milliseconds.
retryCountnumber1Total request attempts including the first. Retries apply only to idempotent GET requests, not POST, PUT, or DELETE.
retryDelayMsnumber2000Base delay between retry attempts in milliseconds. Uses linear backoff.
loggerBlnkLoggerconsoleCustom logger for SDK info and error output.
const blnk = BlnkInit(process.env.BLNK_API_KEY ?? '', {
  baseUrl: 'http://localhost:5001',
  timeout: 30000,
  retryCount: 3,
  retryDelayMs: 2000,
});

Custom logger

Attach a logger to control SDK output in production:
const blnk = BlnkInit(apiKey, {
  baseUrl: 'http://localhost:5001',
  logger: {
    info: (message, ...meta) => myLogger.info(message, meta),
    error: (message, ...meta) => myLogger.error(message, meta),
  },
});
The SDK redacts API keys and auth headers from error logs. Do not log the raw ApiResponse object if it may contain sensitive metadata from your application. For response patterns, see Error handling.