> For the complete documentation index, see [llms.txt](https://docs.blynk.io/en/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.blynk.io/en/blynk.cloud/platform-https-api/automations.md).

# Automations

Automation rules

## Get automations

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

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Automations","description":"Automation rules"}],"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":{"Automation":{"type":"object","properties":{"id":{"type":"integer","format":"int32","description":"Automation ID"},"name":{"type":"string","description":"Automation name"},"ownerId":{"type":"integer","format":"int64","description":"User ID of the automation owner"},"isActive":{"type":"boolean","description":"Whether the automation is active"},"isShared":{"type":"boolean","description":"Whether the automation is shared with sub-organizations and has at least one propagated sub-automation."}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/automations":{"get":{"tags":["Automations"],"summary":"Get automations","description":"Retrieve all automations in the organization.\n\nRequired permissions, when user-scoped authentication is used: `AUTOMATION_VIEW`.\n","operationId":"getAutomations","parameters":[{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used."}],"responses":{"200":{"description":"List of automations","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/Automation"}}}}},"400":{"description":"Bad request","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"}}}}}}}}}
```

## Create automation

> Create a new automation in the organization.\
> \
> Required permissions, when user-scoped authentication is used: \`AUTOMATION\_CREATE\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Automations","description":"Automation rules"}],"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":{"AutomationRequest":{"type":"object","description":"Request body used to create or update an automation.","properties":{"id":{"type":"integer","format":"int32","description":"Automation ID. Required for update (PUT), ignored on create (POST)."},"name":{"type":"string","maxLength":255,"description":"Automation name."},"icon":{"type":"string","description":"Optional icon identifier."},"automationRule":{"$ref":"#/components/schemas/AutomationRule"},"isActive":{"type":"boolean","description":"Whether the automation is active."},"ignorePeriod":{"type":"integer","format":"int32","description":"Period (in milliseconds) during which repeated action execution is ignored. Must be >= 0."},"shareAsTemplate":{"type":"boolean","description":"Whether the automation is shared as a template."},"autoCreateInSubOrg":{"type":"boolean","description":"Whether the automation should be auto-created in sub-organizations. Requires the `SHARE_AUTOMATION` permission; otherwise silently ignored."},"autoEnable":{"type":"boolean","description":"Whether auto-created copies in sub-organizations are enabled by default."},"applyForExisting":{"type":"boolean","description":"When `autoCreateInSubOrg` is being turned on, whether to also propagate the automation into existing sub-organizations."},"removeForExisting":{"type":"boolean","description":"When `autoCreateInSubOrg` is being turned off (on update), whether to also remove previously auto-created copies from existing sub-organizations."}},"required":["name"]},"AutomationRule":{"type":"object","description":"The trigger + actions definition of an automation. This is a polymorphic\nobject whose concrete shape is selected by the `type` discriminator.\n","properties":{"type":{"type":"string","description":"Automation rule type.","enum":["SCENE","TIME","SUNSET","DS","TEMPLATE_EVENT"]},"trigger":{"type":"object","description":"Trigger configuration (absent for `SCENE` rules, which are triggered by the user)."},"actions":{"type":"array","description":"Ordered list of actions executed when the automation is triggered.","items":{"type":"object"}}}},"AutomationDetailed":{"type":"object","description":"Detailed automation representation returned by create, update, get-single and control endpoints.","properties":{"id":{"type":"integer","format":"int32"},"name":{"type":"string"},"icon":{"type":"string"},"automationRule":{"$ref":"#/components/schemas/AutomationRule"},"ownerId":{"type":"integer","format":"int64","description":"User ID of the automation owner (0 for organization-scoped tokens)."},"isActive":{"type":"boolean"},"lastTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the last time the automation was triggered."},"nextTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the next scheduled trigger, when applicable."},"status":{"type":"string","description":"Computed automation status.","enum":["COMPLETE","INCOMPLETE","ATTENTION"]},"ignorePeriod":{"type":"integer","format":"int32"},"waitDuration":{"type":"integer","format":"int64","description":"Total duration (in milliseconds) of any wait actions in the automation rule."},"shareAsTemplate":{"type":"boolean"},"autoCreateInSubOrg":{"type":"boolean"},"autoEnable":{"type":"boolean"},"isShared":{"type":"boolean","description":"Whether the automation is shared with sub-organizations and has at least one propagated sub-automation."}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/automations":{"post":{"tags":["Automations"],"summary":"Create automation","description":"Create a new automation in the organization.\n\nRequired permissions, when user-scoped authentication is used: `AUTOMATION_CREATE`.\n","operationId":"createAutomation","parameters":[{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRequest"}}}},"responses":{"201":{"description":"Automation created","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationDetailed"}}}},"400":{"description":"Bad request","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"}}}}}}}}}
```

## Update automation

> Update an existing automation. The target automation is identified by the \`id\` field in the request body.\
> \
> Required permissions, when user-scoped authentication is used: \`AUTOMATION\_EDIT\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Automations","description":"Automation rules"}],"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":{"AutomationRequest":{"type":"object","description":"Request body used to create or update an automation.","properties":{"id":{"type":"integer","format":"int32","description":"Automation ID. Required for update (PUT), ignored on create (POST)."},"name":{"type":"string","maxLength":255,"description":"Automation name."},"icon":{"type":"string","description":"Optional icon identifier."},"automationRule":{"$ref":"#/components/schemas/AutomationRule"},"isActive":{"type":"boolean","description":"Whether the automation is active."},"ignorePeriod":{"type":"integer","format":"int32","description":"Period (in milliseconds) during which repeated action execution is ignored. Must be >= 0."},"shareAsTemplate":{"type":"boolean","description":"Whether the automation is shared as a template."},"autoCreateInSubOrg":{"type":"boolean","description":"Whether the automation should be auto-created in sub-organizations. Requires the `SHARE_AUTOMATION` permission; otherwise silently ignored."},"autoEnable":{"type":"boolean","description":"Whether auto-created copies in sub-organizations are enabled by default."},"applyForExisting":{"type":"boolean","description":"When `autoCreateInSubOrg` is being turned on, whether to also propagate the automation into existing sub-organizations."},"removeForExisting":{"type":"boolean","description":"When `autoCreateInSubOrg` is being turned off (on update), whether to also remove previously auto-created copies from existing sub-organizations."}},"required":["name"]},"AutomationRule":{"type":"object","description":"The trigger + actions definition of an automation. This is a polymorphic\nobject whose concrete shape is selected by the `type` discriminator.\n","properties":{"type":{"type":"string","description":"Automation rule type.","enum":["SCENE","TIME","SUNSET","DS","TEMPLATE_EVENT"]},"trigger":{"type":"object","description":"Trigger configuration (absent for `SCENE` rules, which are triggered by the user)."},"actions":{"type":"array","description":"Ordered list of actions executed when the automation is triggered.","items":{"type":"object"}}}},"AutomationDetailed":{"type":"object","description":"Detailed automation representation returned by create, update, get-single and control endpoints.","properties":{"id":{"type":"integer","format":"int32"},"name":{"type":"string"},"icon":{"type":"string"},"automationRule":{"$ref":"#/components/schemas/AutomationRule"},"ownerId":{"type":"integer","format":"int64","description":"User ID of the automation owner (0 for organization-scoped tokens)."},"isActive":{"type":"boolean"},"lastTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the last time the automation was triggered."},"nextTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the next scheduled trigger, when applicable."},"status":{"type":"string","description":"Computed automation status.","enum":["COMPLETE","INCOMPLETE","ATTENTION"]},"ignorePeriod":{"type":"integer","format":"int32"},"waitDuration":{"type":"integer","format":"int64","description":"Total duration (in milliseconds) of any wait actions in the automation rule."},"shareAsTemplate":{"type":"boolean"},"autoCreateInSubOrg":{"type":"boolean"},"autoEnable":{"type":"boolean"},"isShared":{"type":"boolean","description":"Whether the automation is shared with sub-organizations and has at least one propagated sub-automation."}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/automations":{"put":{"tags":["Automations"],"summary":"Update automation","description":"Update an existing automation. The target automation is identified by the `id` field in the request body.\n\nRequired permissions, when user-scoped authentication is used: `AUTOMATION_EDIT`.\n","operationId":"updateAutomation","parameters":[{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationRequest"}}}},"responses":{"200":{"description":"Automation updated","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationDetailed"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Automation or organization 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"}}}}}}}}}
```

## Delete automation

> Delete an automation by ID.\
> \
> Required permissions, when user-scoped authentication is used: \`AUTOMATION\_DELETE\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Automations","description":"Automation rules"}],"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/automations":{"delete":{"tags":["Automations"],"summary":"Delete automation","description":"Delete an automation by ID.\n\nRequired permissions, when user-scoped authentication is used: `AUTOMATION_DELETE`.\n","operationId":"deleteAutomation","parameters":[{"name":"automationId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"ID of the automation to delete."},{"name":"deleteEverywhere","in":"query","schema":{"type":"boolean","default":false},"description":"Required to delete an automation that is shared with sub-organizations and still has\npropagated sub-automations. When `true`, the parent automation is deleted together with\nevery copy in the sub-organizations (\"delete everywhere\"). When `false` (the default),\ndeleting such a shared automation is rejected so its sub-org copies never become orphaned.\n"},{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used."}],"responses":{"204":{"description":"Automation deleted"},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Automation or organization 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 automation

> Retrieve a single automation by ID, including its rule, computed status and scheduling details.\
> \
> Required permissions, when user-scoped authentication is used: \`AUTOMATION\_VIEW\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Automations","description":"Automation rules"}],"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":{"AutomationDetailed":{"type":"object","description":"Detailed automation representation returned by create, update, get-single and control endpoints.","properties":{"id":{"type":"integer","format":"int32"},"name":{"type":"string"},"icon":{"type":"string"},"automationRule":{"$ref":"#/components/schemas/AutomationRule"},"ownerId":{"type":"integer","format":"int64","description":"User ID of the automation owner (0 for organization-scoped tokens)."},"isActive":{"type":"boolean"},"lastTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the last time the automation was triggered."},"nextTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the next scheduled trigger, when applicable."},"status":{"type":"string","description":"Computed automation status.","enum":["COMPLETE","INCOMPLETE","ATTENTION"]},"ignorePeriod":{"type":"integer","format":"int32"},"waitDuration":{"type":"integer","format":"int64","description":"Total duration (in milliseconds) of any wait actions in the automation rule."},"shareAsTemplate":{"type":"boolean"},"autoCreateInSubOrg":{"type":"boolean"},"autoEnable":{"type":"boolean"},"isShared":{"type":"boolean","description":"Whether the automation is shared with sub-organizations and has at least one propagated sub-automation."}}},"AutomationRule":{"type":"object","description":"The trigger + actions definition of an automation. This is a polymorphic\nobject whose concrete shape is selected by the `type` discriminator.\n","properties":{"type":{"type":"string","description":"Automation rule type.","enum":["SCENE","TIME","SUNSET","DS","TEMPLATE_EVENT"]},"trigger":{"type":"object","description":"Trigger configuration (absent for `SCENE` rules, which are triggered by the user)."},"actions":{"type":"array","description":"Ordered list of actions executed when the automation is triggered.","items":{"type":"object"}}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/automation":{"get":{"tags":["Automations"],"summary":"Get automation","description":"Retrieve a single automation by ID, including its rule, computed status and scheduling details.\n\nRequired permissions, when user-scoped authentication is used: `AUTOMATION_VIEW`.\n","operationId":"getAutomation","parameters":[{"name":"automationId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"ID of the automation."},{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used."}],"responses":{"200":{"description":"Automation details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationDetailed"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Automation or organization 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"}}}}}}}}}
```

## Enable automation

> Enable (activate) an automation.\
> \
> Required permissions, when user-scoped authentication is used: \`AUTOMATION\_EDIT\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Automations","description":"Automation rules"}],"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":{"AutomationControlRequest":{"type":"object","description":"Request body used by the enable, disable, execute and cancel endpoints.","properties":{"automationId":{"type":"integer","format":"int32","description":"ID of the target automation."}},"required":["automationId"]},"AutomationDetailed":{"type":"object","description":"Detailed automation representation returned by create, update, get-single and control endpoints.","properties":{"id":{"type":"integer","format":"int32"},"name":{"type":"string"},"icon":{"type":"string"},"automationRule":{"$ref":"#/components/schemas/AutomationRule"},"ownerId":{"type":"integer","format":"int64","description":"User ID of the automation owner (0 for organization-scoped tokens)."},"isActive":{"type":"boolean"},"lastTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the last time the automation was triggered."},"nextTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the next scheduled trigger, when applicable."},"status":{"type":"string","description":"Computed automation status.","enum":["COMPLETE","INCOMPLETE","ATTENTION"]},"ignorePeriod":{"type":"integer","format":"int32"},"waitDuration":{"type":"integer","format":"int64","description":"Total duration (in milliseconds) of any wait actions in the automation rule."},"shareAsTemplate":{"type":"boolean"},"autoCreateInSubOrg":{"type":"boolean"},"autoEnable":{"type":"boolean"},"isShared":{"type":"boolean","description":"Whether the automation is shared with sub-organizations and has at least one propagated sub-automation."}}},"AutomationRule":{"type":"object","description":"The trigger + actions definition of an automation. This is a polymorphic\nobject whose concrete shape is selected by the `type` discriminator.\n","properties":{"type":{"type":"string","description":"Automation rule type.","enum":["SCENE","TIME","SUNSET","DS","TEMPLATE_EVENT"]},"trigger":{"type":"object","description":"Trigger configuration (absent for `SCENE` rules, which are triggered by the user)."},"actions":{"type":"array","description":"Ordered list of actions executed when the automation is triggered.","items":{"type":"object"}}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/automation/enable":{"post":{"tags":["Automations"],"summary":"Enable automation","description":"Enable (activate) an automation.\n\nRequired permissions, when user-scoped authentication is used: `AUTOMATION_EDIT`.\n","operationId":"enableAutomation","parameters":[{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationControlRequest"}}}},"responses":{"200":{"description":"Automation enabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationDetailed"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Automation or organization 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"}}}}}}}}}
```

## Disable automation

> Disable (deactivate) an automation.\
> \
> Required permissions, when user-scoped authentication is used: \`AUTOMATION\_EDIT\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Automations","description":"Automation rules"}],"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":{"AutomationControlRequest":{"type":"object","description":"Request body used by the enable, disable, execute and cancel endpoints.","properties":{"automationId":{"type":"integer","format":"int32","description":"ID of the target automation."}},"required":["automationId"]},"AutomationDetailed":{"type":"object","description":"Detailed automation representation returned by create, update, get-single and control endpoints.","properties":{"id":{"type":"integer","format":"int32"},"name":{"type":"string"},"icon":{"type":"string"},"automationRule":{"$ref":"#/components/schemas/AutomationRule"},"ownerId":{"type":"integer","format":"int64","description":"User ID of the automation owner (0 for organization-scoped tokens)."},"isActive":{"type":"boolean"},"lastTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the last time the automation was triggered."},"nextTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the next scheduled trigger, when applicable."},"status":{"type":"string","description":"Computed automation status.","enum":["COMPLETE","INCOMPLETE","ATTENTION"]},"ignorePeriod":{"type":"integer","format":"int32"},"waitDuration":{"type":"integer","format":"int64","description":"Total duration (in milliseconds) of any wait actions in the automation rule."},"shareAsTemplate":{"type":"boolean"},"autoCreateInSubOrg":{"type":"boolean"},"autoEnable":{"type":"boolean"},"isShared":{"type":"boolean","description":"Whether the automation is shared with sub-organizations and has at least one propagated sub-automation."}}},"AutomationRule":{"type":"object","description":"The trigger + actions definition of an automation. This is a polymorphic\nobject whose concrete shape is selected by the `type` discriminator.\n","properties":{"type":{"type":"string","description":"Automation rule type.","enum":["SCENE","TIME","SUNSET","DS","TEMPLATE_EVENT"]},"trigger":{"type":"object","description":"Trigger configuration (absent for `SCENE` rules, which are triggered by the user)."},"actions":{"type":"array","description":"Ordered list of actions executed when the automation is triggered.","items":{"type":"object"}}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/automation/disable":{"post":{"tags":["Automations"],"summary":"Disable automation","description":"Disable (deactivate) an automation.\n\nRequired permissions, when user-scoped authentication is used: `AUTOMATION_EDIT`.\n","operationId":"disableAutomation","parameters":[{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationControlRequest"}}}},"responses":{"200":{"description":"Automation disabled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationDetailed"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Automation or organization 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"}}}}}}}}}
```

## Execute automation

> Manually run a scene automation (one that is triggered by the user).\
> \
> Required permissions, when user-scoped authentication is used: \`AUTOMATION\_EXECUTE\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Automations","description":"Automation rules"}],"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":{"AutomationControlRequest":{"type":"object","description":"Request body used by the enable, disable, execute and cancel endpoints.","properties":{"automationId":{"type":"integer","format":"int32","description":"ID of the target automation."}},"required":["automationId"]},"AutomationDetailed":{"type":"object","description":"Detailed automation representation returned by create, update, get-single and control endpoints.","properties":{"id":{"type":"integer","format":"int32"},"name":{"type":"string"},"icon":{"type":"string"},"automationRule":{"$ref":"#/components/schemas/AutomationRule"},"ownerId":{"type":"integer","format":"int64","description":"User ID of the automation owner (0 for organization-scoped tokens)."},"isActive":{"type":"boolean"},"lastTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the last time the automation was triggered."},"nextTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the next scheduled trigger, when applicable."},"status":{"type":"string","description":"Computed automation status.","enum":["COMPLETE","INCOMPLETE","ATTENTION"]},"ignorePeriod":{"type":"integer","format":"int32"},"waitDuration":{"type":"integer","format":"int64","description":"Total duration (in milliseconds) of any wait actions in the automation rule."},"shareAsTemplate":{"type":"boolean"},"autoCreateInSubOrg":{"type":"boolean"},"autoEnable":{"type":"boolean"},"isShared":{"type":"boolean","description":"Whether the automation is shared with sub-organizations and has at least one propagated sub-automation."}}},"AutomationRule":{"type":"object","description":"The trigger + actions definition of an automation. This is a polymorphic\nobject whose concrete shape is selected by the `type` discriminator.\n","properties":{"type":{"type":"string","description":"Automation rule type.","enum":["SCENE","TIME","SUNSET","DS","TEMPLATE_EVENT"]},"trigger":{"type":"object","description":"Trigger configuration (absent for `SCENE` rules, which are triggered by the user)."},"actions":{"type":"array","description":"Ordered list of actions executed when the automation is triggered.","items":{"type":"object"}}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/automation/execute":{"post":{"tags":["Automations"],"summary":"Execute automation","description":"Manually run a scene automation (one that is triggered by the user).\n\nRequired permissions, when user-scoped authentication is used: `AUTOMATION_EXECUTE`.\n","operationId":"executeAutomation","parameters":[{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationControlRequest"}}}},"responses":{"200":{"description":"Automation executed","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationDetailed"}}}},"400":{"description":"Bad request (for example, the automation is not a user-triggered scene)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Automation or organization 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"}}}}}}}}}
```

## Cancel running automation

> Cancel a currently running automation execution.\
> \
> Required permissions, when user-scoped authentication is used: \`AUTOMATION\_EXECUTE\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Automations","description":"Automation rules"}],"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":{"AutomationControlRequest":{"type":"object","description":"Request body used by the enable, disable, execute and cancel endpoints.","properties":{"automationId":{"type":"integer","format":"int32","description":"ID of the target automation."}},"required":["automationId"]},"AutomationDetailed":{"type":"object","description":"Detailed automation representation returned by create, update, get-single and control endpoints.","properties":{"id":{"type":"integer","format":"int32"},"name":{"type":"string"},"icon":{"type":"string"},"automationRule":{"$ref":"#/components/schemas/AutomationRule"},"ownerId":{"type":"integer","format":"int64","description":"User ID of the automation owner (0 for organization-scoped tokens)."},"isActive":{"type":"boolean"},"lastTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the last time the automation was triggered."},"nextTriggeredAt":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the next scheduled trigger, when applicable."},"status":{"type":"string","description":"Computed automation status.","enum":["COMPLETE","INCOMPLETE","ATTENTION"]},"ignorePeriod":{"type":"integer","format":"int32"},"waitDuration":{"type":"integer","format":"int64","description":"Total duration (in milliseconds) of any wait actions in the automation rule."},"shareAsTemplate":{"type":"boolean"},"autoCreateInSubOrg":{"type":"boolean"},"autoEnable":{"type":"boolean"},"isShared":{"type":"boolean","description":"Whether the automation is shared with sub-organizations and has at least one propagated sub-automation."}}},"AutomationRule":{"type":"object","description":"The trigger + actions definition of an automation. This is a polymorphic\nobject whose concrete shape is selected by the `type` discriminator.\n","properties":{"type":{"type":"string","description":"Automation rule type.","enum":["SCENE","TIME","SUNSET","DS","TEMPLATE_EVENT"]},"trigger":{"type":"object","description":"Trigger configuration (absent for `SCENE` rules, which are triggered by the user)."},"actions":{"type":"array","description":"Ordered list of actions executed when the automation is triggered.","items":{"type":"object"}}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/automation/cancel":{"post":{"tags":["Automations"],"summary":"Cancel running automation","description":"Cancel a currently running automation execution.\n\nRequired permissions, when user-scoped authentication is used: `AUTOMATION_EXECUTE`.\n","operationId":"cancelAutomation","parameters":[{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationControlRequest"}}}},"responses":{"200":{"description":"Automation execution cancelled","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AutomationDetailed"}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Automation or organization 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 automation log

> Retrieve the execution log for an automation.\
> \
> Required permissions, when user-scoped authentication is used: \`AUTOMATION\_VIEW\`.<br>

```json
{"openapi":"3.0.3","info":{"title":"Blynk Platform API","version":"1.0.0"},"tags":[{"name":"Automations","description":"Automation rules"}],"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":{"AutomationLogEntry":{"type":"object","description":"A single automation execution log record.","properties":{"ts":{"type":"integer","format":"int64","description":"Timestamp (epoch millis) of the log record."},"deviceId":{"type":"integer","format":"int32"},"deviceName":{"type":"string"},"dataStreamId":{"type":"integer","format":"int32"},"dataStreamName":{"type":"string"},"pin":{"type":"integer","format":"int32"},"pinType":{"type":"string"},"value":{"type":"number","format":"double"},"stringValue":{"type":"string"},"isOnline":{"type":"boolean"},"actionType":{"type":"string","description":"The type of action recorded."}}},"ErrorResponse":{"type":"object","properties":{"error":{"type":"object","properties":{"message":{"type":"string","description":"Error message"}},"required":["message"]}},"required":["error"]}}},"paths":{"/api/v1/organization/automation/log":{"get":{"tags":["Automations"],"summary":"Get automation log","description":"Retrieve the execution log for an automation.\n\nRequired permissions, when user-scoped authentication is used: `AUTOMATION_VIEW`.\n","operationId":"getAutomationLog","parameters":[{"name":"automationId","in":"query","required":true,"schema":{"type":"integer","format":"int32"},"description":"ID of the automation."},{"name":"period","in":"query","schema":{"type":"string","default":"DAY"},"description":"Reporting period. Use `CUSTOM` together with `from`/`to` for an explicit range."},{"name":"from","in":"query","schema":{"type":"integer","format":"int64"},"description":"Start timestamp (epoch millis), used only when `period` is `CUSTOM`."},{"name":"to","in":"query","schema":{"type":"integer","format":"int64"},"description":"End timestamp (epoch millis), used only when `period` is `CUSTOM`."},{"name":"offset","in":"query","schema":{"type":"integer","format":"int32","default":0},"description":"Number of records to skip."},{"name":"limit","in":"query","schema":{"type":"integer","format":"int32","default":100,"maximum":100},"description":"Maximum number of records to return (1-100)."},{"name":"orgId","in":"query","schema":{"type":"integer","format":"int32"},"description":"Organization ID (optional). If not provided, the organization, that is associated with the authentication token, will be used."}],"responses":{"200":{"description":"Automation log records","content":{"application/json":{"schema":{"type":"array","items":{"$ref":"#/components/schemas/AutomationLogEntry"}}}}},"400":{"description":"Bad request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"403":{"description":"Forbidden"},"404":{"description":"Automation or organization 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"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.blynk.io/en/blynk.cloud/platform-https-api/automations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
