Sample - Box Platform API
POST/group_memberships

Add user to group

Creates a group membership. Only users with admin-level permissions will be able to use this API.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

1 parameter · 4 body fields
fieldsarray<string>optional
A comma-separated list of attributes to include in the response. This can be used to request fields that are not normally returned in a standard response. Be aware that specifying this parameter will have the effect that none of the standard fields are returned in the response unless explicitly specified, instead only fields for the mini representation are returned, additional to the fields requested.
userobjectrequired
The user to add to the group.
groupobjectrequired
The group to add the user to.
rolestringoptional
The role of the user in the group.
Allowed:memberadmin
configurable_permissionsobjectoptional
Custom configuration for the permissions an admin if a group will receive. This option has no effect on members with a role of `member`. Setting these permissions overwrites the default access levels of an admin. Specifying a value of `null` for this object will disable all configurable permissions. Specifying permissions will set them accordingly, omitted permissions will be enabled by default.

3 status codes
201Returns a new group membership object.
idstringoptional
The unique identifier for this group membership.
typestringoptional
The value will always be `group_membership`.
Allowed:group_membership
userobjectoptional
groupobjectoptional
rolestringoptional
The role of the user in the group.
Allowed:memberadmin
created_atstringoptional
The time this membership was created.
modified_atstringoptional
The time this membership was last modified.
403Returns an error when the user cannot be added to a group. * `forbidden_by_policy`: Adding a user to a group is forbidden due to information barrier restrictions.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.
defaultAn unexpected client error.
typestringoptional
The value will always be `error`.
Allowed:error
statusintegeroptional
The HTTP status of the response.
codestringoptional
A Box-specific error code.
Allowed:createdacceptedno_contentredirectnot_modifiedbad_requestunauthorizedforbiddennot_foundmethod_not_allowedconflictprecondition_failed
messagestringoptional
A short message describing the error.
context_infoobjectoptional
A free-form object that contains additional context about the error. The possible fields are defined on a per-endpoint basis. `message` is only one example.
help_urlstringoptional
A URL that links to more information about why this error occurred.
request_idstringoptional
A unique identifier for this response, which can be used when contacting Box support.

Error handling

A 403 is returned: Returns an error when the user cannot be added to a group.

  • forbidden_by_policy: Adding a user to a group is forbidden due to information barrier restrictions. Any other status is an error: An unexpected client error.