> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Automation

> Partially update an automation's name, description, active status, triggers, or actions. Sending triggers or actions replaces the existing set atomically.

> [!NOTE]
>
> **Beta.** See the [Automations Overview](https://www.ayrshare.com/docs/apis/automations/overview.md) for the full feature description.

Partial update. Only the listed fields are editable; sending anything else (e.g. `platform`, `accountId`) is rejected as a validation error.

Sending `triggers` or `actions` **replaces** the existing children atomically: the old set is deleted and the new set is written in a single Firestore transaction. To change only one trigger, send the full new array.

Re-activating a previously-inactive automation (`active: true`) re-checks the active-cap. If the cap is already at the limit, the update fails with code `470` and no changes are made.

## Header Parameters

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

## Path Parameters

**id** `string` *required*

The automation ID returned from `POST /automations`.

## Body Parameters

**name** `string`

New name.

**description** `string`

New description.

**active** `boolean`

Toggle the automation on or off. Setting this from `false` to `true` re-checks the active automation cap.

**triggers** `array`

Full replacement set of triggers (1–50). Same shape as the create endpoint.

**actions** `array`

Full replacement set of actions (1–50). Same shape as the create endpoint.

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{
  "name": "Spring promo (updated)",
  "active": true,
  "actions": [
    {
      "type": "send_dm",
      "message": "Hey {{recipient_username}}! New link: https://example.com/spring"
    }
  ]
}' \
-X PUT https://api.ayrshare.com/api/automations/auto_9xKp2Lm4nQ
```

```javascript JavaScript theme={"system"}
const API_KEY = "API_KEY";
const id = "auto_9xKp2Lm4nQ";

fetch(`https://api.ayrshare.com/api/automations/${id}`, {
  method: "PUT",
  headers: {
    "Authorization": `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    name: "Spring promo (updated)",
    active: true,
    actions: [
      {
        type: "send_dm",
        message: "Hey {{recipient_username}}! New link: https://example.com/spring",
      },
    ],
  }),
})
  .then((res) => res.json())
  .then((json) => console.log(json))
  .catch(console.error);
```

```python Python theme={"system"}
import requests

headers = {
    "Authorization": "Bearer API_KEY",
    "Content-Type": "application/json",
}
automation_id = "auto_9xKp2Lm4nQ"

payload = {
    "name": "Spring promo (updated)",
    "active": True,
    "actions": [
        {
            "type": "send_dm",
            "message": "Hey {{recipient_username}}! New link: https://example.com/spring",
        }
    ],
}

r = requests.put(
    f"https://api.ayrshare.com/api/automations/{automation_id}",
    json=payload,
    headers=headers,
)

print(r.json())
```

```php PHP theme={"system"}
$id = "auto_9xKp2Lm4nQ";

$data = [
    "name" => "Spring promo (updated)",
    "active" => true,
    "actions" => [
        [
            "type" => "send_dm",
            "message" => "Hey {{recipient_username}}! New link: https://example.com/spring",
        ],
    ],
];

$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL => "https://api.ayrshare.com/api/automations/" . $id,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => "PUT",
    CURLOPT_POSTFIELDS => json_encode($data),
    CURLOPT_HTTPHEADER => [
        "Authorization: Bearer API_KEY",
        "Content-Type: application/json",
    ],
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

```json 200: Success theme={"system"}
{
  "status": "success",
  "id": "auto_9xKp2Lm4nQ"
}
```

```json 400: Validation failed — editing platform is not allowed theme={"system"}
{
  "action": "request",
  "status": "error",
  "code": 473,
  "message": "Validation failed. Please see: https://www.ayrshare.com/docs/introduction",
  "details": {
    "formErrors": ["Unrecognized key: \"platform\""],
    "fieldErrors": {}
  }
}
```

```json 404: Not found theme={"system"}
{
  "action": "automation",
  "status": "error",
  "code": 469,
  "message": "Automation not found"
}
```

```json 429: Cap reached on reactivation theme={"system"}
{
  "action": "automation",
  "status": "error",
  "code": 470,
  "message": "Active automation limit reached for your plan tier"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.