---
title: Print a report
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Report Schedules
---

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

# Print a report{% #print-a-report %}
Copy pageCopied
{% tab title="v2" %}

| Datadog site      | API endpoint                                              |
| ----------------- | --------------------------------------------------------- |
| ap1.datadoghq.com | POST https://api.ap1.datadoghq.com/api/v2/reporting/print |
| ap2.datadoghq.com | POST https://api.ap2.datadoghq.com/api/v2/reporting/print |
| app.datadoghq.eu  | POST https://api.datadoghq.eu/api/v2/reporting/print      |
| app.ddog-gov.com  | POST https://api.ddog-gov.com/api/v2/reporting/print      |
| us2.ddog-gov.com  | POST https://api.us2.ddog-gov.com/api/v2/reporting/print  |
| uk1.datadoghq.com | POST https://api.uk1.datadoghq.com/api/v2/reporting/print |
| app.datadoghq.com | POST https://api.datadoghq.com/api/v2/reporting/print     |
| us3.datadoghq.com | POST https://api.us3.datadoghq.com/api/v2/reporting/print |
| us5.datadoghq.com | POST https://api.us5.datadoghq.com/api/v2/reporting/print |

### Overview

Initiate a one-off, print-only report for a dashboard or integration dashboard. The report is rendered as a PDF and made available for download through the URL returned in the response. Requires a reporting permission appropriate to the targeted resource type.

### Request

#### Body Data (required)



{% tab title="Model" %}

| Parent field       | Field                                | Type     | Description                                                                                                                                                            |
| ------------------ | ------------------------------------ | -------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|                    | data [*required*]               | object   | The JSON:API data object for a print report request.                                                                                                                   |
| data               | attributes [*required*]         | object   | The configuration for a print-only report. Specify exactly one of `timeframe` (for a relative time window) or both `from_ts` and `to_ts` (for an absolute time range). |
| attributes         | from_ts                              | int64    | The start of an absolute time range, as a Unix timestamp in milliseconds. Required when `timeframe` is omitted.                                                        |
| attributes         | resource_id [*required*]        | string   | The identifier of the dashboard or integration dashboard to render.                                                                                                    |
| attributes         | resource_type [*required*]      | enum     | The type of dashboard resource the report schedule targets. Allowed enum values: `dashboard,integration_dashboard`                                                     |
| attributes         | template_variables [*required*] | [object] | The dashboard template variables applied when rendering the report.                                                                                                    |
| template_variables | name [*required*]               | string   | The name of the template variable.                                                                                                                                     |
| template_variables | values [*required*]             | [string] | The selected values for the template variable.                                                                                                                         |
| attributes         | timeframe                            | string   | A relative time window (for example `1w` or `calendar_month`). Mutually exclusive with `from_ts` and `to_ts`.                                                          |
| attributes         | timezone [*required*]           | string   | The IANA time zone identifier used to evaluate the time window.                                                                                                        |
| attributes         | to_ts                                | int64    | The end of an absolute time range, as a Unix timestamp in milliseconds. Required when `timeframe` is omitted.                                                          |
| data               | type [*required*]               | enum     | JSON:API resource type for a print-only report. Allowed enum values: `report`                                                                                          |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "from_ts": 1780318800000,
      "resource_id": "abc-def-ghi",
      "resource_type": "dashboard",
      "template_variables": [
        {
          "name": "env",
          "values": [
            "prod"
          ]
        }
      ],
      "timeframe": "1w",
      "timezone": "America/New_York",
      "to_ts": 1780923600000
    },
    "type": "report"
  }
}
```

{% /tab %}

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
Response containing the initiated print-only report.

| Parent field       | Field                                | Type     | Description                                                                                                        |
| ------------------ | ------------------------------------ | -------- | ------------------------------------------------------------------------------------------------------------------ |
|                    | data [*required*]               | object   | The JSON:API data object for a print-only report.                                                                  |
| data               | attributes [*required*]         | object   | The configuration and download URL for the initiated print-only report.                                            |
| attributes         | download_url [*required*]       | string   | The URL from which the rendered PDF report can be downloaded.                                                      |
| attributes         | from_ts [*required*]            | int64    | The start of the rendered time range, as a Unix timestamp in milliseconds.                                         |
| attributes         | resource_id [*required*]        | string   | The identifier of the dashboard or integration dashboard.                                                          |
| attributes         | resource_type [*required*]      | enum     | The type of dashboard resource the report schedule targets. Allowed enum values: `dashboard,integration_dashboard` |
| attributes         | template_variables [*required*] | [object] | The dashboard template variables applied when rendering the report.                                                |
| template_variables | name [*required*]               | string   | The name of the template variable.                                                                                 |
| template_variables | values [*required*]             | [string] | The selected values for the template variable.                                                                     |
| attributes         | timeframe                            | string   | The relative time window used, if one was specified in the request.                                                |
| attributes         | timezone [*required*]           | string   | The IANA time zone identifier used when rendering the report.                                                      |
| attributes         | to_ts [*required*]              | int64    | The end of the rendered time range, as a Unix timestamp in milliseconds.                                           |
| data               | id [*required*]                 | uuid     | The unique identifier of the report.                                                                               |
| data               | type [*required*]               | enum     | JSON:API resource type for a print-only report. Allowed enum values: `report`                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": {
    "attributes": {
      "download_url": "https://app.datadoghq.com/...",
      "from_ts": 1780318800000,
      "resource_id": "abc-def-ghi",
      "resource_type": "dashboard",
      "template_variables": [
        {
          "name": "env",
          "values": [
            "prod"
          ]
        }
      ],
      "timeframe": "1w",
      "timezone": "America/New_York",
      "to_ts": 1780923600000
    },
    "id": "11111111-2222-3333-4444-555555555555",
    "type": "report"
  }
}
```

{% /tab %}

{% /tab %}

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

| Parent field | Field                    | Type     | Description                                                                     |
| ------------ | ------------------------ | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail                   | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                     | object   | Non-standard meta-information about the error                                   |
| errors       | source                   | object   | References to the source of the error.                                          |
| source       | header                   | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter                | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer                  | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status                   | string   | Status code of the response.                                                    |
| errors       | title                    | string   | Short human-readable summary of the error.                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

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

| Parent field | Field                    | Type     | Description                                                                     |
| ------------ | ------------------------ | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail                   | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                     | object   | Non-standard meta-information about the error                                   |
| errors       | source                   | object   | References to the source of the error.                                          |
| source       | header                   | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter                | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer                  | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status                   | string   | Status code of the response.                                                    |
| errors       | title                    | string   | Short human-readable summary of the error.                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

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

| Parent field | Field                    | Type     | Description                                                                     |
| ------------ | ------------------------ | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail                   | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                     | object   | Non-standard meta-information about the error                                   |
| errors       | source                   | object   | References to the source of the error.                                          |
| source       | header                   | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter                | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer                  | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status                   | string   | Status code of the response.                                                    |
| errors       | title                    | string   | Short human-readable summary of the error.                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

{% tab title="422" %}
Unprocessable Entity
{% tab title="Model" %}
API error response.

| Parent field | Field                    | Type     | Description                                                                     |
| ------------ | ------------------------ | -------- | ------------------------------------------------------------------------------- |
|              | errors [*required*] | [object] | A list of errors.                                                               |
| errors       | detail                   | string   | A human-readable explanation specific to this occurrence of the error.          |
| errors       | meta                     | object   | Non-standard meta-information about the error                                   |
| errors       | source                   | object   | References to the source of the error.                                          |
| source       | header                   | string   | A string indicating the name of a single request header which caused the error. |
| source       | parameter                | string   | A string indicating which URI query parameter caused the error.                 |
| source       | pointer                  | string   | A JSON pointer to the value in the request document that caused the error.      |
| errors       | status                   | string   | Status code of the response.                                                    |
| errors       | title                    | string   | Short human-readable summary of the error.                                      |

{% /tab %}

{% tab title="Example" %}

```json
{
  "errors": [
    {
      "detail": "Missing required attribute in body",
      "meta": {},
      "source": {
        "header": "Authorization",
        "parameter": "limit",
        "pointer": "/data/attributes/title"
      },
      "status": "400",
      "title": "Bad Request"
    }
  ]
}
```

{% /tab %}

{% /tab %}

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

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

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

### Code Example

##### 
                  \## default
# 
 \# Curl command curl -X POST "https://api.datadoghq.com/api/v2/reporting/print" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "resource_id": "abc-def-ghi",
      "resource_type": "dashboard",
      "template_variables": [
        {
          "name": "env",
          "values": [
            "prod"
          ]
        }
      ],
      "timeframe": "1w",
      "timezone": "America/New_York"
    },
    "type": "report"
  }
}
EOF 
                
##### 

```python
"""
Print a report returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.report_schedules_api import ReportSchedulesApi
from datadog_api_client.v2.model.print_report_request import PrintReportRequest
from datadog_api_client.v2.model.print_report_request_attributes import PrintReportRequestAttributes
from datadog_api_client.v2.model.print_report_request_data import PrintReportRequestData
from datadog_api_client.v2.model.print_report_type import PrintReportType
from datadog_api_client.v2.model.report_schedule_resource_type import ReportScheduleResourceType
from datadog_api_client.v2.model.report_schedule_template_variable import ReportScheduleTemplateVariable

body = PrintReportRequest(
    data=PrintReportRequestData(
        attributes=PrintReportRequestAttributes(
            from_ts=1780318800000,
            resource_id="abc-def-ghi",
            resource_type=ReportScheduleResourceType.DASHBOARD,
            template_variables=[
                ReportScheduleTemplateVariable(
                    name="env",
                    values=[
                        "prod",
                    ],
                ),
            ],
            timeframe="1w",
            timezone="America/New_York",
            to_ts=1780923600000,
        ),
        type=PrintReportType.REPORT,
    ),
)

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = ReportSchedulesApi(api_client)
    response = api_instance.print_report(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="<API-KEY>" DD_APP_KEY="<APP-KEY>" python3 "example.py"
##### 

```ruby
# Print a report returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::ReportSchedulesAPI.new

body = DatadogAPIClient::V2::PrintReportRequest.new({
  data: DatadogAPIClient::V2::PrintReportRequestData.new({
    attributes: DatadogAPIClient::V2::PrintReportRequestAttributes.new({
      from_ts: 1780318800000,
      resource_id: "abc-def-ghi",
      resource_type: DatadogAPIClient::V2::ReportScheduleResourceType::DASHBOARD,
      template_variables: [
        DatadogAPIClient::V2::ReportScheduleTemplateVariable.new({
          name: "env",
          values: [
            "prod",
          ],
        }),
      ],
      timeframe: "1w",
      timezone: "America/New_York",
      to_ts: 1780923600000,
    }),
    type: DatadogAPIClient::V2::PrintReportType::REPORT,
  }),
})
p api_instance.print_report(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="<API-KEY>" DD_APP_KEY="<APP-KEY>" rb "example.rb"
##### 

```go
// Print a report 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() {
	body := datadogV2.PrintReportRequest{
		Data: datadogV2.PrintReportRequestData{
			Attributes: datadogV2.PrintReportRequestAttributes{
				FromTs:       datadog.PtrInt64(1780318800000),
				ResourceId:   "abc-def-ghi",
				ResourceType: datadogV2.REPORTSCHEDULERESOURCETYPE_DASHBOARD,
				TemplateVariables: []datadogV2.ReportScheduleTemplateVariable{
					{
						Name: "env",
						Values: []string{
							"prod",
						},
					},
				},
				Timeframe: datadog.PtrString("1w"),
				Timezone:  "America/New_York",
				ToTs:      datadog.PtrInt64(1780923600000),
			},
			Type: datadogV2.PRINTREPORTTYPE_REPORT,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewReportSchedulesApi(apiClient)
	resp, r, err := api.PrintReport(ctx, body)

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

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `ReportSchedulesApi.PrintReport`:\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="<API-KEY>" DD_APP_KEY="<APP-KEY>" go run "main.go"
##### 

```java
// Print a report returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ReportSchedulesApi;
import com.datadog.api.client.v2.model.PrintReportRequest;
import com.datadog.api.client.v2.model.PrintReportRequestAttributes;
import com.datadog.api.client.v2.model.PrintReportRequestData;
import com.datadog.api.client.v2.model.PrintReportResponse;
import com.datadog.api.client.v2.model.PrintReportType;
import com.datadog.api.client.v2.model.ReportScheduleResourceType;
import com.datadog.api.client.v2.model.ReportScheduleTemplateVariable;
import java.util.Collections;

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

    PrintReportRequest body =
        new PrintReportRequest()
            .data(
                new PrintReportRequestData()
                    .attributes(
                        new PrintReportRequestAttributes()
                            .fromTs(1780318800000L)
                            .resourceId("abc-def-ghi")
                            .resourceType(ReportScheduleResourceType.DASHBOARD)
                            .templateVariables(
                                Collections.singletonList(
                                    new ReportScheduleTemplateVariable()
                                        .name("env")
                                        .values(Collections.singletonList("prod"))))
                            .timeframe("1w")
                            .timezone("America/New_York")
                            .toTs(1780923600000L))
                    .type(PrintReportType.REPORT));

    try {
      PrintReportResponse result = apiInstance.printReport(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ReportSchedulesApi#printReport");
      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="<API-KEY>" DD_APP_KEY="<APP-KEY>" java "Example.java"
##### 

```rust
// Print a report returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_report_schedules::ReportSchedulesAPI;
use datadog_api_client::datadogV2::model::PrintReportRequest;
use datadog_api_client::datadogV2::model::PrintReportRequestAttributes;
use datadog_api_client::datadogV2::model::PrintReportRequestData;
use datadog_api_client::datadogV2::model::PrintReportType;
use datadog_api_client::datadogV2::model::ReportScheduleResourceType;
use datadog_api_client::datadogV2::model::ReportScheduleTemplateVariable;

#[tokio::main]
async fn main() {
    let body = PrintReportRequest::new(PrintReportRequestData::new(
        PrintReportRequestAttributes::new(
            "abc-def-ghi".to_string(),
            ReportScheduleResourceType::DASHBOARD,
            vec![ReportScheduleTemplateVariable::new(
                "env".to_string(),
                vec!["prod".to_string()],
            )],
            "America/New_York".to_string(),
        )
        .from_ts(1780318800000)
        .timeframe("1w".to_string())
        .to_ts(1780923600000),
        PrintReportType::REPORT,
    ));
    let configuration = datadog::Configuration::new();
    let api = ReportSchedulesAPI::with_config(configuration);
    let resp = api.print_report(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="<API-KEY>" DD_APP_KEY="<APP-KEY>" cargo run
##### 

```typescript
/**
 * Print a report returns "OK" response
 */

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

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

const params: v2.ReportSchedulesApiPrintReportRequest = {
  body: {
    data: {
      attributes: {
        fromTs: 1780318800000,
        resourceId: "abc-def-ghi",
        resourceType: "dashboard",
        templateVariables: [
          {
            name: "env",
            values: ["prod"],
          },
        ],
        timeframe: "1w",
        timezone: "America/New_York",
        toTs: 1780923600000,
      },
      type: "report",
    },
  },
};

apiInstance
  .printReport(params)
  .then((data: v2.PrintReportResponse) => {
    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="<API-KEY>" DD_APP_KEY="<APP-KEY>" tsc "example.ts"
{% /tab %}
