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

# Get a mobile test{% #get-a-mobile-test %}
Copy pageCopied
{% tab title="v1" %}

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

### Overview

Get the detailed configuration associated with a Synthetic mobile test. This endpoint requires the `synthetics_read` permission.

OAuth apps require the `synthetics_read` 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. |

### 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="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
{% 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

##### 
                  \# Path parameters export public_id="CHANGE_ME" \# Curl command curl -X GET "https://api.datadoghq.com/api/v1/synthetics/tests/mobile/${public_id}" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" 
                
##### 

```python
"""
Get a mobile test returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v1.api.synthetics_api import SyntheticsApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.get_mobile_test(
        public_id="public_id",
    )

    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
# Get a mobile test returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V1::SyntheticsAPI.new
p api_instance.get_mobile_test("public_id")
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
##### 

```go
// Get 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() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV1.NewSyntheticsApi(apiClient)
	resp, r, err := api.GetMobileTest(ctx, "public_id")

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.GetMobileTest`:\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
// Get 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;

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

    try {
      SyntheticsMobileTest result = apiInstance.getMobileTest("public_id");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#getMobileTest");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
##### 

```rust
// Get a mobile test returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV1::api_synthetics::SyntheticsAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = SyntheticsAPI::with_config(configuration);
    let resp = api.get_mobile_test("public_id".to_string()).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
/**
 * Get a mobile test returns "OK" response
 */

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

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

const params: v1.SyntheticsApiGetMobileTestRequest = {
  publicId: "public_id",
};

apiInstance
  .getMobileTest(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 %}
