Note: Each team has a setting that determines who is allowed to modify membership of the team. The user_access_manage permission generally grants access to modify membership of any team. To get the full picture, see Team Membership documentation.
This endpoint requires the teams_read permission.
OAuth apps require the teams_read authorization scope to access this endpoint.
The mechanism responsible for provisioning the team relationship.
Possible values: null for added by a user, "service_account" if added by a service account, and "saml_mapping" if provisioned via SAML mapping.
provisioned_by_id
string
UUID of the User or Service Account who provisioned this team membership, or null if provisioned via SAML mapping.
role
enum
The user's role within the team
Allowed enum values: admin
type [required]
enum
Team membership type
Allowed enum values: team_memberships
The mechanism responsible for provisioning the team relationship.
Possible values: null for added by a user, "service_account" if added by a service account, and "saml_mapping" if provisioned via SAML mapping.
provisioned_by_id
string
UUID of the User or Service Account who provisioned this team membership, or null if provisioned via SAML mapping.
role
enum
The user's role within the team
Allowed enum values: admin
id [required]
string
The ID of a user's relationship with a team
relationships
object
Relationship between membership and a user
team
object
Relationship between team membership and team
data [required]
object
The team associated with the membership
id [required]
string
The ID of the team associated with the membership
type [required]
enum
User team team type
Allowed enum values: team
default: team
user
object
Relationship between team membership and user
data [required]
object
A user's relationship with a team
id [required]
string
The ID of the user associated with the team
type [required]
enum
User team user type
Allowed enum values: users
default: users
type [required]
enum
Team membership type
Allowed enum values: team_memberships
default: team_memberships
included
[ <oneOf>]
Resources related to the team memberships
Option 1
object
User object returned by the API.
attributes
object
Attributes of user object returned by the API.
created_at
date-time
The ISO 8601 timestamp of when the user account was created.
disabled
boolean
Whether the user account is deactivated. Disabled users cannot log in.
email
string
The email address of the user, used for login and notifications.
handle
string
The unique handle (username) of the user, typically matching their email prefix.
icon
string
URL of the user's profile icon, typically a Gravatar URL derived from the email address.
last_login_time
date-time
The ISO 8601 timestamp of the user's most recent login, or null if the user has never logged in.
mfa_enabled
boolean
Whether multi-factor authentication (MFA) is enabled for the user's account.
modified_at
date-time
The ISO 8601 timestamp of when the user account was last modified.
name
string
The full display name of the user as shown in the Datadog UI.
service_account
boolean
Whether this is a service account rather than a human user.
Service accounts are used for programmatic API access.
status
string
The current status of the user account (for example, Active, Pending, or Disabled).
title
string
The job title of the user (for example, "Senior Engineer" or "Product Manager").
uuid
string
The globally unique identifier (UUID) of the user.
verified
boolean
Whether the user's email address has been verified.
id
string
ID of the user.
relationships
object
Relationships of the user object returned by the API.
// Update a user's membership attributes on a team returns "OK" responsepackagemainimport("context""encoding/json""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){// there is a valid "dd_team" in the systemDdTeamDataID:=os.Getenv("DD_TEAM_DATA_ID")// there is a valid "user" in the systemUserDataID:=os.Getenv("USER_DATA_ID")body:=datadogV2.UserTeamUpdateRequest{Data:datadogV2.UserTeamUpdate{Attributes:&datadogV2.UserTeamAttributes{Role:*datadogV2.NewNullableUserTeamRole(datadogV2.USERTEAMROLE_ADMIN.Ptr()),},Type:datadogV2.USERTEAMTYPE_TEAM_MEMBERSHIPS,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewTeamsApi(apiClient)resp,r,err:=api.UpdateTeamMembership(ctx,DdTeamDataID,UserDataID,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `TeamsApi.UpdateTeamMembership`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}responseContent,_:=json.MarshalIndent(resp,""," ")fmt.Fprintf(os.Stdout,"Response from `TeamsApi.UpdateTeamMembership`:\n%s\n",responseContent)}
// Update a user's membership attributes on a team returns "OK" responseimportcom.datadog.api.client.ApiClient;importcom.datadog.api.client.ApiException;importcom.datadog.api.client.v2.api.TeamsApi;importcom.datadog.api.client.v2.model.UserTeamAttributes;importcom.datadog.api.client.v2.model.UserTeamResponse;importcom.datadog.api.client.v2.model.UserTeamRole;importcom.datadog.api.client.v2.model.UserTeamType;importcom.datadog.api.client.v2.model.UserTeamUpdate;importcom.datadog.api.client.v2.model.UserTeamUpdateRequest;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();TeamsApiapiInstance=newTeamsApi(defaultClient);// there is a valid "dd_team" in the systemStringDD_TEAM_DATA_ID=System.getenv("DD_TEAM_DATA_ID");// there is a valid "user" in the systemStringUSER_DATA_ID=System.getenv("USER_DATA_ID");UserTeamUpdateRequestbody=newUserTeamUpdateRequest().data(newUserTeamUpdate().attributes(newUserTeamAttributes().role(UserTeamRole.ADMIN)).type(UserTeamType.TEAM_MEMBERSHIPS));try{UserTeamResponseresult=apiInstance.updateTeamMembership(DD_TEAM_DATA_ID,USER_DATA_ID,body);System.out.println(result);}catch(ApiExceptione){System.err.println("Exception when calling TeamsApi#updateTeamMembership");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Update a user's membership attributes on a team returns "OK" response
"""fromosimportenvironfromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.teams_apiimportTeamsApifromdatadog_api_client.v2.model.user_team_attributesimportUserTeamAttributesfromdatadog_api_client.v2.model.user_team_roleimportUserTeamRolefromdatadog_api_client.v2.model.user_team_typeimportUserTeamTypefromdatadog_api_client.v2.model.user_team_updateimportUserTeamUpdatefromdatadog_api_client.v2.model.user_team_update_requestimportUserTeamUpdateRequest# there is a valid "dd_team" in the systemDD_TEAM_DATA_ID=environ["DD_TEAM_DATA_ID"]# there is a valid "user" in the systemUSER_DATA_ID=environ["USER_DATA_ID"]body=UserTeamUpdateRequest(data=UserTeamUpdate(attributes=UserTeamAttributes(role=UserTeamRole.ADMIN,),type=UserTeamType.TEAM_MEMBERSHIPS,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=TeamsApi(api_client)response=api_instance.update_team_membership(team_id=DD_TEAM_DATA_ID,user_id=USER_DATA_ID,body=body)print(response)
# Update a user's membership attributes on a team returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::TeamsAPI.new# there is a valid "dd_team" in the systemDD_TEAM_DATA_ID=ENV["DD_TEAM_DATA_ID"]# there is a valid "user" in the systemUSER_DATA_ID=ENV["USER_DATA_ID"]body=DatadogAPIClient::V2::UserTeamUpdateRequest.new({data:DatadogAPIClient::V2::UserTeamUpdate.new({attributes:DatadogAPIClient::V2::UserTeamAttributes.new({role:DatadogAPIClient::V2::UserTeamRole::ADMIN,}),type:DatadogAPIClient::V2::UserTeamType::TEAM_MEMBERSHIPS,}),})papi_instance.update_team_membership(DD_TEAM_DATA_ID,USER_DATA_ID,body)
// Update a user's membership attributes on a team returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_teams::TeamsAPI;usedatadog_api_client::datadogV2::model::UserTeamAttributes;usedatadog_api_client::datadogV2::model::UserTeamRole;usedatadog_api_client::datadogV2::model::UserTeamType;usedatadog_api_client::datadogV2::model::UserTeamUpdate;usedatadog_api_client::datadogV2::model::UserTeamUpdateRequest;#[tokio::main]asyncfnmain(){// there is a valid "dd_team" in the system
letdd_team_data_id=std::env::var("DD_TEAM_DATA_ID").unwrap();// there is a valid "user" in the system
letuser_data_id=std::env::var("USER_DATA_ID").unwrap();letbody=UserTeamUpdateRequest::new(UserTeamUpdate::new(UserTeamType::TEAM_MEMBERSHIPS).attributes(UserTeamAttributes::new().role(Some(UserTeamRole::ADMIN))),);letconfiguration=datadog::Configuration::new();letapi=TeamsAPI::with_config(configuration);letresp=api.update_team_membership(dd_team_data_id.clone(),user_data_id.clone(),body).await;ifletOk(value)=resp{println!("{:#?}",value);}else{println!("{:#?}",resp.unwrap_err());}}
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comddog-gov.comus2.ddog-gov.com"DD_API_KEY="<DD_API_KEY>"DD_APP_KEY="<DD_APP_KEY>"cargo run
/**
* Update a user's membership attributes on a team returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.TeamsApi(configuration);// there is a valid "dd_team" in the system
constDD_TEAM_DATA_ID=process.env.DD_TEAM_DATA_IDasstring;// there is a valid "user" in the system
constUSER_DATA_ID=process.env.USER_DATA_IDasstring;constparams: v2.TeamsApiUpdateTeamMembershipRequest={body:{data:{attributes:{role:"admin",},type:"team_memberships",},},teamId: DD_TEAM_DATA_ID,userId: USER_DATA_ID,};apiInstance.updateTeamMembership(params).then((data: v2.UserTeamResponse)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));