This endpoint configures synchronization between your existing Datadog teams and GitHub teams by matching their names.
It evaluates all current Datadog teams and compares them against teams in the GitHub organization
connected to your Datadog account, based on Datadog Team handle and GitHub Team slug
(lowercased and kebab-cased).
This operation is read-only on the GitHub side, no teams will be modified or created.
Optionally, provide selection_state to limit synchronization
to specific teams or organizations and their subtrees, instead
of syncing all teams.
A GitHub organization must be connected to your Datadog account,
and the GitHub App integrated with Datadog must have the Members Read permission. Matching is performed by comparing the Datadog team handle to the GitHub team slug
using a normalized exact match; case is ignored and spaces are removed. No modifications are made
to teams in GitHub. This only creates new teams in Datadog when type is set to provision.
This endpoint requires the teams_manage permission.
OAuth apps require the teams_manage authorization scope to access this endpoint.
A configuration governing syncing between Datadog teams and teams from an external system.
attributes [required]
object
Team sync attributes.
frequency
enum
How often the sync process should be run. Defaults to once when not provided.
Allowed enum values: once,continuously,paused
selection_state
[object]
Specifies which teams or organizations to sync. When
provided, synchronization is limited to the specified
items and their subtrees.
external_id [required]
object
The external identifier for a team or organization in the source platform.
type [required]
enum
The type of external identifier for the selection state item.
For GitHub synchronization, the allowed values are team and
organization.
Allowed enum values: team,organization
value [required]
string
The external identifier value from the source
platform. For GitHub, this is the string
representation of a GitHub organization ID or team
ID.
operation
enum
The operation to perform on the selected hierarchy.
When set to include, synchronization covers the
referenced teams or organizations.
Allowed enum values: include
scope
enum
The scope of the selection. When set to subtree,
synchronization includes the referenced team or
organization and everything nested under it.
Allowed enum values: subtree
source [required]
enum
The external source platform for team synchronization. Only "github" is supported.
Allowed enum values: github
sync_membership
boolean
Whether to sync members from the external team to the Datadog team. Defaults to false when not provided.
type [required]
enum
The type of synchronization operation. "link" connects teams by matching names. "provision" creates new teams when no match is found.
Allowed enum values: link,provision
id
string
The sync's identifier
type [required]
enum
Team sync bulk type.
Allowed enum values: team_sync_bulk
// Link Teams with GitHub Teams returns "OK" responsepackagemainimport("context""fmt""os""github.com/DataDog/datadog-api-client-go/v2/api/datadog""github.com/DataDog/datadog-api-client-go/v2/api/datadogV2")funcmain(){body:=datadogV2.TeamSyncRequest{Data:datadogV2.TeamSyncData{Attributes:datadogV2.TeamSyncAttributes{Source:datadogV2.TEAMSYNCATTRIBUTESSOURCE_GITHUB,Type:datadogV2.TEAMSYNCATTRIBUTESTYPE_LINK,},Type:datadogV2.TEAMSYNCBULKTYPE_TEAM_SYNC_BULK,},}ctx:=datadog.NewDefaultContext(context.Background())configuration:=datadog.NewConfiguration()apiClient:=datadog.NewAPIClient(configuration)api:=datadogV2.NewTeamsApi(apiClient)r,err:=api.SyncTeams(ctx,body)iferr!=nil{fmt.Fprintf(os.Stderr,"Error when calling `TeamsApi.SyncTeams`: %v\n",err)fmt.Fprintf(os.Stderr,"Full HTTP response: %v\n",r)}}
// Link Teams with GitHub Teams 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.TeamSyncAttributes;importcom.datadog.api.client.v2.model.TeamSyncAttributesSource;importcom.datadog.api.client.v2.model.TeamSyncAttributesType;importcom.datadog.api.client.v2.model.TeamSyncBulkType;importcom.datadog.api.client.v2.model.TeamSyncData;importcom.datadog.api.client.v2.model.TeamSyncRequest;publicclassExample{publicstaticvoidmain(String[]args){ApiClientdefaultClient=ApiClient.getDefaultApiClient();TeamsApiapiInstance=newTeamsApi(defaultClient);TeamSyncRequestbody=newTeamSyncRequest().data(newTeamSyncData().attributes(newTeamSyncAttributes().source(TeamSyncAttributesSource.GITHUB).type(TeamSyncAttributesType.LINK)).type(TeamSyncBulkType.TEAM_SYNC_BULK));try{apiInstance.syncTeams(body);}catch(ApiExceptione){System.err.println("Exception when calling TeamsApi#syncTeams");System.err.println("Status code: "+e.getCode());System.err.println("Reason: "+e.getResponseBody());System.err.println("Response headers: "+e.getResponseHeaders());e.printStackTrace();}}}
"""
Link Teams with GitHub Teams returns "OK" response
"""fromdatadog_api_clientimportApiClient,Configurationfromdatadog_api_client.v2.api.teams_apiimportTeamsApifromdatadog_api_client.v2.model.team_sync_attributesimportTeamSyncAttributesfromdatadog_api_client.v2.model.team_sync_attributes_sourceimportTeamSyncAttributesSourcefromdatadog_api_client.v2.model.team_sync_attributes_typeimportTeamSyncAttributesTypefromdatadog_api_client.v2.model.team_sync_bulk_typeimportTeamSyncBulkTypefromdatadog_api_client.v2.model.team_sync_dataimportTeamSyncDatafromdatadog_api_client.v2.model.team_sync_requestimportTeamSyncRequestbody=TeamSyncRequest(data=TeamSyncData(attributes=TeamSyncAttributes(source=TeamSyncAttributesSource.GITHUB,type=TeamSyncAttributesType.LINK,),type=TeamSyncBulkType.TEAM_SYNC_BULK,),)configuration=Configuration()withApiClient(configuration)asapi_client:api_instance=TeamsApi(api_client)api_instance.sync_teams(body=body)
# Link Teams with GitHub Teams returns "OK" responserequire"datadog_api_client"api_instance=DatadogAPIClient::V2::TeamsAPI.newbody=DatadogAPIClient::V2::TeamSyncRequest.new({data:DatadogAPIClient::V2::TeamSyncData.new({attributes:DatadogAPIClient::V2::TeamSyncAttributes.new({source:DatadogAPIClient::V2::TeamSyncAttributesSource::GITHUB,type:DatadogAPIClient::V2::TeamSyncAttributesType::LINK,}),type:DatadogAPIClient::V2::TeamSyncBulkType::TEAM_SYNC_BULK,}),})papi_instance.sync_teams(body)
// Link Teams with GitHub Teams returns "OK" response
usedatadog_api_client::datadog;usedatadog_api_client::datadogV2::api_teams::TeamsAPI;usedatadog_api_client::datadogV2::model::TeamSyncAttributes;usedatadog_api_client::datadogV2::model::TeamSyncAttributesSource;usedatadog_api_client::datadogV2::model::TeamSyncAttributesType;usedatadog_api_client::datadogV2::model::TeamSyncBulkType;usedatadog_api_client::datadogV2::model::TeamSyncData;usedatadog_api_client::datadogV2::model::TeamSyncRequest;#[tokio::main]asyncfnmain(){letbody=TeamSyncRequest::new(TeamSyncData::new(TeamSyncAttributes::new(TeamSyncAttributesSource::GITHUB,TeamSyncAttributesType::LINK,),TeamSyncBulkType::TEAM_SYNC_BULK,));letconfiguration=datadog::Configuration::new();letapi=TeamsAPI::with_config(configuration);letresp=api.sync_teams(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
/**
* Link Teams with GitHub Teams returns "OK" response
*/import{client,v2}from"@datadog/datadog-api-client";constconfiguration=client.createConfiguration();constapiInstance=newv2.TeamsApi(configuration);constparams: v2.TeamsApiSyncTeamsRequest={body:{data:{attributes:{source:"github",type:"link",},type:"team_sync_bulk",},},};apiInstance.syncTeams(params).then((data: any)=>{console.log("API called successfully. Returned data: "+JSON.stringify(data));}).catch((error: any)=>console.error(error));