---
title: "create mqtt trigger"
method: POST
path: "/w/{workspace}/mqtt_triggers/create"
tags: ["mqtt_trigger"]
---

# create mqtt trigger

`POST /w/{workspace}/mqtt_triggers/create`

## Path parameters

- `workspace` string, required

## Request body

- NewMqttTrigger
  - `mqtt_resource_path` string, required — Path to the MQTT resource containing broker connection configuration
  - `subscribe_topics` MqttSubscribeTopic[], required — Array of MQTT topics to subscribe to, each with topic name and QoS level
    - `qos` 'qos0' | 'qos1' | 'qos2', required
    - `topic` string, required
  - `client_id` string, nullable — MQTT client ID for this connection
  - `v3_config` MqttV3Config
    - `clean_session` boolean
  - `v5_config` MqttV5Config
    - `clean_start` boolean
    - `topic_alias_maximum` number
    - `session_expiry_interval` number
  - `client_version` 'v3' | 'v5'
  - `path` string, required — The unique Windmill path for this trigger. Must be of the form `u/<user>/<path>` or `f/<folder>/<path>`. This is the trigger object path, not the HTTP route path.
  - `script_path` string, required — Path to the script or flow to execute when a message is received
  - `is_flow` boolean, required — True if script_path points to a flow, false if it points to a script
  - `mode` 'enabled' | 'disabled' | 'suspended' — job trigger mode
  - `error_handler_path` string — Path to a script or flow to run when the triggered job fails
  - `error_handler_args` ScriptArgs — The arguments to pass to the script or flow
  - `retry` Retry — unresolved $ref
  - `permissioned_as` string — The user or group this trigger runs as. Used during deployment to preserve the original trigger owner.
  - `preserve_permissioned_as` boolean — When true and the caller is a member of the 'wm_deployers' group, preserves the original permissioned_as value instead of overwriting it.
  - `labels` string[]

## Response `201`

mqtt trigger created

---

[API](https://skmtc.net/windmill/apis/windmill-api.md) · [All operations](https://skmtc.net/windmill/apis/windmill-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/windmill/windmill-api/revisions/a7f071808448/schema)
