Teams
Teams, simplifies role and permission management by grouping users. Instead of assigning roles individually or at the stack level, you can directly assign roles to a team. This ensures that all team members share the same set of role permissions.
Get all teams
https://api.contentstack.io/organizations/{organization_uid}/teamsThe Get all teams request returns comprehensive information of all the teams available in your organization.
{
"count": 2,
"teams": [
{
"_id": "65b*****************e9a",
"name": "Team A",
"createdAt": "2024-02-01T09:55:46.703Z",
"createdBy": "blt**************f0",
"updatedAt": "2024-02-01T09:56:36.724Z",
"updatedBy": "blt**************f0",
"organizationUid": "blt**************b5",
"users": [
"blt**************a0",
"blt**************8d",
"blt**************21"
],
"stackRoleMapping": [
{
"stackApiKey": "blt**************74",
"roles": [
"blt**************37"
]
},
{
"stackApiKey": "blt**************fe",
"roles": [
"blt**************32"
]
}
],
"organizationRole": "blt**************8d",
"__v": 0,
"uid": "65b*****************e9a",
"createdByUserName": "Jane Doe",
"updatedByUserName": "Jane Doe"
},
{
"_id": "65b*****************892",
"name": "Sample Team",
"createdAt": "2024-01-31T11:52:27.049Z",
"createdBy": "blt**************f0",
"updatedAt": "2024-01-31T11:52:27.049Z",
"updatedBy": "blt**************f0",
"organizationUid": "blt**************b5",
"users": [],
"stackRoleMapping": [],
"organizationRole": "blt**************8d",
"__v": 0,
"uid": "65b*****************892",
"createdByUserName": "Jane Doe",
"updatedByUserName": "Jane Doe"
}
]
}Get a single team
https://api.contentstack.io/organizations/{organization_uid}/teams/{team_uid}The Get a single team request returns comprehensive information of a specific team available in a particular organization.
{
"_id": "65b******************e9a",
"name": "Sample Team",
"createdAt": "2024-02-01T09:55:46.703Z",
"createdBy": "blt**************f0",
"updatedAt": "2024-02-01T09:56:36.724Z",
"updatedBy": "blt**************f0",
"organizationUid": "blt**************b5",
"users": [
"blt**************a0",
"blt**************8d",
"blt**************21"
],
"stackRoleMapping": [
{
"stackApiKey": "blt**************74",
"roles": [
"blt**************37"
]
},
{
"stackApiKey": "blt**************fe",
"roles": [
"blt**************32"
]
}
],
"organizationRole": "blt**************8d",
"__v": 0,
"uid": "65b******************e9a",
"createdByUserName": "Sample User",
"updatedByUserName": "Sample User"
}Create a team
https://api.contentstack.io/organizations/{organization_uid}/teamsThe Create a team request creates a team in the specified organization.
{
"name": "Team A",
"users": ["blt**************a0"],
"stackRoleMapping": [{
"stackApiKey": "blt**************74",
"roles": [
"blt**************f6"
]
}],
"organizationRole": "blt**************c5"
}{
"_id": "65b*******************11",
"name": "Team A",
"createdAt": "2024-02-01T11:01:33.399Z",
"createdBy": "blt**************f0",
"updatedAt": "2024-02-01T11:01:33.399Z",
"updatedBy": "blt**************f0",
"organizationUid": "blt**************b5",
"users": [
"blt**************a0"
],
"stackRoleMapping": [
{
"stackApiKey": "blt**************74",
"roles": [
"blt**************f6"
]
}
],
"organizationRole": "blt**************c5",
"__v": 0,
"uid": "65b*******************11",
"createdByUserName": "Jane Doe
"updatedByUserName": "Jane Doe"
}Update a team
https://api.contentstack.io/organizations/{organization_uid}/teams/{team_uid}The Update a team request is used to modify details, such as adding or removing users from a team, assigning or removing stack roles within a team, updating team descriptions, and updating organization roles for an existing team within a specific organization.
{
"name": "Team A",
"users": [
{
"email": "[email protected]"
}
],
"organizationRole": "blt**************8d",
"stackRoleMapping": [
{
"roles": [
"blt**************f6"
],
"stackApiKey": "blt**************74"
}
]
}{
"_id": "65b******************e9a",
"name": "Team A",
"createdAt": "2024-02-01T09:55:46.703Z",
"createdBy": "blt**************f0",
"updatedAt": "2024-02-01T11:06:35.107Z",
"updatedBy": "blt**************f0",
"organizationUid": "blt**************b5",
"users": [
"blt**************21"
],
"stackRoleMapping": [
{
"stackApiKey": "blt**************74",
"roles": [
"blt**************f6"
]
}
],
"organizationRole": "blt**************8d",
"__v": 0,
"uid": "65b******************e9a",
"createdByUserName": "Jane Doe",
"updatedByUserName": "Jane Doe"
}Delete a team
https://api.contentstack.io/organizations/{organization_uid}/teams/{team_uid}The Delete a team request deletes an existing team along with all its associated users and assigned roles.
Get all users of team
https://api.contentstack.io/organizations/{organization_uid}/teams/{team_uid}/usersThe Get all users of team request retrieves information about all the users associated with a particular team.
Additionally, you can also set the query parameters: includeUserDetails or include_count to true to include user details and the count of users in the response.
Add users to team
{
"users": [
{
"uid": "blt**************f0",
"username": "jane_blt6266157b",
"email": "[email protected]",
"firstName": "Jane",
"lastName": "Doer",
"active": true,
"orgInvitationStatus": "accepted"
},
{
"uid": "blt**************8d",
"username": "john_blt28057039",
"email": "[email protected]",
"firstName": "John",
"lastName": "Doe",
"active": true,
"orgInvitationStatus": "accepted"
},
{
"uid": "blt**************21",
"username": "jane_blt9d1e076e",
"email": "[email protected]",
"firstName": "Jane",
"lastName": "Doe",
"active": true,
"orgInvitationStatus": "accepted"
},
{
"uid": "blt**************a0",
"username": "sample_blt03a1b0ad",
"email": "[email protected]",
"firstName": "Sample",
"lastName": "User",
"active": true,
"orgInvitationStatus": "accepted"
}
],
"count": 4
}Add users to team
https://api.contentstack.io/organizations/{organization_uid}/teams/{team_uid}/usersThe Add users to team request allows you to send invitations to add users and assign them organizational and stack roles.
NoteOnly the Owner or the Admin of the organization can add users to a team.
You need to pass the email IDs of the users in the request body as follows:
{
"emails": [ "[email protected]", "[email protected]"]
}Remove a user from team
{
"emails":["[email protected]", "[email protected]"]
}Remove a user from team
https://api.contentstack.io/organizations/{organization_uid}/teams/{team_uid}/users/{user_uid}The Remove a user from team request allows you to remove an existing user from a particular team.
NoteOnly the Owner or the Admin of the organization can remove users from a team.
All accounts registered with Contentstack are known as Users. An organization can have many users with varying permissions and roles.
Get all users of team
Get all stack role mapping
https://api.contentstack.io/organizations/{organization_uid}/teams/{team_uid}/stack_role_mappingsThe Get all stack role mapping request allows you to retrieve details of all associated stacks for a specified team in your organization.
Add a stack role mapping
{
"stackRoleMappings": [
{
"stackApiKey": "blt**************74",
"roles": [
"blt**************f6"
]
},
{
"stackApiKey": "blt**************fe",
"roles": [
"blt**************3a"
]
}
]
}Add a stack role mapping
https://api.contentstack.io/organizations/{organization_uid}/teams/{team_uid}/stack_role_mappingsThe Add a stack role mapping request allows you to associate users from a specified team with the available stacks in your organization.
You need to pass the API key of the stack and the role UIDs in the request body as follows:
{
"stackApiKey": "stack_api_key",
"roles": [
"role_one_uid",
"role_two_uid"
]
}
Update a stack role mapping
{
"stackApiKey": "blt**************74",
"roles": [
"blt**************f6",
"blt**************37"
]
}{
"stackRoleMapping": {
"stackApiKey": "blt**************74",
"roles": [
"blt**************f6",
"blt**************37"
]
}
}Update a stack role mapping
https://api.contentstack.io/organizations/{organization_uid}/teams/{team_uid}/stack_role_mappings/{stack_api_key}The Update a stack role mapping request allows you to update the stack roles for a specific stack in your organization. You need to pass the role UIDs in the request body as follows:
{
"roles": [
"role_uid"
]
}Remove a stack role mapping
{
"roles": [
"blt**************48",
"blt**************f4"
]
}{
"stackRoleMapping": {
"stackApiKey": "blt**************74",
"roles": [
"blt**************48",
"blt**************f4"
]
}
}Remove a stack role mapping
https://api.contentstack.io/organizations/{organization_uid}/teams/{team_uid}/stack_role_mappings/{stack_api_key}The Remove a stack role mapping request allows you to delete the associations of team users for a specified stack in your organization.
When adding users to a team, you have the option to simultaneously assign roles for the available stacks within the organization. This process involves mapping stack roles for all the users added to the team.