# Import DataStream Values

Allow importing historical data of device's datastream. This can be helpful when you don't stream the data in real-time, but instead, collect it on the device and need to send it periodically as a dataset.&#x20;

For example, your device can be offline most of the time, but connect periodically and upload a set of data points.

{% hint style="warning" %}
**LIMIT:** You can send a max of 10,000 data points per day per device. No matter if you split it into multiple sets or send all data once.

This limit can vary based on the plan you are using and is common with [Upload a Set of Timestamped Data](https://docs.blynk.io/en/~/revisions/ynmC8lZ6FPocTYWigjcO/blynk.cloud/device-https-api/upload-set-of-data-with-timestamps-api) endpoint of Device HTTPS API.
{% endhint %}

## Import DataStream Values

<mark style="color:green;">`POST`</mark> `https://{server_address}/api/v1/organization/device/import/batch`

#### Headers

| Name                                            | Type                   | Description |
| ----------------------------------------------- | ---------------------- | ----------- |
| Authorization<mark style="color:red;">\*</mark> | Bearer {access\_token} |             |
| Content-Type<mark style="color:red;">\*</mark>  | application/json       |             |

#### Request Body

| Name                                               | Type   | Description                                                                                                                                                                                          |
| -------------------------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| deviceId<mark style="color:red;">\*</mark>         | 1      | Device identifier.                                                                                                                                                                                   |
| dataStreamId<mark style="color:red;">\*</mark>     | 1      | Device datastream identifier.                                                                                                                                                                        |
| values<mark style="color:red;">\*</mark>           |        | Datastream values to import.                                                                                                                                                                         |
| values\[x].value<mark style="color:red;">\*</mark> | 1      | Datastream value.                                                                                                                                                                                    |
| values\[x].ts<mark style="color:red;">\*</mark>    | String | <p>Unix epoch time in milliseconds representing datastream value creation time.</p><p><strong>Note:</strong> Timestamps could be only one month in the past. Older timestamps won't be accepted.</p> |

{% tabs %}
{% tab title="404: Not Found Device is not found" %}

```json
{
    "error": {
        "message": "Device with identifier 1 is not found or belong to another organization."
    }
}
```

{% endtab %}

{% tab title="204: No Content Device datastream value updated" %}

{% endtab %}

{% tab title="404: Not Found Datastream is not found" %}

```json
{
    "error": {
        "message": "Data stream with identifier 1 is not found!"
    }
}
```

{% endtab %}
{% endtabs %}

Request examples:

```bash
# curl command example:
$ curl -X POST -H "Content-Type: application/json" \
      -H "Authorization: Bearer {accessToken}" \
      -d '{"deviceId":1,"dataStreamId":1,"values":[{"value":5,"ts":1702656423136},{"value":2,"ts":1702656428136}]}' \
      https://fra1.blynk.cloud/api/v1/organization/device/import/batch

$ curl -X POST -H "Content-Type: application/json" \
      -H "Authorization: Bearer eIdWHQqRfFmvP5LDDh-IGxPUzi7I27HthzCPAVmS" \
      -d '{"deviceId":1,"dataStreamId":1,"values":[{"value":5,"ts":1702656423136},{"value":2,"ts":1702656428136}]}' \
      https://fra1.blynk.cloud/api/v1/organization/device/import/batch
```
