Memberships
Defines user memberships in groups, linking users to groups and managing their access within Box.
Table Specific Information
Memberships are the relations between a User and a Group.
Select
When selecting from the Memberships table, you must specify Id, GroupId, or UserId in the WHERE clause.
SELECT * FROM Memberships WHERE Id = '24201762883';
If you're authenticated as an administrator with user impersonation permissions, you can query memberships from multiple user accounts. For example:
SELECT * FROM Memberships WHERE AsUserId IN (SELECT Id FROM Users);
Note: User impersonation has the following limitations:
- The authenticated user cannot be impersonated unless that user is a service account.
- If the authenticated user is a standard user account, they can only query memberships associated with their account.
- Memberships shared with multiple users are only returned for one of the users.
Insert
To insert into Memberships, connect a Group (GroupId) with a User (UserId).
INSERT INTO Memberships (GroupId, UserId) VALUES (1001, 123);
Update
You can only update the role of Memberships. The default role is 'memberships' with the option for 'admin'.
UPDATE Memberships SET Role = 'admin' WHERE Id = '100';
Delete
Delete a membership by specifying its Id:
DELETE FROM Memberships WHERE Id = '100'
Columns
| Name | Type | ReadOnly | Description |
| Id [KEY] | String | True |
Unique identifier assigned to the membership record. |
| Role | String | False |
The role granted to the user within the group, such as member or admin. |
| CreatedAt | Datetime | True |
The date and time when the membership was created. Requires an Id to retrieve this field. |
| ModifiedAt | Datetime | True |
The date and time when the membership was last updated. Requires an Id to retrieve this field. |
| UserName | String | True |
The full name of the user who is part of the membership. |
| UserLogin | String | True |
The login email of the user who is part of the membership. |
| UserId | String | False |
Identifier of the user associated with the membership. |
| GroupName | String | False |
The display name of the group that the membership belongs to. |
| GroupId | String | False |
Identifier of the group that the membership is associated with. |
| AsUserId | String | False |
Identifier of the user to impersonate for API requests, available only for Admin, Co-Admin, and Service Accounts. |