---
title: Bulk create and remove teams ownership mappings
description: Add and remove teams ownership mappings for your organization in a single atomic request, following the JSON:API atomic operations extension.
breadcrumbs: Docs > API > Bulk create and remove teams ownership mappings
---

> For the complete documentation index, see [llms.txt](https://docs.datadoghq.com/llms.txt).

# Bulk create and remove teams ownership mappings

## v2 (latest)

{% alert level="warning" %}
**Note**: This endpoint is in Preview and is subject to change.
If you have any feedback, contact [Datadog support](https://docs.datadoghq.com/help.md).
{% /alert %}

| Datadog site      | API endpoint                                                                             |
| ----------------- | ---------------------------------------------------------------------------------------- |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operations     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operations |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operations |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/rum/config/teams-ownership/mappings/operations      |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operations |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operations |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/rum/config/teams-ownership/mappings/operations |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/rum/config/teams-ownership/mappings/operations      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.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](https://jsonapi.org/ext/atomic/).
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.

This endpoint requires the `rum_apps_write` permission.

### Request

#### Body Data (required)

The list of add and remove operations to apply atomically.

{% tabs %}
{% tab label="Model" %}
| Parent field      | Field                          | Type     | Description                                                                                                                                                                                                                                                                                                                                                                |
| ----------------- | ------------------------------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                   | atomic:operations [*required*] | [object] | The list of add and remove operations to apply atomically.                                                                                                                                                                                                                                                                                                                 |
| atomic:operations | data                           | object   | The mapping to add. Required when `op` is `add`.                                                                                                                                                                                                                                                                                                                           |
| data              | 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.                                                                                                                                                                                                       |
| attributes        | 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. |
| attributes        | match_type                     | enum     | How the `view_name` is matched against RUM view names. Allowed enum values: `exact`, `prefix`. Default: `exact`.                                                                                                                                                                                                                                                           |
| attributes        | 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.                                                                                                                                                                                                  |
| attributes        | team_handle                    | string   | The handle of the team that owns the matched RUM views.                                                                                                                                                                                                                                                                                                                    |
| attributes        | view_name                      | string   | The RUM view name to match, or its prefix when `match_type` is `prefix`.                                                                                                                                                                                                                                                                                                   |
| data              | 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 | op [*required*]                | enum     | Whether this operation adds a new mapping or removes an existing one. Allowed enum values: `add`, `remove`.                                                                                                                                                                                                                                                                |
| atomic:operations | ref                            | object   | Identifies an existing mapping to remove. Required when `op` is `remove`.                                                                                                                                                                                                                                                                                                  |
| ref               | id [*required*]                | string   | The ID of the mapping to remove.                                                                                                                                                                                                                                                                                                                                           |
| ref               | 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`.                                                                                                                                                                                                       |
{% /tab %}

{% tab label="Example" %}
```json
{
  "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"
      }
    }
  ]
}
```
{% /tab %}
{% /tabs %}

### Response

{% tabs %}
{% tab label="200" %}
OK

{% tabs %}
{% tab label="Model" %}
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.

| Parent field   | 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. |
| atomic:results | data                     | object    | The mapping created by an `add` operation.                                                                                                                                     |
| data           | attributes [*required*]  | object    | The attributes of a mapping created by an `add` operation.                                                                                                                     |
| attributes     | application_id           | uuid      | The ID of the RUM application, when one was provided.                                                                                                                          |
| attributes     | created_at [*required*]  | date-time | Timestamp when the mapping was created.                                                                                                                                        |
| attributes     | created_by [*required*]  | string    | The UUID of the user who created the mapping.                                                                                                                                  |
| attributes     | match_type [*required*]  | enum      | How the `view_name` is matched against RUM view names. Allowed enum values: `exact`, `prefix`. Default: `exact`.                                                               |
| attributes     | org_id [*required*]      | int64     | The ID of the organization that owns this mapping.                                                                                                                             |
| attributes     | service                  | string    | The RUM application's service name, when one was provided.                                                                                                                     |
| attributes     | team_handle [*required*] | string    | The handle of the team that owns the matched RUM views.                                                                                                                        |
| attributes     | view_name [*required*]   | string    | The RUM view name to match, or its prefix when `match_type` is `prefix`.                                                                                                       |
| data           | id [*required*]          | string    | The unique identifier of the teams ownership mapping.                                                                                                                          |
| data           | 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.                                                                         |
| errors         | detail                   | string    | A human-readable explanation specific to this error.                                                                                                                           |
| errors         | status [*required*]      | string    | The HTTP status code applicable to this error.                                                                                                                                 |
| errors         | title [*required*]       | string    | A short, human-readable summary of the error.                                                                                                                                  |
{% /tab %}

{% tab label="Example" %}
```json
{
  "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"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
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.

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Not Authorized

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="404" %}
Not Found. One or more mappings requested for removal do not exist.

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="409" %}
Conflict. One or more mappings requested for creation already exist.

{% tabs %}
{% tab label="Model" %}
API error response.

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | code                | string   | An application-specific error code.                                             |
| errors       | detail              | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                | object   | Non-standard meta-information about the error                                   |
| errors       | source              | object   | References to the source of the error.                                          |
| source       | header              | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter           | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer             | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status              | string   | Status code of the response.                                                    |
| errors       | title               | string   | Short human-readable summary of the error.                                      |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    {
      "code": "invalid_request",
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X POST "https://api.${DD_SITE}/api/v2/rum/config/teams-ownership/mappings/operations" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-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
```
{% /tab %}

{% tab label="Go" %}
```go
// 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())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	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](https://docs.datadoghq.com/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
```
{% /tab %}

{% tab label="Java" %}
```java
// 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();
    defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
    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](https://docs.datadoghq.com/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
```
{% /tab %}

{% tab label="Python" %}
```python
"""
Bulk create and remove teams ownership mappings returns "OK" response
"""

from os import environ
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()
configuration.access_token = environ["DD_BEARER_TOKEN"]
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](https://docs.datadoghq.com/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
```
{% /tab %}

{% tab label="Ruby" %}
```ruby
# Bulk create and remove teams ownership mappings returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
end
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](https://docs.datadoghq.com/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" ruby "example.rb"
```
{% /tab %}

{% tab label="Rust" %}
```rust
// 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](https://docs.datadoghq.com/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_API_KEY="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
```
{% /tab %}

{% tab label="TypeScript" %}
```typescript
/**
 * Bulk create and remove teams ownership mappings returns "OK" response
 */

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

const configuration = client.createConfiguration({
  authMethods: {
    AuthZ: {
      accessToken: process.env.DD_BEARER_TOKEN as string,
    },
  },
});
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](https://docs.datadoghq.com/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" npx tsx "example.ts"
```
{% /tab %}
{% /tabs %}
