---
title: "Update command definition"
method: PATCH
path: "/api/v2/devices/{id}/commands/{commandId}"
tags: ["Commands"]
---

# Update command definition

`PATCH /api/v2/devices/{id}/commands/{commandId}`

## Request

- Base URL: `https://api.chirpwireless.io`
- URL: `https://api.chirpwireless.io/api/v2/devices/{id}/commands/{commandId}`
- Auth: API key in header `X-API-Key` and API key in header `X-Organization-Id`

Replace an existing command definition on a digital device.

**Required scope:** `commands:write`

## Path parameters

- `id` string, required
- `commandId` string, required

## Request body

- object
  - `organizationId` string, required: Organization ID
  - `command` object, required: Full command definition (replaces the existing one).
    - `name` string, required
    - `description` string
    - `mode` 'direct' | 'encoded', required
    - `verificationStrategy` 'no_verification' | 'wait_next_uplink' | 'query_after_ack', required

## Response `200`

Command updated (HTTP 200)

- Command: A command definition stored under a digital device.
  - `id` string
  - `name` string
  - `description` string
  - `mode` 'direct' | 'encoded'
  - `paramsSchema` object: Per-parameter JSON Schema subset, keyed by parameter name.
  - `encodedParamsTemplate` object
  - `directPayload` string
  - `customEncoder` string
  - `fPort` integer
  - `mqttTopic` string
  - `confirmed` boolean
  - `verificationStrategy` 'no_verification' | 'wait_next_uplink' | 'query_after_ack'
  - `queryCommandId` string
  - `expectedSensorStates` object[]
    - `sensorId` string
    - `valueTemplate` string
  - `convergenceTimeout` integer
  - `suitableAsQuery` boolean
  - `createdAt` string, date-time
  - `updatedAt` string, date-time

## Other responses

- `401`: Missing or invalid API key
- `403`: Insufficient permissions (missing required scope)

---

[API](https://skmtc.dev/chirpwireless/apis/chirp-public-api.md) · [All operations](https://skmtc.dev/chirpwireless/apis/chirp-public-api/llms.txt) · [OpenAPI document](https://skmtc.dev/chirpwireless/apis/chirp-public-api/revisions/0414f3e239ff?raw)
