> 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/platform-https-api/data-streams.md).

# Data Streams

Device datastream operations

## Get device datastream values

> Retrieve current values for datastreams of a device using datastream IDs\
> \
> Required permissions, when user-scoped authentication is used: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can read datastreams only for owned devices unless \`ORG\_DEVICES\_VIEW\` is granted.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"DataStreams","description":"Device datastream operations"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"DataStreamValue":{"type":"object","properties":{"dataStreamId":{"type":"integer","format":"int32","description":"DataStream ID"},"pin":{"type":"string","description":"DataStream pin"},"dataStreamLabel":{"type":"string","description":"DataStream label"},"dataStreamAlias":{"type":"string","description":"DataStream alias"},"value":{"$ref":"#/components/schemas/DataStreamRawValue"},"updatedAt":{"type":"integer","format":"int64","description":"Last update timestamp"}},"required":["dataStreamId","pin","dataStreamLabel","dataStreamAlias"]},"DataStreamRawValue":{"oneOf":[{"type":"string","description":"String datastream value"},{"type":"number","format":"double","description":"Double, integer or enum datastream value"},{"type":"array","description":"Location datastream value. Represented as an array of two elements, where the first is longitude, and the second is latitude.","items":{"type":"number","format":"double"},"minItems":2,"maxItems":2}]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v2/organization/device/datastreams":{"get":{"tags":["DataStreams"],"summary":"Get device datastream values","description":"Retrieve current values for datastreams of a device using datastream IDs\n\nRequired permissions, when user-scoped authentication is used: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can read datastreams only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"getDeviceDataStreamsV2","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"},{"name":"dataStreamIds","in":"query","schema":{"type":"array","items":{"type":"integer","format":"int32"}},"description":"Optional list of datastream IDs to filter results","style":"form","explode":true}],"responses":{"200":{"description":"Datastream values","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DataStreamValue"}}}}},"403":{"description":"Forbidden"},"404":{"description":"Device not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Get datastreams values for multiple devices

> Retrieve current values for datastreams across multiple devices in batch.\
> Maximum of 10 devices per request.\
> \
> If any device is not found or you don't have access to it, the device will be ignored.\
> \
> Required permissions, when user-scoped authentication is used: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens return data only for owned devices unless \`ORG\_DEVICES\_VIEW\` is granted; inaccessible devices are skipped.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"DataStreams","description":"Device datastream operations"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"DataStreamValue":{"type":"object","properties":{"dataStreamId":{"type":"integer","format":"int32","description":"DataStream ID"},"pin":{"type":"string","description":"DataStream pin"},"dataStreamLabel":{"type":"string","description":"DataStream label"},"dataStreamAlias":{"type":"string","description":"DataStream alias"},"value":{"$ref":"#/components/schemas/DataStreamRawValue"},"updatedAt":{"type":"integer","format":"int64","description":"Last update timestamp"}},"required":["dataStreamId","pin","dataStreamLabel","dataStreamAlias"]},"DataStreamRawValue":{"oneOf":[{"type":"string","description":"String datastream value"},{"type":"number","format":"double","description":"Double, integer or enum datastream value"},{"type":"array","description":"Location datastream value. Represented as an array of two elements, where the first is longitude, and the second is latitude.","items":{"type":"number","format":"double"},"minItems":2,"maxItems":2}]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/datastreams/batch":{"get":{"tags":["DataStreams"],"summary":"Get datastreams values for multiple devices","description":"Retrieve current values for datastreams across multiple devices in batch.\nMaximum of 10 devices per request.\n\nIf any device is not found or you don't have access to it, the device will be ignored.\n\nRequired permissions, when user-scoped authentication is used: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens return data only for owned devices unless `ORG_DEVICES_VIEW` is granted; inaccessible devices are skipped.\n","operationId":"getBatchDeviceDataStreams","parameters":[{"name":"deviceIds","in":"query","required":true,"schema":{"type":"array","items":{"type":"integer","format":"int32"},"maxItems":10},"description":"List of device IDs","style":"form","explode":true},{"name":"dataStreamIds","in":"query","schema":{"type":"array","items":{"type":"integer","format":"int32"}},"description":"Optional list of datastream IDs to filter results","style":"form","explode":true}],"responses":{"200":{"description":"Batch datastream values","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"deviceId":{"type":"integer","format":"int32"},"dataStreams":{"type":"array","items":{"$ref":"#/components/schemas/DataStreamValue"}}},"required":["deviceId","dataStreams"]}}}}},"403":{"description":"Forbidden"},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Get datastream history

> Retrieve historical data for a specific datastream\
> \
> Required permissions, when user-scoped authentication is used: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can read history only for owned devices unless \`ORG\_DEVICES\_VIEW\` is granted.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"DataStreams","description":"Device datastream operations"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/datastream/history":{"get":{"tags":["DataStreams"],"summary":"Get datastream history","description":"Retrieve historical data for a specific datastream\n\nRequired permissions, when user-scoped authentication is used: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can read history only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"getDeviceDataStreamHistory","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"},{"name":"dataStreamId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"DataStream ID (alternative to pin)"},{"name":"from","in":"query","required":true,"schema":{"type":"integer","format":"int64"},"description":"Start timestamp (Unix epoch milliseconds)"},{"name":"to","in":"query","required":true,"schema":{"type":"integer","format":"int64"},"description":"End timestamp (Unix epoch milliseconds)"},{"name":"page","in":"query","schema":{"type":"integer","format":"int32","default":0,"minimum":0},"description":"Page number (0-indexed)"},{"name":"size","in":"query","schema":{"type":"integer","format":"int32","default":50,"minimum":1,"maximum":1000},"description":"Page size (max 1000)"}],"responses":{"200":{"description":"Historical data","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"array","items":{"type":"object","properties":{"value":{"type":"number","format":"double","description":"Datastream value (number representation)"},"createdAt":{"type":"integer","format":"int64","description":"Timestamp of the data point in milliseconds since epoch"}},"required":["value","createdAt"]}},"totalElements":{"type":"integer","format":"int64"}},"required":["content","totalElements"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device/datastream not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Get aggregated historical data from device

> Retrieve aggregated (downsampled) historical data for all datastreams of a device, or only\
> for the requested datastreams when the \`dataStreamIds\` parameter is provided.\
> \
> Values are read from the pre-aggregated reporting tables selected by \`granularity\`\
> (\`minute\`, \`hour\` or \`day\`) and rolled up with the requested \`aggregation\` function\
> (\`avg\`, \`min\`, \`max\`, \`sum\` or \`count\`). This is the server-side alternative to pulling raw\
> points and rolling them up on the client, which makes it suitable for dashboards, charts and\
> constrained clients. Only numeric datastreams produce aggregated values; string datastreams\
> yield no rows.\
> \
> Like the raw \`/device/datastreams/history\` endpoint, the full time range is always returned\
> (there is no pagination). By default the response is a compact \`{columns, data}\` envelope\
> streamed in chunks, so it can be arbitrarily large - use the \`from\`/\`to\` parameters to bound\
> the range. \`columns\` lists the field names once (\`dataStreamId\`, \`createdAt\`, \`value\`) and\
> each entry in \`data\` is a positional array in that column order. Entries are ordered by\
> timestamp descending. When \`format=csv\` is supplied the same data is instead streamed back as\
> a downloadable \`dataStreamId,timestamp,value\` CSV attachment.\
> \
> Required permissions, when user-scoped authentication is used: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can read history only for owned devices unless \`ORG\_DEVICES\_VIEW\` is granted.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"DataStreams","description":"Device datastream operations"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/datastreams/history/aggregated":{"get":{"tags":["DataStreams"],"summary":"Get aggregated historical data from device","description":"Retrieve aggregated (downsampled) historical data for all datastreams of a device, or only\nfor the requested datastreams when the `dataStreamIds` parameter is provided.\n\nValues are read from the pre-aggregated reporting tables selected by `granularity`\n(`minute`, `hour` or `day`) and rolled up with the requested `aggregation` function\n(`avg`, `min`, `max`, `sum` or `count`). This is the server-side alternative to pulling raw\npoints and rolling them up on the client, which makes it suitable for dashboards, charts and\nconstrained clients. Only numeric datastreams produce aggregated values; string datastreams\nyield no rows.\n\nLike the raw `/device/datastreams/history` endpoint, the full time range is always returned\n(there is no pagination). By default the response is a compact `{columns, data}` envelope\nstreamed in chunks, so it can be arbitrarily large - use the `from`/`to` parameters to bound\nthe range. `columns` lists the field names once (`dataStreamId`, `createdAt`, `value`) and\neach entry in `data` is a positional array in that column order. Entries are ordered by\ntimestamp descending. When `format=csv` is supplied the same data is instead streamed back as\na downloadable `dataStreamId,timestamp,value` CSV attachment.\n\nRequired permissions, when user-scoped authentication is used: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can read history only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"getDeviceDataStreamsHistoryAggregated","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"},{"name":"dataStreamIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"integer","format":"int32"}},"style":"form","explode":true,"description":"Optional list of DataStream IDs to filter by. Can be passed as a comma-separated list\n(`dataStreamIds=1,2,3`) or as repeated parameters (`dataStreamIds=1&dataStreamIds=2`);\ndo not mix both forms in a single request.\nWhen omitted, aggregated data for all datastreams of the device is returned.\n"},{"name":"from","in":"query","required":false,"schema":{"type":"integer","format":"int64","default":0},"description":"Start timestamp (Unix epoch milliseconds)"},{"name":"to","in":"query","required":false,"schema":{"type":"integer","format":"int64"},"description":"End timestamp (Unix epoch milliseconds). Defaults to the current time"},{"name":"granularity","in":"query","required":false,"schema":{"type":"string","enum":["minute","hour","day"],"default":"minute"},"description":"Time bucket size used to downsample the data"},{"name":"aggregation","in":"query","required":false,"schema":{"type":"string","enum":["avg","min","max","sum","count"],"default":"avg"},"description":"Aggregation function applied within each time bucket"},{"name":"format","in":"query","required":false,"schema":{"type":"string","enum":["json","csv"],"default":"json"},"description":"Response format. `json` returns the `{columns, data}` envelope; `csv` streams a downloadable file"}],"responses":{"200":{"description":"Aggregated historical data ordered by timestamp descending, streamed as a compact {columns, data} envelope (or as a CSV attachment when format=csv)\n","content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","description":"Field names for the positional arrays in `data`, always `[\"dataStreamId\", \"createdAt\", \"value\"]` in this order.\n","items":{"type":"string"}},"data":{"type":"array","description":"One entry per aggregated time bucket. Each entry is a positional array `[dataStreamId, createdAt, value]` matching `columns`.\n","items":{"type":"array","description":"A single aggregated point as `[dataStreamId, createdAt, value]`: the DataStream ID (int32), the start timestamp of the aggregated bucket in milliseconds since epoch (int64), and the aggregated value (number).\n","items":{"oneOf":[{"type":"integer","format":"int64"},{"type":"number","format":"double"}]},"minItems":3,"maxItems":3}}},"required":["columns","data"]}},"text/csv":{"schema":{"type":"string","format":"binary","description":"CSV document with a `dataStreamId,timestamp,value` header followed by one row per\naggregated time bucket, ordered by timestamp descending. Returned when `format=csv`.\n"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device/datastream not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Get historical data from device

> Retrieve historical data for all datastreams of a device, or only for the requested\
> datastreams when the \`dataStreamIds\` parameter is provided.\
> \
> Covers numeric and string datastreams. History of location datastreams is not returned\
> by this operation.\
> \
> The response is a compact \`{columns, data}\` envelope streamed in chunks, so it can be\
> arbitrarily large - use the \`from\`/\`to\` parameters to bound the time range. \`columns\`\
> lists the field names once (\`dataStreamId\`, \`createdAt\`, \`value\`) and each entry in \`data\`\
> is a positional array in that column order, which avoids repeating the field names on\
> every row. Entries are ordered by timestamp descending.\
> \
> Required permissions, when user-scoped authentication is used: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can read history only for owned devices unless \`ORG\_DEVICES\_VIEW\` is granted.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"DataStreams","description":"Device datastream operations"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/datastreams/history":{"get":{"tags":["DataStreams"],"summary":"Get historical data from device","description":"Retrieve historical data for all datastreams of a device, or only for the requested\ndatastreams when the `dataStreamIds` parameter is provided.\n\nCovers numeric and string datastreams. History of location datastreams is not returned\nby this operation.\n\nThe response is a compact `{columns, data}` envelope streamed in chunks, so it can be\narbitrarily large - use the `from`/`to` parameters to bound the time range. `columns`\nlists the field names once (`dataStreamId`, `createdAt`, `value`) and each entry in `data`\nis a positional array in that column order, which avoids repeating the field names on\nevery row. Entries are ordered by timestamp descending.\n\nRequired permissions, when user-scoped authentication is used: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can read history only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"getDeviceDataStreamsHistory","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"},{"name":"dataStreamIds","in":"query","required":false,"schema":{"type":"array","items":{"type":"integer","format":"int32"}},"style":"form","explode":true,"description":"Optional list of DataStream IDs to filter by. Can be passed as a comma-separated list\n(`dataStreamIds=1,2,3`) or as repeated parameters (`dataStreamIds=1&dataStreamIds=2`);\ndo not mix both forms in a single request.\nWhen omitted, historical data for all datastreams of the device is returned.\n"},{"name":"from","in":"query","required":false,"schema":{"type":"integer","format":"int64","default":0},"description":"Start timestamp (Unix epoch milliseconds)"},{"name":"to","in":"query","required":false,"schema":{"type":"integer","format":"int64"},"description":"End timestamp (Unix epoch milliseconds). Defaults to the current time"}],"responses":{"200":{"description":"Historical data ordered by timestamp descending, streamed as a compact {columns, data} envelope\n","content":{"application/json":{"schema":{"type":"object","properties":{"columns":{"type":"array","description":"Field names for the positional arrays in `data`, always `[\"dataStreamId\", \"createdAt\", \"value\"]` in this order.\n","items":{"type":"string"}},"data":{"type":"array","description":"One entry per data point. Each entry is a positional array `[dataStreamId, createdAt, value]` matching `columns`.\n","items":{"type":"array","description":"A single data point as `[dataStreamId, createdAt, value]`: the DataStream ID (int32), the timestamp in milliseconds since epoch (int64), and the value (number for numeric datastreams, string for string datastreams).\n","items":{"oneOf":[{"type":"integer","format":"int64"},{"type":"number","format":"double"},{"type":"string"}]},"minItems":3,"maxItems":3}}},"required":["columns","data"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device/datastream not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Update single datastream value

> Update the value of a specific datastream\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_CONTROL\`.\
> Required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can update datastreams only for owned devices unless \`ORG\_DEVICES\_VIEW\` is granted.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"DataStreams","description":"Device datastream operations"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"DataStreamRawValue":{"oneOf":[{"type":"string","description":"String datastream value"},{"type":"number","format":"double","description":"Double, integer or enum datastream value"},{"type":"array","description":"Location datastream value. Represented as an array of two elements, where the first is longitude, and the second is latitude.","items":{"type":"number","format":"double"},"minItems":2,"maxItems":2}]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/datastream":{"post":{"tags":["DataStreams"],"summary":"Update single datastream value","description":"Update the value of a specific datastream\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_CONTROL`.\nRequired device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can update datastreams only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"updateDeviceDataStream","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"integer","format":"int32","description":"Device ID"},"dataStreamId":{"type":"integer","format":"int32","description":"DataStream ID"},"value":{"$ref":"#/components/schemas/DataStreamRawValue"}},"required":["deviceId","dataStreamId","value"]}}}},"responses":{"204":{"description":"Datastream updated successfully"},"400":{"description":"Bad request - Invalid value","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device/datastream not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Update multiple datastream values

> Update values for multiple datastreams of a single device.\
> \
> Invalid datastream IDs or values with mismatched types are silently skipped (no error is returned for individual entries).\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_CONTROL\`.\
> Required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can update datastreams only for owned devices unless \`ORG\_DEVICES\_VIEW\` is granted.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"DataStreams","description":"Device datastream operations"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"DataStreamRawValue":{"oneOf":[{"type":"string","description":"String datastream value"},{"type":"number","format":"double","description":"Double, integer or enum datastream value"},{"type":"array","description":"Location datastream value. Represented as an array of two elements, where the first is longitude, and the second is latitude.","items":{"type":"number","format":"double"},"minItems":2,"maxItems":2}]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/datastreams":{"post":{"tags":["DataStreams"],"summary":"Update multiple datastream values","description":"Update values for multiple datastreams of a single device.\n\nInvalid datastream IDs or values with mismatched types are silently skipped (no error is returned for individual entries).\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_CONTROL`.\nRequired device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can update datastreams only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"updateMultipleDeviceDataStreams","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"integer","format":"int32","description":"Device ID"},"values":{"type":"object","additionalProperties":{"$ref":"#/components/schemas/DataStreamRawValue"},"description":"Map of dataStreamId to value"}},"required":["deviceId","values"]}}}},"responses":{"204":{"description":"Datastreams updated successfully"},"400":{"description":"Bad request - Invalid values","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Batch update datastream values for multiple devices

> Update datastream values for multiple devices in a single request.\
> The product is automatically derived from the first valid device in the batch.\
> All devices must belong to the same product (validated via original product ID to support sub-products/variants).\
> \
> The \`fields\` array defines the column schema: the first element must be \`"deviceId"\`,\
> followed by datastream labels (e.g., \`"Temperature"\`, \`"Humidity"\`).\
> Each entry in \`updates\` is an array matching the \`fields\` schema.\
> Use \`null\` to skip a datastream for a given device.\
> \
> Maximum of 10,000 updates per request.\
> \
> When all rows succeed, the endpoint returns \`204 No Content\`.\
> When some rows are skipped (invalid device, no access, wrong product, etc.),\
> the endpoint returns \`200 OK\` with a JSON body reporting either:\
> \- \*\*Counter mode\*\* (default): generic counters per error category\
> \- \*\*Debug mode\*\* (\`"debug": true\`): detailed per-row skip reasons (at most 100)\
> \
> When no valid device is found to derive the product, the endpoint returns \`400 Bad Request\`.\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_CONTROL\`.\
> Required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can update datastreams only for owned devices unless \`ORG\_DEVICES\_VIEW\` is granted.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"DataStreams","description":"Device datastream operations"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/product/devices/batch-update":{"post":{"tags":["DataStreams"],"summary":"Batch update datastream values for multiple devices","description":"Update datastream values for multiple devices in a single request.\nThe product is automatically derived from the first valid device in the batch.\nAll devices must belong to the same product (validated via original product ID to support sub-products/variants).\n\nThe `fields` array defines the column schema: the first element must be `\"deviceId\"`,\nfollowed by datastream labels (e.g., `\"Temperature\"`, `\"Humidity\"`).\nEach entry in `updates` is an array matching the `fields` schema.\nUse `null` to skip a datastream for a given device.\n\nMaximum of 10,000 updates per request.\n\nWhen all rows succeed, the endpoint returns `204 No Content`.\nWhen some rows are skipped (invalid device, no access, wrong product, etc.),\nthe endpoint returns `200 OK` with a JSON body reporting either:\n- **Counter mode** (default): generic counters per error category\n- **Debug mode** (`\"debug\": true`): detailed per-row skip reasons (at most 100)\n\nWhen no valid device is found to derive the product, the endpoint returns `400 Bad Request`.\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_CONTROL`.\nRequired device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can update datastreams only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"batchUpdateDeviceDataStreams","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"fields":{"type":"array","minItems":2,"items":{"type":"string"},"description":"Column schema. The first element must be `\"deviceId\"`.\nRemaining elements are datastream labels to update.\n"},"updates":{"type":"array","minItems":1,"maxItems":10000,"items":{"type":"array","items":{}},"description":"List of update rows. Each row must have the same number of elements as `fields`.\nThe first element is the device ID (integer).\nRemaining elements are the values for the corresponding datastream labels.\nUse `null` to skip updating a datastream for that device.\n"},"debug":{"type":"boolean","default":false,"description":"When `true`, the response includes detailed per-row skip reasons (max 100).\nWhen `false` (default), the response includes only generic error counters.\n"}},"required":["fields","updates"]}}}},"responses":{"200":{"description":"Partial success — some rows were skipped","content":{"application/json":{"schema":{"type":"object","properties":{"skippedRows":{"type":"array","items":{"type":"string"},"description":"Detailed per-row skip reasons (only when `debug` is `true`, max 100)"},"invalidRowSize":{"type":"integer","description":"Number of rows with incorrect array length (counter mode)"},"nullDeviceId":{"type":"integer","description":"Number of rows with null deviceId (counter mode)"},"nonNumericDeviceId":{"type":"integer","description":"Number of rows with non-numeric deviceId (counter mode)"},"deviceNotFound":{"type":"integer","description":"Number of rows where device was not found or no org access (counter mode)"},"noAccessToDevice":{"type":"integer","description":"Number of rows where per-device access check failed (counter mode)"},"wrongProduct":{"type":"integer","description":"Number of rows where device belongs to a different product (counter mode)"}}}}}},"204":{"description":"All datastreams updated successfully"},"400":{"description":"Bad request — invalid fields or no valid device found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Import batch data

> Import historical data for device in batch.\
> \
> A per-device rate limit applies to import operations.\
> Data points with timestamps more than 1 month in the future are silently skipped.\
> Maximum of 10,000 data points per request.\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICE\_DATA\_IMPORT\`.\
> Required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can import data only for owned devices unless \`ORG\_DEVICES\_VIEW\` is granted.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"DataStreams","description":"Device datastream operations"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"DataStreamRawValue":{"oneOf":[{"type":"string","description":"String datastream value"},{"type":"number","format":"double","description":"Double, integer or enum datastream value"},{"type":"array","description":"Location datastream value. Represented as an array of two elements, where the first is longitude, and the second is latitude.","items":{"type":"number","format":"double"},"minItems":2,"maxItems":2}]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/import/batch":{"post":{"tags":["DataStreams"],"summary":"Import batch data","description":"Import historical data for device in batch.\n\nA per-device rate limit applies to import operations.\nData points with timestamps more than 1 month in the future are silently skipped.\nMaximum of 10,000 data points per request.\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICE_DATA_IMPORT`.\nRequired device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can import data only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"importDeviceBatchData","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"integer","format":"int32","description":"Device ID"},"dataStreamId":{"type":"integer","format":"int32","description":"DataStream ID"},"values":{"type":"array","minItems":1,"maxItems":10000,"items":{"type":"object","properties":{"value":{"$ref":"#/components/schemas/DataStreamRawValue"},"ts":{"type":"integer","format":"int64","description":"Timestamp of the data point in milliseconds since epoch"}},"required":["value","ts"]}}},"required":["deviceId","dataStreamId","values"]}}}},"responses":{"204":{"description":"Import accepted and processing asynchronously"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Update datastream widget property

> Update a widget property for a datastream (label, color, min, max, etc.).\
> \
> The \`value\` must be in the correct format for the given property. Returns 400 if the format is invalid.\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_CONTROL\`.\
> Required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can update properties only for owned devices unless \`ORG\_DEVICES\_VIEW\` is granted.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"DataStreams","description":"Device datastream operations"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"DataStreamPropertyName":{"type":"string","enum":["label","color","onBackColor","offBackColor","onColor","offColor","onLabel","offLabel","labels","min","max","isOnPlay","url","urls","step","valueFormatting","suffix","maximumFractionDigits","opacity","scale","rotation","sortType","isDisabled","isHidden","icons","onImageUrl","offImageUrl","page","sound","isMuted","loop","autoplay","contentDesign","backColor"],"description":"Widget property to update"},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/datastream/property":{"post":{"tags":["DataStreams"],"summary":"Update datastream widget property","description":"Update a widget property for a datastream (label, color, min, max, etc.).\n\nThe `value` must be in the correct format for the given property. Returns 400 if the format is invalid.\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_CONTROL`.\nRequired device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can update properties only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"updateDeviceDataStreamProperty","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"integer","format":"int32","description":"Device ID"},"dataStreamId":{"type":"integer","format":"int32","description":"DataStream ID"},"property":{"$ref":"#/components/schemas/DataStreamPropertyName"},"value":{"type":"string","description":"New property value","maxLength":200}},"required":["deviceId","dataStreamId","property","value"]}}}},"responses":{"204":{"description":"Property updated successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device/datastream/property not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```


---

# 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/platform-https-api/data-streams.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.
