---
title: "Update an Automation"
method: PATCH
path: "/v1/automations/{id}"
tags: ["Automations"]
---

# Update an Automation

`PATCH /v1/automations/{id}`

Den schedules Automations and keeps durable run history. Automations created by Desktop run on the owner's connected desktop; Automations created by Web run in OpenWork Cloud. If no desktop runner is connected when a desktop occurrence is due, that occurrence is recorded as missed. Creation makes an Automation active immediately and uses the owner's current OpenWork Connect integrations. Deactivation stops future runs but does not cancel a run already in progress. Every behavior-changing edit creates an immutable revision and applies it to future runs immediately.

## Path parameters

- `id` string, required

## Request body

- object
  - `name` string
  - `instructions` string
  - `schedule` union
    - object
      - `kind` 'once', required
      - `timezone` string, required
      - `at` integer, required
    - object
      - `kind` 'daily', required
      - `timezone` string, required
      - `hour` integer, required
      - `minute` integer, required
    - object
      - `kind` 'weekly', required
      - `timezone` string, required
      - `daysOfWeek` integer[], required
      - `hour` integer, required
      - `minute` integer, required
  - `model` object
    - `providerId` string, required
    - `modelId` string, required
    - `variant` string, nullable
  - `action` union
    - object
      - `kind` 'agent', required
      - `instructions` string, required
      - `model` object, required
        - `providerId` string, required
        - `modelId` string, required
        - `variant` string, nullable
    - object
      - `kind` 'saved_script', required
      - `script` object, required
        - `pluginId` string, required
        - `configObjectId` string, required
        - `configObjectVersionId` string, required
      - `input` unknown
  - `executionTarget` 'desktop' | 'cloud'

## Response `200`

Automation updated.

- object
  - `automation` object, required
    - `id` string, required
    - `organizationId` string, required
    - `ownerMemberId` string, required
    - `name` string, required
    - `state` 'active' | 'inactive' | 'needs_attention' | 'archived', required
    - `currentRevisionId` string, required
    - `nextDueAt` integer, nullable, required
    - `latestRunAt` integer, nullable, required
    - `latestSuccessfulRunId` string, nullable
    - `latestSuccessfulResult` unknown
    - `needsAttentionReason` object, nullable, required
      - `code` 'owner_membership_lost' | 'model_access_lost' | 'provider_unavailable' | 'connect_access_unavailable' | 'execution_runtime_unavailable', required
      - `message` string, required
      - `occurredAt` integer, required
    - `createdAt` integer, required
    - `updatedAt` integer, required
    - `archivedAt` integer, nullable, required
  - `revision` object, required
    - `id` string, required
    - `automationId` string, required
    - `version` integer, required
    - `instructions` string, required
    - `schedule` union, required
      - object
        - `kind` 'once', required
        - `timezone` string, required
        - `at` integer, required
      - object
        - `kind` 'daily', required
        - `timezone` string, required
        - `hour` integer, required
        - `minute` integer, required
      - object
        - `kind` 'weekly', required
        - `timezone` string, required
        - `daysOfWeek` integer[], required
        - `hour` integer, required
        - `minute` integer, required
    - `model` object, required
      - `providerId` string, required
      - `modelId` string, required
      - `variant` string, nullable
    - `action` union
      - object
        - `kind` 'agent', required
        - `instructions` string, required
        - `model` object, required
          - `providerId` string, required
          - `modelId` string, required
          - `variant` string, nullable
      - object
        - `kind` 'saved_script', required
        - `script` object, required
          - `pluginId` string, required
          - `configObjectId` string, required
          - `configObjectVersionId` string, required
        - `input` unknown
    - `executionTarget` 'desktop' | 'cloud'
    - `maximumRuntimeMs` integer, required
    - `digest` string, required
    - `createdAt` integer, required
  - `latestRun` object, nullable, required
    - `id` string, required
    - `automationId` string, required
    - `revisionId` string, required
    - `trigger` 'scheduled' | 'recovery' | 'manual', required
    - `scheduledFor` integer, nullable, required
    - `idempotencyKey` string, required
    - `status` 'queued' | 'claimed' | 'running' | 'succeeded' | 'failed' | 'cancelled' | 'skipped', required
    - `leaseOwner` string, nullable, required
    - `leaseExpiresAt` integer, nullable, required
    - `heartbeatAt` integer, nullable, required
    - `attemptCount` integer, required
    - `executionTarget` 'desktop' | 'cloud', required
    - `executionThread` object, nullable, required
      - `id` string, required
      - `threadKind` 'automation', required
      - `executionLocation` 'desktop' | 'cloud', required
      - `automationId` string, required
      - `automationRunId` string, required
      - `engineKind` string, required
      - `nativeThreadId` string, nullable
      - `workspaceId` string, nullable
    - `providerId` string, required
    - `modelId` string, required
    - `modelVariant` string, nullable
    - `startedAt` integer, nullable, required
    - `finishedAt` integer, nullable, required
    - `error` object, nullable, required
      - `code` 'owner_membership_lost' | 'model_access_lost' | 'provider_unavailable' | 'connect_access_unavailable' | 'execution_runtime_unavailable' | 'execution_failed' | 'execution_timed_out' | 'runner_unavailable' | 'cancelled' | 'lease_lost' | 'internal_error', required
      - `message` string, required
      - `retryable` boolean, required
    - `resultSummary` string, nullable, required
    - `codemodeReceiptId` string, nullable
    - `validatedResult` unknown
    - `usage` object, required
      - `inputTokens` integer, nullable, required
      - `outputTokens` integer, nullable, required
      - `costMicros` integer, nullable, required
    - `createdAt` integer, required
    - `updatedAt` integer, required

## Other responses

- `400` — Invalid request.

## Changes

> 24 revisions in range; 5 could not be searched.

- **2026-08-12** `f973b1b5b4cf` — 1 breaking, 2 warning, 2 info
  - the `executionLocation` response property const value `desktop` was removed for the status `200`
  - added the new `cloud` enum value to the `latestRun/anyOf[subschema #1]/executionThread/anyOf[subschema #1]/executionLocation` response property for the response status `200`
  - added the new `desktop` enum value to the `latestRun/anyOf[subschema #1]/executionThread/anyOf[subschema #1]/executionLocation` response property for the response status `200`
  - added the optional property `latestRun/anyOf[subschema #1]/executionThread/anyOf[subschema #1]/nativeThreadId` to the response with the `200` status
  - …1 more
- **2026-08-11** `0d4ebf20cbde` — 3 breaking, 4 warning, 7 info
  - the response property `revision/executionTarget` became optional for the status `200`
  - the `executionTarget` response property const value `desktop` was removed for the status `200`
  - the `executionTarget` response property const value `desktop` was removed for the status `200`
  - added the new `cloud` enum value to the `latestRun/anyOf[subschema #1]/executionTarget` response property for the response status `200`
  - …10 more
- …earlier changes not shown

[Full history](https://skmtc.dev/openworklabs/apis/den-api/changes/v1/automations/:id/patch.md)

---

[API](https://skmtc.dev/openworklabs/apis/den-api.md) · [All operations](https://skmtc.dev/openworklabs/apis/den-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/openworklabs/den-api/revisions/fcbb34aa1702/schema)
