DEV Community

Ben Sabic for 224 Industries

Posted on

How to Bulk-Invite Members and Assign Plans with Memberstack CLI

You can onboard an entire list of members into Memberstack from a single CSV file using the Memberstack CLI. No dashboard clicking, no manual data entry. If you're running a course launch, onboarding event attendees, or migrating a list of users from a spreadsheet, this is the fastest way to get them all into your membership site with the right plans attached.

If you're using an AI agent like Claude Code or Codex, you can hand it this guide and it'll run the whole workflow for you.

This guide covers the full process: install the CLI, prepare your CSV, import your members, and verify the results.

What You Need

Before you start, make sure you have:

  • Node.js v20 or higher installed on your machine. Check with node --version.
  • A Memberstack account with at least one app created. Sign up free at memberstack.com.
  • A CSV or JSON file with the members you want to import (we'll cover the format below).
  • A terminal (or an AI agent with terminal access like Claude Code, Codex, Cursor, or Gemini CLI).

If you're using an AI agent, install the Agent Skill so the agent knows how to use the CLI:

npx skills add Flash-Brew-Digital/memberstack-skills --skill memberstack-cli
Enter fullscreen mode Exit fullscreen mode

Step 1: Install and Authenticate

Install Memberstack CLI globally:

npm install -g memberstack-cli
Enter fullscreen mode Exit fullscreen mode

Then log in:

memberstack auth login
Enter fullscreen mode Exit fullscreen mode

This opens your browser to the Memberstack OAuth page, where you'll choose which application to connect. Your credentials are stored locally and never leave your machine.

Verify it worked:

memberstack whoami
Enter fullscreen mode Exit fullscreen mode

You should see your email, app ID, and current environment (sandbox by default).

Step 2: Check Your Plans

Before importing members, you need the plan IDs you want to assign. List your existing plans:

memberstack plans list
Enter fullscreen mode Exit fullscreen mode

This prints a table of all your plans with their IDs, names, and statuses. Grab the plan ID (it looks like pln_abc123) for any plan you want to assign to your imported members.

Don't have the right plan yet? Create one:

memberstack plans create --name "Workshop Attendee" --description "Access for workshop participants"
Enter fullscreen mode Exit fullscreen mode

The CLI prints the new plan's ID when it's created. Copy that for the next step.

Step 3: Prepare Your CSV File

Your import file needs two required columns: email and password. To assign plans during import, add a plans column with comma-separated plan IDs.

Here's a sample members.csv:

email,password,plans,customFields.firstName,customFields.lastName,customFields.company
alice@example.com,temp-Pass1!,pln_abc123,Alice,Chen,Acme Corp
bob@example.com,temp-Pass2!,pln_abc123,Bob,Martinez,Globex
carol@example.com,temp-Pass3!,"pln_abc123,pln_xyz789",Carol,Johnson,Initech
dave@example.com,temp-Pass4!,pln_abc123,Dave,Wilson,Umbrella Co
Enter fullscreen mode Exit fullscreen mode

A few things to note about the format:

  • email and password are required for every row.
  • The plans column accepts one or more plan IDs, separated by commas. Wrap the value in quotes if you're assigning multiple plans (like Carol's row above).
  • Custom fields use the customFields.* prefix. These map directly to the custom fields you've set up in Memberstack.
  • You can also include metaData.* columns for metadata and a loginRedirect column for per-member redirect URLs.

If you're using an AI agent, you can skip building the CSV by hand. Just tell it:

"I have a list of 50 attendees in a Google Sheet. Export it as CSV, make sure it has email, password, plans, and name columns, then format it for Memberstack CLI import."

The agent will handle the column mapping and formatting.

Step 4: Import Your Members

Run the import:

memberstack members import --file members.csv
Enter fullscreen mode Exit fullscreen mode

The CLI reads each row, creates the member, and assigns the specified plans. You'll see a progress spinner while it works through the file.

JSON files work too:

memberstack members import --file members.json
Enter fullscreen mode Exit fullscreen mode

For a JSON import, structure the file as an array of objects with the same field names.

Step 5: Verify the Import

Check that your members came through:

memberstack members list --all
Enter fullscreen mode Exit fullscreen mode

The --all flag auto-paginates so you see every member, not just the first page. For a quick count:

memberstack members count
Enter fullscreen mode Exit fullscreen mode

Want to confirm a specific member? Look them up by email:

memberstack members get alice@example.com
Enter fullscreen mode Exit fullscreen mode

This shows their full profile including assigned plans, custom fields, and metadata.

Step 6: Assign Plans After Import (Optional)

If you imported members without plans (or need to add a plan to existing members later), you have two options.

Add a plan to a single member:

memberstack members add-plan mem_abc123 --plan-id pln_xyz789
Enter fullscreen mode Exit fullscreen mode

Add a plan to all members who don't have one yet:

memberstack members bulk-add-plan --plan pln_abc123 --filter no-plan --dry-run
Enter fullscreen mode Exit fullscreen mode

The --dry-run flag previews the changes without applying them. Remove it when you're ready to commit:

memberstack members bulk-add-plan --plan pln_abc123 --filter no-plan
Enter fullscreen mode Exit fullscreen mode

Working with Live vs Sandbox

All commands run against your sandbox (test mode) environment by default. This is the right place to test your import before going live.

Once you're happy with the results, run the same commands against your live environment:

memberstack members import --file members.csv --live
Enter fullscreen mode Exit fullscreen mode

Or use the full flag:

memberstack members import --file members.csv --mode live
Enter fullscreen mode Exit fullscreen mode

Quick Tips

Export first, then re-import. If you need to update a batch of members later, export them, edit the file, and use bulk-update:

memberstack members export --format csv --output current-members.csv
# edit the file...
memberstack members bulk-update --file current-members.csv --dry-run
Enter fullscreen mode Exit fullscreen mode

Pipe JSON for scripting. Add --json to any command to get raw JSON output. This is useful for chaining commands or feeding data into other tools:

memberstack members list --all --json | jq '.[] | .email'
Enter fullscreen mode Exit fullscreen mode

Stats at a glance. After a big import, check your member breakdown by plan:

memberstack members stats
Enter fullscreen mode Exit fullscreen mode

Frequently Asked Questions

What file formats does Memberstack CLI accept for imports?

The CLI accepts both CSV and JSON files. CSV files should use customFields.* and metaData.* prefixes for nested data. JSON files use an array of objects with the same field names.

Can I assign multiple plans to a member during import?

Yes. In a CSV file, list the plan IDs in the plans column separated by commas and wrap them in quotes. In a JSON file, use an array of plan ID strings.

What happens if I import a member that already exists?

The import will fail for that row and continue processing the remaining members. The CLI reports which rows succeeded and which failed so you can fix and re-run.

Is there a limit to how many members I can import at once?

There's no hard limit on the file size. The CLI processes members sequentially and respects Memberstack's API rate limits automatically. Large imports (thousands of members) will take longer but will complete without issues.

How do I test the import before going live?

All commands target the sandbox environment by default. Run your import there first, verify the results, then re-run with the --live flag to push to your live environment.

Key Takeaways

  • Memberstack CLI lets you import members from a CSV or JSON file in a single command.
  • You can assign plans, set custom fields, and add metadata during import.
  • The --dry-run flag on bulk operations lets you preview changes before committing.
  • Sandbox mode (the default) is the safe place to test imports before going live.
  • AI agents like Claude Code and Codex can run this entire workflow from a single prompt.

Resources

Top comments (0)