Prefect Managed Automations API

The Managed Automations API from Prefect — 6 operation(s) for managed automations.

OpenAPI Specification

prefect-managed-automations-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Prefect Cloud Account Billing Managed Automations API
  description: Prefect Cloud REST API documentation.
  version: 0.8.4
tags:
- name: Managed Automations
paths:
  /api/accounts/{account_id}/workspaces/{workspace_id}/automations/managed/:
    get:
      tags:
      - Managed Automations
      summary: List Managed Automations
      operationId: list_managed_automations_api_accounts__account_id__workspaces__workspace_id__automations_managed__get
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: workspace_id
        in: path
        required: true
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Workspace Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ManagedAutomationResponse'
                title: Response List Managed Automations Api Accounts  Account Id  Workspaces  Workspace Id  Automations Managed  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/workspaces/{workspace_id}/automations/managed/{automation_type}:
    put:
      tags:
      - Managed Automations
      summary: Create Or Update Managed Automation
      operationId: create_or_update_managed_automation_api_accounts__account_id__workspaces__workspace_id__automations_managed__automation_type__put
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: workspace_id
        in: path
        required: true
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Workspace Id
      - name: automation_type
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ManagedAutomationType'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Body_create_or_update_managed_automation_api_accounts__account_id__workspaces__workspace_id__automations_managed__automation_type__put'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ManagedAutomationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
    delete:
      tags:
      - Managed Automations
      summary: Delete Managed Automation
      operationId: delete_managed_automation_api_accounts__account_id__workspaces__workspace_id__automations_managed__automation_type__delete
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      - name: workspace_id
        in: path
        required: true
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Workspace Id
      - name: automation_type
        in: path
        required: true
        schema:
          $ref: '#/components/schemas/ManagedAutomationType'
      responses:
        '204':
          description: Successful Response
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/workspaces/{workspace_id}/automations/managed/types:
    get:
      tags:
      - Managed Automations
      summary: List Managed Automation Types
      operationId: list_managed_automation_types_api_accounts__account_id__workspaces__workspace_id__automations_managed_types_get
      parameters:
      - name: workspace_id
        in: path
        required: true
        schema:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Workspace Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ManagedAutomationTypeResponse'
                title: Response List Managed Automation Types Api Accounts  Account Id  Workspaces  Workspace Id  Automations Managed Types Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/managed-automations/:
    get:
      tags:
      - Managed Automations
      summary: List Managed Automations By Workspace
      operationId: list_managed_automations_by_workspace_api_accounts__account_id__managed_automations__get
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/WorkspaceManagedAutomationsResponse'
                title: Response List Managed Automations By Workspace Api Accounts  Account Id  Managed Automations  Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/managed-automations:
    delete:
      tags:
      - Managed Automations
      summary: Delete All Managed Automations
      operationId: delete_all_managed_automations_api_accounts__account_id__managed_automations_delete
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
  /api/accounts/{account_id}/managed-automations/quick-enable:
    post:
      tags:
      - Managed Automations
      summary: Quick Enable Managed Automations
      description: 'Enable all managed automations across every workspace in the account.


        Currently enables zombie-cleanup and stuck-cancelling with their default

        settings. Enqueues a fan-out docket task; individual workspaces are

        processed asynchronously.'
      operationId: quick_enable_managed_automations_api_accounts__account_id__managed_automations_quick_enable_post
      parameters:
      - name: account_id
        in: path
        required: true
        schema:
          type: string
          format: uuid
          title: Account Id
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    RunDeployment:
      properties:
        type:
          type: string
          const: run-deployment
          title: Type
          default: run-deployment
        source:
          type: string
          enum:
          - selected
          - inferred
          title: Source
          description: Whether this Action applies to a specific selected deployment (given by `deployment_id`), or to a deployment that is inferred from the triggering event.  If the source is 'inferred', the `deployment_id` may not be set.  If the source is 'selected', the `deployment_id` must be set.
          default: selected
        deployment_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Deployment Id
          description: The identifier of the deployment
        parameters:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Parameters
          description: The parameters to pass to the deployment, or None to use the deployment's default parameters
        job_variables:
          anyOf:
          - additionalProperties: true
            type: object
          - type: 'null'
          title: Job Variables
          description: The job variables to pass to the created flow run, or None to use the deployment's default job variables
        schedule_after:
          type: number
          title: Schedule After
          description: The amount of time to wait before running the deployment. Defaults to running the deployment immediately.
          default: 0.0
      type: object
      title: RunDeployment
      description: Runs the given deployment with the given parameters
    ResumeSchedule:
      properties:
        type:
          type: string
          const: resume-schedule-for-flow-run
          title: Type
          default: resume-schedule-for-flow-run
        deployment_id:
          type: string
          format: uuid
          title: Deployment Id
          description: The identifier of the deployment
        schedule_id:
          type: string
          format: uuid
          title: Schedule Id
          description: The identifier of the schedule
      type: object
      required:
      - deployment_id
      - schedule_id
      title: ResumeSchedule
      description: Resumes the given schedule
    SendEmailNotification:
      properties:
        type:
          type: string
          const: send-email-notification
          title: Type
          default: send-email-notification
        block_document_id:
          type: string
          format: uuid
          title: Block Document Id
          description: The identifier of the notification block to use
        subject:
          type: string
          title: Subject
          default: Prefect automated notification
        body:
          type: string
          title: Body
          description: The text of the notification to send
        emails:
          items:
            type: string
            format: email
          type: array
          title: Emails
          description: The email addresses to send the notification to
      type: object
      required:
      - body
      - emails
      title: SendEmailNotification
      description: Send an email notification when an Automation is triggered
    ResumeAutomation:
      properties:
        type:
          type: string
          const: resume-automation
          title: Type
          default: resume-automation
        source:
          type: string
          enum:
          - selected
          - inferred
          title: Source
          description: Whether this Action applies to a specific selected automation (given by `automation_id`), or to an automation that is inferred from the triggering event.  If the source is 'inferred', the `automation_id` may not be set.  If the source is 'selected', the `automation_id` must be set.
          default: selected
        automation_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Automation Id
          description: The identifier of the automation to act on
      type: object
      title: ResumeAutomation
      description: Resumes a Work Queue
    PauseScheduleForFlowRun:
      properties:
        type:
          type: string
          const: pause-schedule-for-flow-run
          title: Type
          default: pause-schedule-for-flow-run
        deployment_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Deployment Id
          description: The identifier of the deployment
        schedule_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Schedule Id
          description: The identifier of the schedule
      type: object
      title: PauseScheduleForFlowRun
      description: Pauses the schedule for a flow run associated with the trigger
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
            - type: string
            - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
      - loc
      - msg
      - type
      title: ValidationError
    EventTrigger:
      properties:
        type:
          type: string
          const: event
          title: Type
          default: event
        id:
          type: string
          format: uuid
          title: Id
          description: The unique ID of this trigger
        match:
          anyOf:
          - $ref: '#/components/schemas/ResourceSpecification'
          - additionalProperties:
              anyOf:
              - type: string
              - items:
                  type: string
                type: array
            type: object
          title: Match
          description: Labels for resources which this trigger will match.
        match_related:
          anyOf:
          - $ref: '#/components/schemas/ResourceSpecification'
          - additionalProperties:
              anyOf:
              - type: string
              - items:
                  type: string
                type: array
            type: object
          - items:
              anyOf:
              - $ref: '#/components/schemas/ResourceSpecification'
              - additionalProperties:
                  anyOf:
                  - type: string
                  - items:
                      type: string
                    type: array
                type: object
            type: array
          title: Match Related
          description: Labels for related resources which this trigger will match.
        after:
          items:
            type: string
          type: array
          uniqueItems: true
          title: After
          description: The event(s) which must first been seen to fire this trigger.  If empty, then fire this trigger immediately.  Events may include trailing wildcards, like `prefect.flow-run.*`
        expect:
          items:
            type: string
          type: array
          uniqueItems: true
          title: Expect
          description: The event(s) this trigger is expecting to see.  If empty, this trigger will match any event.  Events may include trailing wildcards, like `prefect.flow-run.*`
        for_each:
          items:
            type: string
          type: array
          uniqueItems: true
          title: For Each
          description: 'Evaluate the trigger separately for each distinct value of these labels on the resource.  By default, labels refer to the primary resource of the triggering event.  You may also refer to labels from related resources by specifying `related:<role>:<label>`.  This will use the value of that label for the first related resource in that role.  For example, `"for_each": ["related:flow:prefect.resource.id"]` would evaluate the trigger for each flow.'
        posture:
          type: string
          enum:
          - Reactive
          - Proactive
          title: Posture
          description: The posture of this trigger, either Reactive or Proactive.  Reactive triggers respond to the _presence_ of the expected events, while Proactive triggers respond to the _absence_ of those expected events.
        threshold:
          type: integer
          title: Threshold
          description: The number of events required for this trigger to fire (for Reactive triggers), or the number of events expected (for Proactive triggers)
          default: 1
        within:
          type: number
          title: Within
          description: The time period over which the events must occur.  For Reactive triggers, this may be as low as 0 seconds, but must be at least 10 seconds for Proactive triggers
          default: 0.0
      type: object
      required:
      - posture
      title: EventTrigger
      description: 'A trigger that fires based on the presence or absence of events within a given

        period of time.'
    MetricTrigger-Output:
      properties:
        type:
          type: string
          const: metric
          title: Type
          default: metric
        id:
          type: string
          format: uuid
          title: Id
          description: The unique ID of this trigger
        match:
          anyOf:
          - $ref: '#/components/schemas/ResourceSpecification'
          - additionalProperties:
              anyOf:
              - type: string
              - items:
                  type: string
                type: array
            type: object
          title: Match
          description: Labels for resources which this trigger will match.
        match_related:
          anyOf:
          - $ref: '#/components/schemas/ResourceSpecification'
          - additionalProperties:
              anyOf:
              - type: string
              - items:
                  type: string
                type: array
            type: object
          - items:
              anyOf:
              - $ref: '#/components/schemas/ResourceSpecification'
              - additionalProperties:
                  anyOf:
                  - type: string
                  - items:
                      type: string
                    type: array
                type: object
            type: array
          title: Match Related
          description: Labels for related resources which this trigger will match.
        posture:
          type: string
          const: Metric
          title: Posture
          description: Periodically evaluate the configured metric query.
          default: Metric
        metric:
          $ref: '#/components/schemas/MetricTriggerQuery'
          description: 'The metric query to evaluate for this trigger. '
      type: object
      required:
      - metric
      title: MetricTrigger
      description: A trigger that fires based on the results of a metric query.
    ManagedAutomationType:
      type: string
      enum:
      - zombie-cleanup
      - stuck-cancelling
      title: ManagedAutomationType
    ChangeFlowRunState:
      properties:
        type:
          type: string
          const: change-flow-run-state
          title: Type
          default: change-flow-run-state
        force:
          type: boolean
          title: Force
          description: Force the state change, bypassing orchestration rules
          default: false
        name:
          anyOf:
          - type: string
          - type: 'null'
          title: Name
          description: The name of the state to change the flow run to
        state:
          $ref: '#/components/schemas/StateType'
          description: The type of the state to change the flow run to
        message:
          anyOf:
          - type: string
          - type: 'null'
          title: Message
          description: An optional message to associate with the state change
      type: object
      required:
      - state
      title: ChangeFlowRunState
      description: Changes the state of a flow run associated with the trigger
    WorkspaceManagedAutomationsResponse:
      properties:
        workspace_id:
          type: string
          format: uuid
          title: Workspace Id
        workspace_name:
          type: string
          title: Workspace Name
        workspace_handle:
          type: string
          title: Workspace Handle
        automations:
          items:
            $ref: '#/components/schemas/WorkspaceAutomationSummary'
          type: array
          title: Automations
      type: object
      required:
      - workspace_id
      - workspace_name
      - workspace_handle
      - automations
      title: WorkspaceManagedAutomationsResponse
    CancelFlowRun:
      properties:
        type:
          type: string
          const: cancel-flow-run
          title: Type
          default: cancel-flow-run
        force:
          type: boolean
          title: Force
          description: Force the state change, bypassing orchestration rules
          default: false
      type: object
      title: CancelFlowRun
      description: Cancels a flow run associated with the trigger
    SequenceTrigger-Output:
      properties:
        type:
          type: string
          const: sequence
          title: Type
          default: sequence
        id:
          type: string
          format: uuid
          title: Id
          description: The unique ID of this trigger
        triggers:
          items:
            anyOf:
            - $ref: '#/components/schemas/EventTrigger'
            - $ref: '#/components/schemas/MetricTrigger-Output'
            - $ref: '#/components/schemas/CompoundTrigger-Output'
            - $ref: '#/components/schemas/SequenceTrigger-Output'
          type: array
          title: Triggers
        within:
          anyOf:
          - type: number
          - type: 'null'
          title: Within
      type: object
      required:
      - triggers
      - within
      title: SequenceTrigger
      description: 'A composite trigger that requires some number of triggers to have fired

        within the given time period in a specific order'
    CallWebhook:
      properties:
        type:
          type: string
          const: call-webhook
          title: Type
          default: call-webhook
        block_document_id:
          type: string
          format: uuid
          title: Block Document Id
          description: The identifier of the webhook block to use
        payload:
          type: string
          title: Payload
          description: An optional templatable payload to send when calling the webhook.
          default: ''
      type: object
      required:
      - block_document_id
      title: CallWebhook
      description: Call a webhook when an Automation is triggered.
    PauseDeployment:
      properties:
        type:
          type: string
          const: pause-deployment
          title: Type
          default: pause-deployment
        source:
          type: string
          enum:
          - selected
          - inferred
          title: Source
          description: Whether this Action applies to a specific selected deployment (given by `deployment_id`), or to a deployment that is inferred from the triggering event.  If the source is 'inferred', the `deployment_id` may not be set.  If the source is 'selected', the `deployment_id` must be set.
          default: selected
        deployment_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Deployment Id
          description: The identifier of the deployment
      type: object
      title: PauseDeployment
      description: Pauses the given Deployment
    SlaViolation:
      properties:
        type:
          type: string
          const: sla-violation
          title: Type
          default: sla-violation
        source:
          type: string
          const: inferred
          title: Source
          default: inferred
        deployment_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Deployment Id
          description: The identifier of the deployment
        sla_severity:
          type: string
          enum:
          - minor
          - low
          - moderate
          - high
          - critical
          title: Sla Severity
          default: high
        sla_payload:
          additionalProperties:
            anyOf:
            - type: string
            - type: boolean
            - type: integer
            - type: number
          type: object
          title: Sla Payload
          default: {}
      type: object
      title: SlaViolation
      description: Base class for actions that operate on SLA violations
    CompoundTrigger-Output:
      properties:
        type:
          type: string
          const: compound
          title: Type
          default: compound
        id:
          type: string
          format: uuid
          title: Id
          description: The unique ID of this trigger
        triggers:
          items:
            anyOf:
            - $ref: '#/components/schemas/EventTrigger'
            - $ref: '#/components/schemas/MetricTrigger-Output'
            - $ref: '#/components/schemas/CompoundTrigger-Output'
            - $ref: '#/components/schemas/SequenceTrigger-Output'
          type: array
          title: Triggers
        within:
          anyOf:
          - type: number
          - type: 'null'
          title: Within
        require:
          anyOf:
          - type: integer
          - type: string
            enum:
            - any
            - all
          title: Require
      type: object
      required:
      - triggers
      - within
      - require
      title: CompoundTrigger
      description: 'A composite trigger that requires some number of triggers to have

        fired within the given time period'
    SendNotification:
      properties:
        type:
          type: string
          const: send-notification
          title: Type
          default: send-notification
        block_document_id:
          type: string
          format: uuid
          title: Block Document Id
          description: The identifier of the notification block to use
        subject:
          type: string
          title: Subject
          default: Prefect automated notification
        body:
          type: string
          title: Body
          description: The text of the notification to send
      type: object
      required:
      - block_document_id
      - body
      title: SendNotification
      description: Send a notification when an Automation is triggered
    ManagedAutomationTypeResponse:
      properties:
        type:
          $ref: '#/components/schemas/ManagedAutomationType'
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
        defaults:
          additionalProperties: true
          type: object
          title: Defaults
        settings_schema:
          additionalProperties: true
          type: object
          title: Settings Schema
      type: object
      required:
      - type
      - name
      - description
      - defaults
      - settings_schema
      title: ManagedAutomationTypeResponse
    PauseWorkPool:
      properties:
        type:
          type: string
          const: pause-work-pool
          title: Type
          default: pause-work-pool
        source:
          type: string
          enum:
          - selected
          - inferred
          title: Source
          description: Whether this Action applies to a specific selected work pool (given by `work_pool_id`), or to a work pool that is inferred from the triggering event.  If the source is 'inferred', the `work_pool_id` may not be set.  If the source is 'selected', the `work_pool_id` must be set.
          default: selected
        work_pool_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Work Pool Id
          description: The identifier of the work pool to pause
      type: object
      title: PauseWorkPool
      description: Pauses a Work Pool
    SendPrefectNotification:
      properties:
        type:
          type: string
          const: prefect-notification
          title: Type
          default: prefect-notification
        notification_type:
          type: string
          title: Notification Type
          description: The type of notification to emit
        message:
          type: string
          title: Message
          description: The message to emit
      type: object
      required:
      - notification_type
      - message
      title: SendPrefectNotification
    ResourceSpecification:
      additionalProperties:
        anyOf:
        - type: string
        - items:
            type: string
          type: array
      type: object
      title: ResourceSpecification
      description: 'A specification that may match zero, one, or many resources, used to target or

        select a set of resources in a query or automation.  A resource must match at least

        one value of all of the provided labels'
    MetricTriggerQuery:
      properties:
        name:
          $ref: '#/components/schemas/PrefectMetric'
          description: The name of the metric to query.
        threshold:
          type: number
          title: Threshold
          description: The threshold value against which we'll compare the query result.
        operator:
          $ref: '#/components/schemas/MetricTriggerOperator'
          description: The comparative operator (LT / LTE / GT / GTE) used to compare the query result against the threshold value.
        range:
          type: number
          title: Range
          description: The lookback duration (seconds) for a metric query. This duration is used to determine the time range over which the query will be executed. The minimum value is 300 seconds (5 minutes).
          default: 300.0
        firing_for:
          type: number
          title: Firing For
          description: The duration (seconds) for which the metric query must breach or resolve continuously before the state is updated and the automation is triggered. The minimum value is 300 seconds (5 minutes).
          default: 300.0
      type: object
      required:
      - name
      - threshold
      - operator
      title: MetricTriggerQuery
      description: 'Defines a subset of the Trigger subclass, which is specific

        to Metric automations, that specify the query configurations

        and breaching conditions for the Automation'
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    WorkspaceAutomationSummary:
      properties:
        type:
          $ref: '#/components/schemas/ManagedAutomationType'
        enabled:
          type: boolean
          title: Enabled
      type: object
      required:
      - type
      - enabled
      title: WorkspaceAutomationSummary
    ResumeWorkQueue:
      properties:
        type:
          type: string
          const: resume-work-queue
          title: Type
          default: resume-work-queue
        source:
          type: string
          enum:
          - selected
          - inferred
          title: Source
          description: Whether this Action applies to a specific selected work queue (given by `work_queue_id`), or to a work queue that is inferred from the triggering event.  If the source is 'inferred', the `work_queue_id` may not be set.  If the source is 'selected', the `work_queue_id` must be set.
          default: selected
        work_queue_id:
          anyOf:
          - type: string
            format: uuid
          - type: 'null'
          title: Work Queue Id
          description: The identifier of the work queue to pause
      type: object
      title: ResumeWorkQueue
      description: Resumes a Work Queue
    ? Body_create_or_update_managed_automation_api_accounts__account_id__workspaces__workspace_id__automations_managed__automation_type__put
    : properties:
        enabled:
          type: boolean
          title: Enabled
          default: true
        settings:
          additionalProperties: true
          type: object
          title: Settings
      type: object
      title:

# --- truncated at 32 KB (45 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/prefect/refs/heads/main/openapi/prefect-managed-automations-api-openapi.yml