# Set DND

> Change a contact's Do-Not-Disturb for one direction.

Source: https://docs.mycrmsim.com/docs/contacts/set-contact-dnd

```http
PATCH https://backend.mysmsgateway.app/api/v1/ext/contacts/{id}/dnd
```

- Category: myCRMSIM Contacts / Contacts
- Auth: Bearer access token
- Scope: `contacts.write`

One call changes one direction. `enable_all` / `disable_all` set or clear DND on every channel; `enable_specific` adds the named `channels` (and narrows an "all channels" DND to just those); `disable_specific` removes them. Automations that trigger on **Contact Updated** run when the settings actually change, as in the dashboard. The response is the contact's full DND afterwards.

## Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `id` | path | number | yes | The contact id. Example: `1234` |
| `direction` | body | enum | yes | Which direction to change. One of: `outbound`, `inbound`. Example: `outbound` |
| `status` | body | enum | yes | What to do. One of: `enable_all`, `enable_specific`, `disable_all`, `disable_specific`. Example: `enable_specific` |
| `channels` | body | array<string> | no | For `enable_specific` / `disable_specific`: any of sms, whatsapp, imessage, rcs (or a comma-separated string). Example: `["sms","whatsapp"]` |

## Request body

```json
{
  "direction": "outbound",
  "status": "enable_specific",
  "channels": [
    "sms",
    "whatsapp"
  ]
}
```

## Response 200

OK — the contact's DND now

```json
{
  "success": true,
  "message": "Contact DND updated",
  "data": {
    "contact_id": 1234,
    "workspace_id": 7,
    "dnd": {
      "outbound": {
        "all": false,
        "channels": [
          "sms",
          "whatsapp"
        ]
      },
      "inbound": {
        "all": false,
        "channels": []
      }
    }
  }
}
```

## Response 400

Bad direction, status or channel

```json
{
  "success": false,
  "message": "channels is required for enable_specific."
}
```

## Response 401

Missing or invalid token

```json
{
  "success": false,
  "message": "Invalid or expired access token."
}
```

## Response 403

Missing scope

```json
{
  "success": false,
  "message": "Missing scope(s): contacts.write. This integration was granted: …"
}
```

## Response 404

Contact does not exist or is not owned by the installer (same response for both)

```json
{
  "success": false,
  "message": "Contact not found or not accessible to this token"
}
```
