---
title: Add RUM replay session to playlist
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Rum Replay Playlists
---

# Add RUM replay session to playlist{% #add-rum-replay-session-to-playlist %}
Copy pageCopied
{% tab title="v2" %}

| Datadog site      | API endpoint                                                                                      |
| ----------------- | ------------------------------------------------------------------------------------------------- |
| ap1.datadoghq.com | PUT https://api.ap1.datadoghq.com/api/v2/rum/replay/playlists/{playlist_id}/sessions/{session_id} |
| ap2.datadoghq.com | PUT https://api.ap2.datadoghq.com/api/v2/rum/replay/playlists/{playlist_id}/sessions/{session_id} |
| app.datadoghq.eu  | PUT https://api.datadoghq.eu/api/v2/rum/replay/playlists/{playlist_id}/sessions/{session_id}      |
| app.ddog-gov.com  | PUT https://api.ddog-gov.com/api/v2/rum/replay/playlists/{playlist_id}/sessions/{session_id}      |
| us2.ddog-gov.com  | PUT https://api.us2.ddog-gov.com/api/v2/rum/replay/playlists/{playlist_id}/sessions/{session_id}  |
| app.datadoghq.com | PUT https://api.datadoghq.com/api/v2/rum/replay/playlists/{playlist_id}/sessions/{session_id}     |
| us3.datadoghq.com | PUT https://api.us3.datadoghq.com/api/v2/rum/replay/playlists/{playlist_id}/sessions/{session_id} |
| us5.datadoghq.com | PUT https://api.us5.datadoghq.com/api/v2/rum/replay/playlists/{playlist_id}/sessions/{session_id} |

### Overview

Add a session to a playlist.

### Arguments

#### Path Parameters

| Name                          | Type    | Description                        |
| ----------------------------- | ------- | ---------------------------------- |
| playlist_id [*required*] | integer | Unique identifier of the playlist. |
| session_id [*required*]  | string  | Unique identifier of the session.  |

#### Query Strings

| Name                 | Type    | Description                                                                      |
| -------------------- | ------- | -------------------------------------------------------------------------------- |
| data_source          | string  | Data source type. Valid values: 'rum' or 'product_analytics'. Defaults to 'rum'. |
| ts [*required*] | integer | Server-side timestamp in milliseconds.                                           |

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
A single RUM replay session resource as it appears within a playlist context.

| Parent field | Field                  | Type   | Description                                                                                           |
| ------------ | ---------------------- | ------ | ----------------------------------------------------------------------------------------------------- |
|              | data [*required*] | object | Data object representing a session within a playlist, including its identifier, type, and attributes. |
| data         | attributes             | object | Attributes of a session within a playlist, including the session event data and its replay track.     |
| attributes   | session_event          | object | Raw event data associated with the replay session.                                                    |
| attributes   | track                  | string | Replay track identifier indicating which recording track the session belongs to.                      |
| data         | id                     | string | Unique identifier of the RUM replay session.                                                          |
| data         | type [*required*] | enum   | Rum replay session resource type. Allowed enum values: `rum_replay_session`                           |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "session_event": {},
      "track": "string"
    },
    "id": "string",
    "type": "rum_replay_session"
  }
}
```

{% /tab %}

{% /tab %}

{% tab title="201" %}
Created
{% tab title="Model" %}
A single RUM replay session resource as it appears within a playlist context.

| Parent field | Field                  | Type   | Description                                                                                           |
| ------------ | ---------------------- | ------ | ----------------------------------------------------------------------------------------------------- |
|              | data [*required*] | object | Data object representing a session within a playlist, including its identifier, type, and attributes. |
| data         | attributes             | object | Attributes of a session within a playlist, including the session event data and its replay track.     |
| attributes   | session_event          | object | Raw event data associated with the replay session.                                                    |
| attributes   | track                  | string | Replay track identifier indicating which recording track the session belongs to.                      |
| data         | id                     | string | Unique identifier of the RUM replay session.                                                          |
| data         | type [*required*] | enum   | Rum replay session resource type. Allowed enum values: `rum_replay_session`                           |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "session_event": {},
      "track": "string"
    },
    "id": "string",
    "type": "rum_replay_session"
  }
}
```

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too many requests
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

### Code Example

##### 
                  \# Path parameters export playlist_id="1.234567e+06" export session_id="00000000-0000-0000-0000-000000000001" \# Required query arguments export ts="1.7040672e+12" \# Curl command curl -X PUT "https://api.datadoghq.com/api/v2/rum/replay/playlists/${playlist_id}/sessions/${session_id}?ts=${ts}" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" 
                
##### 

```python
"""
Add rum replay session to playlist returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.rum_replay_playlists_api import RumReplayPlaylistsApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = RumReplayPlaylistsApi(api_client)
    response = api_instance.add_rum_replay_session_to_playlist(
        ts=1704067200000,
        playlist_id=1234567,
        session_id="00000000-0000-0000-0000-000000000001",
    )

    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:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
##### 

```ruby
# Add rum replay session to playlist returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::RumReplayPlaylistsAPI.new
p api_instance.add_rum_replay_session_to_playlist(1704067200000, 1234567, "00000000-0000-0000-0000-000000000001")
```

#### 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:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
##### 

```go
// Add rum replay session to playlist 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() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewRumReplayPlaylistsApi(apiClient)
	resp, r, err := api.AddRumReplaySessionToPlaylist(ctx, 1704067200000, 1234567, "00000000-0000-0000-0000-000000000001", *datadogV2.NewAddRumReplaySessionToPlaylistOptionalParameters())

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `RumReplayPlaylistsApi.AddRumReplaySessionToPlaylist`:\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:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
##### 

```java
// Add rum replay session to playlist returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.RumReplayPlaylistsApi;
import com.datadog.api.client.v2.model.PlaylistsSession;

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

    try {
      PlaylistsSession result =
          apiInstance.addRumReplaySessionToPlaylist(
              1704067200000L, 1234567, "00000000-0000-0000-0000-000000000001");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling RumReplayPlaylistsApi#addRumReplaySessionToPlaylist");
      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:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
##### 

```rust
// Add rum replay session to playlist returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_rum_replay_playlists::AddRumReplaySessionToPlaylistOptionalParams;
use datadog_api_client::datadogV2::api_rum_replay_playlists::RumReplayPlaylistsAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = RumReplayPlaylistsAPI::with_config(configuration);
    let resp = api
        .add_rum_replay_session_to_playlist(
            1704067200000,
            1234567,
            "00000000-0000-0000-0000-000000000001".to_string(),
            AddRumReplaySessionToPlaylistOptionalParams::default(),
        )
        .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:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
##### 

```typescript
/**
 * Add rum replay session to playlist returns "OK" response
 */

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

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

const params: v2.RumReplayPlaylistsApiAddRumReplaySessionToPlaylistRequest = {
  ts: 1704067200000,
  playlistId: 1234567,
  sessionId: "00000000-0000-0000-0000-000000000001",
};

apiInstance
  .addRumReplaySessionToPlaylist(params)
  .then((data: v2.PlaylistsSession) => {
    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:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"
{% /tab %}
