# Change an Instagram automation

`PATCH https://app.whatsetter.com/api/v1/instagram/automations/{id}`

Changes the fields you send, the others stay. `active: true` switches
it on (it then writes to real people; refused with `409
automation_conflict` like on create), `active: false` switches it
off. What the dashboard's editor sets beyond these fields (rotated
wordings, the e-mail ask, scripted steps, its follow-up, « Aussi sur
Facebook ») is kept. Its account never changes. Requires scope
`instagram:write`.

## Request body

| Field | Type | Required | Description |
|---|---|---|---|
| `account_id` | string | no | Create only: required when the workspace has several Instagram accounts. |
| `name` | string | no |  |
| `active` | boolean | no | true: it writes to real people from now on. |
| `trigger` | object | no |  |
| `public_replies` | array | no | Comments only: public replies under the comment, one picked each time. Empty = none. |
| `dm_message` | string | no | The private message people receive (one per comment |
| `link` | object,null | no | A link delivered as a card with a button once the person taps the button under the private message. null removes it. |
| `follow_gate` | object,null | no | Ask the person to follow the account before the link. null removes it. |
| `campaign_id` | string,null | no | The agent that continues (`GET /campaigns`, its `id` or `campaign_id`). Default: the account's own. |
| `ai_handoff` | boolean | no | The agent takes the conversation over after the automation. |

```json
{
  "active": false
}
```

## Example request

```bash
curl --request PATCH \
  --url 'https://app.whatsetter.com/api/v1/instagram/automations/{id}' \
  --header 'Authorization: Bearer ws_live_…'
  --header 'Content-Type: application/json' \
  --data '{"active":false}'
```

## Responses

### 200: Changed

```json
{
  "data": {
    "id": "",
    "account_id": "",
    "name": "",
    "active": false,
    "trigger": {
      "on": "comment",
      "posts": "",
      "keywords": [
        ""
      ],
      "any_word": false
    },
    "public_replies": [
      ""
    ],
    "dm_message": "",
    "link": {
      "url": "",
      "label": "",
      "ask_label": "",
      "title": ""
    },
    "follow_gate": {
      "message": "",
      "button_label": "",
      "success_message": ""
    },
    "campaign_id": "",
    "ai_handoff": false,
    "stats": {
      "fired": 0,
      "dms_sent": 0,
      "link_clicks": 0,
      "last_fired_at": ""
    },
    "created_at": ""
  }
}
```

### 401: Missing, unknown or revoked API key

```json
{
  "error": {
    "code": "",
    "message": ""
  }
}
```

### 403: The key lacks the required scope (`insufficient_scope`), the plan does not have this part of the API (`not_in_plan`), or Instagram is not enabled on the workspace (`instagram_not_enabled`, Instagram routes)

```json
{
  "error": {
    "code": "",
    "message": ""
  }
}
```

### 404: Resource not found in this workspace

```json
{
  "error": {
    "code": "",
    "message": ""
  }
}
```

### 409: `automation_conflict`, see createInstagramAutomation.

```json
{
  "error": {
    "code": "",
    "message": ""
  }
}
```

### 422: Invalid parameter or body (also an invalid or expired `cursor`)

```json
{
  "error": {
    "code": "",
    "message": ""
  }
}
```


Source: https://docs.whatsetter.com/api-reference/operations/updateinstagramautomation/
