# Devices

Device lifecycle and management

## Get devices in organization

> Retrieve a paginated list of devices in an organization.\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_VIEW\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Devices","description":"Device lifecycle and 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":{"Device":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Device ID"},"name":{"type":"string","description":"Device name"},"templateId":{"type":"integer","format":"int32","description":"Template ID this device belongs to"},"originalTemplateId":{"type":"integer","format":"int32","description":"Original template ID from the template hierarchy (the root template ID this device is ultimately derived from)"},"orgId":{"type":"integer","format":"int32","description":"Organization ID this device belongs to"},"token":{"type":"string","description":"Device authentication token"},"activatedAt":{"type":"integer","format":"int64","description":"Device activation timestamp"},"ownerUserId":{"type":"integer","format":"int64","description":"Device owner identifier"},"hardwareInfo":{"$ref":"#/components/schemas/DeviceHardwareInfo"}},"required":["id","name","templateId","originalTemplateId","orgId","token"]},"DeviceHardwareInfo":{"type":"object","properties":{"version":{"type":"string","description":"Device firmware version"},"fwType":{"type":"string","description":"Device firmware type"},"blynkVersion":{"type":"string","description":"Version of the Blynk Library, that is used on the device"},"boardType":{"$ref":"#/components/schemas/BoardType"},"build":{"type":"string","description":"Firmware build number, that is used on the device"},"templateId":{"type":"string","description":"The identifier of the template that the device belongs to."}}},"BoardType":{"type":"string","enum":["Arduino","BBC_Microbit","ESP32","ESP8266","Lantronix_Fox_3","Microduino","Onion_Omega","Particle","Pycom_WiPy","Raspberry_Pi","Seeed_Wio_Terminal","SparkFun_Blynk_Board","Teensy","TinyDuino","NodeRed","Python","TI_CC3220","Iridium","Iridium_9704_Launch_Pad","NCD","Milesight","Seeed","Blues","MOKOSmart","Thermokon","Miromiko","Pepperl_Fuchs","Atim","Other"],"description":"Device board type"},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/devices":{"get":{"tags":["Devices"],"summary":"Get devices in organization","description":"Retrieve a paginated list of devices in an organization.\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_VIEW`.\n","operationId":"getDevices","parameters":[{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional, defaults to the organization, associated with the authentication token)"},{"name":"includeSubOrgDevices","in":"query","schema":{"type":"boolean","default":false},"description":"Include devices from sub-organizations"},{"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":"List of devices","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"array","items":{"$ref":"#/components/schemas/Device"}},"totalElements":{"type":"integer","format":"int64","description":"Total amount of devices, available to fetch."}},"required":["content","totalElements"]}}}},"400":{"description":"Bad request - requested page size is too big","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Organization 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 devices in organization (v2)

> Retrieve a paginated list of devices in an organization, with optional field expansion.\
> Use the \`include\` parameter to selectively embed sub-resources inline,\
> eliminating the need for per-device follow-up API calls.\
> \
> By default, only core device fields (id, name, token, etc.) are returned.\
> Fields like \`hardwareInfo\`, \`dataStreamValues\`, and \`metaFieldValues\` are omitted unless\
> explicitly requested via the \`include\` parameter.\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_VIEW\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Devices","description":"Device lifecycle and 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":{"DeviceHardwareInfo":{"type":"object","properties":{"version":{"type":"string","description":"Device firmware version"},"fwType":{"type":"string","description":"Device firmware type"},"blynkVersion":{"type":"string","description":"Version of the Blynk Library, that is used on the device"},"boardType":{"$ref":"#/components/schemas/BoardType"},"build":{"type":"string","description":"Firmware build number, that is used on the device"},"templateId":{"type":"string","description":"The identifier of the template that the device belongs to."}}},"BoardType":{"type":"string","enum":["Arduino","BBC_Microbit","ESP32","ESP8266","Lantronix_Fox_3","Microduino","Onion_Omega","Particle","Pycom_WiPy","Raspberry_Pi","Seeed_Wio_Terminal","SparkFun_Blynk_Board","Teensy","TinyDuino","NodeRed","Python","TI_CC3220","Iridium","Iridium_9704_Launch_Pad","NCD","Milesight","Seeed","Blues","MOKOSmart","Thermokon","Miromiko","Pepperl_Fuchs","Atim","Other"],"description":"Device board type"},"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}]},"MetaFieldValue":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"MetaField ID"},"name":{"type":"string","description":"MetaField name"},"isMandatory":{"type":"boolean","description":"Mark whether the metafield is required"},"includeInProvision":{"type":"boolean","description":"Mark whether the metafield should be included in the provisioning flow"},"value":{"nullable":true,"description":"Metafield value. The schema depends on the `type` discriminator property.","discriminator":{"propertyName":"type","mapping":{"MultiText":"#/components/schemas/MultiTextMetafieldValue","Text":"#/components/schemas/TextMetafieldValue","Email":"#/components/schemas/EmailMetafieldValue","Number":"#/components/schemas/NumberMetafieldValue","Int":"#/components/schemas/IntMetafieldValue","Range":"#/components/schemas/RangeMetafieldValue","Shift":"#/components/schemas/ShiftMetafieldValue","Switch":"#/components/schemas/SwitchMetafieldValue","Cost":"#/components/schemas/CostMetafieldValue","Contact":"#/components/schemas/ContactMetafieldValue","Measurement":"#/components/schemas/MeasurementMetafieldValue","Time":"#/components/schemas/TimeMetafieldValue","Coordinates":"#/components/schemas/CoordinatesMetafieldValue","Address":"#/components/schemas/AddressMetafieldValue","List":"#/components/schemas/ListMetafieldValue","Table":"#/components/schemas/TableMetafieldValue","DeviceReference":"#/components/schemas/DeviceReferenceMetafieldValue","Location":"#/components/schemas/LocationMetafieldValue","Tz":"#/components/schemas/TzMetafieldValue","Image":"#/components/schemas/ImageMetafieldValue","DeviceName":"#/components/schemas/DeviceNameMetafieldValue","DeviceOwner":"#/components/schemas/DeviceOwnerMetafieldValue","HotspotName":"#/components/schemas/HotspotNameMetafieldValue","Imei":"#/components/schemas/ImeiMetafieldValue","ICCID":"#/components/schemas/ICCIDMetafieldValue","DeviceEui":"#/components/schemas/DeviceEuiMetafieldValue","JoinEui":"#/components/schemas/JoinEuiMetafieldValue","ApplicationKey":"#/components/schemas/ApplicationKeyMetafieldValue","BluesDevice":"#/components/schemas/BluesDeviceMetafieldValue","TheThingsNetwork":"#/components/schemas/TheThingsNetworkMetafieldValue","ThingName":"#/components/schemas/ThingNameMetafieldValue","OTASettings":"#/components/schemas/OTASettingsMetafieldValue","MyriotaTerminalId":"#/components/schemas/MyriotaTerminalIdMetafieldValue"}},"oneOf":[{"$ref":"#/components/schemas/MultiTextMetafieldValue"},{"$ref":"#/components/schemas/TextMetafieldValue"},{"$ref":"#/components/schemas/EmailMetafieldValue"},{"$ref":"#/components/schemas/NumberMetafieldValue"},{"$ref":"#/components/schemas/IntMetafieldValue"},{"$ref":"#/components/schemas/RangeMetafieldValue"},{"$ref":"#/components/schemas/ShiftMetafieldValue"},{"$ref":"#/components/schemas/SwitchMetafieldValue"},{"$ref":"#/components/schemas/CostMetafieldValue"},{"$ref":"#/components/schemas/ContactMetafieldValue"},{"$ref":"#/components/schemas/MeasurementMetafieldValue"},{"$ref":"#/components/schemas/TimeMetafieldValue"},{"$ref":"#/components/schemas/CoordinatesMetafieldValue"},{"$ref":"#/components/schemas/AddressMetafieldValue"},{"$ref":"#/components/schemas/ListMetafieldValue"},{"$ref":"#/components/schemas/TableMetafieldValue"},{"$ref":"#/components/schemas/DeviceReferenceMetafieldValue"},{"$ref":"#/components/schemas/LocationMetafieldValue"},{"$ref":"#/components/schemas/TzMetafieldValue"},{"$ref":"#/components/schemas/ImageMetafieldValue"},{"$ref":"#/components/schemas/DeviceNameMetafieldValue"},{"$ref":"#/components/schemas/DeviceOwnerMetafieldValue"},{"$ref":"#/components/schemas/HotspotNameMetafieldValue"},{"$ref":"#/components/schemas/ImeiMetafieldValue"},{"$ref":"#/components/schemas/ICCIDMetafieldValue"},{"$ref":"#/components/schemas/DeviceEuiMetafieldValue"},{"$ref":"#/components/schemas/JoinEuiMetafieldValue"},{"$ref":"#/components/schemas/ApplicationKeyMetafieldValue"},{"$ref":"#/components/schemas/BluesDeviceMetafieldValue"},{"$ref":"#/components/schemas/TheThingsNetworkMetafieldValue"},{"$ref":"#/components/schemas/ThingNameMetafieldValue"},{"$ref":"#/components/schemas/OTASettingsMetafieldValue"},{"$ref":"#/components/schemas/MyriotaTerminalIdMetafieldValue"}]}}},"MultiTextMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["MultiText"],"description":"MetaField value type"},"values":{"type":"array","items":{"type":"string","maxLength":200},"description":"List of text values","maxItems":10000}},"required":["type"]},"TextMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Text"],"description":"MetaField value type"},"value":{"type":"string","description":"Text value","maxLength":200}},"required":["type"]},"EmailMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Email"],"description":"MetaField value type"},"value":{"type":"string","format":"email","description":"Email address value","maxLength":255}},"required":["type"]},"NumberMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Number"],"description":"MetaField value type"},"value":{"type":"number","format":"double","description":"Numeric value"}},"required":["type","value"]},"IntMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Int"],"description":"MetaField value type"},"value":{"type":"integer","format":"int32","description":"Integer value"}},"required":["type","value"]},"RangeMetafieldValue":{"type":"object","description":"Time range value. `from` and `to` are represented as seconds since midnight (0–86399).","properties":{"type":{"type":"string","enum":["Range"],"description":"MetaField value type"},"from":{"type":"integer","format":"int32","description":"Start time as seconds since midnight"},"to":{"type":"integer","format":"int32","description":"End time as seconds since midnight"}},"required":["type"]},"ShiftMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Shift"],"description":"MetaField value type"},"shifts":{"type":"array","items":{"type":"object","description":"A named time range. `from` and `to` are represented as seconds since midnight (0–86399).","properties":{"name":{"type":"string","description":"Shift name","maxLength":200},"from":{"type":"integer","format":"int32","description":"Start time as seconds since midnight"},"to":{"type":"integer","format":"int32","description":"End time as seconds since midnight"}}},"maxItems":10000,"description":"List of shifts"}},"required":["type"]},"SwitchMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Switch"],"description":"MetaField value type"},"value":{"type":"string","description":"Currently selected switch option","maxLength":200},"from":{"type":"string","description":"Label for the \"off\" option","maxLength":200},"to":{"type":"string","description":"Label for the \"on\" option","maxLength":200}},"required":["type"]},"CostMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Cost"],"description":"MetaField value type"},"currency":{"type":"string","description":"ISO 4217 currency code"},"price":{"type":"number","format":"double","description":"Price value"},"perValue":{"type":"number","format":"double","description":"Per-unit value"},"units":{"$ref":"#/components/schemas/MeasurementUnits"}},"required":["type"]},"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"]},"ContactMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Contact"],"description":"MetaField value type"},"firstName":{"type":"string","description":"First name","maxLength":200},"lastName":{"type":"string","description":"Last name","maxLength":200},"email":{"type":"string","format":"email","description":"Email address","maxLength":255},"phone":{"type":"string","description":"Phone number","maxLength":200},"streetAddress":{"type":"string","description":"Street address line 1","maxLength":200},"streetAddress2":{"type":"string","description":"Street address line 2","maxLength":200},"country":{"type":"string","description":"Country","maxLength":200},"city":{"type":"string","description":"City","maxLength":200},"state":{"type":"string","description":"State or province","maxLength":200},"zip":{"type":"string","description":"ZIP or postal code","maxLength":200}},"required":["type"]},"MeasurementMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Measurement"],"description":"MetaField value type"},"units":{"$ref":"#/components/schemas/MeasurementUnits"},"value":{"type":"number","format":"double","description":"Measured value"}},"required":["type"]},"TimeMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Time"],"description":"MetaField value type"},"time":{"type":"integer","format":"int64","description":"Timestamp in milliseconds"}},"required":["type"]},"CoordinatesMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Coordinates"],"description":"MetaField value type"},"lat":{"type":"number","format":"double","description":"Latitude"},"lon":{"type":"number","format":"double","description":"Longitude"}},"required":["type"]},"AddressMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Address"],"description":"MetaField value type"},"streetAddress":{"type":"string","description":"Street address","maxLength":200},"city":{"type":"string","description":"City","maxLength":200},"state":{"type":"string","description":"State or province","maxLength":200},"zip":{"type":"string","description":"ZIP or postal code","maxLength":200},"country":{"type":"string","description":"Country","maxLength":200}},"required":["type"]},"ListMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["List"],"description":"MetaField value type"},"selectedOption":{"type":"string","description":"Currently selected option","maxLength":200}},"required":["type"]},"TableMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Table"],"description":"MetaField value type"},"selectedRowIndex":{"type":"integer","format":"int32","description":"Index of the selected row"}},"required":["type"]},"DeviceReferenceMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceReference"],"description":"MetaField value type"},"selectedDeviceId":{"type":"integer","format":"int32","description":"ID of the referenced device"}},"required":["type"]},"LocationMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Location"],"description":"MetaField value type"},"orgLocationId":{"type":"integer","format":"int32","description":"Organization location ID"},"siteName":{"type":"string","description":"Site name","maxLength":200},"lat":{"type":"number","format":"double","nullable":true,"description":"Latitude"},"lon":{"type":"number","format":"double","nullable":true,"description":"Longitude"},"buildingName":{"type":"string","description":"Building name","maxLength":200},"floorName":{"type":"string","description":"Floor name","maxLength":200},"unit":{"type":"string","description":"Unit identifier","maxLength":200},"room":{"type":"string","description":"Room identifier","maxLength":200},"zone":{"type":"string","description":"Zone identifier","maxLength":200},"size":{"type":"number","format":"double","description":"Size of the location"},"placeId":{"type":"string","description":"External place ID","maxLength":200},"mapStyle":{"type":"string","description":"Map display style","enum":["LIGHT","DARK","STREETS","OUTDOORS","SATELLITE","SATELLITE_STREETS","BLYNK_THEME"]}},"required":["type"]},"TzMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Tz"],"description":"MetaField value type"},"value":{"type":"string","description":"Timezone identifier","maxLength":200}},"required":["type"]},"ImageMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Image"],"description":"MetaField value type"},"url":{"type":"string","format":"uri","description":"Image URL","maxLength":200}},"required":["type"]},"DeviceNameMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceName"],"description":"MetaField value type"},"value":{"type":"string","description":"Device name"}},"required":["type"]},"DeviceOwnerMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceOwner"],"description":"MetaField value type"},"value":{"type":"string","format":"email","description":"Device owner email"},"userId":{"type":"integer","format":"int64","description":"Owner user ID"}},"required":["type"]},"HotspotNameMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["HotspotName"],"description":"MetaField value type"},"value":{"type":"string","description":"Hotspot name","maxLength":200}},"required":["type"]},"ImeiMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Imei"],"description":"MetaField value type"},"value":{"type":"string","description":"IMEI number"}},"required":["type"]},"ICCIDMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["ICCID"],"description":"MetaField value type"},"value":{"type":"string","description":"ICCID number","maxLength":200}},"required":["type"]},"DeviceEuiMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceEui"],"description":"MetaField value type"},"value":{"type":"string","description":"Device EUI (lowercase)","maxLength":200}},"required":["type"]},"JoinEuiMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["JoinEui"],"description":"MetaField value type"},"value":{"type":"string","description":"Join EUI (lowercase)","maxLength":200}},"required":["type"]},"ApplicationKeyMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["ApplicationKey"],"description":"MetaField value type"},"value":{"type":"string","description":"Application key","maxLength":200}},"required":["type"]},"BluesDeviceMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["BluesDevice"],"description":"MetaField value type"},"deviceId":{"type":"string","description":"Blues device ID","maxLength":200}},"required":["type"]},"TheThingsNetworkMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["TheThingsNetwork"],"description":"MetaField value type"},"deviceId":{"type":"string","description":"The Things Network device ID","maxLength":200}},"required":["type"]},"ThingNameMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["ThingName"],"description":"MetaField value type"},"region":{"type":"string","description":"AWS IoT region","enum":["us-east-2","us-east-1","us-west-1","us-west-2","ap-east-1","ap-south-1","ap-northeast-2","ap-southeast-1","ap-southeast-2","ap-northeast-1","ca-central-1","eu-central-1","eu-west-1","eu-west-2","eu-west-3","eu-north-1","me-south-1","me-central-1","sa-east-1"]},"thingName":{"type":"string","description":"AWS IoT thing name","maxLength":200}},"required":["type"]},"OTASettingsMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["OTASettings"],"description":"MetaField value type"},"isAutoupdateEnabled":{"type":"boolean","description":"Whether auto-update is enabled"}},"required":["type"]},"MyriotaTerminalIdMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["MyriotaTerminalId"],"description":"MetaField value type"},"terminalId":{"type":"string","description":"Myriota terminal ID","maxLength":200}},"required":["type"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v2/organization/devices":{"get":{"tags":["Devices"],"summary":"Get devices in organization (v2)","description":"Retrieve a paginated list of devices in an organization, with optional field expansion.\nUse the `include` parameter to selectively embed sub-resources inline,\neliminating the need for per-device follow-up API calls.\n\nBy default, only core device fields (id, name, token, etc.) are returned.\nFields like `hardwareInfo`, `dataStreamValues`, and `metaFieldValues` are omitted unless\nexplicitly requested via the `include` parameter.\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_VIEW`.\n","operationId":"getDevicesV2","parameters":[{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional, defaults to the organization, associated with the authentication token)"},{"name":"includeSubOrgDevices","in":"query","schema":{"type":"boolean","default":false},"description":"Include devices from sub-organizations"},{"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)"},{"name":"include","in":"query","style":"form","explode":true,"schema":{"type":"array","items":{"type":"string","enum":["hardwareInfo","metadata","datastreams"]}},"description":"Optional fields to include in each device object.\nSupported values: `hardwareInfo`, `metadata`, `datastreams`.\nClients should send multiple values as repeated query parameters,\nfor example `?include=metadata&include=datastreams&include=hardwareInfo`.\nFor compatibility, the server also accepts comma-separated values\n(for example `?include=metadata,datastreams,hardwareInfo` or\n`?include=metadata,datastreams&include=hardwareInfo`).\nWhen a field is requested but has no data, an empty array is returned\n(rather than omitting the field), so clients can distinguish\n\"requested but empty\" from \"not requested\".\n"}],"responses":{"200":{"description":"List of devices with optional expanded fields","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"array","items":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Device ID"},"name":{"type":"string","description":"Device name"},"templateId":{"type":"integer","format":"int32","description":"Template ID this device belongs to"},"originalTemplateId":{"type":"integer","format":"int32","description":"Original template ID from the template hierarchy"},"orgId":{"type":"integer","format":"int32","description":"Organization ID this device belongs to"},"token":{"type":"string","description":"Device authentication token"},"activatedAt":{"type":"integer","format":"int64","description":"Device activation timestamp"},"ownerUserId":{"type":"integer","format":"int64","description":"Device owner identifier"},"hardwareInfo":{"$ref":"#/components/schemas/DeviceHardwareInfo","description":"Device hardware info (only present when `include` contains `hardwareInfo`)"},"dataStreamValues":{"type":"array","items":{"$ref":"#/components/schemas/DataStreamValue"},"description":"Current datastream values (only present when `include` contains `datastreams`)\n"},"metaFieldValues":{"type":"array","items":{"$ref":"#/components/schemas/MetaFieldValue"},"description":"Device metadata field values (only present when `include` contains `metadata`)\n"}},"required":["id","name","templateId","originalTemplateId","orgId","token"]}},"totalElements":{"type":"integer","format":"int64","description":"Total amount of devices, available to fetch."}},"required":["content","totalElements"]}}}},"400":{"description":"Bad request - requested page size is too big or `include` contains unknown values","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Organization 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"}}}}}}}}}
```

## Search devices

> Search for devices by the provided query.\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_VIEW\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Devices","description":"Device lifecycle and 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":{"Device":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Device ID"},"name":{"type":"string","description":"Device name"},"templateId":{"type":"integer","format":"int32","description":"Template ID this device belongs to"},"originalTemplateId":{"type":"integer","format":"int32","description":"Original template ID from the template hierarchy (the root template ID this device is ultimately derived from)"},"orgId":{"type":"integer","format":"int32","description":"Organization ID this device belongs to"},"token":{"type":"string","description":"Device authentication token"},"activatedAt":{"type":"integer","format":"int64","description":"Device activation timestamp"},"ownerUserId":{"type":"integer","format":"int64","description":"Device owner identifier"},"hardwareInfo":{"$ref":"#/components/schemas/DeviceHardwareInfo"}},"required":["id","name","templateId","originalTemplateId","orgId","token"]},"DeviceHardwareInfo":{"type":"object","properties":{"version":{"type":"string","description":"Device firmware version"},"fwType":{"type":"string","description":"Device firmware type"},"blynkVersion":{"type":"string","description":"Version of the Blynk Library, that is used on the device"},"boardType":{"$ref":"#/components/schemas/BoardType"},"build":{"type":"string","description":"Firmware build number, that is used on the device"},"templateId":{"type":"string","description":"The identifier of the template that the device belongs to."}}},"BoardType":{"type":"string","enum":["Arduino","BBC_Microbit","ESP32","ESP8266","Lantronix_Fox_3","Microduino","Onion_Omega","Particle","Pycom_WiPy","Raspberry_Pi","Seeed_Wio_Terminal","SparkFun_Blynk_Board","Teensy","TinyDuino","NodeRed","Python","TI_CC3220","Iridium","Iridium_9704_Launch_Pad","NCD","Milesight","Seeed","Blues","MOKOSmart","Thermokon","Miromiko","Pepperl_Fuchs","Atim","Other"],"description":"Device board type"},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/search/devices":{"get":{"tags":["Devices"],"summary":"Search devices","description":"Search for devices by the provided query.\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_VIEW`.\n","operationId":"searchDevices","parameters":[{"name":"query","in":"query","required":true,"schema":{"type":"string","maxLength":255},"description":"Search query string"},{"name":"sortBy","in":"query","schema":{"type":"string"},"description":"Field to sort by"},{"name":"sortOrder","in":"query","schema":{"type":"string","enum":["ASC","DESC"],"default":"ASC"},"description":"Sort order"},{"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":"Search results","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"array","items":{"$ref":"#/components/schemas/Device"},"description":"Array of matching devices"},"totalElements":{"type":"integer","format":"int64","description":"Total amount of devices, available to fetch."}},"required":["content","totalElements"]}}}},"400":{"description":"Bad request","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"}}}}}}}}}
```

## Get device by ID

> Retrieve detailed information about a specific device including current datastream values.\
> \
> Required permissions, when user-scoped authentication is used: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can access only 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":"Devices","description":"Device lifecycle and 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":{"DeviceDetails":{"allOf":[{"$ref":"#/components/schemas/DeviceBasicInfo"},{"type":"object","properties":{"dataStreamValues":{"type":"array","items":{"$ref":"#/components/schemas/DataStreamValue"},"description":"Current datastream values"},"metaFieldValues":{"type":"array","items":{"$ref":"#/components/schemas/MetaFieldValue"},"description":"Device metadata field values"}}}]},"DeviceBasicInfo":{"allOf":[{"$ref":"#/components/schemas/Device"},{"type":"object","properties":{"lifecycleStatus":{"type":"object","description":"Current device lifecycle status","properties":{"eventId":{"type":"integer","format":"int32","description":"Identifier of event, that is used as a lifecycle status"},"name":{"type":"string","description":"Lifecycle status name"},"color":{"type":"string","description":"Lifecycle status color"},"icon":{"type":"string","description":"Lifecycle status icon"}}},"firstConnectTime":{"type":"integer","format":"int64","description":"Device first connection timestamp"},"firmwareUpdatedAt":{"type":"integer","format":"int64","description":"Timestamp, when the device firmware was last updated"},"connectTime":{"type":"integer","format":"int64","description":"Timestamp, when the device has been connected last time"},"disconnectTime":{"type":"integer","format":"int64","description":"Timestamp, when the device has been disconnected last time"},"ip":{"type":"string","format":"ipv4","description":"IP address the device used for connecting"},"lastReceivedEventAt":{"type":"integer","format":"int64","description":"Timestamp, when the device has reported an event last time"},"lastReportedAt":{"type":"integer","format":"int64","description":"Timestamp, when the device has updated the datastream value last time"}},"required":["lifecycleStatus"]}]},"Device":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Device ID"},"name":{"type":"string","description":"Device name"},"templateId":{"type":"integer","format":"int32","description":"Template ID this device belongs to"},"originalTemplateId":{"type":"integer","format":"int32","description":"Original template ID from the template hierarchy (the root template ID this device is ultimately derived from)"},"orgId":{"type":"integer","format":"int32","description":"Organization ID this device belongs to"},"token":{"type":"string","description":"Device authentication token"},"activatedAt":{"type":"integer","format":"int64","description":"Device activation timestamp"},"ownerUserId":{"type":"integer","format":"int64","description":"Device owner identifier"},"hardwareInfo":{"$ref":"#/components/schemas/DeviceHardwareInfo"}},"required":["id","name","templateId","originalTemplateId","orgId","token"]},"DeviceHardwareInfo":{"type":"object","properties":{"version":{"type":"string","description":"Device firmware version"},"fwType":{"type":"string","description":"Device firmware type"},"blynkVersion":{"type":"string","description":"Version of the Blynk Library, that is used on the device"},"boardType":{"$ref":"#/components/schemas/BoardType"},"build":{"type":"string","description":"Firmware build number, that is used on the device"},"templateId":{"type":"string","description":"The identifier of the template that the device belongs to."}}},"BoardType":{"type":"string","enum":["Arduino","BBC_Microbit","ESP32","ESP8266","Lantronix_Fox_3","Microduino","Onion_Omega","Particle","Pycom_WiPy","Raspberry_Pi","Seeed_Wio_Terminal","SparkFun_Blynk_Board","Teensy","TinyDuino","NodeRed","Python","TI_CC3220","Iridium","Iridium_9704_Launch_Pad","NCD","Milesight","Seeed","Blues","MOKOSmart","Thermokon","Miromiko","Pepperl_Fuchs","Atim","Other"],"description":"Device board type"},"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}]},"MetaFieldValue":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"MetaField ID"},"name":{"type":"string","description":"MetaField name"},"isMandatory":{"type":"boolean","description":"Mark whether the metafield is required"},"includeInProvision":{"type":"boolean","description":"Mark whether the metafield should be included in the provisioning flow"},"value":{"nullable":true,"description":"Metafield value. The schema depends on the `type` discriminator property.","discriminator":{"propertyName":"type","mapping":{"MultiText":"#/components/schemas/MultiTextMetafieldValue","Text":"#/components/schemas/TextMetafieldValue","Email":"#/components/schemas/EmailMetafieldValue","Number":"#/components/schemas/NumberMetafieldValue","Int":"#/components/schemas/IntMetafieldValue","Range":"#/components/schemas/RangeMetafieldValue","Shift":"#/components/schemas/ShiftMetafieldValue","Switch":"#/components/schemas/SwitchMetafieldValue","Cost":"#/components/schemas/CostMetafieldValue","Contact":"#/components/schemas/ContactMetafieldValue","Measurement":"#/components/schemas/MeasurementMetafieldValue","Time":"#/components/schemas/TimeMetafieldValue","Coordinates":"#/components/schemas/CoordinatesMetafieldValue","Address":"#/components/schemas/AddressMetafieldValue","List":"#/components/schemas/ListMetafieldValue","Table":"#/components/schemas/TableMetafieldValue","DeviceReference":"#/components/schemas/DeviceReferenceMetafieldValue","Location":"#/components/schemas/LocationMetafieldValue","Tz":"#/components/schemas/TzMetafieldValue","Image":"#/components/schemas/ImageMetafieldValue","DeviceName":"#/components/schemas/DeviceNameMetafieldValue","DeviceOwner":"#/components/schemas/DeviceOwnerMetafieldValue","HotspotName":"#/components/schemas/HotspotNameMetafieldValue","Imei":"#/components/schemas/ImeiMetafieldValue","ICCID":"#/components/schemas/ICCIDMetafieldValue","DeviceEui":"#/components/schemas/DeviceEuiMetafieldValue","JoinEui":"#/components/schemas/JoinEuiMetafieldValue","ApplicationKey":"#/components/schemas/ApplicationKeyMetafieldValue","BluesDevice":"#/components/schemas/BluesDeviceMetafieldValue","TheThingsNetwork":"#/components/schemas/TheThingsNetworkMetafieldValue","ThingName":"#/components/schemas/ThingNameMetafieldValue","OTASettings":"#/components/schemas/OTASettingsMetafieldValue","MyriotaTerminalId":"#/components/schemas/MyriotaTerminalIdMetafieldValue"}},"oneOf":[{"$ref":"#/components/schemas/MultiTextMetafieldValue"},{"$ref":"#/components/schemas/TextMetafieldValue"},{"$ref":"#/components/schemas/EmailMetafieldValue"},{"$ref":"#/components/schemas/NumberMetafieldValue"},{"$ref":"#/components/schemas/IntMetafieldValue"},{"$ref":"#/components/schemas/RangeMetafieldValue"},{"$ref":"#/components/schemas/ShiftMetafieldValue"},{"$ref":"#/components/schemas/SwitchMetafieldValue"},{"$ref":"#/components/schemas/CostMetafieldValue"},{"$ref":"#/components/schemas/ContactMetafieldValue"},{"$ref":"#/components/schemas/MeasurementMetafieldValue"},{"$ref":"#/components/schemas/TimeMetafieldValue"},{"$ref":"#/components/schemas/CoordinatesMetafieldValue"},{"$ref":"#/components/schemas/AddressMetafieldValue"},{"$ref":"#/components/schemas/ListMetafieldValue"},{"$ref":"#/components/schemas/TableMetafieldValue"},{"$ref":"#/components/schemas/DeviceReferenceMetafieldValue"},{"$ref":"#/components/schemas/LocationMetafieldValue"},{"$ref":"#/components/schemas/TzMetafieldValue"},{"$ref":"#/components/schemas/ImageMetafieldValue"},{"$ref":"#/components/schemas/DeviceNameMetafieldValue"},{"$ref":"#/components/schemas/DeviceOwnerMetafieldValue"},{"$ref":"#/components/schemas/HotspotNameMetafieldValue"},{"$ref":"#/components/schemas/ImeiMetafieldValue"},{"$ref":"#/components/schemas/ICCIDMetafieldValue"},{"$ref":"#/components/schemas/DeviceEuiMetafieldValue"},{"$ref":"#/components/schemas/JoinEuiMetafieldValue"},{"$ref":"#/components/schemas/ApplicationKeyMetafieldValue"},{"$ref":"#/components/schemas/BluesDeviceMetafieldValue"},{"$ref":"#/components/schemas/TheThingsNetworkMetafieldValue"},{"$ref":"#/components/schemas/ThingNameMetafieldValue"},{"$ref":"#/components/schemas/OTASettingsMetafieldValue"},{"$ref":"#/components/schemas/MyriotaTerminalIdMetafieldValue"}]}}},"MultiTextMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["MultiText"],"description":"MetaField value type"},"values":{"type":"array","items":{"type":"string","maxLength":200},"description":"List of text values","maxItems":10000}},"required":["type"]},"TextMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Text"],"description":"MetaField value type"},"value":{"type":"string","description":"Text value","maxLength":200}},"required":["type"]},"EmailMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Email"],"description":"MetaField value type"},"value":{"type":"string","format":"email","description":"Email address value","maxLength":255}},"required":["type"]},"NumberMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Number"],"description":"MetaField value type"},"value":{"type":"number","format":"double","description":"Numeric value"}},"required":["type","value"]},"IntMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Int"],"description":"MetaField value type"},"value":{"type":"integer","format":"int32","description":"Integer value"}},"required":["type","value"]},"RangeMetafieldValue":{"type":"object","description":"Time range value. `from` and `to` are represented as seconds since midnight (0–86399).","properties":{"type":{"type":"string","enum":["Range"],"description":"MetaField value type"},"from":{"type":"integer","format":"int32","description":"Start time as seconds since midnight"},"to":{"type":"integer","format":"int32","description":"End time as seconds since midnight"}},"required":["type"]},"ShiftMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Shift"],"description":"MetaField value type"},"shifts":{"type":"array","items":{"type":"object","description":"A named time range. `from` and `to` are represented as seconds since midnight (0–86399).","properties":{"name":{"type":"string","description":"Shift name","maxLength":200},"from":{"type":"integer","format":"int32","description":"Start time as seconds since midnight"},"to":{"type":"integer","format":"int32","description":"End time as seconds since midnight"}}},"maxItems":10000,"description":"List of shifts"}},"required":["type"]},"SwitchMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Switch"],"description":"MetaField value type"},"value":{"type":"string","description":"Currently selected switch option","maxLength":200},"from":{"type":"string","description":"Label for the \"off\" option","maxLength":200},"to":{"type":"string","description":"Label for the \"on\" option","maxLength":200}},"required":["type"]},"CostMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Cost"],"description":"MetaField value type"},"currency":{"type":"string","description":"ISO 4217 currency code"},"price":{"type":"number","format":"double","description":"Price value"},"perValue":{"type":"number","format":"double","description":"Per-unit value"},"units":{"$ref":"#/components/schemas/MeasurementUnits"}},"required":["type"]},"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"]},"ContactMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Contact"],"description":"MetaField value type"},"firstName":{"type":"string","description":"First name","maxLength":200},"lastName":{"type":"string","description":"Last name","maxLength":200},"email":{"type":"string","format":"email","description":"Email address","maxLength":255},"phone":{"type":"string","description":"Phone number","maxLength":200},"streetAddress":{"type":"string","description":"Street address line 1","maxLength":200},"streetAddress2":{"type":"string","description":"Street address line 2","maxLength":200},"country":{"type":"string","description":"Country","maxLength":200},"city":{"type":"string","description":"City","maxLength":200},"state":{"type":"string","description":"State or province","maxLength":200},"zip":{"type":"string","description":"ZIP or postal code","maxLength":200}},"required":["type"]},"MeasurementMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Measurement"],"description":"MetaField value type"},"units":{"$ref":"#/components/schemas/MeasurementUnits"},"value":{"type":"number","format":"double","description":"Measured value"}},"required":["type"]},"TimeMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Time"],"description":"MetaField value type"},"time":{"type":"integer","format":"int64","description":"Timestamp in milliseconds"}},"required":["type"]},"CoordinatesMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Coordinates"],"description":"MetaField value type"},"lat":{"type":"number","format":"double","description":"Latitude"},"lon":{"type":"number","format":"double","description":"Longitude"}},"required":["type"]},"AddressMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Address"],"description":"MetaField value type"},"streetAddress":{"type":"string","description":"Street address","maxLength":200},"city":{"type":"string","description":"City","maxLength":200},"state":{"type":"string","description":"State or province","maxLength":200},"zip":{"type":"string","description":"ZIP or postal code","maxLength":200},"country":{"type":"string","description":"Country","maxLength":200}},"required":["type"]},"ListMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["List"],"description":"MetaField value type"},"selectedOption":{"type":"string","description":"Currently selected option","maxLength":200}},"required":["type"]},"TableMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Table"],"description":"MetaField value type"},"selectedRowIndex":{"type":"integer","format":"int32","description":"Index of the selected row"}},"required":["type"]},"DeviceReferenceMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceReference"],"description":"MetaField value type"},"selectedDeviceId":{"type":"integer","format":"int32","description":"ID of the referenced device"}},"required":["type"]},"LocationMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Location"],"description":"MetaField value type"},"orgLocationId":{"type":"integer","format":"int32","description":"Organization location ID"},"siteName":{"type":"string","description":"Site name","maxLength":200},"lat":{"type":"number","format":"double","nullable":true,"description":"Latitude"},"lon":{"type":"number","format":"double","nullable":true,"description":"Longitude"},"buildingName":{"type":"string","description":"Building name","maxLength":200},"floorName":{"type":"string","description":"Floor name","maxLength":200},"unit":{"type":"string","description":"Unit identifier","maxLength":200},"room":{"type":"string","description":"Room identifier","maxLength":200},"zone":{"type":"string","description":"Zone identifier","maxLength":200},"size":{"type":"number","format":"double","description":"Size of the location"},"placeId":{"type":"string","description":"External place ID","maxLength":200},"mapStyle":{"type":"string","description":"Map display style","enum":["LIGHT","DARK","STREETS","OUTDOORS","SATELLITE","SATELLITE_STREETS","BLYNK_THEME"]}},"required":["type"]},"TzMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Tz"],"description":"MetaField value type"},"value":{"type":"string","description":"Timezone identifier","maxLength":200}},"required":["type"]},"ImageMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Image"],"description":"MetaField value type"},"url":{"type":"string","format":"uri","description":"Image URL","maxLength":200}},"required":["type"]},"DeviceNameMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceName"],"description":"MetaField value type"},"value":{"type":"string","description":"Device name"}},"required":["type"]},"DeviceOwnerMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceOwner"],"description":"MetaField value type"},"value":{"type":"string","format":"email","description":"Device owner email"},"userId":{"type":"integer","format":"int64","description":"Owner user ID"}},"required":["type"]},"HotspotNameMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["HotspotName"],"description":"MetaField value type"},"value":{"type":"string","description":"Hotspot name","maxLength":200}},"required":["type"]},"ImeiMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Imei"],"description":"MetaField value type"},"value":{"type":"string","description":"IMEI number"}},"required":["type"]},"ICCIDMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["ICCID"],"description":"MetaField value type"},"value":{"type":"string","description":"ICCID number","maxLength":200}},"required":["type"]},"DeviceEuiMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceEui"],"description":"MetaField value type"},"value":{"type":"string","description":"Device EUI (lowercase)","maxLength":200}},"required":["type"]},"JoinEuiMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["JoinEui"],"description":"MetaField value type"},"value":{"type":"string","description":"Join EUI (lowercase)","maxLength":200}},"required":["type"]},"ApplicationKeyMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["ApplicationKey"],"description":"MetaField value type"},"value":{"type":"string","description":"Application key","maxLength":200}},"required":["type"]},"BluesDeviceMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["BluesDevice"],"description":"MetaField value type"},"deviceId":{"type":"string","description":"Blues device ID","maxLength":200}},"required":["type"]},"TheThingsNetworkMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["TheThingsNetwork"],"description":"MetaField value type"},"deviceId":{"type":"string","description":"The Things Network device ID","maxLength":200}},"required":["type"]},"ThingNameMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["ThingName"],"description":"MetaField value type"},"region":{"type":"string","description":"AWS IoT region","enum":["us-east-2","us-east-1","us-west-1","us-west-2","ap-east-1","ap-south-1","ap-northeast-2","ap-southeast-1","ap-southeast-2","ap-northeast-1","ca-central-1","eu-central-1","eu-west-1","eu-west-2","eu-west-3","eu-north-1","me-south-1","me-central-1","sa-east-1"]},"thingName":{"type":"string","description":"AWS IoT thing name","maxLength":200}},"required":["type"]},"OTASettingsMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["OTASettings"],"description":"MetaField value type"},"isAutoupdateEnabled":{"type":"boolean","description":"Whether auto-update is enabled"}},"required":["type"]},"MyriotaTerminalIdMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["MyriotaTerminalId"],"description":"MetaField value type"},"terminalId":{"type":"string","description":"Myriota terminal ID","maxLength":200}},"required":["type"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device":{"get":{"tags":["Devices"],"summary":"Get device by ID","description":"Retrieve detailed information about a specific device including current datastream values.\n\nRequired permissions, when user-scoped authentication is used: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can access only owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"getDevice","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"}],"responses":{"200":{"description":"Device details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceDetails"}}}},"400":{"description":"Bad request - invalid device ID","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 device

> Update device properties (e.g., name).\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_EDIT\`.\
> Additionally, required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can update only 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":"Devices","description":"Device lifecycle and 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":{"Device":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Device ID"},"name":{"type":"string","description":"Device name"},"templateId":{"type":"integer","format":"int32","description":"Template ID this device belongs to"},"originalTemplateId":{"type":"integer","format":"int32","description":"Original template ID from the template hierarchy (the root template ID this device is ultimately derived from)"},"orgId":{"type":"integer","format":"int32","description":"Organization ID this device belongs to"},"token":{"type":"string","description":"Device authentication token"},"activatedAt":{"type":"integer","format":"int64","description":"Device activation timestamp"},"ownerUserId":{"type":"integer","format":"int64","description":"Device owner identifier"},"hardwareInfo":{"$ref":"#/components/schemas/DeviceHardwareInfo"}},"required":["id","name","templateId","originalTemplateId","orgId","token"]},"DeviceHardwareInfo":{"type":"object","properties":{"version":{"type":"string","description":"Device firmware version"},"fwType":{"type":"string","description":"Device firmware type"},"blynkVersion":{"type":"string","description":"Version of the Blynk Library, that is used on the device"},"boardType":{"$ref":"#/components/schemas/BoardType"},"build":{"type":"string","description":"Firmware build number, that is used on the device"},"templateId":{"type":"string","description":"The identifier of the template that the device belongs to."}}},"BoardType":{"type":"string","enum":["Arduino","BBC_Microbit","ESP32","ESP8266","Lantronix_Fox_3","Microduino","Onion_Omega","Particle","Pycom_WiPy","Raspberry_Pi","Seeed_Wio_Terminal","SparkFun_Blynk_Board","Teensy","TinyDuino","NodeRed","Python","TI_CC3220","Iridium","Iridium_9704_Launch_Pad","NCD","Milesight","Seeed","Blues","MOKOSmart","Thermokon","Miromiko","Pepperl_Fuchs","Atim","Other"],"description":"Device board type"},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device":{"put":{"tags":["Devices"],"summary":"Update device","description":"Update device properties (e.g., name).\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_EDIT`.\nAdditionally, required device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can update only owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"updateDevice","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50,"description":"New device name. Only letters, digits, spaces, apostrophes, underscores and hyphens are allowed."}},"required":["name"]}}}},"responses":{"200":{"description":"Device updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Device"}}}},"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"}}}}}}}}}
```

## Delete device

> Delete a device and all associated data\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_DELETE\`.\
> Additionally, required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can delete only 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":"Devices","description":"Device lifecycle and 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/device":{"delete":{"tags":["Devices"],"summary":"Delete device","description":"Delete a device and all associated data\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_DELETE`.\nAdditionally, required device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can delete only owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"deleteDevice","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"}],"responses":{"204":{"description":"Device deleted successfully"},"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"}}}}}}}}}
```

## Get device base info

> Retrieve basic device information (minimized version without all details).\
> \
> Required permissions, when user-scoped authentication is used: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can access only 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":"Devices","description":"Device lifecycle and 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":{"DeviceBasicInfo":{"allOf":[{"$ref":"#/components/schemas/Device"},{"type":"object","properties":{"lifecycleStatus":{"type":"object","description":"Current device lifecycle status","properties":{"eventId":{"type":"integer","format":"int32","description":"Identifier of event, that is used as a lifecycle status"},"name":{"type":"string","description":"Lifecycle status name"},"color":{"type":"string","description":"Lifecycle status color"},"icon":{"type":"string","description":"Lifecycle status icon"}}},"firstConnectTime":{"type":"integer","format":"int64","description":"Device first connection timestamp"},"firmwareUpdatedAt":{"type":"integer","format":"int64","description":"Timestamp, when the device firmware was last updated"},"connectTime":{"type":"integer","format":"int64","description":"Timestamp, when the device has been connected last time"},"disconnectTime":{"type":"integer","format":"int64","description":"Timestamp, when the device has been disconnected last time"},"ip":{"type":"string","format":"ipv4","description":"IP address the device used for connecting"},"lastReceivedEventAt":{"type":"integer","format":"int64","description":"Timestamp, when the device has reported an event last time"},"lastReportedAt":{"type":"integer","format":"int64","description":"Timestamp, when the device has updated the datastream value last time"}},"required":["lifecycleStatus"]}]},"Device":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Device ID"},"name":{"type":"string","description":"Device name"},"templateId":{"type":"integer","format":"int32","description":"Template ID this device belongs to"},"originalTemplateId":{"type":"integer","format":"int32","description":"Original template ID from the template hierarchy (the root template ID this device is ultimately derived from)"},"orgId":{"type":"integer","format":"int32","description":"Organization ID this device belongs to"},"token":{"type":"string","description":"Device authentication token"},"activatedAt":{"type":"integer","format":"int64","description":"Device activation timestamp"},"ownerUserId":{"type":"integer","format":"int64","description":"Device owner identifier"},"hardwareInfo":{"$ref":"#/components/schemas/DeviceHardwareInfo"}},"required":["id","name","templateId","originalTemplateId","orgId","token"]},"DeviceHardwareInfo":{"type":"object","properties":{"version":{"type":"string","description":"Device firmware version"},"fwType":{"type":"string","description":"Device firmware type"},"blynkVersion":{"type":"string","description":"Version of the Blynk Library, that is used on the device"},"boardType":{"$ref":"#/components/schemas/BoardType"},"build":{"type":"string","description":"Firmware build number, that is used on the device"},"templateId":{"type":"string","description":"The identifier of the template that the device belongs to."}}},"BoardType":{"type":"string","enum":["Arduino","BBC_Microbit","ESP32","ESP8266","Lantronix_Fox_3","Microduino","Onion_Omega","Particle","Pycom_WiPy","Raspberry_Pi","Seeed_Wio_Terminal","SparkFun_Blynk_Board","Teensy","TinyDuino","NodeRed","Python","TI_CC3220","Iridium","Iridium_9704_Launch_Pad","NCD","Milesight","Seeed","Blues","MOKOSmart","Thermokon","Miromiko","Pepperl_Fuchs","Atim","Other"],"description":"Device board type"},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/baseInfo":{"get":{"tags":["Devices"],"summary":"Get device base info","description":"Retrieve basic device information (minimized version without all details).\n\nRequired permissions, when user-scoped authentication is used: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can access only owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"getDeviceBaseInfo","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"}],"responses":{"200":{"description":"Device details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DeviceBasicInfo"}}}},"400":{"description":"Bad request - invalid device ID","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"}}}}}}}}}
```

## Create a new device

> Create a new device from a template.\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_CREATE\`.\
> User-scoped tokens that set \`ownerId\` different from authenticated user ID also require \`ORG\_VIEW\_USERS\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Devices","description":"Device lifecycle and 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":{"DeviceDetails":{"allOf":[{"$ref":"#/components/schemas/DeviceBasicInfo"},{"type":"object","properties":{"dataStreamValues":{"type":"array","items":{"$ref":"#/components/schemas/DataStreamValue"},"description":"Current datastream values"},"metaFieldValues":{"type":"array","items":{"$ref":"#/components/schemas/MetaFieldValue"},"description":"Device metadata field values"}}}]},"DeviceBasicInfo":{"allOf":[{"$ref":"#/components/schemas/Device"},{"type":"object","properties":{"lifecycleStatus":{"type":"object","description":"Current device lifecycle status","properties":{"eventId":{"type":"integer","format":"int32","description":"Identifier of event, that is used as a lifecycle status"},"name":{"type":"string","description":"Lifecycle status name"},"color":{"type":"string","description":"Lifecycle status color"},"icon":{"type":"string","description":"Lifecycle status icon"}}},"firstConnectTime":{"type":"integer","format":"int64","description":"Device first connection timestamp"},"firmwareUpdatedAt":{"type":"integer","format":"int64","description":"Timestamp, when the device firmware was last updated"},"connectTime":{"type":"integer","format":"int64","description":"Timestamp, when the device has been connected last time"},"disconnectTime":{"type":"integer","format":"int64","description":"Timestamp, when the device has been disconnected last time"},"ip":{"type":"string","format":"ipv4","description":"IP address the device used for connecting"},"lastReceivedEventAt":{"type":"integer","format":"int64","description":"Timestamp, when the device has reported an event last time"},"lastReportedAt":{"type":"integer","format":"int64","description":"Timestamp, when the device has updated the datastream value last time"}},"required":["lifecycleStatus"]}]},"Device":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Device ID"},"name":{"type":"string","description":"Device name"},"templateId":{"type":"integer","format":"int32","description":"Template ID this device belongs to"},"originalTemplateId":{"type":"integer","format":"int32","description":"Original template ID from the template hierarchy (the root template ID this device is ultimately derived from)"},"orgId":{"type":"integer","format":"int32","description":"Organization ID this device belongs to"},"token":{"type":"string","description":"Device authentication token"},"activatedAt":{"type":"integer","format":"int64","description":"Device activation timestamp"},"ownerUserId":{"type":"integer","format":"int64","description":"Device owner identifier"},"hardwareInfo":{"$ref":"#/components/schemas/DeviceHardwareInfo"}},"required":["id","name","templateId","originalTemplateId","orgId","token"]},"DeviceHardwareInfo":{"type":"object","properties":{"version":{"type":"string","description":"Device firmware version"},"fwType":{"type":"string","description":"Device firmware type"},"blynkVersion":{"type":"string","description":"Version of the Blynk Library, that is used on the device"},"boardType":{"$ref":"#/components/schemas/BoardType"},"build":{"type":"string","description":"Firmware build number, that is used on the device"},"templateId":{"type":"string","description":"The identifier of the template that the device belongs to."}}},"BoardType":{"type":"string","enum":["Arduino","BBC_Microbit","ESP32","ESP8266","Lantronix_Fox_3","Microduino","Onion_Omega","Particle","Pycom_WiPy","Raspberry_Pi","Seeed_Wio_Terminal","SparkFun_Blynk_Board","Teensy","TinyDuino","NodeRed","Python","TI_CC3220","Iridium","Iridium_9704_Launch_Pad","NCD","Milesight","Seeed","Blues","MOKOSmart","Thermokon","Miromiko","Pepperl_Fuchs","Atim","Other"],"description":"Device board type"},"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}]},"MetaFieldValue":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"MetaField ID"},"name":{"type":"string","description":"MetaField name"},"isMandatory":{"type":"boolean","description":"Mark whether the metafield is required"},"includeInProvision":{"type":"boolean","description":"Mark whether the metafield should be included in the provisioning flow"},"value":{"nullable":true,"description":"Metafield value. The schema depends on the `type` discriminator property.","discriminator":{"propertyName":"type","mapping":{"MultiText":"#/components/schemas/MultiTextMetafieldValue","Text":"#/components/schemas/TextMetafieldValue","Email":"#/components/schemas/EmailMetafieldValue","Number":"#/components/schemas/NumberMetafieldValue","Int":"#/components/schemas/IntMetafieldValue","Range":"#/components/schemas/RangeMetafieldValue","Shift":"#/components/schemas/ShiftMetafieldValue","Switch":"#/components/schemas/SwitchMetafieldValue","Cost":"#/components/schemas/CostMetafieldValue","Contact":"#/components/schemas/ContactMetafieldValue","Measurement":"#/components/schemas/MeasurementMetafieldValue","Time":"#/components/schemas/TimeMetafieldValue","Coordinates":"#/components/schemas/CoordinatesMetafieldValue","Address":"#/components/schemas/AddressMetafieldValue","List":"#/components/schemas/ListMetafieldValue","Table":"#/components/schemas/TableMetafieldValue","DeviceReference":"#/components/schemas/DeviceReferenceMetafieldValue","Location":"#/components/schemas/LocationMetafieldValue","Tz":"#/components/schemas/TzMetafieldValue","Image":"#/components/schemas/ImageMetafieldValue","DeviceName":"#/components/schemas/DeviceNameMetafieldValue","DeviceOwner":"#/components/schemas/DeviceOwnerMetafieldValue","HotspotName":"#/components/schemas/HotspotNameMetafieldValue","Imei":"#/components/schemas/ImeiMetafieldValue","ICCID":"#/components/schemas/ICCIDMetafieldValue","DeviceEui":"#/components/schemas/DeviceEuiMetafieldValue","JoinEui":"#/components/schemas/JoinEuiMetafieldValue","ApplicationKey":"#/components/schemas/ApplicationKeyMetafieldValue","BluesDevice":"#/components/schemas/BluesDeviceMetafieldValue","TheThingsNetwork":"#/components/schemas/TheThingsNetworkMetafieldValue","ThingName":"#/components/schemas/ThingNameMetafieldValue","OTASettings":"#/components/schemas/OTASettingsMetafieldValue","MyriotaTerminalId":"#/components/schemas/MyriotaTerminalIdMetafieldValue"}},"oneOf":[{"$ref":"#/components/schemas/MultiTextMetafieldValue"},{"$ref":"#/components/schemas/TextMetafieldValue"},{"$ref":"#/components/schemas/EmailMetafieldValue"},{"$ref":"#/components/schemas/NumberMetafieldValue"},{"$ref":"#/components/schemas/IntMetafieldValue"},{"$ref":"#/components/schemas/RangeMetafieldValue"},{"$ref":"#/components/schemas/ShiftMetafieldValue"},{"$ref":"#/components/schemas/SwitchMetafieldValue"},{"$ref":"#/components/schemas/CostMetafieldValue"},{"$ref":"#/components/schemas/ContactMetafieldValue"},{"$ref":"#/components/schemas/MeasurementMetafieldValue"},{"$ref":"#/components/schemas/TimeMetafieldValue"},{"$ref":"#/components/schemas/CoordinatesMetafieldValue"},{"$ref":"#/components/schemas/AddressMetafieldValue"},{"$ref":"#/components/schemas/ListMetafieldValue"},{"$ref":"#/components/schemas/TableMetafieldValue"},{"$ref":"#/components/schemas/DeviceReferenceMetafieldValue"},{"$ref":"#/components/schemas/LocationMetafieldValue"},{"$ref":"#/components/schemas/TzMetafieldValue"},{"$ref":"#/components/schemas/ImageMetafieldValue"},{"$ref":"#/components/schemas/DeviceNameMetafieldValue"},{"$ref":"#/components/schemas/DeviceOwnerMetafieldValue"},{"$ref":"#/components/schemas/HotspotNameMetafieldValue"},{"$ref":"#/components/schemas/ImeiMetafieldValue"},{"$ref":"#/components/schemas/ICCIDMetafieldValue"},{"$ref":"#/components/schemas/DeviceEuiMetafieldValue"},{"$ref":"#/components/schemas/JoinEuiMetafieldValue"},{"$ref":"#/components/schemas/ApplicationKeyMetafieldValue"},{"$ref":"#/components/schemas/BluesDeviceMetafieldValue"},{"$ref":"#/components/schemas/TheThingsNetworkMetafieldValue"},{"$ref":"#/components/schemas/ThingNameMetafieldValue"},{"$ref":"#/components/schemas/OTASettingsMetafieldValue"},{"$ref":"#/components/schemas/MyriotaTerminalIdMetafieldValue"}]}}},"MultiTextMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["MultiText"],"description":"MetaField value type"},"values":{"type":"array","items":{"type":"string","maxLength":200},"description":"List of text values","maxItems":10000}},"required":["type"]},"TextMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Text"],"description":"MetaField value type"},"value":{"type":"string","description":"Text value","maxLength":200}},"required":["type"]},"EmailMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Email"],"description":"MetaField value type"},"value":{"type":"string","format":"email","description":"Email address value","maxLength":255}},"required":["type"]},"NumberMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Number"],"description":"MetaField value type"},"value":{"type":"number","format":"double","description":"Numeric value"}},"required":["type","value"]},"IntMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Int"],"description":"MetaField value type"},"value":{"type":"integer","format":"int32","description":"Integer value"}},"required":["type","value"]},"RangeMetafieldValue":{"type":"object","description":"Time range value. `from` and `to` are represented as seconds since midnight (0–86399).","properties":{"type":{"type":"string","enum":["Range"],"description":"MetaField value type"},"from":{"type":"integer","format":"int32","description":"Start time as seconds since midnight"},"to":{"type":"integer","format":"int32","description":"End time as seconds since midnight"}},"required":["type"]},"ShiftMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Shift"],"description":"MetaField value type"},"shifts":{"type":"array","items":{"type":"object","description":"A named time range. `from` and `to` are represented as seconds since midnight (0–86399).","properties":{"name":{"type":"string","description":"Shift name","maxLength":200},"from":{"type":"integer","format":"int32","description":"Start time as seconds since midnight"},"to":{"type":"integer","format":"int32","description":"End time as seconds since midnight"}}},"maxItems":10000,"description":"List of shifts"}},"required":["type"]},"SwitchMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Switch"],"description":"MetaField value type"},"value":{"type":"string","description":"Currently selected switch option","maxLength":200},"from":{"type":"string","description":"Label for the \"off\" option","maxLength":200},"to":{"type":"string","description":"Label for the \"on\" option","maxLength":200}},"required":["type"]},"CostMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Cost"],"description":"MetaField value type"},"currency":{"type":"string","description":"ISO 4217 currency code"},"price":{"type":"number","format":"double","description":"Price value"},"perValue":{"type":"number","format":"double","description":"Per-unit value"},"units":{"$ref":"#/components/schemas/MeasurementUnits"}},"required":["type"]},"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"]},"ContactMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Contact"],"description":"MetaField value type"},"firstName":{"type":"string","description":"First name","maxLength":200},"lastName":{"type":"string","description":"Last name","maxLength":200},"email":{"type":"string","format":"email","description":"Email address","maxLength":255},"phone":{"type":"string","description":"Phone number","maxLength":200},"streetAddress":{"type":"string","description":"Street address line 1","maxLength":200},"streetAddress2":{"type":"string","description":"Street address line 2","maxLength":200},"country":{"type":"string","description":"Country","maxLength":200},"city":{"type":"string","description":"City","maxLength":200},"state":{"type":"string","description":"State or province","maxLength":200},"zip":{"type":"string","description":"ZIP or postal code","maxLength":200}},"required":["type"]},"MeasurementMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Measurement"],"description":"MetaField value type"},"units":{"$ref":"#/components/schemas/MeasurementUnits"},"value":{"type":"number","format":"double","description":"Measured value"}},"required":["type"]},"TimeMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Time"],"description":"MetaField value type"},"time":{"type":"integer","format":"int64","description":"Timestamp in milliseconds"}},"required":["type"]},"CoordinatesMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Coordinates"],"description":"MetaField value type"},"lat":{"type":"number","format":"double","description":"Latitude"},"lon":{"type":"number","format":"double","description":"Longitude"}},"required":["type"]},"AddressMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Address"],"description":"MetaField value type"},"streetAddress":{"type":"string","description":"Street address","maxLength":200},"city":{"type":"string","description":"City","maxLength":200},"state":{"type":"string","description":"State or province","maxLength":200},"zip":{"type":"string","description":"ZIP or postal code","maxLength":200},"country":{"type":"string","description":"Country","maxLength":200}},"required":["type"]},"ListMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["List"],"description":"MetaField value type"},"selectedOption":{"type":"string","description":"Currently selected option","maxLength":200}},"required":["type"]},"TableMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Table"],"description":"MetaField value type"},"selectedRowIndex":{"type":"integer","format":"int32","description":"Index of the selected row"}},"required":["type"]},"DeviceReferenceMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceReference"],"description":"MetaField value type"},"selectedDeviceId":{"type":"integer","format":"int32","description":"ID of the referenced device"}},"required":["type"]},"LocationMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Location"],"description":"MetaField value type"},"orgLocationId":{"type":"integer","format":"int32","description":"Organization location ID"},"siteName":{"type":"string","description":"Site name","maxLength":200},"lat":{"type":"number","format":"double","nullable":true,"description":"Latitude"},"lon":{"type":"number","format":"double","nullable":true,"description":"Longitude"},"buildingName":{"type":"string","description":"Building name","maxLength":200},"floorName":{"type":"string","description":"Floor name","maxLength":200},"unit":{"type":"string","description":"Unit identifier","maxLength":200},"room":{"type":"string","description":"Room identifier","maxLength":200},"zone":{"type":"string","description":"Zone identifier","maxLength":200},"size":{"type":"number","format":"double","description":"Size of the location"},"placeId":{"type":"string","description":"External place ID","maxLength":200},"mapStyle":{"type":"string","description":"Map display style","enum":["LIGHT","DARK","STREETS","OUTDOORS","SATELLITE","SATELLITE_STREETS","BLYNK_THEME"]}},"required":["type"]},"TzMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Tz"],"description":"MetaField value type"},"value":{"type":"string","description":"Timezone identifier","maxLength":200}},"required":["type"]},"ImageMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Image"],"description":"MetaField value type"},"url":{"type":"string","format":"uri","description":"Image URL","maxLength":200}},"required":["type"]},"DeviceNameMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceName"],"description":"MetaField value type"},"value":{"type":"string","description":"Device name"}},"required":["type"]},"DeviceOwnerMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceOwner"],"description":"MetaField value type"},"value":{"type":"string","format":"email","description":"Device owner email"},"userId":{"type":"integer","format":"int64","description":"Owner user ID"}},"required":["type"]},"HotspotNameMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["HotspotName"],"description":"MetaField value type"},"value":{"type":"string","description":"Hotspot name","maxLength":200}},"required":["type"]},"ImeiMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Imei"],"description":"MetaField value type"},"value":{"type":"string","description":"IMEI number"}},"required":["type"]},"ICCIDMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["ICCID"],"description":"MetaField value type"},"value":{"type":"string","description":"ICCID number","maxLength":200}},"required":["type"]},"DeviceEuiMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceEui"],"description":"MetaField value type"},"value":{"type":"string","description":"Device EUI (lowercase)","maxLength":200}},"required":["type"]},"JoinEuiMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["JoinEui"],"description":"MetaField value type"},"value":{"type":"string","description":"Join EUI (lowercase)","maxLength":200}},"required":["type"]},"ApplicationKeyMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["ApplicationKey"],"description":"MetaField value type"},"value":{"type":"string","description":"Application key","maxLength":200}},"required":["type"]},"BluesDeviceMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["BluesDevice"],"description":"MetaField value type"},"deviceId":{"type":"string","description":"Blues device ID","maxLength":200}},"required":["type"]},"TheThingsNetworkMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["TheThingsNetwork"],"description":"MetaField value type"},"deviceId":{"type":"string","description":"The Things Network device ID","maxLength":200}},"required":["type"]},"ThingNameMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["ThingName"],"description":"MetaField value type"},"region":{"type":"string","description":"AWS IoT region","enum":["us-east-2","us-east-1","us-west-1","us-west-2","ap-east-1","ap-south-1","ap-northeast-2","ap-southeast-1","ap-southeast-2","ap-northeast-1","ca-central-1","eu-central-1","eu-west-1","eu-west-2","eu-west-3","eu-north-1","me-south-1","me-central-1","sa-east-1"]},"thingName":{"type":"string","description":"AWS IoT thing name","maxLength":200}},"required":["type"]},"OTASettingsMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["OTASettings"],"description":"MetaField value type"},"isAutoupdateEnabled":{"type":"boolean","description":"Whether auto-update is enabled"}},"required":["type"]},"MyriotaTerminalIdMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["MyriotaTerminalId"],"description":"MetaField value type"},"terminalId":{"type":"string","description":"Myriota terminal ID","maxLength":200}},"required":["type"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/create":{"post":{"tags":["Devices"],"summary":"Create a new device","description":"Create a new device from a template.\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_CREATE`.\nUser-scoped tokens that set `ownerId` different from authenticated user ID also require `ORG_VIEW_USERS`.\n","operationId":"createDevice","parameters":[{"name":"baseInfoResponse","in":"query","required":false,"schema":{"type":"boolean","default":false},"description":"Flag, indicating whether server should respond only with base info"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"templateId":{"type":"string","maxLength":200,"description":"Template ID for the device"},"orgId":{"type":"integer","format":"int32","description":"Organization ID (optional). If none is specified, the device is being created in the organization associated with the authentication token."},"name":{"type":"string","maxLength":50,"description":"Device name. Only letters, digits, spaces, apostrophes, underscores and hyphens are allowed."},"ownerId":{"type":"integer","format":"int64","description":"Owner user ID (optional)"}},"required":["templateId","name"]}}}},"responses":{"201":{"description":"Device created successfully","content":{"application/json":{"schema":{"oneOf":[{"$ref":"#/components/schemas/DeviceDetails"},{"$ref":"#/components/schemas/DeviceBasicInfo"}]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Template/user/organization 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 device online status

> Check whether a device is currently connected to the server over MQTT or Blynk Protocol.\
> \
> Required permissions, when user-scoped authentication is used: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can read status 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":"Devices","description":"Device lifecycle and 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/device/online":{"get":{"tags":["Devices"],"summary":"Get device online status","description":"Check whether a device is currently connected to the server over MQTT or Blynk Protocol.\n\nRequired permissions, when user-scoped authentication is used: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can read status only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"getDeviceOnlineStatus","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"}],"responses":{"200":{"description":"Device online status","content":{"application/json":{"schema":{"type":"object","properties":{"connected":{"type":"boolean","description":"Whether the device is currently connected"}}}}}},"400":{"description":"Bad request - invalid device ID","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"}}}}}}}}}
```

## Get device tags

> Retrieve all tags assigned to a device\
> \
> Required permissions, when user-scoped authentication is used: \`VIEW\_OWN\_ORG\_TAG\`.\
> Additionally, required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can read tags 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":"Devices","description":"Device lifecycle and 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":{"DeviceTag":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Tag ID"},"name":{"type":"string","description":"Tag name"},"tagOwnerOrgId":{"type":"integer","format":"int32","description":"ID of the organization, that created the tag"}},"required":["id","name","tagOwnerOrgId"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/tags":{"get":{"tags":["Devices"],"summary":"Get device tags","description":"Retrieve all tags assigned to a device\n\nRequired permissions, when user-scoped authentication is used: `VIEW_OWN_ORG_TAG`.\nAdditionally, required device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can read tags only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"getDeviceTags","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"}],"responses":{"200":{"description":"List of device tags","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DeviceTag"}}}}},"400":{"description":"Bad request - invalid device ID","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device not found","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 device Events and Lifecycle history

> It may take up to a minute for new events to appear in the API result.\
> The data is sorted in reverse chronological order (most recent events first).\
> \
> Required permissions, when user-scoped authentication is used: \`VIEW\_TIMELINE\`.\
> Additionally, required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can read timeline 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":"Devices","description":"Device lifecycle and 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":{"DeviceLogEvent":{"type":"object","properties":{"id":{"type":"integer","format":"int64","description":"Log event unique ID"},"eventId":{"type":"integer","format":"int32","description":"Event ID, that was logged"},"orgId":{"type":"integer","format":"int32","description":"Organization ID, where event was logged"},"eventType":{"type":"string","enum":["ONLINE","OFFLINE","INFORMATION","WARNING","CRITICAL","CONTENT","INACTIVE","LIFECYCLE","NOTE"],"description":"Event type"},"description":{"type":"string","description":"Event description"},"ts":{"type":"integer","format":"int64","description":"Timestamp, when the event was triggered"},"isResolved":{"type":"boolean","description":"Whether the event is resolved"},"resolvedAt":{"type":"integer","format":"int64","description":"Timestamp, when the event was resolved"},"resolvedComment":{"type":"string","description":"Comment, added when the event was resolved"}},"required":["id","eventId","orgId","eventType","ts","isResolved"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/timeline":{"get":{"tags":["Devices"],"summary":"Get device Events and Lifecycle history","description":"It may take up to a minute for new events to appear in the API result.\nThe data is sorted in reverse chronological order (most recent events first).\n\nRequired permissions, when user-scoped authentication is used: `VIEW_TIMELINE`.\nAdditionally, required device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can read timeline only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"getDeviceTimeline","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"},{"name":"eventType","in":"query","schema":{"type":"string","enum":["ONLINE","OFFLINE","INFORMATION","WARNING","CRITICAL","CONTENT","INACTIVE","LIFECYCLE","NOTE"]},"description":"Filter by event type (optional)"},{"name":"eventId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Filter by event ID (optional). Must be a valid event ID defined in the template."},{"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":"Device timeline events","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"array","items":{"$ref":"#/components/schemas/DeviceLogEvent"}},"totalElements":{"type":"integer","format":"int64","description":"Total amount of timeline events, available to fetch."}},"required":["content","totalElements"]}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device or event not found","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 device logs

> Retrieve device logs related to user actions.\
> This endpoint returns logs of datastream updates that were performed by users (not by the device itself). Actions initiated by the device are not included.\
> \
> It may take up to a minute for new log entries to appear in the logs list.\
> Logs are sorted in reverse chronological order (most recent entries first).\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICE\_VIEW\_ACTION\_LOG\`.\
> Additionally, required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can read logs 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":"Devices","description":"Device lifecycle and 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/device/logs":{"get":{"tags":["Devices"],"summary":"Get device logs","description":"Retrieve device logs related to user actions.\nThis endpoint returns logs of datastream updates that were performed by users (not by the device itself). Actions initiated by the device are not included.\n\nIt may take up to a minute for new log entries to appear in the logs list.\nLogs are sorted in reverse chronological order (most recent entries first).\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICE_VIEW_ACTION_LOG`.\nAdditionally, required device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can read logs only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"getDeviceLogs","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"},{"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":"Device logs","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"array","items":{"type":"object","properties":{"triggerUserEmail":{"type":"string","format":"email","description":"Email of the user who triggered the log entry"},"value":{"type":"number","format":"double","description":"Value, that was updated on the device (number representation)"},"pin":{"type":"integer","format":"int32","description":"Pin number of the datastream, that was updated on the device"},"pinType":{"type":"string","description":"Pin type of the datastream, that was updated on the device","enum":["VIRTUAL","ANALOG","DIGITAL"]},"isOnline":{"type":"boolean","description":"Whether the device was online at the moment of the log entry"},"createdAt":{"type":"integer","format":"int64","description":"Timestamp of the log entry in milliseconds since epoch"}},"required":["triggerUserEmail","value","pin","pinType","isOnline","createdAt"]}},"totalElements":{"type":"integer","format":"int64","description":"Total amount of log entries, available to fetch."}}}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device not found","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"}}}}}}}}}
```

## Transfer device to a new owner

> Transfer device ownership to a new owner user. The user must exist and be activated.\
> \
> Required permissions, when user-scoped authentication is used: \`TRANSFER\_DEVICE\`.\
> Additionally, required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens that set \`newUserId\` different from authenticated user ID also require \`ORG\_VIEW\_USERS\`.\
> User-scoped tokens can transfer only 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":"Devices","description":"Device lifecycle and 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/device/transfer/to-owner":{"post":{"tags":["Devices"],"summary":"Transfer device to a new owner","description":"Transfer device ownership to a new owner user. The user must exist and be activated.\n\nRequired permissions, when user-scoped authentication is used: `TRANSFER_DEVICE`.\nAdditionally, required device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens that set `newUserId` different from authenticated user ID also require `ORG_VIEW_USERS`.\nUser-scoped tokens can transfer only owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"transferDeviceToOwner","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"integer","format":"int32","description":"Device ID to transfer"},"newOwnerUserId":{"type":"integer","format":"int64","description":"New owner user ID"}},"required":["deviceId","newOwnerUserId"]}}}},"responses":{"204":{"description":"Device transferred successfully"},"400":{"description":"Bad request - Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device/organization 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"}}}}}}}}}
```

## Transfer device to a new organization

> Transfer a device to another organization without assigning a new owner.\
> \
> Required permissions, when user-scoped authentication is used: \`TRANSFER\_DEVICE\`, \`ORG\_VIEW\`.\
> Additionally, required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can transfer only 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":"Devices","description":"Device lifecycle and 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/device/transfer/to-organization":{"post":{"tags":["Devices"],"summary":"Transfer device to a new organization","description":"Transfer a device to another organization without assigning a new owner.\n\nRequired permissions, when user-scoped authentication is used: `TRANSFER_DEVICE`, `ORG_VIEW`.\nAdditionally, required device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can transfer only owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"transferDeviceToOrganization","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"integer","format":"int32","description":"Device ID to transfer"},"newOrgId":{"type":"integer","format":"int32","description":"New organization ID"}},"required":["deviceId","newOrgId"]}}}},"responses":{"204":{"description":"Device transferred successfully"},"400":{"description":"Bad request - Invalid request body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device/organization 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"}}}}}}}}}
```

## Remove device owner

> Remove the current owner from a device\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_EDIT\`.\
> Required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can remove owner 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":"Devices","description":"Device lifecycle and 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/device/owner":{"delete":{"tags":["Devices"],"summary":"Remove device owner","description":"Remove the current owner from a device\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_EDIT`.\nRequired device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can remove owner only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"removeDeviceOwner","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"}],"responses":{"204":{"description":"Device owner removed successfully"},"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"}}}}}}}}}
```

## Clear device data

> Clear all device data, including datastream history values and timeline.\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICE\_DATA\_DELETE\`.\
> Required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can clear 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":"Devices","description":"Device lifecycle and 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/device/clear":{"delete":{"tags":["Devices"],"summary":"Clear device data","description":"Clear all device data, including datastream history values and timeline.\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICE_DATA_DELETE`.\nRequired device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can clear data only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"clearDeviceData","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"}],"responses":{"204":{"description":"Device data cleared successfully"},"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"}}}}}}}}}
```

## Trigger device event

> Manually trigger a device event.\
> \
> The event may be muted if a notification schedule is configured and the current time falls outside the allowed window.\
> A per-device rate limit applies to log events.\
> \
> 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 trigger events 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":"Devices","description":"Device lifecycle and 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/device/trigger-event":{"post":{"tags":["Devices"],"summary":"Trigger device event","description":"Manually trigger a device event.\n\nThe event may be muted if a notification schedule is configured and the current time falls outside the allowed window.\nA per-device rate limit applies to log events.\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 trigger events only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"triggerDeviceEvent","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"integer","format":"int32","description":"Device ID"},"eventCode":{"type":"string","description":"Event code to trigger","maxLength":200},"eventDescription":{"type":"string","description":"Optional event description","maxLength":200}},"required":["deviceId","eventCode"]}}}},"responses":{"204":{"description":"Event triggered successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device/event 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"}}}}}}}}}
```

## Resolve a device event

> Mark a device timeline event as resolved.\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_EDIT\` or \`OWN\_DEVICES\_EDIT\`.\
> If only \`OWN\_DEVICES\_EDIT\` is granted, the authenticated user must be the owner of the device.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Devices","description":"Device lifecycle and 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/device/resolve-event":{"post":{"tags":["Devices"],"summary":"Resolve a device event","description":"Mark a device timeline event as resolved.\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_EDIT` or `OWN_DEVICES_EDIT`.\nIf only `OWN_DEVICES_EDIT` is granted, the authenticated user must be the owner of the device.\n","operationId":"resolveDeviceEvent","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"logEventId":{"type":"integer","format":"int64","description":"Unique sequence ID of the log event to resolve (the `id` field from the timeline response)"},"resolveComment":{"type":"string","description":"Optional comment describing how the event was resolved"}},"required":["logEventId"]}}}},"responses":{"204":{"description":"Event resolved successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Event or 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 devices by owner

> Retrieve all devices owned by a specific user\
> \
> When querying \`ownerEmail\` equal to authenticated user email (user-scoped auth), requires at least one of: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> When querying another \`ownerEmail\` with user-scoped auth, requires both \`ORG\_VIEW\_USERS\` and \`ORG\_DEVICES\_VIEW\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Devices","description":"Device lifecycle and 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":{"Device":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Device ID"},"name":{"type":"string","description":"Device name"},"templateId":{"type":"integer","format":"int32","description":"Template ID this device belongs to"},"originalTemplateId":{"type":"integer","format":"int32","description":"Original template ID from the template hierarchy (the root template ID this device is ultimately derived from)"},"orgId":{"type":"integer","format":"int32","description":"Organization ID this device belongs to"},"token":{"type":"string","description":"Device authentication token"},"activatedAt":{"type":"integer","format":"int64","description":"Device activation timestamp"},"ownerUserId":{"type":"integer","format":"int64","description":"Device owner identifier"},"hardwareInfo":{"$ref":"#/components/schemas/DeviceHardwareInfo"}},"required":["id","name","templateId","originalTemplateId","orgId","token"]},"DeviceHardwareInfo":{"type":"object","properties":{"version":{"type":"string","description":"Device firmware version"},"fwType":{"type":"string","description":"Device firmware type"},"blynkVersion":{"type":"string","description":"Version of the Blynk Library, that is used on the device"},"boardType":{"$ref":"#/components/schemas/BoardType"},"build":{"type":"string","description":"Firmware build number, that is used on the device"},"templateId":{"type":"string","description":"The identifier of the template that the device belongs to."}}},"BoardType":{"type":"string","enum":["Arduino","BBC_Microbit","ESP32","ESP8266","Lantronix_Fox_3","Microduino","Onion_Omega","Particle","Pycom_WiPy","Raspberry_Pi","Seeed_Wio_Terminal","SparkFun_Blynk_Board","Teensy","TinyDuino","NodeRed","Python","TI_CC3220","Iridium","Iridium_9704_Launch_Pad","NCD","Milesight","Seeed","Blues","MOKOSmart","Thermokon","Miromiko","Pepperl_Fuchs","Atim","Other"],"description":"Device board type"},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/by-owner":{"get":{"tags":["Devices"],"summary":"Get devices by owner","description":"Retrieve all devices owned by a specific user\n\nWhen querying `ownerEmail` equal to authenticated user email (user-scoped auth), requires at least one of: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nWhen querying another `ownerEmail` with user-scoped auth, requires both `ORG_VIEW_USERS` and `ORG_DEVICES_VIEW`.\n","operationId":"getDevicesByOwner","parameters":[{"name":"ownerEmail","in":"query","required":true,"schema":{"type":"string","format":"email"},"description":"Owner email address"},{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional)"},{"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":"List of devices","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"array","items":{"$ref":"#/components/schemas/Device"}},"totalElements":{"type":"integer","format":"int64"}}}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Organization/User 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 devices by user and organization

> Retrieve devices accessible by a specific user in their organization\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens querying \`userEmail\` different from authenticated user email also require \`ORG\_VIEW\_USERS\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Devices","description":"Device lifecycle and 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":{"Device":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Device ID"},"name":{"type":"string","description":"Device name"},"templateId":{"type":"integer","format":"int32","description":"Template ID this device belongs to"},"originalTemplateId":{"type":"integer","format":"int32","description":"Original template ID from the template hierarchy (the root template ID this device is ultimately derived from)"},"orgId":{"type":"integer","format":"int32","description":"Organization ID this device belongs to"},"token":{"type":"string","description":"Device authentication token"},"activatedAt":{"type":"integer","format":"int64","description":"Device activation timestamp"},"ownerUserId":{"type":"integer","format":"int64","description":"Device owner identifier"},"hardwareInfo":{"$ref":"#/components/schemas/DeviceHardwareInfo"}},"required":["id","name","templateId","originalTemplateId","orgId","token"]},"DeviceHardwareInfo":{"type":"object","properties":{"version":{"type":"string","description":"Device firmware version"},"fwType":{"type":"string","description":"Device firmware type"},"blynkVersion":{"type":"string","description":"Version of the Blynk Library, that is used on the device"},"boardType":{"$ref":"#/components/schemas/BoardType"},"build":{"type":"string","description":"Firmware build number, that is used on the device"},"templateId":{"type":"string","description":"The identifier of the template that the device belongs to."}}},"BoardType":{"type":"string","enum":["Arduino","BBC_Microbit","ESP32","ESP8266","Lantronix_Fox_3","Microduino","Onion_Omega","Particle","Pycom_WiPy","Raspberry_Pi","Seeed_Wio_Terminal","SparkFun_Blynk_Board","Teensy","TinyDuino","NodeRed","Python","TI_CC3220","Iridium","Iridium_9704_Launch_Pad","NCD","Milesight","Seeed","Blues","MOKOSmart","Thermokon","Miromiko","Pepperl_Fuchs","Atim","Other"],"description":"Device board type"},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/by-user-org":{"get":{"tags":["Devices"],"summary":"Get devices by user and organization","description":"Retrieve devices accessible by a specific user in their organization\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_VIEW`.\nUser-scoped tokens querying `userEmail` different from authenticated user email also require `ORG_VIEW_USERS`.\n","operationId":"getDevicesByUserOrg","parameters":[{"name":"userEmail","in":"query","required":true,"schema":{"type":"string","format":"email"},"description":"User email address"},{"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":"List of devices","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"array","items":{"$ref":"#/components/schemas/Device"}},"totalElements":{"type":"integer","format":"int64"}}}}}},"400":{"description":"Bad request","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"}}}}}}}}}
```

## Get last activated devices

> Retrieve recently activated devices in the organization\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_VIEW\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Devices","description":"Device lifecycle and 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":{"DeviceActivation":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Device ID"},"orgId":{"type":"integer","format":"int32","description":"Organization ID"},"templateId":{"type":"integer","format":"int32","description":"Template ID"},"ownerUserId":{"type":"integer","format":"int64","description":"User ID of the device owner"},"activationTime":{"type":"integer","format":"int64","description":"Device activation timestamp"}},"required":["id","orgId","templateId","activationTime"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/last-activated":{"get":{"tags":["Devices"],"summary":"Get last activated devices","description":"Retrieve recently activated devices in the organization\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_VIEW`.\n","operationId":"getLastActivatedDevices","parameters":[{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional). If not specified, the endpoint will return recently activated devices in the organization, that is associated with the authentication token."},{"name":"minutes","in":"query","schema":{"type":"integer","format":"int32","default":5,"minimum":1,"maximum":60},"description":"Time window in minutes for \"recent\" activations"}],"responses":{"200":{"description":"List of activated devices","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/DeviceActivation"}}}}},"403":{"description":"Forbidden"},"404":{"description":"Organization 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 device metadata fields

> Retrieve all metadata field values for a device\
> \
> Required permissions, when user-scoped authentication is used: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can read metafields 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":"Devices","description":"Device lifecycle and 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":{"MetaFieldValue":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"MetaField ID"},"name":{"type":"string","description":"MetaField name"},"isMandatory":{"type":"boolean","description":"Mark whether the metafield is required"},"includeInProvision":{"type":"boolean","description":"Mark whether the metafield should be included in the provisioning flow"},"value":{"nullable":true,"description":"Metafield value. The schema depends on the `type` discriminator property.","discriminator":{"propertyName":"type","mapping":{"MultiText":"#/components/schemas/MultiTextMetafieldValue","Text":"#/components/schemas/TextMetafieldValue","Email":"#/components/schemas/EmailMetafieldValue","Number":"#/components/schemas/NumberMetafieldValue","Int":"#/components/schemas/IntMetafieldValue","Range":"#/components/schemas/RangeMetafieldValue","Shift":"#/components/schemas/ShiftMetafieldValue","Switch":"#/components/schemas/SwitchMetafieldValue","Cost":"#/components/schemas/CostMetafieldValue","Contact":"#/components/schemas/ContactMetafieldValue","Measurement":"#/components/schemas/MeasurementMetafieldValue","Time":"#/components/schemas/TimeMetafieldValue","Coordinates":"#/components/schemas/CoordinatesMetafieldValue","Address":"#/components/schemas/AddressMetafieldValue","List":"#/components/schemas/ListMetafieldValue","Table":"#/components/schemas/TableMetafieldValue","DeviceReference":"#/components/schemas/DeviceReferenceMetafieldValue","Location":"#/components/schemas/LocationMetafieldValue","Tz":"#/components/schemas/TzMetafieldValue","Image":"#/components/schemas/ImageMetafieldValue","DeviceName":"#/components/schemas/DeviceNameMetafieldValue","DeviceOwner":"#/components/schemas/DeviceOwnerMetafieldValue","HotspotName":"#/components/schemas/HotspotNameMetafieldValue","Imei":"#/components/schemas/ImeiMetafieldValue","ICCID":"#/components/schemas/ICCIDMetafieldValue","DeviceEui":"#/components/schemas/DeviceEuiMetafieldValue","JoinEui":"#/components/schemas/JoinEuiMetafieldValue","ApplicationKey":"#/components/schemas/ApplicationKeyMetafieldValue","BluesDevice":"#/components/schemas/BluesDeviceMetafieldValue","TheThingsNetwork":"#/components/schemas/TheThingsNetworkMetafieldValue","ThingName":"#/components/schemas/ThingNameMetafieldValue","OTASettings":"#/components/schemas/OTASettingsMetafieldValue","MyriotaTerminalId":"#/components/schemas/MyriotaTerminalIdMetafieldValue"}},"oneOf":[{"$ref":"#/components/schemas/MultiTextMetafieldValue"},{"$ref":"#/components/schemas/TextMetafieldValue"},{"$ref":"#/components/schemas/EmailMetafieldValue"},{"$ref":"#/components/schemas/NumberMetafieldValue"},{"$ref":"#/components/schemas/IntMetafieldValue"},{"$ref":"#/components/schemas/RangeMetafieldValue"},{"$ref":"#/components/schemas/ShiftMetafieldValue"},{"$ref":"#/components/schemas/SwitchMetafieldValue"},{"$ref":"#/components/schemas/CostMetafieldValue"},{"$ref":"#/components/schemas/ContactMetafieldValue"},{"$ref":"#/components/schemas/MeasurementMetafieldValue"},{"$ref":"#/components/schemas/TimeMetafieldValue"},{"$ref":"#/components/schemas/CoordinatesMetafieldValue"},{"$ref":"#/components/schemas/AddressMetafieldValue"},{"$ref":"#/components/schemas/ListMetafieldValue"},{"$ref":"#/components/schemas/TableMetafieldValue"},{"$ref":"#/components/schemas/DeviceReferenceMetafieldValue"},{"$ref":"#/components/schemas/LocationMetafieldValue"},{"$ref":"#/components/schemas/TzMetafieldValue"},{"$ref":"#/components/schemas/ImageMetafieldValue"},{"$ref":"#/components/schemas/DeviceNameMetafieldValue"},{"$ref":"#/components/schemas/DeviceOwnerMetafieldValue"},{"$ref":"#/components/schemas/HotspotNameMetafieldValue"},{"$ref":"#/components/schemas/ImeiMetafieldValue"},{"$ref":"#/components/schemas/ICCIDMetafieldValue"},{"$ref":"#/components/schemas/DeviceEuiMetafieldValue"},{"$ref":"#/components/schemas/JoinEuiMetafieldValue"},{"$ref":"#/components/schemas/ApplicationKeyMetafieldValue"},{"$ref":"#/components/schemas/BluesDeviceMetafieldValue"},{"$ref":"#/components/schemas/TheThingsNetworkMetafieldValue"},{"$ref":"#/components/schemas/ThingNameMetafieldValue"},{"$ref":"#/components/schemas/OTASettingsMetafieldValue"},{"$ref":"#/components/schemas/MyriotaTerminalIdMetafieldValue"}]}}},"MultiTextMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["MultiText"],"description":"MetaField value type"},"values":{"type":"array","items":{"type":"string","maxLength":200},"description":"List of text values","maxItems":10000}},"required":["type"]},"TextMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Text"],"description":"MetaField value type"},"value":{"type":"string","description":"Text value","maxLength":200}},"required":["type"]},"EmailMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Email"],"description":"MetaField value type"},"value":{"type":"string","format":"email","description":"Email address value","maxLength":255}},"required":["type"]},"NumberMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Number"],"description":"MetaField value type"},"value":{"type":"number","format":"double","description":"Numeric value"}},"required":["type","value"]},"IntMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Int"],"description":"MetaField value type"},"value":{"type":"integer","format":"int32","description":"Integer value"}},"required":["type","value"]},"RangeMetafieldValue":{"type":"object","description":"Time range value. `from` and `to` are represented as seconds since midnight (0–86399).","properties":{"type":{"type":"string","enum":["Range"],"description":"MetaField value type"},"from":{"type":"integer","format":"int32","description":"Start time as seconds since midnight"},"to":{"type":"integer","format":"int32","description":"End time as seconds since midnight"}},"required":["type"]},"ShiftMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Shift"],"description":"MetaField value type"},"shifts":{"type":"array","items":{"type":"object","description":"A named time range. `from` and `to` are represented as seconds since midnight (0–86399).","properties":{"name":{"type":"string","description":"Shift name","maxLength":200},"from":{"type":"integer","format":"int32","description":"Start time as seconds since midnight"},"to":{"type":"integer","format":"int32","description":"End time as seconds since midnight"}}},"maxItems":10000,"description":"List of shifts"}},"required":["type"]},"SwitchMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Switch"],"description":"MetaField value type"},"value":{"type":"string","description":"Currently selected switch option","maxLength":200},"from":{"type":"string","description":"Label for the \"off\" option","maxLength":200},"to":{"type":"string","description":"Label for the \"on\" option","maxLength":200}},"required":["type"]},"CostMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Cost"],"description":"MetaField value type"},"currency":{"type":"string","description":"ISO 4217 currency code"},"price":{"type":"number","format":"double","description":"Price value"},"perValue":{"type":"number","format":"double","description":"Per-unit value"},"units":{"$ref":"#/components/schemas/MeasurementUnits"}},"required":["type"]},"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"]},"ContactMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Contact"],"description":"MetaField value type"},"firstName":{"type":"string","description":"First name","maxLength":200},"lastName":{"type":"string","description":"Last name","maxLength":200},"email":{"type":"string","format":"email","description":"Email address","maxLength":255},"phone":{"type":"string","description":"Phone number","maxLength":200},"streetAddress":{"type":"string","description":"Street address line 1","maxLength":200},"streetAddress2":{"type":"string","description":"Street address line 2","maxLength":200},"country":{"type":"string","description":"Country","maxLength":200},"city":{"type":"string","description":"City","maxLength":200},"state":{"type":"string","description":"State or province","maxLength":200},"zip":{"type":"string","description":"ZIP or postal code","maxLength":200}},"required":["type"]},"MeasurementMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Measurement"],"description":"MetaField value type"},"units":{"$ref":"#/components/schemas/MeasurementUnits"},"value":{"type":"number","format":"double","description":"Measured value"}},"required":["type"]},"TimeMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Time"],"description":"MetaField value type"},"time":{"type":"integer","format":"int64","description":"Timestamp in milliseconds"}},"required":["type"]},"CoordinatesMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Coordinates"],"description":"MetaField value type"},"lat":{"type":"number","format":"double","description":"Latitude"},"lon":{"type":"number","format":"double","description":"Longitude"}},"required":["type"]},"AddressMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Address"],"description":"MetaField value type"},"streetAddress":{"type":"string","description":"Street address","maxLength":200},"city":{"type":"string","description":"City","maxLength":200},"state":{"type":"string","description":"State or province","maxLength":200},"zip":{"type":"string","description":"ZIP or postal code","maxLength":200},"country":{"type":"string","description":"Country","maxLength":200}},"required":["type"]},"ListMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["List"],"description":"MetaField value type"},"selectedOption":{"type":"string","description":"Currently selected option","maxLength":200}},"required":["type"]},"TableMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Table"],"description":"MetaField value type"},"selectedRowIndex":{"type":"integer","format":"int32","description":"Index of the selected row"}},"required":["type"]},"DeviceReferenceMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceReference"],"description":"MetaField value type"},"selectedDeviceId":{"type":"integer","format":"int32","description":"ID of the referenced device"}},"required":["type"]},"LocationMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Location"],"description":"MetaField value type"},"orgLocationId":{"type":"integer","format":"int32","description":"Organization location ID"},"siteName":{"type":"string","description":"Site name","maxLength":200},"lat":{"type":"number","format":"double","nullable":true,"description":"Latitude"},"lon":{"type":"number","format":"double","nullable":true,"description":"Longitude"},"buildingName":{"type":"string","description":"Building name","maxLength":200},"floorName":{"type":"string","description":"Floor name","maxLength":200},"unit":{"type":"string","description":"Unit identifier","maxLength":200},"room":{"type":"string","description":"Room identifier","maxLength":200},"zone":{"type":"string","description":"Zone identifier","maxLength":200},"size":{"type":"number","format":"double","description":"Size of the location"},"placeId":{"type":"string","description":"External place ID","maxLength":200},"mapStyle":{"type":"string","description":"Map display style","enum":["LIGHT","DARK","STREETS","OUTDOORS","SATELLITE","SATELLITE_STREETS","BLYNK_THEME"]}},"required":["type"]},"TzMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Tz"],"description":"MetaField value type"},"value":{"type":"string","description":"Timezone identifier","maxLength":200}},"required":["type"]},"ImageMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Image"],"description":"MetaField value type"},"url":{"type":"string","format":"uri","description":"Image URL","maxLength":200}},"required":["type"]},"DeviceNameMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceName"],"description":"MetaField value type"},"value":{"type":"string","description":"Device name"}},"required":["type"]},"DeviceOwnerMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceOwner"],"description":"MetaField value type"},"value":{"type":"string","format":"email","description":"Device owner email"},"userId":{"type":"integer","format":"int64","description":"Owner user ID"}},"required":["type"]},"HotspotNameMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["HotspotName"],"description":"MetaField value type"},"value":{"type":"string","description":"Hotspot name","maxLength":200}},"required":["type"]},"ImeiMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["Imei"],"description":"MetaField value type"},"value":{"type":"string","description":"IMEI number"}},"required":["type"]},"ICCIDMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["ICCID"],"description":"MetaField value type"},"value":{"type":"string","description":"ICCID number","maxLength":200}},"required":["type"]},"DeviceEuiMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["DeviceEui"],"description":"MetaField value type"},"value":{"type":"string","description":"Device EUI (lowercase)","maxLength":200}},"required":["type"]},"JoinEuiMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["JoinEui"],"description":"MetaField value type"},"value":{"type":"string","description":"Join EUI (lowercase)","maxLength":200}},"required":["type"]},"ApplicationKeyMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["ApplicationKey"],"description":"MetaField value type"},"value":{"type":"string","description":"Application key","maxLength":200}},"required":["type"]},"BluesDeviceMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["BluesDevice"],"description":"MetaField value type"},"deviceId":{"type":"string","description":"Blues device ID","maxLength":200}},"required":["type"]},"TheThingsNetworkMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["TheThingsNetwork"],"description":"MetaField value type"},"deviceId":{"type":"string","description":"The Things Network device ID","maxLength":200}},"required":["type"]},"ThingNameMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["ThingName"],"description":"MetaField value type"},"region":{"type":"string","description":"AWS IoT region","enum":["us-east-2","us-east-1","us-west-1","us-west-2","ap-east-1","ap-south-1","ap-northeast-2","ap-southeast-1","ap-southeast-2","ap-northeast-1","ca-central-1","eu-central-1","eu-west-1","eu-west-2","eu-west-3","eu-north-1","me-south-1","me-central-1","sa-east-1"]},"thingName":{"type":"string","description":"AWS IoT thing name","maxLength":200}},"required":["type"]},"OTASettingsMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["OTASettings"],"description":"MetaField value type"},"isAutoupdateEnabled":{"type":"boolean","description":"Whether auto-update is enabled"}},"required":["type"]},"MyriotaTerminalIdMetafieldValue":{"type":"object","properties":{"type":{"type":"string","enum":["MyriotaTerminalId"],"description":"MetaField value type"},"terminalId":{"type":"string","description":"Myriota terminal ID","maxLength":200}},"required":["type"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/device/metafield":{"get":{"tags":["Devices"],"summary":"Get device metadata fields","description":"Retrieve all metadata field values for a device\n\nRequired permissions, when user-scoped authentication is used: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can read metafields only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"getDeviceMetaFields","parameters":[{"name":"deviceId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Device ID"}],"responses":{"200":{"description":"Metadata field values","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/MetaFieldValue"}}}}},"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 device metadata field

> Update the value of a specific metadata field for a device.\
> \
> The new value is validated against the metafield type. Returns 400 if the value is invalid for the metafield type.\
> \
> Required permissions, when user-scoped authentication is used: \`ORG\_DEVICES\_EDIT\`.\
> Required device view permission: \`OWN\_DEVICES\_VIEW\` or \`ORG\_DEVICES\_VIEW\`.\
> User-scoped tokens can update metafields 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":"Devices","description":"Device lifecycle and 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/device/metafield":{"post":{"tags":["Devices"],"summary":"Update device metadata field","description":"Update the value of a specific metadata field for a device.\n\nThe new value is validated against the metafield type. Returns 400 if the value is invalid for the metafield type.\n\nRequired permissions, when user-scoped authentication is used: `ORG_DEVICES_EDIT`.\nRequired device view permission: `OWN_DEVICES_VIEW` or `ORG_DEVICES_VIEW`.\nUser-scoped tokens can update metafields only for owned devices unless `ORG_DEVICES_VIEW` is granted.\n","operationId":"updateDeviceMetaField","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"deviceId":{"type":"integer","format":"int32","description":"Device ID"},"metaFieldId":{"type":"integer","format":"int32","description":"MetaField ID"},"newValue":{"type":"string","description":"New metafield value","maxLength":200}},"required":["deviceId","metaFieldId","newValue"]}}}},"responses":{"204":{"description":"Metadata field updated successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Device/metafield 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/devices.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.
