# Export a specified query report as a PDF or CSV file Exports a previously saved query report as a downloadable file in the specified format (PDF or CSV). The report is looked up by its ID, the associated SQL query is executed, and the result is downloaded as a file. ## Endpoints `GET /dcapi/reports/queryReports/{id}/export` ## Request ### Request URL `https://{serverurl}/dcapi/reports/queryReports/{id}/export` ### Scope `DesktopCentralCloud.QueryReport.READ` ### Header `Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52` ### Request Parameters #### Request Headers - **Accept** (`string`, Mandatory): `application/octet-stream` #### Path Parameters - **id** (`string`, Mandatory): The [unique id](https://www.manageengine.com/products/desktop-central/help/api/cloud/report-get-available-query-reports.html) retrieved for saved query report. #### Query Parameters - **format** (`string`, Optional): The export file format. Allowed values: `pdf`, `csv`. Defaults to `pdf` if not specified. ### Sample Request #### Curl ```curl curl --request GET \ --url https://appdomains/dcapi/reports/queryReports/{id}/export \ --header 'Accept: application/octet-stream' \ --header 'Authorization: Zoho-oauthtoken d92d4xxxxxxxxxxxxx15f52' ``` ## Response ### Response Parameters #### HTTP Code 400 Response Body: `application/json` **JSON Object** - **errorCode** (`string`): Error code for invalid export request. `INVALID_QUERY` = the requested export format is not supported (only `pdf` and `csv` are allowed). - **errorMessage** (`string`): Human-readable message describing why the export request failed. Example: Un-Supported format. #### HTTP Code 401 Response Body: `application/json` **JSON Object** - **errorCode** (`string`): Error code for unauthorized access. `REPORT_UNAUTHORIZED` = the specified report ID was not found or the user does not have permission to access it. - **errorMessage** (`string`): Human-readable message indicating the user is not authorized to access the specified query report. #### HTTP Code 500 Response Body: `application/json` **JSON Object** - **errorCode** (`string`): Error code for server-side failure. `INTERNAL_ERROR` = an unexpected error occurred during query execution or file generation. - **errorMessage** (`string`): Human-readable message describing the internal server error encountered during the export process. ### Possible Response Codes - `200` HTTP code - `400` HTTP code - `401` HTTP code - `500` HTTP code ### Sample Response: HTTP 200 ```json 200 OK ``` ### Sample Response: HTTP 400 Export format is not pdf or csv ```json { "errorMessage": "Un-Supported format", "errorCode": "INVALID_QUERY" } ``` ### Sample Response: HTTP 401 Report ID does not exist or user does not have permission ```json { "errorMessage": "You are not authorized to access this report", "errorCode": "REPORT_UNAUTHORIZED" } ``` ### Sample Response: HTTP 500 Unexpected error during query execution or file generation ```json { "errorMessage": "An internal server error occurred while exporting the query report", "errorCode": "INTERNAL_ERROR" } ``` ## Rate Limit ![](https://www.zohowebstatic.com/sites/zweb/images/people/ico-help.png) **Duration:** 1 minute | **Threshold:** 30 | **Lock period:** 5 minutes Duration - Time window for the threshold. Threshold - Number of API calls allowed within the specified duration. Lock Period - Wait time before consecutive API requests.