# PATCH /auto-schedules/:id

**Resource:** [Auto Schedules](./auto-schedules.md)  
**Scopes:** `schedules:write`  
**Write operation:** yes

Partial update -- modify any field. Accepts the same two schedule-input options as POST: either time_of_day (+ optional days_of_week) or cron_expression. If cron_expression is provided it takes precedence. Changing either schedule input or timezone automatically recomputes next_run_at.

## Parameters

| Name | In | Type | Required | Description |
|------|----|------|----------|-------------|
| `id` | path | uuid | yes | Auto schedule ID |
| `name` | body | string | no | Schedule name |
| `description` | body | string | no | Schedule description |
| `is_active` | body | boolean | no | Enable or disable the schedule |
| `time_of_day` | body | string | no | Update the firing time using "HH:MM" format. Server re-derives cron_expression. Use with optional days_of_week. |
| `days_of_week` | body | array | no | Array of integers 0-6. Used with time_of_day to update which days the schedule fires. |
| `cron_expression` | body | string | no | 5-field cron expression. Takes precedence over time_of_day if both are provided. |
| `timezone` | body | string | no | IANA timezone |
| `audience_type` | body | string | no | One of: users, tasks_by_assignee, contacts, deals |
| `audience_filter` | body | object | no | Audience-specific filter JSON |
| `automation_id` | body | uuid | no | Replace the linked automation |
| `end_at` | body | string | no | ISO timestamp after which the schedule stops firing (null to remove) |
| `max_runs` | body | number | no | Max fires before auto-deactivation (null to remove) |

## Request example

```bash
curl -X PATCH \
  "https://api.trustpager.com/functions/v1/api/v1/auto-schedules/SCHEDULE_ID" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"is_active": false}'
```

## Response example

```json
{
  "data": {
    "id": "a1b2c3d4-...",
    "name": "Daily Staff Digest",
    "is_active": false,
    "cron_expression": "0 9 * * 1-5",
    "timezone": "Australia/Sydney",
    "audience_type": "users",
    "audience_filter": {},
    "automation_id": "b2c3d4e5-...",
    "next_run_at": "2026-04-21T23:00:00+00:00",
    "last_run_at": null,
    "run_count": 0,
    "max_runs": null,
    "end_at": null,
    "created_at": "2026-04-19T10:00:00Z",
    "updated_at": "2026-04-19T10:30:00Z"
  },
  "meta": { "credits_remaining": 9987 }
}
```

---
Base URL: `https://api.trustpager.com/functions/v1/api/v1` — Auth: `Authorization: Bearer YOUR_API_KEY`