Memberstack Admin Package (Node.js)

Article author
Josh Lopez
  • Updated

The Memberstack Admin Package for Node.js provides an easy way to build robust user management and authentication into your Node.js applications. With the package, you can programmatically manage members, plans, and security integrations with Memberstack using simple JavaScript functions.

This eliminates the need to build these common user management features from scratch or make raw Admin API calls yourself. The package handles all the underlying API requests, authentication, and response parsing.

This guide covers everything you need to get started using the Admin Package in your Node.js app. It includes:

  • An overview of the package's capabilities
  • Installation and initialization instructions
  • Details on secret keys and authentication
  • Examples for core tasks like managing members and plans
  • Explanations of helper methods for verification

Whether you're looking to quickly prototype something or build a complex, production-ready application, this guide will provide the essentials for integrating Memberstack's user infrastructure through the Admin Package.

View the full Admin Package Website for more additional guidance. 


The Admin Package is an npm module that wraps Memberstack's Admin API. It makes it easy to:

  • Authenticate requests with your secret key
  • List, create, update, and delete members
  • Manage member plans
  • Verify member tokens and webhook signatures


 npm install @memberstack/admin 

Secret Keys

Memberstack uses secret keys to authenticate API requests. There are two types of secret keys:

  • Test keys - Start with sk_sb_. Use for development/testing.
  • Live keys - Start with sk_live_. Use in production.

Keep your secret keys secure and confidential. Only use them server-side.

Rate Limits

The API is rate limited to 25 requests per second. Contact Memberstack support if you need this increased.

Import and Initialize

import memberstackAdmin from "@memberstack/admin"; 

// Initialize with secret key 
const memberstack = memberstackAdmin.init('sk_test_...');

Working with Members

List Members

Accepts pagination parameters:

  • limit - Number of members to return
  • after - Cursor for pagination
  • order - 'ASC' or 'DESC'
const {data: members} = await memberstack.members.list({ 
  limit: 10, 
  after: 'abc123', 
  order: 'ASC' 

Get a Member

Pass member id or email:

const member = await memberstack.members.retrieve({ id: 'abc123' });
// or 
const member = await memberstack.members.retrieve({ email: '' });

Create a Member

Requires email and password. Can also pass:

  • customFields - Object of custom fields
  • metaData - Object of metadata
  • json - Object of custom JSON
  • loginRedirect - URL to redirect after login
const member = await memberstack.members.create({ 
  email: '', 
  password: '123456', 
  customFields: { 
    name: 'John Doe' 
  metaData: { 
    lang: 'en' 
  loginRedirect: '/welcome' 

Update a Member

Pass member id and data to update:

await memberstack.members.update({ 
  id: 'abc123', 
  data: { 
    customFields: { 
      name: 'Jane Doe' 

Delete a Member

Pass member id to delete:

await memberstack.members.delete({ id: 'abc123' });

Plans, Webhooks, Tokens

Helper methods include:

Manage Plans

// Add free plan 
await memberstack.members.addFreePlan({ 
  id: 'abc123', 
  planId: 'plan123' 

// Remove free plan 
await memberstack.members.removeFreePlan({ 
  id: 'abc123', 
  planId: 'plan123' 

Verify Webhooks

// Verify webhook signature 
const isValid = await memberstack.verifyWebhookSignature({ 
  headers: {}, 
  secret: 'secret123', 
  payload: {} 

Verify Tokens

// Verify and decode member token 
const {id, email} = await memberstack.verifyToken({ 
  token: 'jwt123' 

Was this article helpful?



Please sign in to leave a comment.