---
title: Edit a mobile test
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Synthetics
---

# Edit a mobile test{% #edit-a-mobile-test %}
Copy pageCopied
{% tab title="v1" %}

| Datadog site      | API endpoint                                                                 |
| ----------------- | ---------------------------------------------------------------------------- |
| ap1.datadoghq.com | PUT https://api.ap1.datadoghq.com/api/v1/synthetics/tests/mobile/{public_id} |
| ap2.datadoghq.com | PUT https://api.ap2.datadoghq.com/api/v1/synthetics/tests/mobile/{public_id} |
| app.datadoghq.eu  | PUT https://api.datadoghq.eu/api/v1/synthetics/tests/mobile/{public_id}      |
| app.ddog-gov.com  | PUT https://api.ddog-gov.com/api/v1/synthetics/tests/mobile/{public_id}      |
| us2.ddog-gov.com  | PUT https://api.us2.ddog-gov.com/api/v1/synthetics/tests/mobile/{public_id}  |
| app.datadoghq.com | PUT https://api.datadoghq.com/api/v1/synthetics/tests/mobile/{public_id}     |
| us3.datadoghq.com | PUT https://api.us3.datadoghq.com/api/v1/synthetics/tests/mobile/{public_id} |
| us5.datadoghq.com | PUT https://api.us5.datadoghq.com/api/v1/synthetics/tests/mobile/{public_id} |

### Overview

Edit the configuration of a Synthetic mobile test. This endpoint requires the `synthetics_write` permission.

OAuth apps require the `synthetics_write` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#synthetics) to access this endpoint.



### Arguments

#### Path Parameters

| Name                        | Type   | Description                                    |
| --------------------------- | ------ | ---------------------------------------------- |
| public_id [*required*] | string | The public ID of the test to get details from. |

### Request

#### Body Data (required)

New test details to be saved.

{% tab title="Model" %}

| Parent field         | Field                               | Type          | Description                                                                                                                                                                                                            |
| -------------------- | ----------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                      | config [*required*]            | object        | Configuration object for a Synthetic mobile test.                                                                                                                                                                      |
| config               | initialApplicationArguments         | object        | Initial application arguments for a mobile test.                                                                                                                                                                       |
| additionalProperties | <any-key>                           | string        | A single application argument.                                                                                                                                                                                         |
| config               | variables                           | [object]      | Array of variables used for the test steps.                                                                                                                                                                            |
| variables            | example                             | string        | Example for the variable.                                                                                                                                                                                              |
| variables            | id                                  | string        | ID of the variable for global variables.                                                                                                                                                                               |
| variables            | name [*required*]              | string        | Name of the variable.                                                                                                                                                                                                  |
| variables            | pattern                             | string        | Pattern of the variable.                                                                                                                                                                                               |
| variables            | secure                              | boolean       | Whether the value of this variable will be obfuscated in test results. Only for config variables of type `text`.                                                                                                       |
| variables            | type [*required*]              | enum          | Type of the configuration variable. Allowed enum values: `global,text,email`                                                                                                                                           |
|                      | device_ids                          | [string]      | Array with the different device IDs used to run the test.                                                                                                                                                              |
|                      | message [*required*]           | string        | Notification message associated with the test.                                                                                                                                                                         |
|                      | monitor_id                          | int64         | The associated monitor ID.                                                                                                                                                                                             |
|                      | name [*required*]              | string        | Name of the test.                                                                                                                                                                                                      |
|                      | options [*required*]           | object        | Object describing the extra options for a Synthetic test.                                                                                                                                                              |
| options              | allowApplicationCrash               | boolean       | A boolean to set if an application crash would mark the test as failed.                                                                                                                                                |
| options              | bindings                            | [object]      | Array of bindings used for the mobile test.                                                                                                                                                                            |
| bindings             | principals                          | [string]      | List of principals for a mobile test binding.                                                                                                                                                                          |
| bindings             | relation                            | enum          | The type of relation for the binding. Allowed enum values: `editor,viewer`                                                                                                                                             |
| options              | ci                                  | object        | CI/CD options for a Synthetic test.                                                                                                                                                                                    |
| ci                   | executionRule [*required*]     | enum          | Execution rule for a Synthetic test. Allowed enum values: `blocking,non_blocking,skipped`                                                                                                                              |
| options              | defaultStepTimeout                  | int32         | The default timeout for steps in the test (in seconds).                                                                                                                                                                |
| options              | device_ids [*required*]        | [string]      | For mobile test, array with the different device IDs used to run the test.                                                                                                                                             |
| options              | disableAutoAcceptAlert              | boolean       | A boolean to disable auto accepting alerts.                                                                                                                                                                            |
| options              | min_failure_duration                | int64         | Minimum amount of time in failure required to trigger an alert.                                                                                                                                                        |
| options              | mobileApplication [*required*] | object        | Mobile application for mobile synthetics test.                                                                                                                                                                         |
| mobileApplication    | applicationId [*required*]     | string        | Application ID of the mobile application.                                                                                                                                                                              |
| mobileApplication    | referenceId [*required*]       | string        | Reference ID of the mobile application.                                                                                                                                                                                |
| mobileApplication    | referenceType [*required*]     | enum          | Reference type for the mobile application for a mobile synthetics test. Allowed enum values: `latest,version`                                                                                                          |
| options              | monitor_name                        | string        | The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.                                                                                                                    |
| options              | monitor_options                     | object        | Object containing the options for a Synthetic test as a monitor (for example, renotification).                                                                                                                         |
| monitor_options      | escalation_message                  | string        | Message to include in the escalation notification.                                                                                                                                                                     |
| monitor_options      | notification_preset_name            | enum          | The name of the preset for the notification for the monitor. Allowed enum values: `show_all,hide_all,hide_query,hide_handles,hide_query_and_handles,show_only_snapshot,hide_handles_and_footer`                        |
| monitor_options      | renotify_interval                   | int64         | Time interval before renotifying if the test is still failing (in minutes).                                                                                                                                            |
| monitor_options      | renotify_occurrences                | int64         | The number of times to renotify if the test is still failing.                                                                                                                                                          |
| options              | monitor_priority                    | int32         | Integer from 1 (high) to 5 (low) indicating alert severity.                                                                                                                                                            |
| options              | noScreenshot                        | boolean       | A boolean set to not take a screenshot for the step.                                                                                                                                                                   |
| options              | restricted_roles                    | [string]      | **DEPRECATED**: A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. This field is deprecated. Use the restriction policies API to manage permissions.             |
| options              | retry                               | object        | Object describing the retry strategy to apply to a Synthetic test.                                                                                                                                                     |
| retry                | count                               | int64         | Number of times a test needs to be retried before marking a location as failed. Defaults to 0.                                                                                                                         |
| retry                | interval                            | double        | Time interval between retries (in milliseconds). Defaults to 300ms.                                                                                                                                                    |
| options              | scheduling                          | object        | Object containing timeframes and timezone used for advanced scheduling.                                                                                                                                                |
| scheduling           | timeframes [*required*]        | [object]      | Array containing objects describing the scheduling pattern to apply to each day.                                                                                                                                       |
| timeframes           | day [*required*]               | int32         | Number representing the day of the week.                                                                                                                                                                               |
| timeframes           | from [*required*]              | string        | The hour of the day on which scheduling starts.                                                                                                                                                                        |
| timeframes           | to [*required*]                | string        | The hour of the day on which scheduling ends.                                                                                                                                                                          |
| scheduling           | timezone [*required*]          | string        | Timezone in which the timeframe is based.                                                                                                                                                                              |
| options              | tick_every [*required*]        | int64         | The frequency at which to run the Synthetic test (in seconds).                                                                                                                                                         |
| options              | verbosity                           | int32         | The level of verbosity for the mobile test. This field can not be set by a user.                                                                                                                                       |
|                      | public_id                           | string        | The public ID of the test.                                                                                                                                                                                             |
|                      | status                              | enum          | Define whether you want to start (`live`) or pause (`paused`) a Synthetic test. Allowed enum values: `live,paused`                                                                                                     |
|                      | steps                               | [object]      | Array of steps for the test.                                                                                                                                                                                           |
| steps                | allowFailure                        | boolean       | A boolean set to allow this step to fail.                                                                                                                                                                              |
| steps                | hasNewStepElement                   | boolean       | A boolean set to determine if the step has a new step element.                                                                                                                                                         |
| steps                | isCritical                          | boolean       | A boolean to use in addition to `allowFailure` to determine if the test should be marked as failed when the step fails.                                                                                                |
| steps                | name [*required*]              | string        | The name of the step.                                                                                                                                                                                                  |
| steps                | noScreenshot                        | boolean       | A boolean set to not take a screenshot for the step.                                                                                                                                                                   |
| steps                | params [*required*]            | object        | The parameters of a mobile step.                                                                                                                                                                                       |
| params               | check                               | enum          | Type of assertion to apply in an API test. Allowed enum values: `equals,notEquals,contains,notContains,startsWith,notStartsWith,greater,lower,greaterEquals,lowerEquals`                                               |
| params               | delay                               | int64         | Number of milliseconds to wait between inputs in a `typeText` step type.                                                                                                                                               |
| params               | direction                           | enum          | The direction of the scroll for a `scrollToElement` step type. Allowed enum values: `up,down,left,right`                                                                                                               |
| params               | element                             | object        | Information about the element used for a step.                                                                                                                                                                         |
| element              | context                             | string        | Context of the element.                                                                                                                                                                                                |
| element              | contextType                         | enum          | Type of the context that the element is in. Allowed enum values: `native,web`                                                                                                                                          |
| element              | elementDescription                  | string        | Description of the element.                                                                                                                                                                                            |
| element              | multiLocator                        | object        | Multi-locator to find the element.                                                                                                                                                                                     |
| element              | relativePosition                    | object        | Position of the action relative to the element.                                                                                                                                                                        |
| relativePosition     | x                                   | double        | The `relativePosition` on the `x` axis for the element.                                                                                                                                                                |
| relativePosition     | y                                   | double        | The `relativePosition` on the `y` axis for the element.                                                                                                                                                                |
| element              | textContent                         | string        | Text content of the element.                                                                                                                                                                                           |
| element              | userLocator                         | object        | User locator to find the element.                                                                                                                                                                                      |
| userLocator          | failTestOnCannotLocate              | boolean       | Whether if the test should fail if the element cannot be found.                                                                                                                                                        |
| userLocator          | values                              | [object]      | Values of the user locator.                                                                                                                                                                                            |
| values               | type                                | enum          | Type of a user locator. Allowed enum values: `accessibility-id,id,ios-predicate-string,ios-class-chain,xpath`                                                                                                          |
| values               | value                               | string        | Value of a user locator.                                                                                                                                                                                               |
| element              | viewName                            | string        | Name of the view of the element.                                                                                                                                                                                       |
| params               | enabled                             | boolean       | Boolean to change the state of the wifi for a `toggleWiFi` step type.                                                                                                                                                  |
| params               | maxScrolls                          | int64         | Maximum number of scrolls to do for a `scrollToElement` step type.                                                                                                                                                     |
| params               | positions                           | [object]      | List of positions for the `flick` step type. The maximum is 10 flicks per step                                                                                                                                         |
| positions            | x                                   | double        | The `x` position for the flick.                                                                                                                                                                                        |
| positions            | y                                   | double        | The `y` position for the flick.                                                                                                                                                                                        |
| params               | subtestPublicId                     | string        | Public ID of the test to be played as part of a `playSubTest` step type.                                                                                                                                               |
| params               | value                               |  <oneOf> | Values used in the step for in multiple step types.                                                                                                                                                                    |
| value                | Option 1                            | string        | Value used in the step for in multiple step types.                                                                                                                                                                     |
| value                | Option 2                            | int64         | Value used in the step for in multiple step types.                                                                                                                                                                     |
| params               | variable                            | object        | Variable object for `extractVariable` step type.                                                                                                                                                                       |
| variable             | example [*required*]           | string        | An example for the variable.                                                                                                                                                                                           |
| variable             | name [*required*]              | string        | The variable name.                                                                                                                                                                                                     |
| params               | withEnter                           | boolean       | Boolean to indicate if `Enter` should be pressed at the end of the `typeText` step type.                                                                                                                               |
| params               | x                                   | double        | Amount to scroll by on the `x` axis for a `scroll` step type.                                                                                                                                                          |
| params               | y                                   | double        | Amount to scroll by on the `y` axis for a `scroll` step type.                                                                                                                                                          |
| steps                | publicId                            | string        | The public ID of the step.                                                                                                                                                                                             |
| steps                | timeout                             | int64         | The time before declaring a step failed.                                                                                                                                                                               |
| steps                | type [*required*]              | enum          | Step type used in your mobile Synthetic test. Allowed enum values: `assertElementContent,assertScreenContains,assertScreenLacks,doubleTap,extractVariable,flick,openDeeplink,playSubTest,pressBack,restartApplication` |
|                      | tags                                | [string]      | Array of tags attached to the test.                                                                                                                                                                                    |
|                      | type [*required*]              | enum          | Type of the Synthetic test, `mobile`. Allowed enum values: `mobile`                                                                                                                                                    |

{% /tab %}

{% tab title="Example" %}

```json
{
  "name": "Example-Synthetic-updated",
  "status": "paused",
  "type": "mobile",
  "config": {
    "variables": []
  },
  "message": "",
  "options": {
    "device_ids": [
      "synthetics:mobile:device:iphone_15_ios_17"
    ],
    "mobileApplication": {
      "applicationId": "ab0e0aed-536d-411a-9a99-5428c27d8f8e",
      "referenceId": "6115922a-5f5d-455e-bc7e-7955a57f3815",
      "referenceType": "version"
    },
    "tick_every": 3600
  },
  "steps": []
}
```

{% /tab %}

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
Object containing details about a Synthetic mobile test.

| Parent field         | Field                               | Type          | Description                                                                                                                                                                                                            |
| -------------------- | ----------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                      | config [*required*]            | object        | Configuration object for a Synthetic mobile test.                                                                                                                                                                      |
| config               | initialApplicationArguments         | object        | Initial application arguments for a mobile test.                                                                                                                                                                       |
| additionalProperties | <any-key>                           | string        | A single application argument.                                                                                                                                                                                         |
| config               | variables                           | [object]      | Array of variables used for the test steps.                                                                                                                                                                            |
| variables            | example                             | string        | Example for the variable.                                                                                                                                                                                              |
| variables            | id                                  | string        | ID of the variable for global variables.                                                                                                                                                                               |
| variables            | name [*required*]              | string        | Name of the variable.                                                                                                                                                                                                  |
| variables            | pattern                             | string        | Pattern of the variable.                                                                                                                                                                                               |
| variables            | secure                              | boolean       | Whether the value of this variable will be obfuscated in test results. Only for config variables of type `text`.                                                                                                       |
| variables            | type [*required*]              | enum          | Type of the configuration variable. Allowed enum values: `global,text,email`                                                                                                                                           |
|                      | device_ids                          | [string]      | Array with the different device IDs used to run the test.                                                                                                                                                              |
|                      | message [*required*]           | string        | Notification message associated with the test.                                                                                                                                                                         |
|                      | monitor_id                          | int64         | The associated monitor ID.                                                                                                                                                                                             |
|                      | name [*required*]              | string        | Name of the test.                                                                                                                                                                                                      |
|                      | options [*required*]           | object        | Object describing the extra options for a Synthetic test.                                                                                                                                                              |
| options              | allowApplicationCrash               | boolean       | A boolean to set if an application crash would mark the test as failed.                                                                                                                                                |
| options              | bindings                            | [object]      | Array of bindings used for the mobile test.                                                                                                                                                                            |
| bindings             | principals                          | [string]      | List of principals for a mobile test binding.                                                                                                                                                                          |
| bindings             | relation                            | enum          | The type of relation for the binding. Allowed enum values: `editor,viewer`                                                                                                                                             |
| options              | ci                                  | object        | CI/CD options for a Synthetic test.                                                                                                                                                                                    |
| ci                   | executionRule [*required*]     | enum          | Execution rule for a Synthetic test. Allowed enum values: `blocking,non_blocking,skipped`                                                                                                                              |
| options              | defaultStepTimeout                  | int32         | The default timeout for steps in the test (in seconds).                                                                                                                                                                |
| options              | device_ids [*required*]        | [string]      | For mobile test, array with the different device IDs used to run the test.                                                                                                                                             |
| options              | disableAutoAcceptAlert              | boolean       | A boolean to disable auto accepting alerts.                                                                                                                                                                            |
| options              | min_failure_duration                | int64         | Minimum amount of time in failure required to trigger an alert.                                                                                                                                                        |
| options              | mobileApplication [*required*] | object        | Mobile application for mobile synthetics test.                                                                                                                                                                         |
| mobileApplication    | applicationId [*required*]     | string        | Application ID of the mobile application.                                                                                                                                                                              |
| mobileApplication    | referenceId [*required*]       | string        | Reference ID of the mobile application.                                                                                                                                                                                |
| mobileApplication    | referenceType [*required*]     | enum          | Reference type for the mobile application for a mobile synthetics test. Allowed enum values: `latest,version`                                                                                                          |
| options              | monitor_name                        | string        | The monitor name is used for the alert title as well as for all monitor dashboard widgets and SLOs.                                                                                                                    |
| options              | monitor_options                     | object        | Object containing the options for a Synthetic test as a monitor (for example, renotification).                                                                                                                         |
| monitor_options      | escalation_message                  | string        | Message to include in the escalation notification.                                                                                                                                                                     |
| monitor_options      | notification_preset_name            | enum          | The name of the preset for the notification for the monitor. Allowed enum values: `show_all,hide_all,hide_query,hide_handles,hide_query_and_handles,show_only_snapshot,hide_handles_and_footer`                        |
| monitor_options      | renotify_interval                   | int64         | Time interval before renotifying if the test is still failing (in minutes).                                                                                                                                            |
| monitor_options      | renotify_occurrences                | int64         | The number of times to renotify if the test is still failing.                                                                                                                                                          |
| options              | monitor_priority                    | int32         | Integer from 1 (high) to 5 (low) indicating alert severity.                                                                                                                                                            |
| options              | noScreenshot                        | boolean       | A boolean set to not take a screenshot for the step.                                                                                                                                                                   |
| options              | restricted_roles                    | [string]      | **DEPRECATED**: A list of role identifiers that can be pulled from the Roles API, for restricting read and write access. This field is deprecated. Use the restriction policies API to manage permissions.             |
| options              | retry                               | object        | Object describing the retry strategy to apply to a Synthetic test.                                                                                                                                                     |
| retry                | count                               | int64         | Number of times a test needs to be retried before marking a location as failed. Defaults to 0.                                                                                                                         |
| retry                | interval                            | double        | Time interval between retries (in milliseconds). Defaults to 300ms.                                                                                                                                                    |
| options              | scheduling                          | object        | Object containing timeframes and timezone used for advanced scheduling.                                                                                                                                                |
| scheduling           | timeframes [*required*]        | [object]      | Array containing objects describing the scheduling pattern to apply to each day.                                                                                                                                       |
| timeframes           | day [*required*]               | int32         | Number representing the day of the week.                                                                                                                                                                               |
| timeframes           | from [*required*]              | string        | The hour of the day on which scheduling starts.                                                                                                                                                                        |
| timeframes           | to [*required*]                | string        | The hour of the day on which scheduling ends.                                                                                                                                                                          |
| scheduling           | timezone [*required*]          | string        | Timezone in which the timeframe is based.                                                                                                                                                                              |
| options              | tick_every [*required*]        | int64         | The frequency at which to run the Synthetic test (in seconds).                                                                                                                                                         |
| options              | verbosity                           | int32         | The level of verbosity for the mobile test. This field can not be set by a user.                                                                                                                                       |
|                      | public_id                           | string        | The public ID of the test.                                                                                                                                                                                             |
|                      | status                              | enum          | Define whether you want to start (`live`) or pause (`paused`) a Synthetic test. Allowed enum values: `live,paused`                                                                                                     |
|                      | steps                               | [object]      | Array of steps for the test.                                                                                                                                                                                           |
| steps                | allowFailure                        | boolean       | A boolean set to allow this step to fail.                                                                                                                                                                              |
| steps                | hasNewStepElement                   | boolean       | A boolean set to determine if the step has a new step element.                                                                                                                                                         |
| steps                | isCritical                          | boolean       | A boolean to use in addition to `allowFailure` to determine if the test should be marked as failed when the step fails.                                                                                                |
| steps                | name [*required*]              | string        | The name of the step.                                                                                                                                                                                                  |
| steps                | noScreenshot                        | boolean       | A boolean set to not take a screenshot for the step.                                                                                                                                                                   |
| steps                | params [*required*]            | object        | The parameters of a mobile step.                                                                                                                                                                                       |
| params               | check                               | enum          | Type of assertion to apply in an API test. Allowed enum values: `equals,notEquals,contains,notContains,startsWith,notStartsWith,greater,lower,greaterEquals,lowerEquals`                                               |
| params               | delay                               | int64         | Number of milliseconds to wait between inputs in a `typeText` step type.                                                                                                                                               |
| params               | direction                           | enum          | The direction of the scroll for a `scrollToElement` step type. Allowed enum values: `up,down,left,right`                                                                                                               |
| params               | element                             | object        | Information about the element used for a step.                                                                                                                                                                         |
| element              | context                             | string        | Context of the element.                                                                                                                                                                                                |
| element              | contextType                         | enum          | Type of the context that the element is in. Allowed enum values: `native,web`                                                                                                                                          |
| element              | elementDescription                  | string        | Description of the element.                                                                                                                                                                                            |
| element              | multiLocator                        | object        | Multi-locator to find the element.                                                                                                                                                                                     |
| element              | relativePosition                    | object        | Position of the action relative to the element.                                                                                                                                                                        |
| relativePosition     | x                                   | double        | The `relativePosition` on the `x` axis for the element.                                                                                                                                                                |
| relativePosition     | y                                   | double        | The `relativePosition` on the `y` axis for the element.                                                                                                                                                                |
| element              | textContent                         | string        | Text content of the element.                                                                                                                                                                                           |
| element              | userLocator                         | object        | User locator to find the element.                                                                                                                                                                                      |
| userLocator          | failTestOnCannotLocate              | boolean       | Whether if the test should fail if the element cannot be found.                                                                                                                                                        |
| userLocator          | values                              | [object]      | Values of the user locator.                                                                                                                                                                                            |
| values               | type                                | enum          | Type of a user locator. Allowed enum values: `accessibility-id,id,ios-predicate-string,ios-class-chain,xpath`                                                                                                          |
| values               | value                               | string        | Value of a user locator.                                                                                                                                                                                               |
| element              | viewName                            | string        | Name of the view of the element.                                                                                                                                                                                       |
| params               | enabled                             | boolean       | Boolean to change the state of the wifi for a `toggleWiFi` step type.                                                                                                                                                  |
| params               | maxScrolls                          | int64         | Maximum number of scrolls to do for a `scrollToElement` step type.                                                                                                                                                     |
| params               | positions                           | [object]      | List of positions for the `flick` step type. The maximum is 10 flicks per step                                                                                                                                         |
| positions            | x                                   | double        | The `x` position for the flick.                                                                                                                                                                                        |
| positions            | y                                   | double        | The `y` position for the flick.                                                                                                                                                                                        |
| params               | subtestPublicId                     | string        | Public ID of the test to be played as part of a `playSubTest` step type.                                                                                                                                               |
| params               | value                               |  <oneOf> | Values used in the step for in multiple step types.                                                                                                                                                                    |
| value                | Option 1                            | string        | Value used in the step for in multiple step types.                                                                                                                                                                     |
| value                | Option 2                            | int64         | Value used in the step for in multiple step types.                                                                                                                                                                     |
| params               | variable                            | object        | Variable object for `extractVariable` step type.                                                                                                                                                                       |
| variable             | example [*required*]           | string        | An example for the variable.                                                                                                                                                                                           |
| variable             | name [*required*]              | string        | The variable name.                                                                                                                                                                                                     |
| params               | withEnter                           | boolean       | Boolean to indicate if `Enter` should be pressed at the end of the `typeText` step type.                                                                                                                               |
| params               | x                                   | double        | Amount to scroll by on the `x` axis for a `scroll` step type.                                                                                                                                                          |
| params               | y                                   | double        | Amount to scroll by on the `y` axis for a `scroll` step type.                                                                                                                                                          |
| steps                | publicId                            | string        | The public ID of the step.                                                                                                                                                                                             |
| steps                | timeout                             | int64         | The time before declaring a step failed.                                                                                                                                                                               |
| steps                | type [*required*]              | enum          | Step type used in your mobile Synthetic test. Allowed enum values: `assertElementContent,assertScreenContains,assertScreenLacks,doubleTap,extractVariable,flick,openDeeplink,playSubTest,pressBack,restartApplication` |
|                      | tags                                | [string]      | Array of tags attached to the test.                                                                                                                                                                                    |
|                      | type [*required*]              | enum          | Type of the Synthetic test, `mobile`. Allowed enum values: `mobile`                                                                                                                                                    |

{% /tab %}

{% tab title="Example" %}

```json
{
  "config": {
    "initialApplicationArguments": {
      "<any-key>": "string"
    },
    "variables": [
      {
        "example": "string",
        "id": "string",
        "name": "VARIABLE_NAME",
        "pattern": "string",
        "secure": false,
        "type": "text"
      }
    ]
  },
  "device_ids": [
    "chrome.laptop_large"
  ],
  "message": "Notification message",
  "monitor_id": 12345678,
  "name": "Example test name",
  "options": {
    "allowApplicationCrash": false,
    "bindings": [
      {
        "principals": [],
        "relation": "string"
      }
    ],
    "ci": {
      "executionRule": "blocking"
    },
    "defaultStepTimeout": "integer",
    "device_ids": [
      "synthetics:mobile:device:apple_ipad_10th_gen_2022_ios_16"
    ],
    "disableAutoAcceptAlert": false,
    "min_failure_duration": "integer",
    "mobileApplication": {
      "applicationId": "00000000-0000-0000-0000-aaaaaaaaaaaa",
      "referenceId": "00000000-0000-0000-0000-aaaaaaaaaaab",
      "referenceType": "latest"
    },
    "monitor_name": "string",
    "monitor_options": {
      "escalation_message": "string",
      "notification_preset_name": "string",
      "renotify_interval": "integer",
      "renotify_occurrences": "integer"
    },
    "monitor_priority": "integer",
    "noScreenshot": false,
    "restricted_roles": [
      "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
    ],
    "retry": {
      "count": "integer",
      "interval": "number"
    },
    "scheduling": {
      "timeframes": [
        {
          "day": 1,
          "from": "07:00",
          "to": "16:00"
        }
      ],
      "timezone": "America/New_York"
    },
    "tick_every": 300,
    "verbosity": "integer"
  },
  "public_id": "123-abc-456",
  "status": "live",
  "steps": [
    {
      "allowFailure": false,
      "hasNewStepElement": false,
      "isCritical": false,
      "name": "",
      "noScreenshot": false,
      "params": {
        "check": "string",
        "delay": "integer",
        "direction": "string",
        "element": {
          "context": "string",
          "contextType": "string",
          "elementDescription": "string",
          "multiLocator": {},
          "relativePosition": {
            "x": "number",
            "y": "number"
          },
          "textContent": "string",
          "userLocator": {
            "failTestOnCannotLocate": false,
            "values": [
              {
                "type": "string",
                "value": "string"
              }
            ]
          },
          "viewName": "string"
        },
        "enabled": false,
        "maxScrolls": "integer",
        "positions": [
          {
            "x": "number",
            "y": "number"
          }
        ],
        "subtestPublicId": "string",
        "value": {
          "description": "undefined",
          "type": "undefined"
        },
        "variable": {
          "example": "",
          "name": "VAR_NAME"
        },
        "withEnter": false,
        "x": "number",
        "y": "number"
      },
      "publicId": "pub-lic-id0",
      "timeout": "integer",
      "type": "assertElementContent"
    }
  ],
  "tags": [
    "env:production"
  ],
  "type": "mobile"
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
- JSON format is wrong - Updating sub-type is forbidden
{% tab title="Model" %}
Error response object.

| Field                    | Type     | Description                          |
| ------------------------ | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% tab title="Model" %}
Error response object.

| Field                    | Type     | Description                          |
| ------------------------ | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

{% tab title="404" %}
- Synthetic Monitoring is not activated for the user - Test is not owned by the user - Test can't be found
{% tab title="Model" %}
Error response object.

| Field                    | Type     | Description                          |
| ------------------------ | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too many requests
{% tab title="Model" %}
Error response object.

| Field                    | Type     | Description                          |
| ------------------------ | -------- | ------------------------------------ |
| errors [*required*] | [string] | Array of errors returned by the API. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

### Code Example

##### 
                          \## default
# 
 \# Path parameters export public_id="CHANGE_ME" \# Curl command curl -X PUT "https://api.datadoghq.com/api/v1/synthetics/tests/mobile/${public_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
{
  "config": {
    "variables": []
  },
  "message": "Notification message",
  "name": "Example mobile test",
  "options": {
    "device_ids": [
      "synthetics:mobile:device:apple_iphone_14_ios_16"
    ],
    "min_failure_duration": 0,
    "mobileApplication": {
      "applicationId": "abc-123",
      "referenceId": "abc-456",
      "referenceType": "latest"
    },
    "tick_every": 3600
  },
  "tags": [
    "env:production"
  ],
  "type": "mobile"
}
EOF 
                        
##### 

```go
// Edit a Mobile test 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/datadogV1"
)

func main() {
	// there is a valid "synthetics_mobile_test" in the system
	SyntheticsMobileTestPublicID := os.Getenv("SYNTHETICS_MOBILE_TEST_PUBLIC_ID")

	body := datadogV1.SyntheticsMobileTest{
		Name:   "Example-Synthetic-updated",
		Status: datadogV1.SYNTHETICSTESTPAUSESTATUS_PAUSED.Ptr(),
		Type:   datadogV1.SYNTHETICSMOBILETESTTYPE_MOBILE,
		Config: datadogV1.SyntheticsMobileTestConfig{
			Variables: []datadogV1.SyntheticsConfigVariable{},
		},
		Message: "",
		Options: datadogV1.SyntheticsMobileTestOptions{
			DeviceIds: []string{
				"synthetics:mobile:device:iphone_15_ios_17",
			},
			MobileApplication: datadogV1.SyntheticsMobileTestsMobileApplication{
				ApplicationId: "ab0e0aed-536d-411a-9a99-5428c27d8f8e",
				ReferenceId:   "6115922a-5f5d-455e-bc7e-7955a57f3815",
				ReferenceType: datadogV1.SYNTHETICSMOBILETESTSMOBILEAPPLICATIONREFERENCETYPE_VERSION,
			},
			TickEvery: 3600,
		},
		Steps: []datadogV1.SyntheticsMobileStep{},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.UpdateMobileTest(ctx, SyntheticsMobileTestPublicID, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.UpdateMobileTest`:\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
// Edit a Mobile test returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v1.api.SyntheticsApi;
import com.datadog.api.client.v1.model.SyntheticsMobileTest;
import com.datadog.api.client.v1.model.SyntheticsMobileTestConfig;
import com.datadog.api.client.v1.model.SyntheticsMobileTestOptions;
import com.datadog.api.client.v1.model.SyntheticsMobileTestType;
import com.datadog.api.client.v1.model.SyntheticsMobileTestsMobileApplication;
import com.datadog.api.client.v1.model.SyntheticsMobileTestsMobileApplicationReferenceType;
import com.datadog.api.client.v1.model.SyntheticsTestPauseStatus;
import java.util.Collections;

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

    // there is a valid "synthetics_mobile_test" in the system
    String SYNTHETICS_MOBILE_TEST_PUBLIC_ID = System.getenv("SYNTHETICS_MOBILE_TEST_PUBLIC_ID");

    SyntheticsMobileTest body =
        new SyntheticsMobileTest()
            .name("Example-Synthetic-updated")
            .status(SyntheticsTestPauseStatus.PAUSED)
            .type(SyntheticsMobileTestType.MOBILE)
            .config(new SyntheticsMobileTestConfig())
            .message("")
            .options(
                new SyntheticsMobileTestOptions()
                    .deviceIds(
                        Collections.singletonList("synthetics:mobile:device:iphone_15_ios_17"))
                    .mobileApplication(
                        new SyntheticsMobileTestsMobileApplication()
                            .applicationId("ab0e0aed-536d-411a-9a99-5428c27d8f8e")
                            .referenceId("6115922a-5f5d-455e-bc7e-7955a57f3815")
                            .referenceType(
                                SyntheticsMobileTestsMobileApplicationReferenceType.VERSION))
                    .tickEvery(3600L));

    try {
      SyntheticsMobileTest result =
          apiInstance.updateMobileTest(SYNTHETICS_MOBILE_TEST_PUBLIC_ID, body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#updateMobileTest");
      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"
##### 

```python
"""
Edit a Mobile test returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi
from datadog_api_client.v1.model.synthetics_mobile_test import SyntheticsMobileTest
from datadog_api_client.v1.model.synthetics_mobile_test_config import SyntheticsMobileTestConfig
from datadog_api_client.v1.model.synthetics_mobile_test_options import SyntheticsMobileTestOptions
from datadog_api_client.v1.model.synthetics_mobile_test_type import SyntheticsMobileTestType
from datadog_api_client.v1.model.synthetics_mobile_tests_mobile_application import (
    SyntheticsMobileTestsMobileApplication,
)
from datadog_api_client.v1.model.synthetics_mobile_tests_mobile_application_reference_type import (
    SyntheticsMobileTestsMobileApplicationReferenceType,
)
from datadog_api_client.v1.model.synthetics_test_pause_status import SyntheticsTestPauseStatus

# there is a valid "synthetics_mobile_test" in the system
SYNTHETICS_MOBILE_TEST_PUBLIC_ID = environ["SYNTHETICS_MOBILE_TEST_PUBLIC_ID"]

body = SyntheticsMobileTest(
    name="Example-Synthetic-updated",
    status=SyntheticsTestPauseStatus.PAUSED,
    type=SyntheticsMobileTestType.MOBILE,
    config=SyntheticsMobileTestConfig(
        variables=[],
    ),
    message="",
    options=SyntheticsMobileTestOptions(
        device_ids=[
            "synthetics:mobile:device:iphone_15_ios_17",
        ],
        mobile_application=SyntheticsMobileTestsMobileApplication(
            application_id="ab0e0aed-536d-411a-9a99-5428c27d8f8e",
            reference_id="6115922a-5f5d-455e-bc7e-7955a57f3815",
            reference_type=SyntheticsMobileTestsMobileApplicationReferenceType.VERSION,
        ),
        tick_every=3600,
    ),
    steps=[],
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.update_mobile_test(public_id=SYNTHETICS_MOBILE_TEST_PUBLIC_ID, 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:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
##### 

```ruby
# Edit a Mobile test returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new

# there is a valid "synthetics_mobile_test" in the system
SYNTHETICS_MOBILE_TEST_PUBLIC_ID = ENV["SYNTHETICS_MOBILE_TEST_PUBLIC_ID"]

body = DatadogAPIClient::V1::SyntheticsMobileTest.new({
  name: "Example-Synthetic-updated",
  status: DatadogAPIClient::V1::SyntheticsTestPauseStatus::PAUSED,
  type: DatadogAPIClient::V1::SyntheticsMobileTestType::MOBILE,
  config: DatadogAPIClient::V1::SyntheticsMobileTestConfig.new({
    variables: [],
  }),
  message: "",
  options: DatadogAPIClient::V1::SyntheticsMobileTestOptions.new({
    device_ids: [
      "synthetics:mobile:device:iphone_15_ios_17",
    ],
    mobile_application: DatadogAPIClient::V1::SyntheticsMobileTestsMobileApplication.new({
      application_id: "ab0e0aed-536d-411a-9a99-5428c27d8f8e",
      reference_id: "6115922a-5f5d-455e-bc7e-7955a57f3815",
      reference_type: DatadogAPIClient::V1::SyntheticsMobileTestsMobileApplicationReferenceType::VERSION,
    }),
    tick_every: 3600,
  }),
  steps: [],
})
p api_instance.update_mobile_test(SYNTHETICS_MOBILE_TEST_PUBLIC_ID, 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:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
##### 

```rust
// Edit a Mobile test returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_synthetics::SyntheticsAPI;
use datadog_api_client::datadogV1::model::SyntheticsMobileTest;
use datadog_api_client::datadogV1::model::SyntheticsMobileTestConfig;
use datadog_api_client::datadogV1::model::SyntheticsMobileTestOptions;
use datadog_api_client::datadogV1::model::SyntheticsMobileTestType;
use datadog_api_client::datadogV1::model::SyntheticsMobileTestsMobileApplication;
use datadog_api_client::datadogV1::model::SyntheticsMobileTestsMobileApplicationReferenceType;
use datadog_api_client::datadogV1::model::SyntheticsTestPauseStatus;

#[tokio::main]
async fn main() {
    // there is a valid "synthetics_mobile_test" in the system
    let synthetics_mobile_test_public_id =
        std::env::var("SYNTHETICS_MOBILE_TEST_PUBLIC_ID").unwrap();
    let body = SyntheticsMobileTest::new(
        SyntheticsMobileTestConfig::new().variables(vec![]),
        "".to_string(),
        "Example-Synthetic-updated".to_string(),
        SyntheticsMobileTestOptions::new(
            vec!["synthetics:mobile:device:iphone_15_ios_17".to_string()],
            SyntheticsMobileTestsMobileApplication::new(
                "ab0e0aed-536d-411a-9a99-5428c27d8f8e".to_string(),
                "6115922a-5f5d-455e-bc7e-7955a57f3815".to_string(),
                SyntheticsMobileTestsMobileApplicationReferenceType::VERSION,
            ),
            3600,
        ),
        SyntheticsMobileTestType::MOBILE,
    )
    .status(SyntheticsTestPauseStatus::PAUSED)
    .steps(vec![]);
    let configuration = datadog::Configuration::new();
    let api = SyntheticsAPI::with_config(configuration);
    let resp = api
        .update_mobile_test(synthetics_mobile_test_public_id.clone(), 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:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
##### 

```typescript
/**
 * Edit a Mobile test returns "OK" response
 */

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

const configuration = client.createConfiguration();
const apiInstance = new v1.SyntheticsApi(configuration);

// there is a valid "synthetics_mobile_test" in the system
const SYNTHETICS_MOBILE_TEST_PUBLIC_ID = process.env
  .SYNTHETICS_MOBILE_TEST_PUBLIC_ID as string;

const params: v1.SyntheticsApiUpdateMobileTestRequest = {
  body: {
    name: "Example-Synthetic-updated",
    status: "paused",
    type: "mobile",
    config: {
      variables: [],
    },
    message: "",
    options: {
      deviceIds: ["synthetics:mobile:device:iphone_15_ios_17"],
      mobileApplication: {
        applicationId: "ab0e0aed-536d-411a-9a99-5428c27d8f8e",
        referenceId: "6115922a-5f5d-455e-bc7e-7955a57f3815",
        referenceType: "version",
      },
      tickEvery: 3600,
    },
    steps: [],
  },
  publicId: SYNTHETICS_MOBILE_TEST_PUBLIC_ID,
};

apiInstance
  .updateMobileTest(params)
  .then((data: v1.SyntheticsMobileTest) => {
    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 %}
