---
title: Create or update an archive configuration
description: Create or update the archive configuration for a RUM application.
breadcrumbs: Docs > API > Create or update an archive configuration
---

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

# Create or update an archive configuration

## v2 (latest)

| Datadog site      | API endpoint                                                         |
| ----------------- | -------------------------------------------------------------------- |
| app.datadoghq.com | PUT https://api.datadoghq.com/api/v2/rum/config/archive/{app_id}     |
| us3.datadoghq.com | PUT https://api.us3.datadoghq.com/api/v2/rum/config/archive/{app_id} |
| us5.datadoghq.com | PUT https://api.us5.datadoghq.com/api/v2/rum/config/archive/{app_id} |
| app.datadoghq.eu  | PUT https://api.datadoghq.eu/api/v2/rum/config/archive/{app_id}      |
| ap1.datadoghq.com | PUT https://api.ap1.datadoghq.com/api/v2/rum/config/archive/{app_id} |
| ap2.datadoghq.com | PUT https://api.ap2.datadoghq.com/api/v2/rum/config/archive/{app_id} |
| uk1.datadoghq.com | PUT https://api.uk1.datadoghq.com/api/v2/rum/config/archive/{app_id} |
| app.ddog-gov.com  | PUT https://api.ddog-gov.com/api/v2/rum/config/archive/{app_id}      |
| us2.ddog-gov.com  | PUT https://api.us2.ddog-gov.com/api/v2/rum/config/archive/{app_id}  |

### Overview

Create or update the archive configuration for a RUM application. The application ID in the path must match `data.id`. Disabling archiving does not delete archived sessions.

This endpoint requires the `rum_rehydration_filter_write` permission.

### Arguments

#### Path Parameters

| Field               | Type   | Description                                     |
| ------------------- | ------ | ----------------------------------------------- |
| app_id [*required*] | string | RUM application ID. Must match data.id for PUT. |

### Request

#### Body Data (required)

JSON:API request body.

{% tabs %}
{% tab label="Model" %}
| Parent field | Field                   | Type    | Description                                                                                                                                               |
| ------------ | ----------------------- | ------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data [*required*]       | object  | JSON:API resource.                                                                                                                                        |
| data         | attributes [*required*] | object  | Archive configuration to save. When enabled is true, retention_days is required and must be 30, 90, or 180. When disabled, retention_days can be omitted. |
| attributes   | enabled [*required*]    | boolean | Whether archiving is enabled.                                                                                                                             |
| attributes   | retention_days          | int32   | Retention in days. When enabled is true, required and restricted to 30, 90, or 180. When enabled is false, this field can be omitted.                     |
| data         | id [*required*]         | string  | Resource identifier.                                                                                                                                      |
| data         | type [*required*]       | enum    | JSON:API resource type. Allowed enum values: `rum_archive_config`.                                                                                        |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "enabled": true,
      "retention_days": 90
    },
    "id": "a33671aa-24fd-4dcd-ba4b-5bbdbafe7690",
    "type": "rum_archive_config"
  }
}
```
{% /tab %}
{% /tabs %}

### Response

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

{% tabs %}
{% tab label="Model" %}
JSON:API document.

| Parent field | Field                   | Type      | Description                                                                                          |
| ------------ | ----------------------- | --------- | ---------------------------------------------------------------------------------------------------- |
|              | data [*required*]       | object    | JSON:API resource.                                                                                   |
| data         | attributes [*required*] | object    | Archive configuration.                                                                               |
| attributes   | enabled [*required*]    | boolean   | Whether archiving is enabled.                                                                        |
| attributes   | org_id [*required*]     | int64     | Organization ID.                                                                                     |
| attributes   | retention_days          | int32     | Configured retention in days; omitted when unset. When archiving is enabled, this is 30, 90, or 180. |
| attributes   | updated_at              | date-time | Last update time.                                                                                    |
| attributes   | updated_by              | string    | Handle of the user who last updated the configuration.                                               |
| data         | id [*required*]         | string    | Resource identifier.                                                                                 |
| data         | type [*required*]       | enum      | JSON:API resource type. Allowed enum values: `rum_archive_config`.                                   |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": {
    "attributes": {
      "enabled": true,
      "org_id": 123,
      "retention_days": 90,
      "updated_at": "2026-09-21T12:00:00Z",
      "updated_by": "user@example.com"
    },
    "id": "a33671aa-24fd-4dcd-ba4b-5bbdbafe7690",
    "type": "rum_archive_config"
  }
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="400" %}
Bad Request

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

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| 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": [
    {
      "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="401" %}
Unauthorized

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

| Field               | Type  | Description                                                                                   |
| ------------------- | ----- | --------------------------------------------------------------------------------------------- |
| errors [*required*] | [any] | Errors as plain-text messages or JSON:API error objects containing status, title, and detail. |
{% /tab %}

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

{% tab label="403" %}
Forbidden

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

| Field               | Type  | Description                                                                                   |
| ------------------- | ----- | --------------------------------------------------------------------------------------------- |
| errors [*required*] | [any] | Errors as plain-text messages or JSON:API error objects containing status, title, and detail. |
{% /tab %}

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

{% tab label="404" %}
Not Found

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

| Parent field | Field               | Type     | Description                                                                     |
| ------------ | ------------------- | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| 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": [
    {
      "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*] | [any] | Errors as plain-text messages or JSON:API error objects containing status, title, and detail. |
{% /tab %}

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

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
## default

# Path parameters
export app_id="a33671aa-24fd-4dcd-ba4b-5bbdbafe7690"

# 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
export DD_API_KEY="<DD_API_KEY>"
export DD_APP_KEY="<DD_APP_KEY>"

curl -X PUT "https://api.${DD_SITE}/api/v2/rum/config/archive/${app_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": {
      "enabled": true,
      "retention_days": 90
    },
    "id": "a33671aa-24fd-4dcd-ba4b-5bbdbafe7690",
    "type": "rum_archive_config"
  }
}
EOF

## disabled

# Path parameters
export app_id="a33671aa-24fd-4dcd-ba4b-5bbdbafe7690"

# 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
export DD_API_KEY="<DD_API_KEY>"
export DD_APP_KEY="<DD_APP_KEY>"

curl -X PUT "https://api.${DD_SITE}/api/v2/rum/config/archive/${app_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": {
      "enabled": false
    },
    "id": "a33671aa-24fd-4dcd-ba4b-5bbdbafe7690",
    "type": "rum_archive_config"
  }
}
EOF
```
{% /tab %}
{% /tabs %}
