Update a hardcoded retention filter

PATCH https://api.ap1.datadoghq.com/api/v2/rum/applications/{app_id}/hardcoded_retention_filters/{rf_id}https://api.ap2.datadoghq.com/api/v2/rum/applications/{app_id}/hardcoded_retention_filters/{rf_id}https://api.datadoghq.eu/api/v2/rum/applications/{app_id}/hardcoded_retention_filters/{rf_id}https://api.ddog-gov.com/api/v2/rum/applications/{app_id}/hardcoded_retention_filters/{rf_id}https://api.us2.ddog-gov.com/api/v2/rum/applications/{app_id}/hardcoded_retention_filters/{rf_id}https://api.datadoghq.com/api/v2/rum/applications/{app_id}/hardcoded_retention_filters/{rf_id}https://api.us3.datadoghq.com/api/v2/rum/applications/{app_id}/hardcoded_retention_filters/{rf_id}https://api.us5.datadoghq.com/api/v2/rum/applications/{app_id}/hardcoded_retention_filters/{rf_id}

Overview

Update the cross-product sample rates of a hardcoded retention filter for a RUM application. Only fields whose matching flag in cross_product_sampling_editability is true can be updated. Any other field is read-only and cannot be sent in the payload. Returns the updated hardcoded retention filter when the request is successful.

Arguments

Path Parameters

Name

Type

Description

app_id [required]

string

RUM application ID.

rf_id [required]

string

Hardcoded retention filter ID.

Request

Body Data (required)

New cross-product sample rates for the hardcoded retention filter.

Expand All

Field

Type

Description

data [required]

object

The hardcoded retention filter properties to update.

attributes [required]

object

The attributes of a hardcoded retention filter that can be updated. Only fields whose matching flag in cross_product_sampling_editability is true can be modified.

cross_product_sampling

object

Partial update for cross-product retention of a hardcoded retention filter. Only fields whose matching flag in cross_product_sampling_editability is true can be updated.

session_replay_enabled

boolean

Controls whether Session Replay cross-product retention is active. Omit to leave unchanged.

session_replay_sample_rate

double

Percentage (0–100) of retained sessions with an ingested replay whose replay data is kept. Omit to leave unchanged.

trace_enabled

boolean

Controls whether Trace cross-product retention is active. Omit to leave unchanged.

trace_sample_rate

double

Percentage (0–100) of retained sessions with ingested traces whose traces are indexed. Omit to leave unchanged.

id [required]

string

The ID of the hardcoded retention filter. Must match the rf_id path parameter.

type [required]

enum

The resource type. The value must be hardcoded_retention_filters. Allowed enum values: hardcoded_retention_filters

default: hardcoded_retention_filters

{
  "data": {
    "attributes": {
      "cross_product_sampling": {
        "session_replay_enabled": true,
        "session_replay_sample_rate": 50,
        "trace_enabled": true,
        "trace_sample_rate": 25
      }
    },
    "id": "forced_replay_sessions",
    "type": "hardcoded_retention_filters"
  }
}

Response

Updated

A hardcoded retention filter response body.

Expand All

Field

Type

Description

data

object

A hardcoded retention filter.

attributes

object

The attributes of a hardcoded retention filter.

cross_product_sampling

object

Cross-product retention settings for a hardcoded retention filter.

session_replay_enabled

boolean

Indicates whether Session Replay cross-product retention is active.

session_replay_sample_rate

double

Percentage (0–100) of retained sessions with an ingested replay whose replay data is kept.

trace_enabled

boolean

Indicates whether Trace cross-product retention is active.

trace_sample_rate

double

Percentage (0–100) of retained sessions with ingested traces whose traces are indexed.

cross_product_sampling_editability

object

Flags indicating which cross_product_sampling fields can be updated. Read-only.

session_replay_sample_rate

boolean

If true, cross_product_sampling.session_replay_sample_rate can be updated on this filter.

trace_sample_rate

boolean

If true, cross_product_sampling.trace_sample_rate can be updated on this filter.

enabled

boolean

Indicates whether the hardcoded retention filter is active. Read-only.

event_type

enum

The type of RUM events the hardcoded filter applies to. Read-only. Allowed enum values: session,view,action,error,resource,long_task,vital

name

string

The name of the hardcoded retention filter. Read-only.

query

string

The query string for the hardcoded retention filter. Read-only.

sample_rate

double

The retention sample rate (0–100) for the hardcoded filter. Read-only.

id

string

The ID of the hardcoded retention filter.

meta

object

Metadata about the hardcoded retention filter.

source

enum

The source of the last update to a hardcoded retention filter. Allowed enum values: default,ui,terraform

updated_at

int64

Unix epoch (in milliseconds) of the last update.

updated_by_handle

string

Handle of the user who last updated the filter.

type

enum

The resource type. The value must be hardcoded_retention_filters. Allowed enum values: hardcoded_retention_filters

default: hardcoded_retention_filters

{
  "data": {
    "attributes": {
      "cross_product_sampling": {
        "session_replay_enabled": true,
        "session_replay_sample_rate": 50,
        "trace_enabled": true,
        "trace_sample_rate": 25
      },
      "cross_product_sampling_editability": {
        "session_replay_sample_rate": true,
        "trace_sample_rate": false
      },
      "enabled": true,
      "event_type": "session",
      "name": "Replay sessions",
      "query": "@session.has_replay:true",
      "sample_rate": 100
    },
    "id": "forced_replay_sessions",
    "meta": {
      "source": "ui",
      "updated_at": 1735689600000,
      "updated_by_handle": "jane.doe@example.com"
    },
    "type": "hardcoded_retention_filters"
  }
}

Bad Request

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Not Authorized

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

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

Not Found

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "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
# 

# Path parameters
export app_id="CHANGE_ME"
export rf_id="CHANGE_ME"
# Curl command
curl -X PATCH "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.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/rum/applications/${app_id}/hardcoded_retention_filters/${rf_id}" \ -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 { "data": { "attributes": { "cross_product_sampling": { "session_replay_enabled": true, "session_replay_sample_rate": 50 } }, "id": "forced_replay_sessions", "type": "hardcoded_retention_filters" } } EOF