# Templates

Device template configuration

## Get templates in organization

> Retrieve all device templates in the organization.\
> \
> Required permissions, when user-scoped authentication is used: \`PRODUCT\_VIEW\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Device template configuration"}],"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":{"Template":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Template ID"},"templateIds":{"type":"array","items":{"type":"string"},"description":"List of template IDs, that are used on the device"},"parentId":{"type":"integer","format":"int32","description":"Parent template ID"},"orgId":{"type":"integer","format":"int32","description":"Organization ID, that the template belongs to"},"name":{"type":"string","description":"Template name"}},"required":["id","templateIds","orgId","name"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/templates":{"get":{"tags":["Templates"],"summary":"Get templates in organization","description":"Retrieve all device templates in the organization.\n\nRequired permissions, when user-scoped authentication is used: `PRODUCT_VIEW`.\n","operationId":"getTemplates","parameters":[{"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 templates","content":{"application/json":{"schema":{"type":"object","properties":{"content":{"type":"array","items":{"$ref":"#/components/schemas/Template"}},"totalElements":{"type":"integer","format":"int64"}},"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 template by ID

> Retrieve detailed information about a specific template.\
> \
> Required permissions, when user-scoped authentication is used: \`PRODUCT\_VIEW\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Device template configuration"}],"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":{"TemplateDetails":{"allOf":[{"$ref":"#/components/schemas/Template"},{"type":"object","properties":{"boardType":{"$ref":"#/components/schemas/BoardType"},"connectionType":{"$ref":"#/components/schemas/ConnectionType"},"description":{"type":"string","description":"Template description"},"logoUrl":{"type":"string","description":"path of the template logo image, that should be prefixed with the server URL"},"createdAt":{"type":"integer","format":"int64","description":"Template creation timestamp"}},"required":["id","templateIds","orgId","name","createdAt"]}]},"Template":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Template ID"},"templateIds":{"type":"array","items":{"type":"string"},"description":"List of template IDs, that are used on the device"},"parentId":{"type":"integer","format":"int32","description":"Parent template ID"},"orgId":{"type":"integer","format":"int32","description":"Organization ID, that the template belongs to"},"name":{"type":"string","description":"Template name"}},"required":["id","templateIds","orgId","name"]},"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"},"ConnectionType":{"type":"string","enum":["ETHERNET","WI_FI","USB","BLUETOOTH","BLE","GSM","SATELLITE","LORAWAN"],"description":"Connection type, that is used on the device"},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/template":{"get":{"tags":["Templates"],"summary":"Get template by ID","description":"Retrieve detailed information about a specific template.\n\nRequired permissions, when user-scoped authentication is used: `PRODUCT_VIEW`.\n","operationId":"getTemplate","parameters":[{"name":"templateId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Template ID"}],"responses":{"200":{"description":"Template details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateDetails"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Template not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Update template

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

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Device template configuration"}],"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":{"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"},"ConnectionType":{"type":"string","enum":["ETHERNET","WI_FI","USB","BLUETOOTH","BLE","GSM","SATELLITE","LORAWAN"],"description":"Connection type, that is used on the device"},"TemplateDetails":{"allOf":[{"$ref":"#/components/schemas/Template"},{"type":"object","properties":{"boardType":{"$ref":"#/components/schemas/BoardType"},"connectionType":{"$ref":"#/components/schemas/ConnectionType"},"description":{"type":"string","description":"Template description"},"logoUrl":{"type":"string","description":"path of the template logo image, that should be prefixed with the server URL"},"createdAt":{"type":"integer","format":"int64","description":"Template creation timestamp"}},"required":["id","templateIds","orgId","name","createdAt"]}]},"Template":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Template ID"},"templateIds":{"type":"array","items":{"type":"string"},"description":"List of template IDs, that are used on the device"},"parentId":{"type":"integer","format":"int32","description":"Parent template ID"},"orgId":{"type":"integer","format":"int32","description":"Organization ID, that the template belongs to"},"name":{"type":"string","description":"Template name"}},"required":["id","templateIds","orgId","name"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/template":{"put":{"tags":["Templates"],"summary":"Update template","description":"Update template properties.\n\nOnly the original (root) template can be edited (the one with `parentId = null`).\nSub-organizations cannot modify templates that were created by a parent organization.\n\nRequired permissions, when user-scoped authentication is used: `PRODUCT_EDIT`.\nAlso, when the user-scoped authentication is used, user should have developer mode enabled.\n","operationId":"updateTemplate","parameters":[{"name":"templateId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Template ID"}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","description":"New template name. Can only contain letters, digits and spaces.","maxLength":50,"minLength":1},"boardType":{"$ref":"#/components/schemas/BoardType"},"connectionType":{"$ref":"#/components/schemas/ConnectionType"},"description":{"type":"string","description":"New template description. Can only contain letters, digits, spaces and punctuation marks.","maxLength":128}},"required":["name"]}}}},"responses":{"200":{"description":"Template updated successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateDetails"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Template not found or access denied","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too many requests"},"500":{"description":"Internal server error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}}}}}}}
```

## Delete template

> Delete a device template.\
> \
> You can't delete template, that is used in the sub-organizations.\
> If any device is using the template in the root organization, it will be deleted.\
> \
> Required permissions, when user-scoped authentication is used: \`PRODUCT\_DELETE\`.\
> Also, when the user-scoped authentication is used, user should have developer mode enabled.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Device template configuration"}],"servers":[{"url":"https://{server_address}","description":"Blynk Server","variables":{"server_address":{"default":"blynk.cloud","description":"Your Blynk server domain"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth2 Bearer token obtained from authentication endpoint"}},"schemas":{"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/template":{"delete":{"tags":["Templates"],"summary":"Delete template","description":"Delete a device template.\n\nYou can't delete template, that is used in the sub-organizations.\nIf any device is using the template in the root organization, it will be deleted.\n\nRequired permissions, when user-scoped authentication is used: `PRODUCT_DELETE`.\nAlso, when the user-scoped authentication is used, user should have developer mode enabled.\n","operationId":"deleteTemplate","parameters":[{"name":"templateId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"Template ID"}],"responses":{"204":{"description":"Template deleted successfully"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"Template 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 new template

> Create a new device template.\
> \
> Required permissions, when user-scoped authentication is used: \`PRODUCT\_CREATE\`.\
> Also, when the user-scoped authentication is used, user should have developer mode enabled.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Templates","description":"Device template configuration"}],"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":{"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"},"ConnectionType":{"type":"string","enum":["ETHERNET","WI_FI","USB","BLUETOOTH","BLE","GSM","SATELLITE","LORAWAN"],"description":"Connection type, that is used on the device"},"TemplateDetails":{"allOf":[{"$ref":"#/components/schemas/Template"},{"type":"object","properties":{"boardType":{"$ref":"#/components/schemas/BoardType"},"connectionType":{"$ref":"#/components/schemas/ConnectionType"},"description":{"type":"string","description":"Template description"},"logoUrl":{"type":"string","description":"path of the template logo image, that should be prefixed with the server URL"},"createdAt":{"type":"integer","format":"int64","description":"Template creation timestamp"}},"required":["id","templateIds","orgId","name","createdAt"]}]},"Template":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Template ID"},"templateIds":{"type":"array","items":{"type":"string"},"description":"List of template IDs, that are used on the device"},"parentId":{"type":"integer","format":"int32","description":"Parent template ID"},"orgId":{"type":"integer","format":"int32","description":"Organization ID, that the template belongs to"},"name":{"type":"string","description":"Template name"}},"required":["id","templateIds","orgId","name"]},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/template/create":{"post":{"tags":["Templates"],"summary":"Create new template","description":"Create a new device template.\n\nRequired permissions, when user-scoped authentication is used: `PRODUCT_CREATE`.\nAlso, when the user-scoped authentication is used, user should have developer mode enabled.\n","operationId":"createTemplate","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"orgId":{"type":"integer","format":"int32","description":"Organization ID to create template in. If not specified, the template will be created in the organization, that is associated with the authentication token."},"name":{"type":"string","description":"New template name. Can only contain letters, digits and spaces.","maxLength":50,"minLength":1},"boardType":{"$ref":"#/components/schemas/BoardType"},"connectionType":{"$ref":"#/components/schemas/ConnectionType"},"description":{"type":"string","description":"New template description. Can only contain letters, digits, spaces and punctuation marks.","maxLength":128}},"required":["name"]}}}},"responses":{"201":{"description":"Template created successfully","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TemplateDetails"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"404":{"description":"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"}}}}}}}}}
```


---

# 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/templates.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.
