# update_agent_automation

Source: https://modulify.ai/docs/api/agent-automations/update-agent-automation

Changes the name, instruction or schedule of one agent automation, once the person has agreed to the preview.

- Title: Edit an agent automation
- Scope: `config:write`
- Access: Makes changes
- Endpoint: `POST /v1/update_agent_automation`

Only the person who set the automation up can change it, because its reports go to them. Only the fields you send change. Sending `schedule` replaces the whole schedule, including its `Timezone`, so a schedule sent without one moves the automation to UTC. A new schedule recomputes the next run, and runs cannot be closer together than 5 minutes. A run already going keeps the old instruction. See [Agents](https://modulify.ai/docs/automations/agents#change-one).

Call it first with `confirm` set to `false`, which returns the automation as it would be and changes nothing. Show that to the person, and call again with `confirm` set to `true` only after they agree. It is refused while the site is locked, and when Modulify switched the automation off.

## Request

Call it with a `POST` to `https://api.modulify.ai/v1/update_agent_automation`, sending the inputs below as a JSON object. The token needs the `config:write` scope.

It makes changes, so send an [Idempotency-Key](https://modulify.ai/docs/api/idempotency) header whenever you might retry it. A retry with the same key gets the first answer back instead of running again.

```bash
curl -X POST https://api.modulify.ai/v1/update_agent_automation \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"projectId":"PROJECT_ID","automationId":"AUTOMATION_ID"}'
```

Over MCP, the same method is the [update_agent_automation tool](https://modulify.ai/docs/mcp/agent-automations/update-agent-automation).

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `projectId` | string | Yes | The site id. |
| `automationId` | string | Yes | The automation id from `list_agent_automations`. |
| `name` | string | No | A new name, up to 64 characters. It cannot be empty. |
| `instruction` | string | No | A new instruction, up to 2,000 characters. It replaces the old one completely and cannot be empty. |
| `schedule` | object | No | A new schedule, in the same shape as for `create_agent_automation`. |
| `confirm` | boolean | No | `false` by default, which returns the preview. `true` saves the changes. |

## Response

Every call answers with the [JSON envelope](https://modulify.ai/docs/api/requests-and-responses#the-response) of `success`, `message`, `data`, `code` and `version`. `data` holds the result described above, and on a method that returns a total, `count` carries it. The [response headers](https://modulify.ai/docs/api/requests-and-responses#headers-on-every-method-call) carry the call's `X-Request-Id` and what is left of your per-minute budget in `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset`. [Errors](https://modulify.ai/docs/api/errors) explains every status code a call can answer with.