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

# Get a test's latest results{% #get-a-tests-latest-results %}
Copy pageCopied
{% tab title="v2" %}

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

### Overview

Get the latest result summaries for a given Synthetic 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 Synthetic test for which to search results. |

#### Query Strings

| Name      | Type    | Description                                                                       |
| --------- | ------- | --------------------------------------------------------------------------------- |
| from_ts   | integer | Timestamp in milliseconds from which to start querying results.                   |
| to_ts     | integer | Timestamp in milliseconds up to which to query results.                           |
| status    | enum    | Filter results by status. Allowed enum values: `passed, failed, no_data`          |
| runType   | enum    | Filter results by run type. Allowed enum values: `scheduled, fast, ci, triggered` |
| probe_dc  | array   | Locations for which to query results.                                             |
| device_id | array   | Device IDs for which to query results.                                            |

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
Response object for a Synthetic test's latest result summaries.

| Parent field   | Field          | Type     | Description                                                                                                                        |
| -------------- | -------------- | -------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|                | data           | [object] | Array of Synthetic test result summaries.                                                                                          |
| data           | attributes     | object   | Attributes of a Synthetic test result summary.                                                                                     |
| attributes     | device         | object   | Device information for the test result (browser and mobile tests).                                                                 |
| device         | browser        | object   | Browser information for the device used to run the test.                                                                           |
| browser        | type           | string   | Browser type (for example, `chrome`, `firefox`).                                                                                   |
| browser        | user_agent     | string   | User agent string reported by the browser.                                                                                         |
| browser        | version        | string   | Browser version.                                                                                                                   |
| device         | id             | string   | Device identifier.                                                                                                                 |
| device         | name           | string   | Device name.                                                                                                                       |
| device         | platform       | object   | Platform information for the device used to run the test.                                                                          |
| platform       | name           | string   | Platform name (for example, `linux`, `macos`).                                                                                     |
| platform       | version        | string   | Platform version.                                                                                                                  |
| device         | resolution     | object   | Screen resolution of the device used to run the test.                                                                              |
| resolution     | height         | int64    | Viewport height in pixels.                                                                                                         |
| resolution     | pixel_ratio    | double   | Device pixel ratio.                                                                                                                |
| resolution     | width          | int64    | Viewport width in pixels.                                                                                                          |
| device         | type           | string   | Device type.                                                                                                                       |
| attributes     | execution_info | object   | Execution details for a Synthetic test result.                                                                                     |
| execution_info | duration       | object   | Total duration of a Synthetic test execution.                                                                                      |
| duration       | has_duration   | boolean  | Whether a duration was recorded for this execution.                                                                                |
| duration       | value          | int64    | Duration value in milliseconds.                                                                                                    |
| execution_info | error_message  | string   | Error message if the execution encountered an issue.                                                                               |
| execution_info | is_fast_retry  | boolean  | Whether this result is from a fast retry.                                                                                          |
| execution_info | timings        | object   | Timing breakdown of the test execution in milliseconds.                                                                            |
| execution_info | tunnel         | boolean  | Whether the test was executed through a tunnel.                                                                                    |
| execution_info | unhealthy      | boolean  | Whether the location was unhealthy during execution.                                                                               |
| attributes     | finished_at    | int64    | Timestamp of when the test finished (in milliseconds).                                                                             |
| attributes     | location       | object   | Location information for a Synthetic test result.                                                                                  |
| location       | id             | string   | Identifier of the location.                                                                                                        |
| location       | name           | string   | Human-readable name of the location.                                                                                               |
| location       | version        | string   | Version of the worker that ran the test.                                                                                           |
| location       | worker_id      | string   | Identifier of the specific worker that ran the test.                                                                               |
| attributes     | run_type       | enum     | The type of run for a Synthetic test result. Allowed enum values: `scheduled,fast,ci,triggered`                                    |
| attributes     | started_at     | int64    | Timestamp of when the test started (in milliseconds).                                                                              |
| attributes     | status         | enum     | Status of a Synthetic test result. Allowed enum values: `passed,failed,no_data`                                                    |
| attributes     | steps_info     | object   | Step execution summary for a Synthetic test result.                                                                                |
| steps_info     | completed      | int64    | Number of completed steps.                                                                                                         |
| steps_info     | errors         | int64    | Number of steps with errors.                                                                                                       |
| steps_info     | total          | int64    | Total number of steps.                                                                                                             |
| attributes     | test_sub_type  | enum     | Subtype of the Synthetic test that produced this result. Allowed enum values: `dns,grpc,http,icmp,mcp,multi,ssl,tcp,udp,websocket` |
| attributes     | test_type      | enum     | Type of the Synthetic test that produced this result. Allowed enum values: `api,browser,mobile,network`                            |
| data           | id             | string   | The result ID.                                                                                                                     |
| data           | relationships  | object   | Relationships for a Synthetic test result.                                                                                         |
| relationships  | test           | object   | Relationship to the Synthetic test.                                                                                                |
| test           | data           | object   | Data for the test relationship.                                                                                                    |
| data           | id             | string   | The public ID of the test.                                                                                                         |
| data           | type           | string   | Type of the related resource.                                                                                                      |
| data           | type           | enum     | Type of the Synthetic test result summary resource, `result_summary`. Allowed enum values: `result_summary`                        |
|                | included       | [object] | Array of included related resources, such as the test definition.                                                                  |
| included       | attributes     | object   | Attributes of the included resource.                                                                                               |
| included       | id             | string   | ID of the included resource.                                                                                                       |
| included       | type           | string   | Type of the included resource.                                                                                                     |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": [
    {
      "attributes": {
        "device": {
          "browser": {
            "type": "edge",
            "user_agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.212 Safari/537.36 Edg/127.0.2651.105 DatadogSynthetics",
            "version": "127.0.2651.105"
          },
          "id": "chrome.laptop_large",
          "name": "Chrome - Laptop Large",
          "platform": {
            "name": "ios",
            "version": "14.8"
          },
          "resolution": {
            "height": 1100,
            "pixel_ratio": 2,
            "width": 1440
          },
          "type": "browser"
        },
        "execution_info": {
          "duration": {
            "has_duration": true,
            "value": 380
          },
          "error_message": "Connection timed out",
          "is_fast_retry": true,
          "timings": {
            "dns": 2.9,
            "download": 2.1,
            "firstByte": 95.2,
            "ssl": 187.9,
            "tcp": 92.6,
            "total": 380.7
          },
          "tunnel": false,
          "unhealthy": false
        },
        "finished_at": "integer",
        "location": {
          "id": "aws:us-east-1",
          "name": "N. Virginia (AWS)",
          "version": "1.0.0",
          "worker_id": "worker-abc-123"
        },
        "run_type": "scheduled",
        "started_at": "integer",
        "status": "passed",
        "steps_info": {
          "completed": 6,
          "errors": 0,
          "total": 6
        },
        "test_sub_type": "http",
        "test_type": "api"
      },
      "id": "5158904793181869365",
      "relationships": {
        "test": {
          "data": {
            "id": "abc-def-123",
            "type": "test"
          }
        }
      },
      "type": "result_summary"
    }
  ],
  "included": [
    {
      "attributes": {},
      "id": "abc-def-123",
      "type": "test"
    }
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
API error response.
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

{% tab title="404" %}
API error response.
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too many requests
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

### Code Example

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

```python
"""
Get a test's latest results returns "OK" response
"""

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

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = SyntheticsApi(api_client)
    response = api_instance.list_synthetics_test_latest_results(
        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 test's latest results returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::SyntheticsAPI.new
p api_instance.list_synthetics_test_latest_results("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 test's latest results 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/datadogV2"
)

func main() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewSyntheticsApi(apiClient)
	resp, r, err := api.ListSyntheticsTestLatestResults(ctx, "public_id", *datadogV2.NewListSyntheticsTestLatestResultsOptionalParameters())

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SyntheticsApi.ListSyntheticsTestLatestResults`:\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 test's latest results returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SyntheticsApi;
import com.datadog.api.client.v2.model.SyntheticsTestLatestResultsResponse;

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

    try {
      SyntheticsTestLatestResultsResponse result =
          apiInstance.listSyntheticsTestLatestResults("public_id");
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SyntheticsApi#listSyntheticsTestLatestResults");
      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 test's latest results returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_synthetics::ListSyntheticsTestLatestResultsOptionalParams;
use datadog_api_client::datadogV2::api_synthetics::SyntheticsAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = SyntheticsAPI::with_config(configuration);
    let resp = api
        .list_synthetics_test_latest_results(
            "public_id".to_string(),
            ListSyntheticsTestLatestResultsOptionalParams::default(),
        )
        .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 test's latest results returns "OK" response
 */

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

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

const params: v2.SyntheticsApiListSyntheticsTestLatestResultsRequest = {
  publicId: "public_id",
};

apiInstance
  .listSyntheticsTestLatestResults(params)
  .then((data: v2.SyntheticsTestLatestResultsResponse) => {
    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 %}
