Members

Manage your website's members.

The typical response contains the member object, or an array of member objects. The member object contains the following fields:

Key

Value

id

Unique identifier of user.

membership

Membership Object (below)

email

Email address of user

createdAt

Date when user signed up.

stripeInfo (Optional)

Gets returned if the user has a stripe account.

metaData (Optional)

Gets returned if user contains meta data.

Membership Object

Key

Value

oneTime

Boolean

testMode

Boolean

status

trialing| active| expired | past_due| canceled unpaid | incomplete| incomplete_expired

plan

String. Unique identifier of plan.

type

free | paid

cancel_at_period_end

Boolean

current_period_end

String. Unix Timestamp

amount

Integer. Cost of plan in cents.

Key

Value

customer

Unique identifier of Stripe's customer id.

card

payment_method: Unique identifier of Stripe's payment method.

source*: Unique identifier of Stripe's source method. brand: Card brand. American Express | Discover | MasterCard | Visa exp_month: Card's expiration month. exp_year: Card's expiration year. last4: Card's last four digits.

source has been deprecated in favor of payment_methodand is only available on older members.

get
List Members

https://api.memberstack.com/v1/members
List all members that have a subscription to your website.
Request
Response
Request
Headers
X-API-KEY
required
string
Your API key
Query Parameters
limit
optional
number
Limit of the amount of objects that get returned.
page
optional
number
Skip to page
Response
200: OK
Members successfully retrieved.
{
"members": [
{
"id": "...",
"metaData": {
"userName": "johndoe"
},
"membership": {
"oneTime": false,
"testMode": true,
"status": "active",
"plan": "5ed1c411b4a2491976046d43",
"type": "free"
},
"email": "john@doe.com",
"createdAt": "2020-06-02T17:21:52.577Z"
},
{
"id": "5ed68ab0a16813644f3492df",
"stripeInfo": {
"customer": "cus_...",
"card": {
"payment_method": "pm_...",
"source": "src_...",
"brand": "visa",
"exp_month": "09",
"exp_year": "23",
"last4": "1234"
}
},
"membership": {
"oneTime": false,
"testMode": true,
"status": "active",
"plan": "...",
"type": "paid",
"amount": 3200
},
"email": "jane@doe.com",
"createdAt": "2020-06-02T17:21:52.577Z"
}
...
]
}
JavaScript
cURL
JavaScript
fetch('https://api.memberstack.com/v1/members', {
headers: {
'X-API-KEY': 'yourapikey'
}
}
cURL
curl -i -H "X-API-KEY: yourapikey" -H "Content-Type: application/json" https://api.memberstack.com/v1/members

get
Get Member

https://api.memberstack.com/v1/members/123
Request
Response
Request
Path Parameters
id
optional
string
id of member
Response
200: OK
Get the member associated with the id.
Free Member
Paid Member
Free Member
{
"member" : {
"id": "...",
"email": "john@doe.com",
"createdAt": "2020-06-02T17:21:52.577Z"
"metaData": {
"userName": "johndoe"
},
"membership": {
"oneTime": false,
"testMode": true,
"status": "active",
"plan": "...",
"type": "free"
}
}
}
Paid Member
{
"member" : {
"_id": "5ed68ab0a16813644f3492df",
"email": "jane@doe.com",
"createdAt": "2020-06-02T17:21:52.577Z",
"metaData": {
"userName": "janedoe"
},
"memberships": [
{
"oneTime": false,
"testMode": true,
"_id": "5ed68ab0a16813644f3492e0",
"status": "active",
"plan": "5ed1c411b4a2491976046d43",
"type": "paid"
}
],
"stripeInfo": {
"customer": "cus_...",
"card": {
"payment_method": "pm_...",
"source": "src_...",
"brand": "visa",
"exp_month": "09",
"exp_year": "23",
"last4": "1234"
}
},
}
}
JavaScript
cURL
JavaScript
fetch('https://api.memberstack.com/v1/members/123', {
headers: {
'X-API-KEY': 'yourapikey'
}
}
cURL
curl -i -H "X-API-KEY: yourapikey" -H "Content-Type: application/json" https://api.memberstack.com/v1/members/123

post
Create Member

https://api.memberstack.com/v1/members
Create a member that is subscribed to a free membership.
Request
Response
Request
Path Parameters
optional
string
Body Parameters
metaData
optional
object
Object containing metadata on the user object.
memberPage
optional
string
Unique member page
plan
required
string
id of plan for which the member is created
customFields
optional
object
Values of custom fields containing member data
password
required
string
Password of new member. Minimum length: 8 characters.
email
required
string
Email of new member
Response
200: OK
Newly updated member.
Free Member
Free Member
{
"member" : {
"_id": "5ed68ab0a16813644f3492df",
"email": "john@doe.com",
"createdAt": "2020-06-02T17:21:52.577Z"
"metaData": {
"userName": "johndoe"
},
"memberships": [
{
"oneTime": false,
"testMode": true,
"_id": "5ed68ab0a16813644f3492e0",
"status": "active",
"plan": "5ed1c411b4a2491976046d43",
"type": "free"
}
],
}
}
422: Unprocessable Entity
When an invalid value is passed, the API returns an error object with the corresponding error message.
{ "error": "..." }

We currently only allow the creation of new members for free plans.

metaData can contain up to 50 values. Object keys cannot be longer than 50 characters, object values cannot be longer than 500 characters.

JavaScript
cURL
JavaScript
fetch('https://api.memberstack.com/v1/members', {
method: 'POST',
headers: {
'X-API-KEY': 'yourapikey'
},
body: JSON.stringify({
email: "...",
password: "...",
plan: "...",
customFields: {
userName: "...",
avatar: "..."
}
})
}
cURL
curl -XPOST -H 'X-API-KEY: yourapikey' -d '{
email: "...",
password: "...",
plan: "...",
customFields: {
userName: "...",
avatar: "..."
}
}' 'https://api.memberstack.com/v1/members'

You can get the id of a plan by going to memberships in the dashboard, and extracting the id from the signup link.

post
Update Member

https://api.memberstack.com/v1/members/:id
Request
Response
Request
Path Parameters
id
required
string
id of member
Body Parameters
data
required
object
An object containing optional user data. All fields are optional. The value on the user object will remain the same if no value is provided for an existing key/value pair. { email: "...", password: "...", customFields: { ... }, memberPage: "...", metaData: { ... }, }
Response
200: OK
{
"member" : {
"id": "...",
"email": "john@doe.com",
"createdAt": "2020-06-02T17:21:52.577Z"
"metaData": {
"userName": "johndoe"
},
"membership": {
"oneTime": false,
"testMode": true,
"status": "active",
"plan": "...",
"type": "free"
},
}
}

metaData can contain up to 50 values. Object keys cannot be longer than 50 characters, object values cannot be longer than 500 characters.

JavaScript
cURL
JavaScript
fetch('https://api.memberstack.com/v1/members/123', {
method: 'POST',
headers: {
'X-API-KEY': 'yourapikey'
},
body: JSON.stringify({
email: "...",
password: "...",
})
}
cURL
curl -XPOST -H 'X-API-KEY: yourapikey' -d '{
email: "...",
password: "..."
}' 'https://api.memberstack.com/v1/members/123'

delete
Delete Member

https://api.memberstack.com/v1/members/:id
Request
Response
Request
Path Parameters
id
optional
string
id of member to delete
Response
200: OK
Successfully deleted the member.
{ success: true }
JavaScript
cURL
JavaScript
fetch('https://api.memberstack.com/v1/members/123', {
method: 'DELETE',
headers: {
'X-API-KEY': 'yourapikey'
}
}
cURL
curl -XDELETE -H 'X-API-KEY: yourapikey' https://api.memberstack.com/v1/members/123

Live Example

Interact instantly with the API in this Codesandbox embed. In order to be able to use the API endpoints, you'll need to:

  • Update the value of API_KEY with the value of your API key.

  • Update the value of FREE_PLAN_ID with the id of a free plan of your website. You can get the id of a plan by going to memberships in the dashboard, and extracting the id from the signup link.

  • Update the values of the USER_ID_TO_FETCH for the user that will be queried, USER_ID_TO_UPDATE for the user that will be updated, and USER_ID_TO_DELETE for the user that will be deleted. ⚠️ These values can be the same id. Deleting the user with the id of USER_ID_TO_DELETE will be removed permanently. To open the code editor, drag the handle on the far left side of the embed.