# Update a workflow's name, description or enabled switch

> Source: https://elaichi.ai/docs/api-reference/workflows/automation/updateautomation/

`PATCH /automation/{id}`

Resource: **Workflow** · API: **Workflows**

## Path parameters

- **`id`** _(string, required)_
  Resource id

## Request body

- **`name`** _(string)_
- **`description`** _(string)_
- **`enabled`** _(boolean)_

## Response body

- **`id`** _(string)_
- **`owner_user_id`** _(string)_
- **`name`** _(string)_
- **`description`** _(string)_
- **`status`** _(string)_
  Allowed: `draft`, `active`, `disabled`, `paused`
- **`paused_reason`** _(string,null)_
- **`enabled`** _(boolean)_
- **`draft_revision`** _(integer)_
- **`draft_step_count`** _(integer)_
- **`draft_tier`** _(string,null)_
- **`draft_updated_at`** _(string)_
- **`draft_updated_by`** _(string,null)_
- **`published_version_id`** _(string,null)_
- **`published_version_number`** _(integer,null)_
- **`published_at`** _(string,null)_
- **`published_tier`** _(string,null)_
- **`published_revision`** _(integer,null)_
- **`trigger_summary`** _(object)_
  - **`manual_count`** _(integer)_
  - **`cron_count`** _(integer)_
- **`run_summary`** _(unknown)_
- **`run_summary_updated_at`** _(string,null)_
- **`attention`** _(object,null)_
- **`engine_config_rev`** _(integer)_
- **`engine_synced_rev`** _(integer)_
- **`created_at`** _(string)_
- **`updated_at`** _(string)_
- **`can_use`** _(boolean)_
- **`can_share`** _(boolean)_
- **`can_manage`** _(boolean)_
- **`can_transfer`** _(boolean)_
- **`can_revoke_share`** _(boolean)_
- **`can_see_shares`** _(boolean)_
- **`can_run`** _(boolean)_
- **`can_publish`** _(boolean)_
- **`publish_requires`** _(object)_
  - **`permission`** _(string,null)_
  - **`blocked_reason`** _(string,null)_
- **`owner_display_name`** _(string,null)_
- **`owner_avatar_url`** _(string,null)_
  The person's picture: their stored profile picture, else a Gravatar URL (`d=404`, 96px) derived from their email (the address itself is not sent), else null. Draw initials when it is null or the image fails to load.
- **`access_via`** _(string)_
- **`access_summary`** _(unknown)_
- **`glance`** _(object)_
  Absent when the caller is below `use` access (run history is what the runs tab shows) or while it is not known yet.
  - **`apps`** _(array<object>)_
    Connected apps the live version uses (the draft, if never published), most-used first.
    - **`connector_id`** _(string)_
    - **`name`** _(string)_
    - **`icon_url`** _(string,null)_
  - **`apps_more`** _(integer)_
    Apps beyond `apps`.
  - **`run_history`** _(array<object>)_
    Runs per UTC day by the day each was queued, oldest first, ending today. Dry runs excluded.
    - **`day`** _(string)_
    - **`succeeded`** _(integer)_
    - **`failed`** _(integer)_
    - **`other`** _(integer)_
      Canceled, skipped or still going.
- **`draft`** _(object)_
  - **`definition`** _(unknown)_
  - **`definition_valid`** _(boolean)_
  - **`revision`** _(integer)_
  - **`updated_at`** _(string)_
  - **`updated_by`** _(string,null)_
  - **`updated_via`** _(string,null)_
    Where the last draft edit came from.
    Allowed: `console`, `agent`, `mcp`, `api`, `null`
  - **`updated_client`** _(string,null)_
    The MCP client that made the last edit, when `updated_via` is `mcp`.
  - **`updated_by_name`** _(string,null)_
- **`draft_changes`** _(object)_
  - **`count`** _(integer)_
  - **`more`** _(integer)_
    Changes beyond the listed `items`.
  - **`ever_published`** _(boolean)_
    False until a first publish; there is nothing to compare against before then.
  - **`items`** _(array<object>)_
    - **`change`** _(string)_
      Allowed: `added`, `changed`, `removed`
    - **`area`** _(string)_
    - **`key`** _(string,null)_
    - **`label`** _(string)_
    - **`words`** _(string)_
  - **`step_marks`** _(unknown)_
    Per step key: added or changed, for the diagram.
  - **`removed_steps`** _(array<unknown>)_
    Steps the draft no longer has, with where they were.
- **`can_discard_draft`** _(boolean)_
  The caller may throw the draft away and go back to the live version.
- **`can_agent_edit`** _(boolean)_
  The in-app Agent can edit this workflow for the caller.
- **`agent_edit_blocked_by`** _(string,null)_
  Why the Agent cannot edit it, for a caller who otherwise could. Null when available, or when the caller cannot edit at all.
  Allowed: `assistant_disabled`, `llm_not_configured`, `not_permitted`, `null`
- **`published_version`** _(unknown)_
- **`labels`** _(object)_
  - **`toolboxes`** _(unknown)_
  - **`steps`** _(unknown)_
- **`stats`** _(object)_
  The same 14 days as `glance.run_history`. Absent below `use` access, or when the run history is not known.
  - **`runs_14d`** _(integer)_
  - **`success_rate_14d`** _(number,null)_
    Succeeded / (succeeded + failed) over the same 14 days; null when none finished.
  - **`waiting_count`** _(integer)_
    Pending approvals: runs parked on a person.
  - **`oldest_waiting_at`** _(string,null)_
  - **`next_run_at`** _(string,null)_
- **`engine`** _(object)_
  - **`next_run_at`** _(string,null)_
  - **`active_runs`** _(integer)_
  - **`queued_runs`** _(integer)_
  - **`in_sync`** _(boolean)_

## Code examples

### curl

```bash
curl -X PATCH 'https://api.elaichi.ai/automation/<id>' \
  -H 'Authorization: Bearer $ELAICHI_API_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{"name":"your_name","description":"your_description","enabled":true}'
```

### JavaScript

```javascript
const body = {
  "name": "your_name",
  "description": "your_description",
  "enabled": true
};

const response = await fetch('https://api.elaichi.ai/automation/<id>', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer ' + process.env.ELAICHI_API_TOKEN,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import os
import requests

url = "https://api.elaichi.ai/automation/<id>"
headers = {
    "Authorization": f"Bearer {os.environ['ELAICHI_API_TOKEN']}",
    "Content-Type": "application/json",
}
payload = {
    "name": "your_name",
    "description": "your_description",
    "enabled": True
}

response = requests.patch(url, headers=headers, json=payload)
print(response.json())
```
