{"id":48439,"library":"mailerlite-api-v2-node","title":"MailerLite API v2 Node SDK","description":"Node.js SDK for MailerLite API v2, version 1.2.0. It is a thin wrapper around Axios providing authentication, automatic camelCase conversion for request/response, TypeScript type definitions, and shorthand methods for MailerLite endpoints (account, campaigns, groups, segments, subscribers, webhooks, etc.). The library resolves API responses to body only (not full Axios response). It uses a default base URL of https://api.mailerlite.com/api/v2/ and offers options to override Axios config and headers. Release cadence is low; last release was over 2 years ago. Differentiators: built-in camelCase conversion and TypeScript support, unlike simpler wrappers.","status":"maintenance","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/zygos/mailerlite-api-v2-node","tags":["javascript","mailerlite","node","api","typescript"],"install":[{"cmd":"npm install mailerlite-api-v2-node","lang":"bash","label":"npm"},{"cmd":"yarn add mailerlite-api-v2-node","lang":"bash","label":"yarn"},{"cmd":"pnpm add mailerlite-api-v2-node","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"HTTP client for all API requests","package":"axios","optional":false},{"reason":"Converts response keys to camelCase","package":"camelcase-keys","optional":false},{"reason":"Converts request keys to snake_case","package":"decamelize-keys","optional":false}],"imports":[{"note":"Only default export is available; the CommonJS require must include .default or use ESM import. Since v1.0, the package uses .default export.","wrong":"const MailerLite = require('mailerlite-api-v2-node')","symbol":"default","correct":"import MailerLite from 'mailerlite-api-v2-node'"},{"note":"Named import does not exist; use default import. CommonJS: const MailerLite = require('mailerlite-api-v2-node').default","wrong":"import { MailerLite } from 'mailerlite-api-v2-node'","symbol":"MailerLite","correct":"import MailerLite from 'mailerlite-api-v2-node'"},{"note":"Though both work, the constructor pattern is conventional; calling MailerLite() without new also works but may confuse TypeScript.","wrong":"const mailerLite = MailerLite(apiKey)","symbol":"MailerLite (as constructor)","correct":"const mailerLite = new MailerLite(apiKey)"}],"quickstart":{"code":"import MailerLite from 'mailerlite-api-v2-node';\n\nconst mailerLite = new MailerLite(process.env.MAILERLITE_API_KEY ?? '');\n\nasync function main() {\n  try {\n    const account = await mailerLite.getAccount();\n    console.log('Account email:', account.email);\n\n    const subscribers = await mailerLite.getSubscribers({ limit: 10 });\n    console.log('Subscribers:', subscribers);\n\n    const group = await mailerLite.createGroup({ name: 'Test Group' });\n    console.log('Group created:', group.id);\n  } catch (error) {\n    console.error('Error:', error);\n  }\n}\n\nmain();","lang":"typescript","description":"Initializes MailerLite client with API key, fetches account, retrieves recent subscribers, and creates a group."},"warnings":[{"fix":"Use const MailerLite = require('mailerlite-api-v2-node').default","message":"The library uses .default export; CommonJS require must use require('mailerlite-api-v2-node').default instead of direct require.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Consider migrating to MailerLite API v3 or using a different SDK (e.g., @mailerlite/mailerlite-nodejs).","message":"MailerLite API v2 is deprecated in favor of API v3 (as of 2022). The library has not been updated for v3.","severity":"deprecated","affected_versions":"all"},{"fix":"If you need full response, use the raw methods (e.g., getCampaignsRaw) which return the full Axios response.","message":"API responses are resolved to body only (not full Axios response). Cannot access status codes or headers from the promise resolution.","severity":"gotcha","affected_versions":"all"},{"fix":"Disable camelCase conversion by passing { useCaseConverter: false } in options.","message":"CamelCase conversion can cause unexpected behavior with nested objects or custom fields. The conversion may incorrectly modify keys that are not in snake_case.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"search_vec":"'/api/v2/':65 '1.2.0':13 '2':83 'account':37 'ago':85 'api':2,10,47,101 'api.mailerlite.com':64 'api.mailerlite.com/api/v2/':63 'around':19 'authent':22 'automat':23 'axio':20,54,71 'base':60 'bodi':50 'built':88 'built-in':87 'cadenc':76 'camelcas':24,90 'campaign':38 'config':72 'convers':25,91 'default':59 'definit':30 'differenti':86 'endpoint':36 'etc':43 'full':53 'group':39 'header':74 'javascript':98 'last':79 'librari':45 'low':78 'mailerlit':1,9,35,99 'method':33 'node':4,100 'node.js':6 'offer':67 'option':68 'overrid':70 'provid':21 'releas':75,80 'request/response':27 'resolv':46 'respons':48,55 'sdk':5,7 'segment':40 'shorthand':32 'simpler':96 'subscrib':41 'support':94 'thin':17 'type':29 'typescript':28,93,102 'unlik':95 'url':61 'use':57 'v2':3,11 'version':12 'webhook':42 'wrapper':18,97 'year':84","created_at":"2026-06-07T16:56:39.117732+00:00","updated_at":"2026-06-07T16:56:39.117732+00:00","problems":[{"fix":"Use require('mailerlite-api-v2-node').default","cause":"CommonJS require returns the module, not the default export","error":"const mailerLite = require('mailerlite-api-v2-node'); mailerLite.getAccount is not a function"},{"fix":"Use new MailerLite(apiKey) explicitly","cause":"Using the imported default as a class but without 'new' or the module is not returning a class","error":"import MailerLite from 'mailerlite-api-v2-node'; TypeError: MailerLite is not a constructor"},{"fix":"Ensure the method exists (list of methods in README) and that you are not using a raw method like getAccountRaw which returns the full response","cause":"API response is not the body but the full Axios response (unlikely) or the method name is wrong","error":"TypeError: Cannot read property 'email' of undefined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/zygos/mailerlite-api-v2-node#readme","github":"https://github.com/zygos/mailerlite-api-v2-node","docs":null,"changelog":null,"pypi":null,"npm":"mailerlite-api-v2-node","openapi_spec":null,"status_page":null,"smithery":null,"categories":["marketing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}