---
title: Create a DEM journey variant
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > DEM
---

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

# Create a DEM journey variant{% #create-a-dem-journey-variant %}
Copy pageCopied
{% tab title="v2" %}

| Datadog site      | API endpoint                                                                 |
| ----------------- | ---------------------------------------------------------------------------- |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/dem/journeys/{journey_id}/variants |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/dem/journeys/{journey_id}/variants |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/dem/journeys/{journey_id}/variants      |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/dem/journeys/{journey_id}/variants      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/dem/journeys/{journey_id}/variants  |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/dem/journeys/{journey_id}/variants |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/dem/journeys/{journey_id}/variants     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/dem/journeys/{journey_id}/variants |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/dem/journeys/{journey_id}/variants |

### Overview

Create a variant for a DEM journey. This endpoint requires the `synthetics_write` permission.

### Arguments

#### Path Parameters

| Name                         | Type   | Description                                                 |
| ---------------------------- | ------ | ----------------------------------------------------------- |
| journey_id [*required*] | string | The unique identifier of the journey that owns the variant. |

### Request

#### Body Data (required)



{% tab title="Model" %}

| Parent field | Field                        | Type     | Description                                                                   |
| ------------ | ---------------------------- | -------- | ----------------------------------------------------------------------------- |
|              | data [*required*]       | object   | Data object for a DEM journey variant request.                                |
| data         | attributes [*required*] | object   | Attributes of a DEM journey variant.                                          |
| attributes   | filter                       | string   | An optional RUM query filter to scope this variant.                           |
| attributes   | name [*required*]       | string   | The name of the variant.                                                      |
| attributes   | rum_steps [*required*]  | [object] | List of RUM journey steps.                                                    |
| rum_steps    | nodes [*required*]      | [object] | List of RUM nodes within a journey step.                                      |
| nodes        | app_id                       | string   | The application ID associated with this node.                                 |
| nodes        | id                           | string   | The ID of the RUM node element.                                               |
| nodes        | query [*required*]      | string   | The RUM query for matching this node.                                         |
| rum_steps    | type [*required*]       | enum     | The type of a RUM journey step. Allowed enum values: `start,stop,step`        |
| data         | type [*required*]       | enum     | The type identifier for DEM journey variants. Allowed enum values: `variants` |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "filter": "device.type:mobile",
      "name": "Mobile checkout",
      "rum_steps": [
        {
          "nodes": [
            {
              "app_id": "app-xyz789",
              "id": "element-id-123",
              "query": "action.name:'checkout'"
            }
          ],
          "type": "start"
        }
      ]
    },
    "type": "variants"
  }
}
```

{% /tab %}

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
Response containing a DEM journey variant.

| Parent field | Field                        | Type     | Description                                                                   |
| ------------ | ---------------------------- | -------- | ----------------------------------------------------------------------------- |
|              | data [*required*]       | object   | Data object returned for a DEM journey variant.                               |
| data         | attributes [*required*] | object   | Attributes of a DEM journey variant.                                          |
| attributes   | filter                       | string   | An optional RUM query filter to scope this variant.                           |
| attributes   | name [*required*]       | string   | The name of the variant.                                                      |
| attributes   | rum_steps [*required*]  | [object] | List of RUM journey steps.                                                    |
| rum_steps    | nodes [*required*]      | [object] | List of RUM nodes within a journey step.                                      |
| nodes        | app_id                       | string   | The application ID associated with this node.                                 |
| nodes        | id                           | string   | The ID of the RUM node element.                                               |
| nodes        | query [*required*]      | string   | The RUM query for matching this node.                                         |
| rum_steps    | type [*required*]       | enum     | The type of a RUM journey step. Allowed enum values: `start,stop,step`        |
| data         | id [*required*]         | string   | The unique identifier of the variant.                                         |
| data         | type [*required*]       | enum     | The type identifier for DEM journey variants. Allowed enum values: `variants` |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "filter": "device.type:mobile",
      "name": "Mobile checkout",
      "rum_steps": [
        {
          "nodes": [
            {
              "app_id": "app-xyz789",
              "id": "element-id-123",
              "query": "action.name:'checkout'"
            }
          ],
          "type": "start"
        }
      ]
    },
    "id": "variant-001",
    "type": "variants"
  }
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
Bad Request
{% tab title="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 title="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 %}

{% /tab %}

{% tab title="404" %}
Not Found
{% tab title="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 title="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 %}

{% /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

##### 
                  \## default
# 
 \# Path parameters export journey_id="journey-abc123" \# Curl command curl -X POST "https://api.datadoghq.com/api/v2/dem/journeys/${journey_id}/variants" \
-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": {
      "filter": "device.type:mobile",
      "name": "Mobile checkout",
      "rum_steps": [
        {
          "nodes": [
            {
              "query": "action.name:'checkout'"
            }
          ],
          "type": "start"
        },
        {
          "nodes": [
            {
              "query": "action.name:'confirmation'"
            }
          ],
          "type": "stop"
        }
      ]
    },
    "type": "variants"
  }
}
EOF 
                
{% /tab %}
