Add users to a role

Assigns up to 100 users to a role, each against its own set of structures. This endpoint supports partial success: the memberships that were created are returned in structure_memberships, and any assignment that failed is reported in errors with a status code and a reason. A response with a populated errors array is still a 200.

Use this endpoint to give users a role on specific structures. A role defined in the Roles section grants nothing until you assign it here.

Each entry in user_structure_pairs names one user and the structures to assign the role on. Different users can have different structures in the same request.

πŸ“˜

A role applies only to the structure types it is scoped to. Check a role's structure_type_ids with the Get a role endpoint before you assign it, and pass structures of those types only.

Requirements

Limits

  • user_structure_pairs holds 1 to 100 entries per request, so one call assigns at most 100 users.
  • Each entry's structure_ids holds 1 to 10 structures, so one user takes at most 10 structures per call.

Split larger assignments across several requests.

Partial success

This endpoint reports failures per assignment rather than failing the whole request. A response that created some memberships and rejected others is still a 200:

  • structure_memberships holds the memberships that were created.
  • errors holds one entry per rejected (user, structure) pair, each carrying the user ID, the structure ID, a status code, and a human-readable reason. user_name is included where it could be resolved, so you can surface the failure without a second lookup.

Always inspect errors. An empty array is the only confirmation that every assignment succeeded.

Path Params
string
required

The unique identifier of the role to assign. Required.

Body Params

Request message to add users to a role. Each entry assigns one user to the
role on its own set of structures.

user_structure_pairs
array of objects
required

The user-to-structures assignments to apply for the role. Limited to 100
entries per request.

user_structure_pairs*
Responses

Language
Credentials
Bearer
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json