Memberstack provides four types of member data: Custom Fields, Metadata, JSON, and Data Tables. In addition to these, you can also access a member's email and password, but that is separate from these data types.
You can update JSON, Custom Fields, and DataTables using the frontend and backend API, through forms and data attributes in Webflow, and via the dashboard. However, Metadata can only be updated from the backend.
1) Custom Fields
Custom Fields are global key-value pairs that you can store across all members. When you create a custom field property, it becomes available to all members.
Important: Custom fields have a limit of 100. We recommend using Member JSON for data that does not need to be shown to members.
To retrieve and update the logged-in member's custom fields, use the following code from our DOM package:
const memberstack = window.$memberstackDom;
// 1. Retrieve custom fields
const { data: member } = await memberstack.getCurrentMember();
if (member) {
console.log(member.customFields); // Access custom fields object
}
// 2. Update custom fields
await memberstack.updateMember({
customFields: {
country: "Canada",
username: "johndoe"
}
});For example, you can use custom fields to store data that you want every member to have, such as name and username.
Learn more about custom fields.
2) Metadata
Metadata is similar to custom fields as it can be used to store information about a member. However, there are a few key differences:
- Metadata is read-only via the frontend.
- Metadata can only be updated from the backend.
- Metadata comes in key-value pairs.
- Each member can have different sets of key-value pairs in their metadata.
- Metadata is limited to 500 characters per member.
For example, you can use metadata to store information that might vary across members, such as a set of external IDs collected from 3rd party integrations. Member 1 might have GitHub ID, Intercom ID, and Active Campaign ID, while Member 2 might have Instagram ID, Facebook ID, and Slack ID.
To update a member's metadata from your backend, use the @memberstack/admin package.
Note: Metadata is strictly read-only on the frontend and must be updated via a secure server-side environment using your Secret API Key (sk_...).
ES Modules (import)
import memberstackAdmin from "@memberstack/admin";
// Initialize the Admin SDK with your secret API key
const memberstack = memberstackAdmin.init("YOUR_SECRET_KEY");
try {
// Update the member's metadata
const updatedMember = await memberstack.members.update({
id: "mem_abc123",
data: {
metaData: {
githubId: "git_12345",
activeCampaignId: "ac_98765"
}
}
});
console.log("Updated metadata:", updatedMember.metaData);
} catch (error) {
console.error("Failed to update metadata:", error.message);
}CommonJS (require)
const memberstackAdmin = require("@memberstack/admin");
// Initialize the Admin SDK with your secret API key
const memberstack = memberstackAdmin.init("YOUR_SECRET_KEY");
try {
// Update the member's metadata
const updatedMember = await memberstack.members.update({
id: "mem_abc123",
data: {
metaData: {
githubId: "git_12345",
activeCampaignId: "ac_98765"
}
}
});
console.log("Updated metadata:", updatedMember.metaData);
} catch (error) {
console.error("Failed to update metadata:", error.message);
}Key Rules to Keep in Mind:
-
Casing: The property name inside the
dataobject must be spelledmetaData(with a capital D). - Character Limit: Metadata has a strict limit of 500 characters per member. For larger or more nested datasets, use Member JSON (1MB limit) instead.
3) Member JSON
Member JSON allows you to store more complex data on a member. Unlike custom fields and metadata, JSON objects can be nested. Custom fields and metadata only accept boolean types (true/false), strings, and integers as valid values.
For example, you can use JSON to achieve tasks similar to a database, such as storing a list of tweets published by a user or an array of member IDs added as friends. JSON is limited to 1MB per member.
To retrieve the logged-in member's JSON data, use the following code from our DOM package:
window.$memberstackDom.getMemberJSON();To update the logged-in member's JSON data, use the following code from our DOM package:
const memberstack = window.$memberstackDom;
// 1. Get current JSON
const { data: currentJson } = await memberstack.getMemberJSON();
// 2. Add, update, or remove properties
const updatedJson = {
...currentJson,
avatarURL: "https://example.com/new-avatar.png",
theme: "dark"
};
// 3. Save the updated JSON back to the member
await memberstack.updateMemberJSON({ json: updatedJson });
for an additional JSON information please read:
Advanced JSON Data Usage With The Memberstack Dom Package
4) DataTables
DataTables act like a custom spreadsheet or relational database built directly inside Memberstack. Unlike Custom Fields, Metadata, or Member JSON, which store flat or nested data directly attached to a single member's profile, DataTables allow you to build structured, multi-row databases (like collections of items, logs, or submissions) that respect member authentication and access rules.
Important: Unlike Member JSON (which requires you to fetch, modify, and overwrite the entire object), Data Tables support partial updates and full CRUD (Create, Read, Update, Delete) operations on individual records.
For example, you can use Data Tables to store structured, relational data such as:
- User-submitted blog posts, job listings, or marketplace products.
- Course progress, lesson completions, and quiz scores.
- Community forum posts, comments, or event registrations.
To retrieve records from a table, use the following code from our DOM package:
const memberstack = window.$memberstackDom;
// 1. Retrieve a single record by ID
try {
const { data: record } = await memberstack.getDataRecord({
table: 'articles',
recordId: 'rec_abc123'
});
console.log("Article Title:", record.data.title);
} catch (error) {
console.error("Failed to get record:", error.message);
}To create or update records in a table, use the following code:
const memberstack = window.$memberstackDom;
// 1. Create a new record
try {
const { data: newRecord } = await memberstack.createDataRecord({
table: 'articles',
data: {
title: 'My First Article',
content: 'Article content here...',
published: true
}
});
console.log("Created record ID:", newRecord.id);
} catch (error) {
console.error("Failed to create record:", error.message);
}
// 2. Update an existing record (Partial update)
try {
const { data: updatedRecord } = await memberstack.updateDataRecord({
recordId: 'rec_abc123',
data: {
published: false // Only updates the 'published' field
}
});
console.log("Updated record:", updatedRecord);
} catch (error) {
console.error("Failed to update record:", error.message);
}
// 3. Delete a record
try {
const { data: deletedRecord } = await memberstack.deleteDataRecord({
recordId: 'rec_abc123'
});
console.log("Deleted record ID:", deletedRecord.id);
} catch (error) {
console.error("Failed to delete record:", error.message);
}
// 4. Retrieve multiple records with filtering
try {
const { data } = await memberstack.queryDataRecords({
table: 'articles',
query: {
where: { published: { equals: true } },
orderBy: { createdAt: 'desc' },
take: 10
}
});
console.log("Published articles:", data.records);
} catch (error) {
console.error("Failed to query records:", error.message);
}Learn more about Data Tables.
Comments
6 comments
Please make an article on how to get the JSON of a member using the front-end JavaScript API. Thank you.
It'd be awesome to have an article on how to access and update the User's Json via Webflow's script in the front-end. Thanks Team!
In dire need of a guidance article here, specifically for accessing the JSON from a Webflow front-end. Thanks in advance 🙂
Just updated the article. To get JSON data use:
You can read more in our DOM package docs
Hello,
I would like to know if I could update the metadata and / or the JSON via Make (via a http request) or Postman ?
Thanks
William
Hey William de Broucker 👋
You should be able to update member metadata and json using the Memberstack Admin Package for REST
Please sign in to leave a comment.