Navigation

Update Team Roles in One Project

The Atlas API authenticates using HTTP Digest Authentication. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request.

To learn how to configure API access for an Atlas project, see Configure Atlas API Access.

https://cloud.mongodb.com/api/atlas/v1.0

PATCH /groups/{PROJECT-ID}/teams/{TEAM-ID}
Path ParameterTypeNecessityDescription
PROJECT-IDstringRequiredUnique identifier of the project associated with this team.
TEAM-IDstringRequiredUnique identifier of the team for which you want to update roles.
Query ParameterTypeNecessityDescription
envelopebooleanOptional

Flag that specifies whether or not to wrap the response in an envelope.

Defaults to false.

prettybooleanOptional

Flag that specifies whether or not to return a "pretty-printed" JSON document.

Defaults to false.

Specify an array of strings, where each string represents one role you want to add to the team. You must specify an array even if you are only associating a single role to the team.

Body ParameterTypeNecessityDescription
roleNamesarrayRequiredProject roles you want to assign the given team.

The response JSON document includes an array of result objects, an array of link objects, and a count of the total number of result objects retrieved.

NameTypeDescription
resultsobject arrayIncludes one object for each item detailed in the results array section.
linksobject arrayIncludes one or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification.
totalCountnumberCount of the total number of items in the result set. It may be greater than the number of objects in the results array if the entire result set is paginated.

Each element in the result array is one set of roles specified for one team.

Response ParameterTypeDescription
roleNamesarrayProject roles assigned to the team for the specified teamsId.
teamsIdstringUnique identifier of the team assigned the listed roles.
curl --user '{PUBLIC-KEY}:{PRIVATE-KEY}' --digest \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--request PATCH "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/teams/{TEAM-ID3}?pretty=true" \
--data '{
"roleNames": ["GROUP_OWNER"]
}'
HTTP/1.1 200 OK
Vary: Accept-Encoding
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: {dateInUnixFormat}
Connection: keep-alive
Content-Length: {requestLengthInBytes}
{
"links": [{
"href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/teams/{TEAM-ID3}?pretty=true&pageNum=1&itemsPerPage=100",
"rel": "self"
}],
"results": [{
"links": [{
"href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/teams/{TEAM-ID1}",
"rel": "self"
}],
"roleNames": ["GROUP_OWNER", "GROUP_DATA_ACCESS_READ_ONLY", "GROUP_DATA_ACCESS_ADMIN", "GROUP_DATA_ACCESS_READ_WRITE", "GROUP_READ_ONLY"],
"teamId": "{TEAM-ID1}"
}, {
"links": [{
"href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/teams/{TEAM-ID2}",
"rel": "self"
}],
"roleNames": ["GROUP_DATA_ACCESS_ADMIN", "GROUP_READ_ONLY"],
"teamId": "{TEAM-ID2}"
}, {
"links": [{
"href": "https://cloud.mongodb.com/api/atlas/v1.0/groups/{PROJECT-ID}/teams/{TEAM-ID3}",
"rel": "self"
}],
"roleNames": ["GROUP_OWNER"],
"teamId": "{TEAM-ID3}"
}],
"totalCount": 3
}
Give Feedback