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

# Archive an Automation

> 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. Durable run history is retained.



## OpenAPI

````yaml /openapi.json delete /v1/automations/{id}
openapi: 3.1.0
info:
  title: Den API
  description: >-
    OpenAPI spec for the Den control plane API.


    Authentication:

    - Use `Authorization: Bearer <session-token>` for user-authenticated routes
    that require a Den session.

    - Use `x-api-key: <den-api-key>` for API-key-authenticated routes that
    accept organization API keys.

    - Public routes like health and documentation do not require authentication.


    Swagger tip: use the security schemes in the Authorize dialog to set either
    `bearerAuth` or `denApiKey` before trying protected endpoints.
  version: dev
servers:
  - url: http://api.den.local
security: []
tags:
  - name: System
    description: Service health and operational routes.
  - name: Organizations
    description: Top-level organization creation and context routes.
  - name: Invitations
    description: Invitation preview, acceptance, creation, and cancellation routes.
  - name: API Keys
    description: Organization API key management routes.
  - name: SCIM
    description: Organization SCIM connector management routes.
  - name: SSO
    description: Organization single sign-on connector management routes.
  - name: Members
    description: Organization member management routes.
  - name: Roles
    description: Organization custom role management routes.
  - name: Teams
    description: Organization team management routes.
  - name: Templates
    description: Organization shared template routes.
  - name: LLM Providers
    description: Organization LLM provider catalog, configuration, and access routes.
  - name: Workers
    description: Worker lifecycle, billing, and runtime routes.
  - name: Worker Runtime
    description: Worker runtime inspection and upgrade routes.
  - name: Worker Activity
    description: Worker heartbeat and activity reporting routes.
  - name: Telemetry
    description: Telemetry event ingestion and adoption analytics.
  - name: Admin
    description: Administrative reporting routes.
  - name: Users
    description: Current user and membership routes.
  - name: Bootstrap
    description: Agent-first provisional workspace setup routes.
paths:
  /v1/automations/{id}:
    delete:
      tags:
        - Automations
      summary: Archive an Automation
      description: >-
        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. Durable run history is
        retained.
      operationId: archiveAutomation
      parameters:
        - in: path
          name: id
          schema:
            type: string
            minLength: 1
            maxLength: 160
          required: true
      responses:
        '200':
          description: Automation archived.
          content:
            application/json:
              schema:
                type: object
                properties:
                  automation:
                    type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 160
                      organizationId:
                        type: string
                        minLength: 1
                        maxLength: 160
                      ownerMemberId:
                        type: string
                        minLength: 1
                        maxLength: 160
                      name:
                        type: string
                        minLength: 1
                        maxLength: 120
                      state:
                        type: string
                        enum:
                          - active
                          - inactive
                          - needs_attention
                          - archived
                      currentRevisionId:
                        type: string
                        minLength: 1
                        maxLength: 160
                      nextDueAt:
                        anyOf:
                          - type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          - type: 'null'
                      latestRunAt:
                        anyOf:
                          - type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          - type: 'null'
                      latestSuccessfulRunId:
                        anyOf:
                          - type: string
                            minLength: 1
                            maxLength: 160
                          - type: 'null'
                      latestSuccessfulResult: {}
                      needsAttentionReason:
                        anyOf:
                          - type: object
                            properties:
                              code:
                                type: string
                                enum:
                                  - owner_membership_lost
                                  - model_access_lost
                                  - provider_unavailable
                                  - connect_access_unavailable
                                  - execution_runtime_unavailable
                              message:
                                type: string
                                minLength: 1
                                maxLength: 2000
                              occurredAt:
                                type: integer
                                minimum: 0
                                maximum: 9007199254740991
                            required:
                              - code
                              - message
                              - occurredAt
                          - type: 'null'
                      createdAt:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                      updatedAt:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                      archivedAt:
                        anyOf:
                          - type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          - type: 'null'
                    required:
                      - id
                      - organizationId
                      - ownerMemberId
                      - name
                      - state
                      - currentRevisionId
                      - nextDueAt
                      - latestRunAt
                      - needsAttentionReason
                      - createdAt
                      - updatedAt
                      - archivedAt
                  revision:
                    type: object
                    properties:
                      id:
                        type: string
                        minLength: 1
                        maxLength: 160
                      automationId:
                        type: string
                        minLength: 1
                        maxLength: 160
                      version:
                        type: integer
                        exclusiveMinimum: 0
                        maximum: 9007199254740991
                      instructions:
                        type: string
                        minLength: 1
                        maxLength: 100000
                      schedule:
                        oneOf:
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: once
                              timezone:
                                type: string
                                minLength: 1
                                maxLength: 120
                              at:
                                type: integer
                                minimum: 0
                                maximum: 9007199254740991
                            required:
                              - kind
                              - timezone
                              - at
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: daily
                              timezone:
                                type: string
                                minLength: 1
                                maxLength: 120
                              hour:
                                type: integer
                                minimum: 0
                                maximum: 23
                              minute:
                                type: integer
                                minimum: 0
                                maximum: 59
                            required:
                              - kind
                              - timezone
                              - hour
                              - minute
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: weekly
                              timezone:
                                type: string
                                minLength: 1
                                maxLength: 120
                              daysOfWeek:
                                minItems: 1
                                maxItems: 7
                                type: array
                                items:
                                  type: integer
                                  minimum: 0
                                  maximum: 6
                              hour:
                                type: integer
                                minimum: 0
                                maximum: 23
                              minute:
                                type: integer
                                minimum: 0
                                maximum: 59
                            required:
                              - kind
                              - timezone
                              - daysOfWeek
                              - hour
                              - minute
                      model:
                        type: object
                        properties:
                          providerId:
                            type: string
                            minLength: 1
                            maxLength: 160
                          modelId:
                            type: string
                            minLength: 1
                            maxLength: 160
                          variant:
                            anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 60
                              - type: 'null'
                        required:
                          - providerId
                          - modelId
                      action:
                        oneOf:
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: agent
                              instructions:
                                type: string
                                minLength: 1
                                maxLength: 100000
                              model:
                                type: object
                                properties:
                                  providerId:
                                    type: string
                                    minLength: 1
                                    maxLength: 160
                                  modelId:
                                    type: string
                                    minLength: 1
                                    maxLength: 160
                                  variant:
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 60
                                      - type: 'null'
                                required:
                                  - providerId
                                  - modelId
                            required:
                              - kind
                              - instructions
                              - model
                            additionalProperties: false
                          - type: object
                            properties:
                              kind:
                                type: string
                                const: saved_script
                              script:
                                type: object
                                properties:
                                  pluginId:
                                    type: string
                                    minLength: 1
                                    maxLength: 160
                                  configObjectId:
                                    type: string
                                    minLength: 1
                                    maxLength: 160
                                  configObjectVersionId:
                                    type: string
                                    minLength: 1
                                    maxLength: 160
                                required:
                                  - pluginId
                                  - configObjectId
                                  - configObjectVersionId
                                additionalProperties: false
                              input: {}
                            required:
                              - kind
                              - script
                            additionalProperties: false
                      executionTarget:
                        type: string
                        enum:
                          - desktop
                          - cloud
                      maximumRuntimeMs:
                        type: integer
                        minimum: 10000
                        maximum: 3600000
                      digest:
                        type: string
                        minLength: 16
                        maxLength: 128
                      createdAt:
                        type: integer
                        minimum: 0
                        maximum: 9007199254740991
                    required:
                      - id
                      - automationId
                      - version
                      - instructions
                      - schedule
                      - model
                      - maximumRuntimeMs
                      - digest
                      - createdAt
                  latestRun:
                    anyOf:
                      - type: object
                        properties:
                          id:
                            type: string
                            minLength: 1
                            maxLength: 160
                          automationId:
                            type: string
                            minLength: 1
                            maxLength: 160
                          revisionId:
                            type: string
                            minLength: 1
                            maxLength: 160
                          trigger:
                            type: string
                            enum:
                              - scheduled
                              - recovery
                              - manual
                          scheduledFor:
                            anyOf:
                              - type: integer
                                minimum: 0
                                maximum: 9007199254740991
                              - type: 'null'
                          idempotencyKey:
                            type: string
                            minLength: 1
                            maxLength: 512
                          status:
                            type: string
                            enum:
                              - queued
                              - claimed
                              - running
                              - succeeded
                              - failed
                              - cancelled
                              - skipped
                          leaseOwner:
                            anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 240
                              - type: 'null'
                          leaseExpiresAt:
                            anyOf:
                              - type: integer
                                minimum: 0
                                maximum: 9007199254740991
                              - type: 'null'
                          heartbeatAt:
                            anyOf:
                              - type: integer
                                minimum: 0
                                maximum: 9007199254740991
                              - type: 'null'
                          attemptCount:
                            type: integer
                            minimum: 0
                            maximum: 2
                          executionTarget:
                            type: string
                            enum:
                              - desktop
                              - cloud
                          executionThread:
                            anyOf:
                              - type: object
                                properties:
                                  id:
                                    type: string
                                    minLength: 1
                                    maxLength: 160
                                  threadKind:
                                    type: string
                                    const: automation
                                  executionLocation:
                                    type: string
                                    enum:
                                      - desktop
                                      - cloud
                                  automationId:
                                    type: string
                                    minLength: 1
                                    maxLength: 160
                                  automationRunId:
                                    type: string
                                    minLength: 1
                                    maxLength: 160
                                  engineKind:
                                    type: string
                                    minLength: 1
                                    maxLength: 160
                                  nativeThreadId:
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 160
                                      - type: 'null'
                                  workspaceId:
                                    anyOf:
                                      - type: string
                                        minLength: 1
                                        maxLength: 160
                                      - type: 'null'
                                required:
                                  - id
                                  - threadKind
                                  - executionLocation
                                  - automationId
                                  - automationRunId
                                  - engineKind
                              - type: 'null'
                          providerId:
                            type: string
                            minLength: 1
                            maxLength: 160
                          modelId:
                            type: string
                            minLength: 1
                            maxLength: 160
                          modelVariant:
                            default: null
                            anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 60
                              - type: 'null'
                          startedAt:
                            anyOf:
                              - type: integer
                                minimum: 0
                                maximum: 9007199254740991
                              - type: 'null'
                          finishedAt:
                            anyOf:
                              - type: integer
                                minimum: 0
                                maximum: 9007199254740991
                              - type: 'null'
                          error:
                            anyOf:
                              - type: object
                                properties:
                                  code:
                                    type: string
                                    enum:
                                      - 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
                                  message:
                                    type: string
                                    minLength: 1
                                    maxLength: 2000
                                  retryable:
                                    type: boolean
                                required:
                                  - code
                                  - message
                                  - retryable
                              - type: 'null'
                          resultSummary:
                            anyOf:
                              - type: string
                                maxLength: 20000
                              - type: 'null'
                          codemodeReceiptId:
                            anyOf:
                              - type: string
                                minLength: 1
                                maxLength: 160
                              - type: 'null'
                          validatedResult: {}
                          usage:
                            type: object
                            properties:
                              inputTokens:
                                anyOf:
                                  - type: integer
                                    minimum: 0
                                    maximum: 9007199254740991
                                  - type: 'null'
                              outputTokens:
                                anyOf:
                                  - type: integer
                                    minimum: 0
                                    maximum: 9007199254740991
                                  - type: 'null'
                              costMicros:
                                anyOf:
                                  - type: integer
                                    minimum: 0
                                    maximum: 9007199254740991
                                  - type: 'null'
                            required:
                              - inputTokens
                              - outputTokens
                              - costMicros
                          createdAt:
                            type: integer
                            minimum: 0
                            maximum: 9007199254740991
                          updatedAt:
                            type: integer
                            minimum: 0
                            maximum: 9007199254740991
                        required:
                          - id
                          - automationId
                          - revisionId
                          - trigger
                          - scheduledFor
                          - idempotencyKey
                          - status
                          - leaseOwner
                          - leaseExpiresAt
                          - heartbeatAt
                          - attemptCount
                          - executionTarget
                          - executionThread
                          - providerId
                          - modelId
                          - startedAt
                          - finishedAt
                          - error
                          - resultSummary
                          - usage
                          - createdAt
                          - updatedAt
                      - type: 'null'
                required:
                  - automation
                  - revision
                  - latestRun
        '404':
          description: Not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundError'
components:
  schemas:
    NotFoundError:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
      required:
        - error

````