# Template DataStreams

Template datastream management

## Get template datastreams

> Retrieve all datastreams defined in a template.\
> \
> Required permissions, when user-scoped authentication is used: \`PRODUCT\_VIEW\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Template DataStreams","description":"Template datastream management"}],"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":{"TemplateDataStream":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"DataStream ID"},"label":{"type":"string","description":"DataStream label"},"alias":{"type":"string","description":"DataStream alias"},"units":{"$ref":"#/components/schemas/MeasurementUnits"},"type":{"type":"string","enum":["STRING","INT","DOUBLE","BOOLEAN","LOCATION","ENUM"],"description":"DataStream value type"},"defaultValue":{"$ref":"#/components/schemas/DataStreamRawValue"},"pin":{"type":"integer","format":"int32","description":"Virtual pin number"},"pinType":{"type":"string","enum":["VIRTUAL","DIGITAL","ANALOG"],"description":"Pin type"},"pinMode":{"type":"string","enum":["INPUT","OUTPUT","INPUT_PULL_UP","INPUT_PULL_DOWN"],"description":"Pin mode"},"isAnalogPin":{"type":"boolean","description":"Whether the pin is an analog pin"},"isRaw":{"type":"boolean","description":"Whether the datastream value should be stored as raw value without parsing"},"isHistory":{"type":"boolean","description":"Whether the datastream should be stored in the aggregated format"},"isForService":{"type":"boolean","description":"Whether the datastream should be displayed in the service chart widget"},"isForReports":{"type":"boolean","description":"Whether the datastream is used for reporting purposes"},"isForActions":{"type":"boolean","description":"Whether the datastream can be used in the automation actions"},"isForConditions":{"type":"boolean","description":"Whether the datastream can be used in the automation conditions"},"isSync":{"type":"boolean","description":"Whether the datastream value should be synced on the hardware request"}},"required":["id","label","alias","type","pin","pinType","isAnalogPin","isRaw","isHistory","isForService","isForReports","isForActions","isForConditions","isSync"]},"MeasurementUnits":{"type":"string","description":"DataStream units","enum":["None","KilometerPerHour","MillimeterPerHour","InchesPerHour","CubicMetresPerHour","MilePerHour","MilePerHour2","GramPerSquareMeter","MilliLitterPerSquareMeter","LitterPerSquareMeter","PoundPerSquareInch","PoundPerSquareInch2","PoundPerCubicYard","OuncePerCubicYard","PoundPerCubicFoot","VolumeFlow","CubicCentimetersPerMinute","SignalStrength","DegreeDays","Millimeter","Centimeter","Meter","Kilometer","KiloBytes","MegaBytes","GigaBytes","Feet","SquareFeet","Inch","Foot","Yard","Mile","Milligram","Gram","Kilogram","Ton","Liter","Milliliter","Ounce","Pint","Gallon","Pound","Stone","Quarter","Hundredweight","Celsius","Fahrenheit","Kelvin","Percentage","Degrees","RPM","Step","Year","Month","Week","Day","Hour","Minute","Second","Volt","Ampere","MilliAmpere","MicroAmpere","Ohm","Hertz","Watts","Farad","Siemen","Henry","MicrogramPerCubicMeter","PartsPerMillion","PartsPerBillion","KiloWatts","HectoPascal","Pascal","Lux","Pressure","PressureInBars","AirQualityIndex","KiloWattHour","MilliSecond","MilliSec","MeterPerSecond","MilliGramPerCubicMeter","KiloPascal","CubicMeter","CubicYard","CubicFeetPerMinute","SquareMeter","LitersPerSecond","WattHour","MilliWatt","pH","AmpereHour","MilliAmpereHour"]},"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/template/datastreams":{"get":{"tags":["Template DataStreams"],"summary":"Get template datastreams","description":"Retrieve all datastreams defined in a template.\n\nRequired permissions, when user-scoped authentication is used: `PRODUCT_VIEW`.\n","operationId":"getTemplateDataStreams","parameters":[{"name":"templateId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Template ID"}],"responses":{"200":{"description":"List of datastreams","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/TemplateDataStream"}}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Template 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"}}}}}}}}}
```

## Create template datastream

> Add a new datastream to a template.\
> \
> Only the original (root) template can be edited (the one with \`parentId = null\`).\
> Sub-organizations cannot modify templates that were created by a parent organization.\
> Pin numbers must be unique within the template.\
> \
> Required permissions, when user-scoped authentication is used: \`PRODUCT\_EDIT\`.\
> Also, when the user-scoped authentication is used, user should have developer mode enabled.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Template DataStreams","description":"Template datastream management"}],"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":{"MeasurementUnits":{"type":"string","description":"DataStream units","enum":["None","KilometerPerHour","MillimeterPerHour","InchesPerHour","CubicMetresPerHour","MilePerHour","MilePerHour2","GramPerSquareMeter","MilliLitterPerSquareMeter","LitterPerSquareMeter","PoundPerSquareInch","PoundPerSquareInch2","PoundPerCubicYard","OuncePerCubicYard","PoundPerCubicFoot","VolumeFlow","CubicCentimetersPerMinute","SignalStrength","DegreeDays","Millimeter","Centimeter","Meter","Kilometer","KiloBytes","MegaBytes","GigaBytes","Feet","SquareFeet","Inch","Foot","Yard","Mile","Milligram","Gram","Kilogram","Ton","Liter","Milliliter","Ounce","Pint","Gallon","Pound","Stone","Quarter","Hundredweight","Celsius","Fahrenheit","Kelvin","Percentage","Degrees","RPM","Step","Year","Month","Week","Day","Hour","Minute","Second","Volt","Ampere","MilliAmpere","MicroAmpere","Ohm","Hertz","Watts","Farad","Siemen","Henry","MicrogramPerCubicMeter","PartsPerMillion","PartsPerBillion","KiloWatts","HectoPascal","Pascal","Lux","Pressure","PressureInBars","AirQualityIndex","KiloWattHour","MilliSecond","MilliSec","MeterPerSecond","MilliGramPerCubicMeter","KiloPascal","CubicMeter","CubicYard","CubicFeetPerMinute","SquareMeter","LitersPerSecond","WattHour","MilliWatt","pH","AmpereHour","MilliAmpereHour"]},"DataStreamDataType":{"type":"object","discriminator":{"propertyName":"type","mapping":{"STRING":"#/components/schemas/DataStreamStringDataType","INT":"#/components/schemas/DataStreamIntDataType","DOUBLE":"#/components/schemas/DataStreamDoubleDataType","ENUM":"#/components/schemas/DataStreamEnumDataType","LOCATION":"#/components/schemas/DataStreamLocationDataType"}},"oneOf":[{"$ref":"#/components/schemas/DataStreamStringDataType"},{"$ref":"#/components/schemas/DataStreamIntDataType"},{"$ref":"#/components/schemas/DataStreamDoubleDataType"},{"$ref":"#/components/schemas/DataStreamEnumDataType"},{"$ref":"#/components/schemas/DataStreamLocationDataType"}]},"DataStreamStringDataType":{"type":"object","properties":{"type":{"type":"string","enum":["STRING"],"description":"DataStream value type"},"defaultValue":{"type":"string","description":"Default value for the datastream"}},"required":["type"]},"DataStreamIntDataType":{"type":"object","properties":{"type":{"type":"string","enum":["INT"],"description":"DataStream value type"},"defaultValue":{"type":"integer","format":"int32","description":"Default value for the datastream"},"min":{"type":"integer","format":"int32","description":"Minimum value for the datastream"},"max":{"type":"integer","format":"int32","description":"Maximum value for the datastream"}},"required":["type","min","max"]},"DataStreamDoubleDataType":{"type":"object","properties":{"type":{"type":"string","enum":["DOUBLE"],"description":"DataStream value type"},"defaultValue":{"type":"number","format":"double","description":"Default value for the datastream"},"min":{"type":"number","format":"double","description":"Minimum value for the datastream"},"max":{"type":"number","format":"double","description":"Maximum value for the datastream"},"decimalsFormat":{"type":"string","description":"Decimal format for the datastream value, that is used for displaying the value in the dashboard and reports.","enum":["NO_FRACTION","FRACTION_1","FRACTION_2","FRACTION_3","FRACTION_4","FRACTION_5","FILL_1","FILL_2","FILL_3","FILL_4","FILL_5"]}},"required":["type","min","max","decimalsFormat"]},"DataStreamEnumDataType":{"type":"object","properties":{"type":{"type":"string","enum":["ENUM"],"description":"DataStream value type"},"defaultValue":{"type":"integer","format":"int32","description":"Default value for the datastream"}},"required":["type"]},"DataStreamLocationDataType":{"type":"object","properties":{"type":{"type":"string","enum":["LOCATION"],"description":"DataStream value type"},"defaultValue":{"type":"string","description":"Default value for the datastream. Should be in format 'longitude,latitude'"}},"required":["type"]},"TemplateDataStream":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"DataStream ID"},"label":{"type":"string","description":"DataStream label"},"alias":{"type":"string","description":"DataStream alias"},"units":{"$ref":"#/components/schemas/MeasurementUnits"},"type":{"type":"string","enum":["STRING","INT","DOUBLE","BOOLEAN","LOCATION","ENUM"],"description":"DataStream value type"},"defaultValue":{"$ref":"#/components/schemas/DataStreamRawValue"},"pin":{"type":"integer","format":"int32","description":"Virtual pin number"},"pinType":{"type":"string","enum":["VIRTUAL","DIGITAL","ANALOG"],"description":"Pin type"},"pinMode":{"type":"string","enum":["INPUT","OUTPUT","INPUT_PULL_UP","INPUT_PULL_DOWN"],"description":"Pin mode"},"isAnalogPin":{"type":"boolean","description":"Whether the pin is an analog pin"},"isRaw":{"type":"boolean","description":"Whether the datastream value should be stored as raw value without parsing"},"isHistory":{"type":"boolean","description":"Whether the datastream should be stored in the aggregated format"},"isForService":{"type":"boolean","description":"Whether the datastream should be displayed in the service chart widget"},"isForReports":{"type":"boolean","description":"Whether the datastream is used for reporting purposes"},"isForActions":{"type":"boolean","description":"Whether the datastream can be used in the automation actions"},"isForConditions":{"type":"boolean","description":"Whether the datastream can be used in the automation conditions"},"isSync":{"type":"boolean","description":"Whether the datastream value should be synced on the hardware request"}},"required":["id","label","alias","type","pin","pinType","isAnalogPin","isRaw","isHistory","isForService","isForReports","isForActions","isForConditions","isSync"]},"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/template/datastream/create":{"post":{"tags":["Template DataStreams"],"summary":"Create template datastream","description":"Add a new datastream to a template.\n\nOnly the original (root) template can be edited (the one with `parentId = null`).\nSub-organizations cannot modify templates that were created by a parent organization.\nPin numbers must be unique within the template.\n\nRequired permissions, when user-scoped authentication is used: `PRODUCT_EDIT`.\nAlso, when the user-scoped authentication is used, user should have developer mode enabled.\n","operationId":"createTemplateDataStream","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"productId":{"type":"integer","format":"int32","description":"Template ID"},"label":{"type":"string","description":"Datastream label. Can only contain letters, digits, spaces and underscores.","maxLength":128,"minLength":1},"alias":{"type":"string","description":"Datastream label. Can only contain letters, digits and spaces.","maxLength":200},"units":{"$ref":"#/components/schemas/MeasurementUnits"},"type":{"$ref":"#/components/schemas/DataStreamDataType"},"pin":{"type":"integer","format":"int32","description":"Pin number"},"pinType":{"type":"string","enum":["VIRTUAL","DIGITAL","ANALOG"],"description":"Pin type"},"pinMode":{"type":"string","enum":["INPUT","OUTPUT","INPUT_PULL_UP","INPUT_PULL_DOWN"],"description":"Pin mode"},"isAnalogPin":{"type":"boolean","description":"Whether the pin is analog"},"isRaw":{"type":"boolean","description":"Whether Blynk should store raw values sent from the device"},"isHistory":{"type":"boolean","description":"Whether Blynk should store aggregated values sent from the device"},"isForService":{"type":"boolean","description":"Whether the datastream should be displayed in the service chart widget"},"isForReports":{"type":"boolean","description":"Whether the datastream values should be included to reports"},"isForActions":{"type":"boolean","description":"Whether the datastream can be used in automation actions"},"isForConditions":{"type":"boolean","description":"Whether the datastream can be used in automation conditions"},"isSync":{"type":"boolean","description":"Whether the datastream should be synced with the device upon request"}},"required":["productId","label","alias","type","pin","pinType"]}}}},"responses":{"201":{"description":"Datastream created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateDataStream"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Template 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 template datastream

> Update a datastream in a template.\
> \
> Only the original (root) template can be edited (the one with \`parentId = null\`).\
> Sub-organizations cannot modify templates that were created by a parent organization.\
> \
> Required permissions, when user-scoped authentication is used: \`PRODUCT\_EDIT\`.\
> Also, when the user-scoped authentication is used, user should have developer mode enabled.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Template DataStreams","description":"Template datastream management"}],"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":{"MeasurementUnits":{"type":"string","description":"DataStream units","enum":["None","KilometerPerHour","MillimeterPerHour","InchesPerHour","CubicMetresPerHour","MilePerHour","MilePerHour2","GramPerSquareMeter","MilliLitterPerSquareMeter","LitterPerSquareMeter","PoundPerSquareInch","PoundPerSquareInch2","PoundPerCubicYard","OuncePerCubicYard","PoundPerCubicFoot","VolumeFlow","CubicCentimetersPerMinute","SignalStrength","DegreeDays","Millimeter","Centimeter","Meter","Kilometer","KiloBytes","MegaBytes","GigaBytes","Feet","SquareFeet","Inch","Foot","Yard","Mile","Milligram","Gram","Kilogram","Ton","Liter","Milliliter","Ounce","Pint","Gallon","Pound","Stone","Quarter","Hundredweight","Celsius","Fahrenheit","Kelvin","Percentage","Degrees","RPM","Step","Year","Month","Week","Day","Hour","Minute","Second","Volt","Ampere","MilliAmpere","MicroAmpere","Ohm","Hertz","Watts","Farad","Siemen","Henry","MicrogramPerCubicMeter","PartsPerMillion","PartsPerBillion","KiloWatts","HectoPascal","Pascal","Lux","Pressure","PressureInBars","AirQualityIndex","KiloWattHour","MilliSecond","MilliSec","MeterPerSecond","MilliGramPerCubicMeter","KiloPascal","CubicMeter","CubicYard","CubicFeetPerMinute","SquareMeter","LitersPerSecond","WattHour","MilliWatt","pH","AmpereHour","MilliAmpereHour"]},"DataStreamDataType":{"type":"object","discriminator":{"propertyName":"type","mapping":{"STRING":"#/components/schemas/DataStreamStringDataType","INT":"#/components/schemas/DataStreamIntDataType","DOUBLE":"#/components/schemas/DataStreamDoubleDataType","ENUM":"#/components/schemas/DataStreamEnumDataType","LOCATION":"#/components/schemas/DataStreamLocationDataType"}},"oneOf":[{"$ref":"#/components/schemas/DataStreamStringDataType"},{"$ref":"#/components/schemas/DataStreamIntDataType"},{"$ref":"#/components/schemas/DataStreamDoubleDataType"},{"$ref":"#/components/schemas/DataStreamEnumDataType"},{"$ref":"#/components/schemas/DataStreamLocationDataType"}]},"DataStreamStringDataType":{"type":"object","properties":{"type":{"type":"string","enum":["STRING"],"description":"DataStream value type"},"defaultValue":{"type":"string","description":"Default value for the datastream"}},"required":["type"]},"DataStreamIntDataType":{"type":"object","properties":{"type":{"type":"string","enum":["INT"],"description":"DataStream value type"},"defaultValue":{"type":"integer","format":"int32","description":"Default value for the datastream"},"min":{"type":"integer","format":"int32","description":"Minimum value for the datastream"},"max":{"type":"integer","format":"int32","description":"Maximum value for the datastream"}},"required":["type","min","max"]},"DataStreamDoubleDataType":{"type":"object","properties":{"type":{"type":"string","enum":["DOUBLE"],"description":"DataStream value type"},"defaultValue":{"type":"number","format":"double","description":"Default value for the datastream"},"min":{"type":"number","format":"double","description":"Minimum value for the datastream"},"max":{"type":"number","format":"double","description":"Maximum value for the datastream"},"decimalsFormat":{"type":"string","description":"Decimal format for the datastream value, that is used for displaying the value in the dashboard and reports.","enum":["NO_FRACTION","FRACTION_1","FRACTION_2","FRACTION_3","FRACTION_4","FRACTION_5","FILL_1","FILL_2","FILL_3","FILL_4","FILL_5"]}},"required":["type","min","max","decimalsFormat"]},"DataStreamEnumDataType":{"type":"object","properties":{"type":{"type":"string","enum":["ENUM"],"description":"DataStream value type"},"defaultValue":{"type":"integer","format":"int32","description":"Default value for the datastream"}},"required":["type"]},"DataStreamLocationDataType":{"type":"object","properties":{"type":{"type":"string","enum":["LOCATION"],"description":"DataStream value type"},"defaultValue":{"type":"string","description":"Default value for the datastream. Should be in format 'longitude,latitude'"}},"required":["type"]},"TemplateDataStream":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"DataStream ID"},"label":{"type":"string","description":"DataStream label"},"alias":{"type":"string","description":"DataStream alias"},"units":{"$ref":"#/components/schemas/MeasurementUnits"},"type":{"type":"string","enum":["STRING","INT","DOUBLE","BOOLEAN","LOCATION","ENUM"],"description":"DataStream value type"},"defaultValue":{"$ref":"#/components/schemas/DataStreamRawValue"},"pin":{"type":"integer","format":"int32","description":"Virtual pin number"},"pinType":{"type":"string","enum":["VIRTUAL","DIGITAL","ANALOG"],"description":"Pin type"},"pinMode":{"type":"string","enum":["INPUT","OUTPUT","INPUT_PULL_UP","INPUT_PULL_DOWN"],"description":"Pin mode"},"isAnalogPin":{"type":"boolean","description":"Whether the pin is an analog pin"},"isRaw":{"type":"boolean","description":"Whether the datastream value should be stored as raw value without parsing"},"isHistory":{"type":"boolean","description":"Whether the datastream should be stored in the aggregated format"},"isForService":{"type":"boolean","description":"Whether the datastream should be displayed in the service chart widget"},"isForReports":{"type":"boolean","description":"Whether the datastream is used for reporting purposes"},"isForActions":{"type":"boolean","description":"Whether the datastream can be used in the automation actions"},"isForConditions":{"type":"boolean","description":"Whether the datastream can be used in the automation conditions"},"isSync":{"type":"boolean","description":"Whether the datastream value should be synced on the hardware request"}},"required":["id","label","alias","type","pin","pinType","isAnalogPin","isRaw","isHistory","isForService","isForReports","isForActions","isForConditions","isSync"]},"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/template/datastream":{"put":{"tags":["Template DataStreams"],"summary":"Update template datastream","description":"Update a datastream in a template.\n\nOnly the original (root) template can be edited (the one with `parentId = null`).\nSub-organizations cannot modify templates that were created by a parent organization.\n\nRequired permissions, when user-scoped authentication is used: `PRODUCT_EDIT`.\nAlso, when the user-scoped authentication is used, user should have developer mode enabled.\n","operationId":"updateTemplateDataStream","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"productId":{"type":"integer","format":"int32","description":"Template ID"},"id":{"type":"integer","format":"int32","description":"Datastream ID, that should be updated"},"label":{"type":"string","description":"Datastream label. Can only contain letters, digits, spaces and underscores.","maxLength":128,"minLength":1},"alias":{"type":"string","description":"Datastream label. Can only contain letters, digits and spaces.","maxLength":200},"units":{"$ref":"#/components/schemas/MeasurementUnits"},"type":{"$ref":"#/components/schemas/DataStreamDataType"},"pin":{"type":"integer","format":"int32","description":"Pin number"},"pinType":{"type":"string","enum":["VIRTUAL","DIGITAL","ANALOG"],"description":"Pin type"},"pinMode":{"type":"string","enum":["INPUT","OUTPUT","INPUT_PULL_UP","INPUT_PULL_DOWN"],"description":"Pin mode"},"isAnalogPin":{"type":"boolean","description":"Whether the pin is analog"},"isRaw":{"type":"boolean","description":"Whether Blynk should store raw values sent from the device"},"isHistory":{"type":"boolean","description":"Whether Blynk should store aggregated values sent from the device"},"isForService":{"type":"boolean","description":"Whether the datastream should be displayed in the service chart widget"},"isForReports":{"type":"boolean","description":"Whether the datastream values should be included to reports"},"isForActions":{"type":"boolean","description":"Whether the datastream can be used in automation actions"},"isForConditions":{"type":"boolean","description":"Whether the datastream can be used in automation conditions"},"isSync":{"type":"boolean","description":"Whether the datastream should be synced with the device upon request"}},"required":["productId","label","alias","type","pin","pinType"]}}}},"responses":{"201":{"description":"Datastream updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateDataStream"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Template/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"}}}}}}}}}
```

## Delete template datastream

> Remove a datastream from a template.\
> \
> Only the original (root) template can be edited (the one with \`parentId = null\`).\
> Sub-organizations cannot modify templates that were created by a parent organization.\
> \
> Required permissions, when user-scoped authentication is used: \`PRODUCT\_EDIT\`.\
> Also, when the user-scoped authentication is used, user should have developer mode enabled.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Template DataStreams","description":"Template datastream management"}],"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/template/datastream":{"delete":{"tags":["Template DataStreams"],"summary":"Delete template datastream","description":"Remove a datastream from a template.\n\nOnly the original (root) template can be edited (the one with `parentId = null`).\nSub-organizations cannot modify templates that were created by a parent organization.\n\nRequired permissions, when user-scoped authentication is used: `PRODUCT_EDIT`.\nAlso, when the user-scoped authentication is used, user should have developer mode enabled.\n","operationId":"deleteTemplateDataStream","parameters":[{"name":"templateId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Template ID"},{"name":"dataStreamId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"DataStream ID"}],"responses":{"204":{"description":"Datastream deleted successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Template/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"}}}}}}}}}
```


---

# Agent Instructions: 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:

```
GET https://docs.blynk.io/en/blynk.cloud/platform-https-api/template-datastreams.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
