---
title: "Execute a Rule"
method: POST
path: "/rules/execute/{ruleId}"
tags: ["Rules"]
---

# Execute a Rule

`POST /rules/execute/{ruleId}`

## Request

- Base URL: `https://api.smartthings.com/v1`
- URL: `https://api.smartthings.com/v1/rules/execute/{ruleId}`
- Auth: OAuth 2
  - Implicit: `https://auth-global.api.smartthings.com`
  - Scopes: `x:rules:*`
- TypeScript: <https://skmtc.dev/smartthings/apis/smartthings-api/docs/rules/execute/:ruleId/post.ts> (a function with typed inputs; its response is checked against the schema)

Trigger Rule execution for a specified user.

## Response `200`

Successfully Executed

- RuleExecutionResponse: The result of a execution
  - `executionId` string, ^(?:([0-9a-fA-F]{32})|([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}))$, required
  - `id` string, ^(?:([0-9a-fA-F]{32})|([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}))$, required
  - `result` 'Success' | 'Failure' | 'Ignored', required
  - `actions` ActionExecutionResult[]
    - `actionId` string, ^(?:([0-9a-fA-F]{32})|([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}))$, required
    - `if` IfActionExecutionResult: The result of a if action execution
      - `result` 'True' | 'False', required
    - `location` LocationActionExecutionResult: The result of a location action execution
      - `result` 'Success' | 'Failure' | 'Ignored', required
      - `locationId` string, ^(?:([0-9a-fA-F]{32})|([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}))$, required: Location ID for location actions
      - `mode` string
      - `security` SecurityState
        - `armState` 'ArmedStay' | 'ArmedAway' | 'Disarmed', required
        - `monitoring` boolean
    - `command` CommandActionExecutionResult[]
      - `result` 'Success' | 'Failure' | 'Offline', required
      - `deviceId` string, ^(?:([0-9a-fA-F]{32})|([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}))$, required: Device ID for device actions
      - `component` string
      - `capability` string
      - `command` string
      - `arguments` object[]
    - `sleep` SleepActionExecutionResult: The result of a sleep action execution
      - `result` 'Success' | 'Failure' | 'Ignored', required
    - `behavior` BehaviorAbnormalExecutionResult: reason for an abnormal execution. e.g. rate limiting
      - `result` 'Success' | 'Failure' | 'Ignored', required
      - `reason` string

## Other responses

- `401`: Not authenticated
- `403`: Not authorized or not found
- `default`: Unexpected error

---

[API](https://skmtc.dev/smartthings/apis/smartthings-api.md) - [All operations](https://skmtc.dev/smartthings/apis/smartthings-api/llms.txt) - [OpenAPI document](https://skmtc.dev/smartthings/apis/smartthings-api/revisions/2788a4236800?raw)
