---
title: "Update a Comment to DM rule"
method: PATCH
path: "/v1/comment-dm-rules/{id}"
---

# Update a Comment to DM rule

`PATCH /v1/comment-dm-rules/{id}`

## Request

- Base URL: `https://api.breakreach.com`
- URL: `https://api.breakreach.com/v1/comment-dm-rules/{id}`
- Auth: HTTP bearer

Only the fields given change. active false pauses the rule; mediaId null makes it watch every post.

## Path parameters

- `id` string, required

## Request body

- CommentDmRuleInput
  - `accountId` string: Instagram account or Facebook Page id from /v1/accounts (create only, a rule can't change account)
  - `mediaId` string, nullable: Instagram or Facebook post id to watch (from /v1/comment-dm-rules/media or the postId of /v1/comments). Omit or null for every post
  - `postId` string: Instead of mediaId: a Breakreach post id published on this account
  - `keywords` string[]: Words or phrases that trigger the DM, case and accents ignored. Empty = every comment
  - `match` 'contains' | 'exact': contains = the keyword appears as a whole word or phrase; exact = the comment is just the keyword (punctuation and emoji around it ignored)
  - `dmText` string: The DM sent to the commenter, links allowed. {username} becomes their @handle on Instagram, their first name on Facebook. Required on create
  - `publicReplies` string[]: Optional public replies under the comment once the DM is sent, one picked at random. {username} becomes their @handle on Instagram, their first name on Facebook
  - `active` boolean
  - `workspace` string

## Response `200`

Updated

- object
  - `rule` CommentDmRule, required
    - `id` string, required
    - `accountId` string, required
    - `platform` 'instagram' | 'facebook', required
    - `account` object
      - `displayName` string
      - `avatarUrl` string, nullable
    - `mediaId` string, nullable, required: The Instagram or Facebook post the rule watches; null = every post of the account
    - `media` object, nullable, required
      - `caption` string
      - `thumbnailUrl` string, nullable
      - `permalink` string, nullable
      - `timestamp` string, date-time, nullable
    - `keywords` string[], required: Empty = every comment triggers the rule
    - `match` 'contains' | 'exact', required
    - `dmText` string, required
    - `publicReplies` string[], required
    - `active` boolean, required
    - `stats` object, required
      - `triggered` integer
      - `sent` integer
      - `failed` integer
    - `lastTriggeredAt` string, date-time, nullable, required
    - `createdAt` string, date-time, required
    - `updatedAt` string, date-time, required

## Other responses

- `400`: Invalid field
- `401`: Missing, invalid or expired API key
- `402`: No active Breakreach subscription or trial
- `403`: Not a member of the requested workspace
- `404`: Rule or workspace not found

---

[API](https://skmtc.dev/breakreach/apis/breakreach-api.md) · [All operations](https://skmtc.dev/breakreach/apis/breakreach-api/llms.txt) · [OpenAPI document](https://skmtc.dev/breakreach/apis/breakreach-api/revisions/290d285f8d73?raw)
