Bulk create and remove teams ownership mappings

Note: This endpoint is in Preview and is subject to change. If you have any feedback, contact Datadog support.

POST https://api.ap1.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operationshttps://api.ap2.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operationshttps://api.datadoghq.eu/api/v2/rum/config/teams-ownership/mappings/operationshttps://api.ddog-gov.com/api/v2/rum/config/teams-ownership/mappings/operationshttps://api.us2.ddog-gov.com/api/v2/rum/config/teams-ownership/mappings/operationshttps://api.uk1.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operationshttps://api.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operationshttps://api.us3.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operationshttps://api.us5.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operations

Overview

Add and remove teams ownership mappings for your organization in a single atomic request, following the JSON:API atomic operations extension. Operations are applied together: if any operation is invalid, none of the operations are applied. Add operations are processed before remove operations, so results may not appear in the same order as the request.

Request

Body Data (required)

The list of add and remove operations to apply atomically.

Expand All

Field

Type

Description

atomic:operations [required]

[object]

The list of add and remove operations to apply atomically.

data

object

The mapping to add. Required when op is add.

attributes [required]

object

The attributes of the mapping to add. team_handle and view_name are required when op is add. At least one of service or application_id must be provided.

application_id

uuid

The ID of the RUM application this mapping applies to. For browser applications, provide the real application UUID — the team is applied to the view regardless of service. For mobile applications, omit this field (or set it to the nil UUID 00000000-0000-0000-0000-000000000000) — the team is applied to the view and service combination across all applications.

match_type

enum

How the view_name is matched against RUM view names. Allowed enum values: exact,prefix

default: exact

service

string

The RUM application's service name. For browser applications, this is optional. For mobile applications, this is required and scopes the ownership to a specific service.

team_handle

string

The handle of the team that owns the matched RUM views.

view_name

string

The RUM view name to match, or its prefix when match_type is prefix.

type [required]

enum

The type of the resource. The value should always be teams_ownership_mappings. Allowed enum values: teams_ownership_mappings

default: teams_ownership_mappings

op [required]

enum

Whether this operation adds a new mapping or removes an existing one. Allowed enum values: add,remove

ref

object

Identifies an existing mapping to remove. Required when op is remove.

id [required]

string

The ID of the mapping to remove.

type [required]

enum

The type of the resource. The value should always be teams_ownership_mappings. Allowed enum values: teams_ownership_mappings

default: teams_ownership_mappings

{
  "atomic:operations": [
    {
      "data": {
        "attributes": {
          "application_id": "11111111-2222-3333-4444-555555555555",
          "match_type": "exact",
          "service": "web-checkout",
          "team_handle": "team-rum",
          "view_name": "/checkout"
        },
        "type": "teams_ownership_mappings"
      },
      "op": "add",
      "ref": {
        "id": "456",
        "type": "teams_ownership_mappings"
      }
    }
  ]
}

Response

OK

The response body for the bulk create and remove operation. On success, atomic:results contains one entry per operation. Add results appear before remove results and may not match request order. Correlate add results by their type and id rather than by array position. On failure, no operations were applied and errors describes what went wrong.

Expand All

Field

Type

Description

atomic:results

[object]

The result of each operation. Add operations are processed first, then remove operations, so results may not appear in the same order as the request. Present only on success.

data

object

The mapping created by an add operation.

attributes [required]

object

The attributes of a mapping created by an add operation.

application_id

uuid

The ID of the RUM application, when one was provided.

created_at [required]

date-time

Timestamp when the mapping was created.

created_by [required]

string

The UUID of the user who created the mapping.

match_type [required]

enum

How the view_name is matched against RUM view names. Allowed enum values: exact,prefix

default: exact

org_id [required]

int64

The ID of the organization that owns this mapping.

service

string

The RUM application's service name, when one was provided.

team_handle [required]

string

The handle of the team that owns the matched RUM views.

view_name [required]

string

The RUM view name to match, or its prefix when match_type is prefix.

id [required]

string

The unique identifier of the teams ownership mapping.

type [required]

enum

The type of the resource. The value should always be teams_ownership_mappings. Allowed enum values: teams_ownership_mappings

default: teams_ownership_mappings

errors

[object]

The validation or processing errors encountered. Present only when the request could not be completed.

detail

string

A human-readable explanation specific to this error.

status [required]

string

The HTTP status code applicable to this error.

title [required]

string

A short, human-readable summary of the error.

{
  "atomic:results": [
    {
      "data": {
        "attributes": {
          "application_id": "11111111-2222-3333-4444-555555555555",
          "created_at": "2026-01-15T09:30:00.000Z",
          "created_by": "aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee",
          "match_type": "exact",
          "org_id": 123456,
          "service": "web-checkout",
          "team_handle": "team-rum",
          "view_name": "/checkout"
        },
        "id": "123",
        "type": "teams_ownership_mappings"
      }
    }
  ],
  "errors": [
    {
      "detail": "prefix match_type is not enabled for this org",
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Bad Request. One or more operations failed validation, so none of the operations were applied. Errors are returned in the JSON:API atomic operations error format rather than the standard error response.

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Not Authorized

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Not Found. One or more mappings requested for removal do not exist.

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Conflict. One or more mappings requested for creation already exist.

API error response.

Expand All

Field

Type

Description

errors [required]

[object]

A list of errors.

detail

string

A human-readable explanation specific to this occurrence of the error.

meta

object

Non-standard meta-information about the error

source

object

References to the source of the error.

header

string

A string indicating the name of a single request header which caused the error.

parameter

string

A string indicating which URI query parameter caused the error.

pointer

string

A JSON pointer to the value in the request document that caused the error.

status

string

Status code of the response.

title

string

Short human-readable summary of the error.

{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  ## default
# 

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.uk1.datadoghq.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operations" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "DD-API-KEY: ${DD_API_KEY}" \ -H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \ -d @- << EOF { "atomic:operations": [ { "data": { "attributes": { "application_id": "11111111-2222-3333-4444-555555555555", "match_type": "exact", "service": "web-checkout", "team_handle": "team-rum", "view_name": "/checkout" }, "type": "teams_ownership_mappings" }, "op": "add" }, { "op": "remove", "ref": { "id": "456", "type": "teams_ownership_mappings" } } ] } EOF
"""
Bulk create and remove teams ownership mappings returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.rum_teams_ownership_api import RumTeamsOwnershipApi
from datadog_api_client.v2.model.teams_ownership_mapping_batch_operation import TeamsOwnershipMappingBatchOperation
from datadog_api_client.v2.model.teams_ownership_mapping_batch_operation_data import (
    TeamsOwnershipMappingBatchOperationData,
)
from datadog_api_client.v2.model.teams_ownership_mapping_batch_operation_data_attributes import (
    TeamsOwnershipMappingBatchOperationDataAttributes,
)
from datadog_api_client.v2.model.teams_ownership_mapping_batch_operation_op import TeamsOwnershipMappingBatchOperationOp
from datadog_api_client.v2.model.teams_ownership_mapping_batch_request import TeamsOwnershipMappingBatchRequest
from datadog_api_client.v2.model.teams_ownership_mapping_type import TeamsOwnershipMappingType
from datadog_api_client.v2.model.teams_ownership_match_type import TeamsOwnershipMatchType

body = TeamsOwnershipMappingBatchRequest(
    atomic_operations=[
        TeamsOwnershipMappingBatchOperation(
            op=TeamsOwnershipMappingBatchOperationOp.ADD,
            data=TeamsOwnershipMappingBatchOperationData(
                type=TeamsOwnershipMappingType.TEAMS_OWNERSHIP_MAPPINGS,
                attributes=TeamsOwnershipMappingBatchOperationDataAttributes(
                    team_handle="team-rum",
                    view_name="/checkout-examplerumteamsownership",
                    service="web-checkout-examplerumteamsownership",
                    match_type=TeamsOwnershipMatchType.EXACT,
                ),
            ),
        ),
    ],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = RumTeamsOwnershipApi(api_client)
    response = api_instance.create_teams_ownership_mappings_batch(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
# Bulk create and remove teams ownership mappings returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::RumTeamsOwnershipAPI.new

body = DatadogAPIClient::V2::TeamsOwnershipMappingBatchRequest.new({
  atomic_operations: [
    DatadogAPIClient::V2::TeamsOwnershipMappingBatchOperation.new({
      op: DatadogAPIClient::V2::TeamsOwnershipMappingBatchOperationOp::ADD,
      data: DatadogAPIClient::V2::TeamsOwnershipMappingBatchOperationData.new({
        type: DatadogAPIClient::V2::TeamsOwnershipMappingType::TEAMS_OWNERSHIP_MAPPINGS,
        attributes: DatadogAPIClient::V2::TeamsOwnershipMappingBatchOperationDataAttributes.new({
          team_handle: "team-rum",
          view_name: "/checkout-examplerumteamsownership",
          service: "web-checkout-examplerumteamsownership",
          match_type: DatadogAPIClient::V2::TeamsOwnershipMatchType::EXACT,
        }),
      }),
    }),
  ],
})
p api_instance.create_teams_ownership_mappings_batch(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
// Bulk create and remove teams ownership mappings returns "OK" response

package main

import (
	"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"
)

func main() {
	body := datadogV2.TeamsOwnershipMappingBatchRequest{
		AtomicOperations: []datadogV2.TeamsOwnershipMappingBatchOperation{
			{
				Op: datadogV2.TEAMSOWNERSHIPMAPPINGBATCHOPERATIONOP_ADD,
				Data: &datadogV2.TeamsOwnershipMappingBatchOperationData{
					Type: datadogV2.TEAMSOWNERSHIPMAPPINGTYPE_TEAMS_OWNERSHIP_MAPPINGS,
					Attributes: datadogV2.TeamsOwnershipMappingBatchOperationDataAttributes{
						TeamHandle: datadog.PtrString("team-rum"),
						ViewName:   datadog.PtrString("/checkout-examplerumteamsownership"),
						Service:    datadog.PtrString("web-checkout-examplerumteamsownership"),
						MatchType:  datadogV2.TEAMSOWNERSHIPMATCHTYPE_EXACT.Ptr(),
					},
				},
			},
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewRumTeamsOwnershipApi(apiClient)
	resp, r, err := api.CreateTeamsOwnershipMappingsBatch(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `RumTeamsOwnershipApi.CreateTeamsOwnershipMappingsBatch`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `RumTeamsOwnershipApi.CreateTeamsOwnershipMappingsBatch`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
// Bulk create and remove teams ownership mappings returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.RumTeamsOwnershipApi;
import com.datadog.api.client.v2.model.TeamsOwnershipMappingBatchOperation;
import com.datadog.api.client.v2.model.TeamsOwnershipMappingBatchOperationData;
import com.datadog.api.client.v2.model.TeamsOwnershipMappingBatchOperationDataAttributes;
import com.datadog.api.client.v2.model.TeamsOwnershipMappingBatchOperationOp;
import com.datadog.api.client.v2.model.TeamsOwnershipMappingBatchRequest;
import com.datadog.api.client.v2.model.TeamsOwnershipMappingBatchResponse;
import com.datadog.api.client.v2.model.TeamsOwnershipMappingType;
import com.datadog.api.client.v2.model.TeamsOwnershipMatchType;
import java.util.Collections;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    RumTeamsOwnershipApi apiInstance = new RumTeamsOwnershipApi(defaultClient);

    TeamsOwnershipMappingBatchRequest body =
        new TeamsOwnershipMappingBatchRequest()
            .atomicOperations(
                Collections.singletonList(
                    new TeamsOwnershipMappingBatchOperation()
                        .op(TeamsOwnershipMappingBatchOperationOp.ADD)
                        .data(
                            new TeamsOwnershipMappingBatchOperationData()
                                .type(TeamsOwnershipMappingType.TEAMS_OWNERSHIP_MAPPINGS)
                                .attributes(
                                    new TeamsOwnershipMappingBatchOperationDataAttributes()
                                        .teamHandle("team-rum")
                                        .viewName("/checkout-examplerumteamsownership")
                                        .service("web-checkout-examplerumteamsownership")
                                        .matchType(TeamsOwnershipMatchType.EXACT)))));

    try {
      TeamsOwnershipMappingBatchResponse result =
          apiInstance.createTeamsOwnershipMappingsBatch(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling RumTeamsOwnershipApi#createTeamsOwnershipMappingsBatch");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
// Bulk create and remove teams ownership mappings returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_rum_teams_ownership::RumTeamsOwnershipAPI;
use datadog_api_client::datadogV2::model::TeamsOwnershipMappingBatchOperation;
use datadog_api_client::datadogV2::model::TeamsOwnershipMappingBatchOperationData;
use datadog_api_client::datadogV2::model::TeamsOwnershipMappingBatchOperationDataAttributes;
use datadog_api_client::datadogV2::model::TeamsOwnershipMappingBatchOperationOp;
use datadog_api_client::datadogV2::model::TeamsOwnershipMappingBatchRequest;
use datadog_api_client::datadogV2::model::TeamsOwnershipMappingType;
use datadog_api_client::datadogV2::model::TeamsOwnershipMatchType;

#[tokio::main]
async fn main() {
    let body =
        TeamsOwnershipMappingBatchRequest::new(vec![TeamsOwnershipMappingBatchOperation::new(
            TeamsOwnershipMappingBatchOperationOp::ADD,
        )
        .data(TeamsOwnershipMappingBatchOperationData::new(
            TeamsOwnershipMappingBatchOperationDataAttributes::new()
                .match_type(TeamsOwnershipMatchType::EXACT)
                .service("web-checkout-examplerumteamsownership".to_string())
                .team_handle("team-rum".to_string())
                .view_name("/checkout-examplerumteamsownership".to_string()),
            TeamsOwnershipMappingType::TEAMS_OWNERSHIP_MAPPINGS,
        ))]);
    let configuration = datadog::Configuration::new();
    let api = RumTeamsOwnershipAPI::with_config(configuration);
    let resp = api.create_teams_ownership_mappings_batch(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
/**
 * Bulk create and remove teams ownership mappings returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration();
const apiInstance = new v2.RumTeamsOwnershipApi(configuration);

const params: v2.RumTeamsOwnershipApiCreateTeamsOwnershipMappingsBatchRequest =
  {
    body: {
      atomicOperations: [
        {
          op: "add",
          data: {
            type: "teams_ownership_mappings",
            attributes: {
              teamHandle: "team-rum",
              viewName: "/checkout-examplerumteamsownership",
              service: "web-checkout-examplerumteamsownership",
              matchType: "exact",
            },
          },
        },
      ],
    },
  };

apiInstance
  .createTeamsOwnershipMappingsBatch(params)
  .then((data: v2.TeamsOwnershipMappingBatchResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"