> For the complete documentation index, see [llms.txt](https://docs.blynk.io/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blynk.io/en/blynk.cloud/device-https-api/get-device-report.md).

# Get Historical Data From Device

<mark style="color:blue;">`GET`</mark> `https://{server_address}/external/api/data/get?token={token}&period={PERIOD}&granularityType={TYPE}&sourceType={SOURCE_TYPE}&tzName={tzName}&format={FORMAT}&pin={pin}`

#### Path Parameters

| Name                | Type   | Description                                                                                                                               |
| ------------------- | ------ | ----------------------------------------------------------------------------------------------------------------------------------------- |
| period              | string | Is `MONTH` by default. Other possible options: `HOUR`, `DAY`, `WEEK`, `THREE_MONTHS`                                                      |
| granularityType     | string | Is `RAW_DATA` by default. ( `RAW_DATA` is not supported for the `THREE_MONTH` period). Other possible values: `MINUTE`, `HOURLY`, `DAILY` |
| sourceType          | string | Is `AVG` by default. Other possible values: `MIN`, `MAX`, `SUM`, `COUNT`                                                                  |
| tzName              | string | Is `UTC` by defult. Please specify timezones accordingly to `java.time.ZoneId`                                                            |
| format              | string | <p>Is TS by default. Other possible values:<br>ISO\_US "04/10/19 11:45:41 AM"<br>ISO\_SIMPLE "2018-06-07 22:01:20"</p>                    |
| sendEvents          | string | Is false by default                                                                                                                       |
| dataStreamId or pin | string | Are optional parameteres, which are used to get data for the specific pin                                                                 |

```
{"link":"https://server_address/device_data_2592_2021-04-13T02-27-11.zip"}
```

```
{"error":{"message":"Invalid token."}}

or

{"error":{"message":"No token provided."}}

or

{"error":{"message":"Request with incorrect parameters"}}

or

{"error":{"message":"Wrong pin format."}}
```

{% tab title="500 Wrong constant is used in parameter (specified in the end of the string) or There is no data for specified pin or datastream" %}

```
{"error":{"message":"No enum constant cc.blynk.server.core.model.widgets.outputs.graph.Period.YEAR"}}

or

{"error":{"message":"No data"}}

or

{"error":{"message":"Wrong pin format."}}
```

## **Use case example:**

Let's say you live in Sydney, Australia and there is a garage door opener and want to get an exact time you departed today in one file. The accuracy you need is up to 1 minute and it should be in "YYYY-MM-DD HH:MM:SS" format. Your device uses Datastream with ID 20 and virtual pin 6 for open/close commands. Let's say you also need to get the list of all the Events that were recorded during this period.

API call will look like this:

`` https://blynk.cloud/external/api/data/get?token=HjKjfij84050fege&period=DAY&granularityType=MINUTE&sourceType=AVG&tzName=America/New_York&format=ISO_SIMPLE&sendEvents=true&dataStreamId=20` ``

**JSON Output example:**

```
{
    "meta":
    [
        {
            "name": "data_stream_name",
            "type": "String"
        },
        {
            "name": "ts",
            "type": "UInt32"
        },
        {
            "name": "value",
            "type": "Float64"
        }
    ],

    "data":
    [
        {
            "data_stream_name": "",
            "ts": 2021-05-14 12:25:00,
            "value": 1.6100000000000003
        }
    ],

    "rows": 1,

    "rows_before_limit_at_least": 1
}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.blynk.io/en/blynk.cloud/device-https-api/get-device-report.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
