Workspace Memberships
In Vrite, each user can be a member of multiple workspaces. Such relationships are called workspace memberships. You can use the API to manage memberships and use them to retrieve relational data, like all workspaces the user belongs to.
List Memberships for the Workspace
Lists the details of memberships in the workspace, including limited information on associated users’ profiles. Supports pagination.
Number of members to return per page
Page number to fetch
Last member ID to starting fetching members from
ID of the workspace member
ID of the associated user
ID of the member's role in the workspace
Email of the invited member
Temporary name of the invited member
Whether the member has a pending invite
User's full name
Short username
URL of the user's profile image
curl --request GET \
--url "https://api.vrite.io/workspace-memberships/list-members" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'
const client = createClient({
token: "<API_TOKEN>"
});
const result = await client.workspaceMemberships.listMembers({
// Optional
page: 1,
// Optional
perPage: 20,
});
[
{
"id": "b895ab04036fd70b3d8c4598",
"userId": "0777762a619a456a4c0e796c",
"roleId": "9011d2bb12acb7cda4bb7218",
"email": "[email protected]",
"name": "string",
"pendingInvite": true,
"profile": {
"fullName": "string",
"username": "string",
"avatar": "string"
}
}
]
List Workspaces for the User
Lists the details of workspaces the user associated with the token belongs to, including limited information on the workspaces and roles assigned to the user. Supports pagination.
Number of workspaces to return per page
Page number to fetch
Last workspace ID to starting fetching workspaces from
Workspace member ID
ID of the workspace
Name of the workspace
Description of the workspace
URL of the workspace logo
ID of the Stripe customer associated with the workspace
Status of the workspace's subscription
Identifier of the workspace's subscription plan
JSON-stringified Stripe subscription data associated with the workspace
Expiration date of the current workspace's billing cycle
Name of the role
ID of the role
curl --request GET \
--url "https://api.vrite.io/workspace-memberships/list-workspaces" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'
const client = createClient({
token: "<API_TOKEN>"
});
const result = await client.workspaceMemberships.listWorkspaces({
// Optional
page: 1,
// Optional
perPage: 20,
});
[
{
"id": "78040f3aed26dcf292f8927c",
"workspace": {
"id": "0687f2a972f2ce9194879649",
"name": "string",
"description": "string",
"logo": "string",
"customerId": "string",
"subscriptionStatus": "string",
"subscriptionPlan": "string",
"subscriptionData": "string",
"subscriptionExpiresAt": "string"
},
"role": {
"name": "string",
"id": "03777db4eaab4f91df6c615a"
}
}
]
Invite User to Workspace
Invites a new user to the workspace, using the provided data to compose and send an email invite.
Email to send invite to
Temporary name of the invited member
ID of the role to assign to the invited member
curl --request POST \
--url "https://api.vrite.io/workspace-memberships" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"email": "{EMAIL}",
"name": "{NAME}",
"roleId": "{ROLEID}"
}'
const client = createClient({
token: "<API_TOKEN>",
});
await client.workspaceMemberships.create({
email: "[email protected]",
name: "string",
roleId: "8ba44cc614a9750ea4df6ba2",
});
Update the Role of the Membership
Updates the role assigned to the membership (user) specified by ID.
ID of the workspace member
ID of the member's role in the workspace
curl --request PUT \
--url "https://api.vrite.io/workspace-memberships" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Content-Type: application/json' \
--header 'Accept: application/json' \
--data '{
"id": "{ID}",
"roleId": "{ROLEID}"
}'
const client = createClient({
token: "<API_TOKEN>",
});
await client.workspaceMemberships.update({
"id": "609baaeb641c2acd5318f7fb",
"roleId": "9e4169ffd0a0a99ae4751569"
});
Delete Member from the Workspace
Deletes the membership (user) from the workspace.
ID of the workspace member
curl --request DELETE \
--url "https://api.vrite.io/workspace-memberships?id={ID}" \
--header 'Authorization: Bearer <TOKEN>' \
--header 'Accept: application/json'
const client = createClient({
token: "<API_TOKEN>",
});
await client.workspaceMemberships.delete({
id: "b7ab40990fbc00927aef8c8f",
});