# Rules API

**URL:** https://community.smartthings.com/c/developer-programs/rules-api/101.md

[Latest](https://community.smartthings.com/latest.md) · [Categories](https://community.smartthings.com/categories.md) · [Tags](https://community.smartthings.com/tags.md)

---

## [About the Rules API category](https://community.smartthings.com/t/about-the-rules-api-category/184646)

<div class="topic-metadata">

**Author:** [@jody.albritton](https://community.smartthings.com/u/jody.albritton)\
**Replies:** 2\
**Last updated:** [January 22, 2020, 6:32pm UTC](https://community.smartthings.com/t/about-the-rules-api-category/184646 "2020-01-22T18:32:22Z")

</div>

Community for discussing the new Rules API and sharing rule recipes.

---

## [How to condition based on month in a rule?](https://community.smartthings.com/t/how-to-condition-based-on-month-in-a-rule/310879)

<div class="topic-metadata">

**Author:** [@georgeh](https://community.smartthings.com/u/georgeh)\
**Replies:** 6\
**Last updated:** [September 4, 2026, 2:50pm UTC](https://community.smartthings.com/t/how-to-condition-based-on-month-in-a-rule/310879 "2026-09-04T14:50:43Z")

</div>

I’m trying to create a rule that triggers within a specific time range (using between), but only for a specific range of months. I can’t find examples of that, and the API rules documentation is well, silent of any synt…

---

## [Method to have a rule trigger on location mode change?](https://community.smartthings.com/t/method-to-have-a-rule-trigger-on-location-mode-change/310779)

<div class="topic-metadata">

**Author:** [@georgeh](https://community.smartthings.com/u/georgeh)\
**Replies:** 3\
**Last updated:** [August 27, 2026, 8:01pm UTC](https://community.smartthings.com/t/method-to-have-a-rule-trigger-on-location-mode-change/310779 "2026-08-27T20:01:45Z")

</div>

Can someone tell me how to have a rule trigger on a location’s mode change? I presume i use the “changes” condition, but the parameters are not clear to me. I did find two example rules in ST’s repository that referenc…

---

## [Aplicaciones Virtuales Mc driver Applications: Number Fields and Basic Calculations](https://community.smartthings.com/t/aplicaciones-virtuales-mc-driver-applications-number-fields-and-basic-calculations/277142)

<div class="topic-metadata">

**Author:** [@TapioX](https://community.smartthings.com/u/TapioX)\
**Replies:** 62\
**Last updated:** [August 26, 2026, 10:41am UTC](https://community.smartthings.com/t/aplicaciones-virtuales-mc-driver-applications-number-fields-and-basic-calculations/277142 "2026-08-26T10:41:14Z")

</div>

@Mariano\_Colmenarejo has added to Number Fields possibility to store variables and to perform some basic calculations. The idea of ​​this topic is to collect these applications in one place. Instructions for using the …

---

## [How to Write API Rule](https://community.smartthings.com/t/how-to-write-api-rule/280637)

<div class="topic-metadata">

**Author:** [@Sleck94](https://community.smartthings.com/u/Sleck94)\
**Replies:** 6\
**Last updated:** [August 10, 2026, 4:51pm UTC](https://community.smartthings.com/t/how-to-write-api-rule/280637 "2026-08-10T16:51:50Z")

</div>

Hello everyone, I’m a little bit in trouble because I haven’t actually understood how to use API Rules. The part I am actually missing is how to log in: I have read it requires the token (I have it) and it uses the HTT…

---

## [Rule Builder - No-code SmartThings Rules API Automation Builder](https://community.smartthings.com/t/rule-builder-no-code-smartthings-rules-api-automation-builder/309654)

<div class="topic-metadata">

**Author:** [@plusthings](https://community.smartthings.com/u/plusthings)\
**Replies:** 4\
**Last updated:** [June 6, 2026, 6:08pm UTC](https://community.smartthings.com/t/rule-builder-no-code-smartthings-rules-api-automation-builder/309654 "2026-06-06T18:08:38Z")

</div>

I recently built a tool called Rule Builder and wanted to share it with the community. Rule Builder is a no-code automation builder for SmartThings Rules API. Rule Builder is a free tool that lets you create advanced S…

---

## [Error 403 on GET /rules](https://community.smartthings.com/t/error-403-on-get-rules/308761)

<div class="topic-metadata">

**Author:** [@jnettleton](https://community.smartthings.com/u/jnettleton)\
**Replies:** 3\
**Last updated:** [April 6, 2026, 6:46pm UTC](https://community.smartthings.com/t/error-403-on-get-rules/308761 "2026-04-06T18:46:51Z")

</div>

I created a new PAT token and I got a 403 error. I was expecting an empty list of items. { “requestId”: “69cef5470000000049c28af729209f4f”, “error”: { “code”: “ForbiddenError”, “message”: “A resource could not be fo…

---

## [\[ST Edge\] Virtual Energy & Power Device Driver for calculating Total Energy Consumption](https://community.smartthings.com/t/st-edge-virtual-energy-power-device-driver-for-calculating-total-energy-consumption/285625)

<div class="topic-metadata">

**Author:** [@TapioX](https://community.smartthings.com/u/TapioX)\
**Replies:** 26\
**Last updated:** [February 9, 2026, 2:58pm UTC](https://community.smartthings.com/t/st-edge-virtual-energy-power-device-driver-for-calculating-total-energy-consumption/285625 "2026-02-09T14:58:03Z")

</div>

I have made a driver that implements Virtual Energy & Power Device and power & energy calculation. Power & energy calculation is implemented using Energy & Power Device(s) and supporting Rules API rules. You will …

---

## [Rules API "changes" condition does not trigger for same value when state\_change = true](https://community.smartthings.com/t/rules-api-changes-condition-does-not-trigger-for-same-value-when-state-change-true/307852)

<div class="topic-metadata">

**Author:** [@mocelet](https://community.smartthings.com/u/mocelet)\
**Replies:** 8\
**Last updated:** [February 6, 2026, 6:46am UTC](https://community.smartthings.com/t/rules-api-changes-condition-does-not-trigger-for-same-value-when-state-change-true/307852 "2026-02-06T06:46:11Z")

</div>

I wonder if there’s a nicer workaround than the one I ended up using and works fine. I have a rule to copy the value of a device attribute to a command of another device, in particular a knob and the step brightness com…

---

## [Rules API rules using Every x minute stopped operation when normal time started](https://community.smartthings.com/t/rules-api-rules-using-every-x-minute-stopped-operation-when-normal-time-started/289841)

<div class="topic-metadata">

**Author:** [@TapioX](https://community.smartthings.com/u/TapioX)\
**Replies:** 12\
**Last updated:** [October 30, 2025, 7:21pm UTC](https://community.smartthings.com/t/rules-api-rules-using-every-x-minute-stopped-operation-when-normal-time-started/289841 "2025-10-30T19:21:12Z")

</div>

Rules API rules using Every x minute stopped operation when clock is changed from summer time to normal time. Device’s history’s last events from ST App From Wikipedia Daylight saving time Members of the European U…

---

## [Automatic switch OFF and ON a TAPO smart plug if it's offline](https://community.smartthings.com/t/automatic-switch-off-and-on-a-tapo-smart-plug-if-its-offline/305992)

<div class="topic-metadata">

**Author:** [@MattIT](https://community.smartthings.com/u/MattIT)\
**Replies:** 13\
**Last updated:** [October 13, 2025, 10:06pm UTC](https://community.smartthings.com/t/automatic-switch-off-and-on-a-tapo-smart-plug-if-its-offline/305992 "2025-10-13T22:06:20Z")

</div>

Hello, i’m new about this useful forum and SmartThings programming. I’ve got a connected TAPO plug that powers the router. I’m trying to reset the router by turning off and on a connected TAPO plug, in case the plug is…

---

## [What are "Recipes"](https://community.smartthings.com/t/what-are-recipes/305913)

<div class="topic-metadata">

**Author:** [@marcos.scheffler](https://community.smartthings.com/u/marcos.scheffler)\
**Replies:** 3\
**Last updated:** [October 8, 2025, 3:27am UTC](https://community.smartthings.com/t/what-are-recipes/305913 "2025-10-08T03:27:12Z")

</div>

Noted this in AWA. I’ve searched in documentation but doesn’t find any reference Getting Started with Automations | Developer Documentation | SmartThings

---

## [Not clear which conditions can trigger an event](https://community.smartthings.com/t/not-clear-which-conditions-can-trigger-an-event/305675)

<div class="topic-metadata">

**Author:** [@niek](https://community.smartthings.com/u/niek)\
**Replies:** 4\
**Last updated:** [September 23, 2025, 9:41am UTC](https://community.smartthings.com/t/not-clear-which-conditions-can-trigger-an-event/305675 "2025-09-23T09:41:44Z")

</div>

From your documentation, it’s not clear to me which actions can fire events, i.e., on which conditions rules can be triggered. I see this documentation: In the Rules API a trigger acts as a way to start the execution o…

---

## [Using ST Api in Tasker to Control Lock](https://community.smartthings.com/t/using-st-api-in-tasker-to-control-lock/302428)

<div class="topic-metadata">

**Author:** [@rcbjr2](https://community.smartthings.com/u/rcbjr2)\
**Replies:** 9\
**Last updated:** [July 8, 2025, 7:37am UTC](https://community.smartthings.com/t/using-st-api-in-tasker-to-control-lock/302428 "2025-07-08T07:37:14Z")

</div>

I am trying to write a Tasker task to control a virtual lock I created with vEdge. A while back, one of the users here posted a lot of Tasker tasks that work using the ST Api to get Device IDs and to issue commands to th…

---

## [How to concatenate string](https://community.smartthings.com/t/how-to-concatenate-string/301234)

<div class="topic-metadata">

**Author:** [@findleybc](https://community.smartthings.com/u/findleybc)\
**Replies:** 2\
**Last updated:** [June 5, 2025, 5:43pm UTC](https://community.smartthings.com/t/how-to-concatenate-string/301234 "2025-06-05T17:43:16Z")

</div>

I need to send single parameter as a string to a virtual device that is a URL string plus the value of a slider in another device. I can’t figure out how to concatenate those two. Here’s what I have tried in the then: …

---

## [I want to create an automation that runs at most once a week](https://community.smartthings.com/t/i-want-to-create-an-automation-that-runs-at-most-once-a-week/300192)

<div class="topic-metadata">

**Author:** [@blueprint](https://community.smartthings.com/u/blueprint)\
**Replies:** 2\
**Last updated:** [May 28, 2025, 9:37pm UTC](https://community.smartthings.com/t/i-want-to-create-an-automation-that-runs-at-most-once-a-week/300192 "2025-05-28T21:37:39Z")

</div>

{ "name": "로청 자동화 테스트", "actions": \[ { "if": { "equals": { "left": { "device": { "devices": \[ …

---

## [422 Errors when Trying to Control Hood Fan Speed with Virtual Dimmer Switch](https://community.smartthings.com/t/422-errors-when-trying-to-control-hood-fan-speed-with-virtual-dimmer-switch/300773)

<div class="topic-metadata">

**Author:** [@alexj](https://community.smartthings.com/u/alexj)\
**Replies:** 5\
**Last updated:** [May 25, 2025, 8:52pm UTC](https://community.smartthings.com/t/422-errors-when-trying-to-control-hood-fan-speed-with-virtual-dimmer-switch/300773 "2025-05-25T20:52:57Z")

</div>

Hey there! I’m attempting to build a virtual dimmer switch that i can expose to HomeAssistant to control my Microwave Hood Fan Speed through automations. I.E, if the oven turns on, always turn on the fan etc. I’m making…

---

## [Help with basic Advanced Web App Query](https://community.smartthings.com/t/help-with-basic-advanced-web-app-query/300225)

<div class="topic-metadata">

**Author:** [@jmmarimon](https://community.smartthings.com/u/jmmarimon)\
**Replies:** 6\
**Last updated:** [May 13, 2025, 7:07am UTC](https://community.smartthings.com/t/help-with-basic-advanced-web-app-query/300225 "2025-05-13T07:07:03Z")

</div>

I am trying to make a very basic query on Advanced Web App Query for my Samsung Frame. I have read all the posts with a solution but nothing works… \[ { “command”: { “devices”: \[ “xxxx” \], “commands”: \[ { “compo…

---

## [\[apparent bug\] Using sunset/sunrise with the Rules](https://community.smartthings.com/t/apparent-bug-using-sunset-sunrise-with-the-rules/297607)

<div class="topic-metadata">

**Author:** [@7kcajoeb](https://community.smartthings.com/u/7kcajoeb)\
**Replies:** 10\
**Last updated:** [March 26, 2025, 10:29pm UTC](https://community.smartthings.com/t/apparent-bug-using-sunset-sunrise-with-the-rules/297607 "2025-03-26T22:29:28Z")

</div>

I have a few simple rules - turn on the exterior light(s) at sunset, turn them off at sunrise. For example: { "every": { "specific": { "reference": "Sunset", "offset": { "value": { …

---

## [Not sure this possible, complex rule](https://community.smartthings.com/t/not-sure-this-possible-complex-rule/295895)

<div class="topic-metadata">

**Author:** [@Kochman76](https://community.smartthings.com/u/Kochman76)\
**Replies:** 2\
**Last updated:** [February 22, 2025, 7:20am UTC](https://community.smartthings.com/t/not-sure-this-possible-complex-rule/295895 "2025-02-22T07:20:21Z")

</div>

I am new to custom rules. I have a door sensor that I would like to test if it has been open for more than 5 minutes and if someone changes the temperature to reset the temperature to a specific value after one minute. …

---

## [Please sovle my rule api problem](https://community.smartthings.com/t/please-sovle-my-rule-api-problem/293982)

<div class="topic-metadata">

**Author:** [@dheowjd1988](https://community.smartthings.com/u/dheowjd1988)\
**Replies:** 3\
**Last updated:** [January 20, 2025, 2:17pm UTC](https://community.smartthings.com/t/please-sovle-my-rule-api-problem/293982 "2025-01-20T14:17:26Z")

</div>

I’ve try to make rule api as below. But I just get error as “Error adding rule “Aqara H1”. 422 The request is malformed. then: Unrecognized field “then” (class v20190122.internal.st.behaviors.Action), not marked as ignor…

---

## [API keys stop working](https://community.smartthings.com/t/api-keys-stop-working/293871)

<div class="topic-metadata">

**Author:** [@Marko\_Herman](https://community.smartthings.com/u/Marko_Herman)\
**Replies:** 1\
**Last updated:** [January 18, 2025, 6:07pm UTC](https://community.smartthings.com/t/api-keys-stop-working/293871 "2025-01-18T18:07:34Z")

</div>

Hi I have 2 API keys for 2 different systems. One is working without issues for months and the other is making me troubles. I have to recreate it every 7 days. Than the POST call works again. I’m just calling a scene t…

---

## [Help with Rules API - Can't get to work even with sample rules](https://community.smartthings.com/t/help-with-rules-api-cant-get-to-work-even-with-sample-rules/286057)

<div class="topic-metadata">

**Author:** [@Krosta](https://community.smartthings.com/u/Krosta)\
**Replies:** 15\
**Last updated:** [January 18, 2025, 1:16am UTC](https://community.smartthings.com/t/help-with-rules-api-cant-get-to-work-even-with-sample-rules/286057 "2025-01-18T01:16:00Z")

</div>

Hello, I was trying to find out, what am I doing wrong, but even when I use sample rules, it just does not work for me. I am trying to do a rule to “copy” humidity value from air condition to virtual humidity sensor. B…

---

## [Getting 403 and 406 Errors with Smartthings Rules API and Postman](https://community.smartthings.com/t/getting-403-and-406-errors-with-smartthings-rules-api-and-postman/293504)

<div class="topic-metadata">

**Author:** [@Johnaand](https://community.smartthings.com/u/Johnaand)\
**Replies:** 8\
**Last updated:** [January 12, 2025, 1:30am UTC](https://community.smartthings.com/t/getting-403-and-406-errors-with-smartthings-rules-api-and-postman/293504 "2025-01-12T01:30:06Z")

</div>

I am brand new to the Rules API and until yesterday had never heard of Postman or JSON. I was able to successfully use the GET command to retrieve my Location and location ID as well as my total Device list. I have set u…

---

## [How to execute a scene from a rule?](https://community.smartthings.com/t/how-to-execute-a-scene-from-a-rule/230684)

<div class="topic-metadata">

**Author:** [@alex.49.98](https://community.smartthings.com/u/alex.49.98)\
**Replies:** 17\
**Last updated:** [January 7, 2025, 2:18am UTC](https://community.smartthings.com/t/how-to-execute-a-scene-from-a-rule/230684 "2025-01-07T02:18:54Z")

</div>

I found quite a number of examples how to create a JSON rule to run a command on a device which basically looks like that "command": { "devices": \[ "GUID" \], "comma…

---

## [I'm curious what the sequence is](https://community.smartthings.com/t/im-curious-what-the-sequence-is/292556)

<div class="topic-metadata">

**Author:** [@blueprint](https://community.smartthings.com/u/blueprint)\
**Replies:** 3\
**Last updated:** [December 24, 2024, 5:32pm UTC](https://community.smartthings.com/t/im-curious-what-the-sequence-is/292556 "2024-12-24T17:32:33Z")

</div>

I don’t know exactly what the sequence option in the rules API does. If someone knows, could you please explain it to me?

---

## [Handling Duplicate CodePins in the SmartThings Lock Codes API](https://community.smartthings.com/t/handling-duplicate-codepins-in-the-smartthings-lock-codes-api/291413)

<div class="topic-metadata">

**Author:** [@Yaroslav\_Mudryi](https://community.smartthings.com/u/Yaroslav_Mudryi)\
**Replies:** 8\
**Last updated:** [December 6, 2024, 7:37pm UTC](https://community.smartthings.com/t/handling-duplicate-codepins-in-the-smartthings-lock-codes-api/291413 "2024-12-06T19:37:01Z")

</div>

Hi SmartThings Community, I’m encountering an issue while setting lock codes using the SmartThings CLI and API. Here’s the situation: I use the following command to set a code for a specific slot: const command = { …

---

## [My routine isn't working properly, what's wrong?](https://community.smartthings.com/t/my-routine-isnt-working-properly-whats-wrong/289766)

<div class="topic-metadata">

**Author:** [@blueprint](https://community.smartthings.com/u/blueprint)\
**Replies:** 2\
**Last updated:** [October 29, 2024, 10:29pm UTC](https://community.smartthings.com/t/my-routine-isnt-working-properly-whats-wrong/289766 "2024-10-29T22:29:53Z")

</div>

{ "name": "직접 만든 데일리 루틴 테스트", "actions": \[ { "every": { "specific": { "daysOfWeek": \[ "Sun", "Mon", …

---

## [Update field with API call](https://community.smartthings.com/t/update-field-with-api-call/288997)

<div class="topic-metadata">

**Author:** [@Diego\_Vescovi](https://community.smartthings.com/u/Diego_Vescovi)\
**Replies:** 2\
**Last updated:** [October 13, 2024, 4:29pm UTC](https://community.smartthings.com/t/update-field-with-api-call/288997 "2024-10-13T16:29:27Z")

</div>

Hi all! I’m Diego and this is my first post! I have a Samsung EHS with MWR-WW10N cable command and the Samsung Wifi Kit. Could I change some values with the API? In the documentation I found the two values that I want t…

---

## [Rules API broken?](https://community.smartthings.com/t/rules-api-broken/282447)

<div class="topic-metadata">

**Author:** [@PWBarrett](https://community.smartthings.com/u/PWBarrett)\
**Replies:** 12\
**Last updated:** [September 24, 2024, 3:01pm UTC](https://community.smartthings.com/t/rules-api-broken/282447 "2024-09-24T15:01:08Z")

</div>

What worked for me a few weeks ago now returns a 403 forbidden error. All l want to do is execute a pre-existing rule. But even a GET to list my rules returns this error. I can still see them on the web. The devices …

[Next page](https://community.smartthings.com/c/developer-programs/rules-api/101.md?page=1)
