Prefect SLAs API
The SLAs API from Prefect — 9 operation(s) for slas.
The SLAs API from Prefect — 9 operation(s) for slas.
openapi: 3.1.0
info:
title: Prefect Cloud Account Billing SLAs API
description: Prefect Cloud REST API documentation.
version: 0.8.4
tags:
- name: SLAs
paths:
/api/accounts/{account_id}/workspaces/{workspace_id}/slas/:
post:
tags:
- SLAs
summary: Create Sla
operationId: create_sla_api_accounts__account_id__workspaces__workspace_id__slas__post
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
requestBody:
required: true
content:
application/json:
schema:
anyOf:
- $ref: '#/components/schemas/TimeToCompletionSla'
- $ref: '#/components/schemas/FrequencySla'
- $ref: '#/components/schemas/FreshnessSla'
- $ref: '#/components/schemas/LatenessSla'
title: Sla
responses:
'201':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceLevelAgreement'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/slas/apply-resource-slas/{resource_id}:
post:
tags:
- SLAs
summary: Apply Slas
operationId: apply_slas_api_accounts__account_id__workspaces__workspace_id__slas_apply_resource_slas__resource_id__post
parameters:
- name: workspace_id
in: path
required: true
schema:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Workspace Id
- name: resource_id
in: path
required: true
schema:
type: string
title: Resource Id
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
requestBody:
required: true
content:
application/json:
schema:
type: array
items:
anyOf:
- $ref: '#/components/schemas/TimeToCompletionSla'
- $ref: '#/components/schemas/FrequencySla'
- $ref: '#/components/schemas/FreshnessSla'
- $ref: '#/components/schemas/LatenessSla'
title: Slas
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: object
additionalProperties:
type: array
items:
$ref: '#/components/schemas/ServiceLevelAgreement'
title: Response Apply Slas Api Accounts Account Id Workspaces Workspace Id Slas Apply Resource Slas Resource Id Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/slas/filter:
post:
tags:
- SLAs
summary: Read Slas
operationId: read_slas_api_accounts__account_id__workspaces__workspace_id__slas_filter_post
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: sort
in: query
required: false
schema:
$ref: '#/components/schemas/SlaSort'
default: NAME_ASC
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Body_read_slas_api_accounts__account_id__workspaces__workspace_id__slas_filter_post'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ServiceLevelAgreement'
title: Response Read Slas Api Accounts Account Id Workspaces Workspace Id Slas Filter Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/slas/by-owner/{owner_resource}:
post:
tags:
- SLAs
summary: Read Slas By Owner Resource
operationId: read_slas_by_owner_resource_api_accounts__account_id__workspaces__workspace_id__slas_by_owner__owner_resource__post
parameters:
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
- name: workspace_id
in: path
required: true
schema:
type: string
format: uuid
title: Workspace Id
- name: owner_resource
in: path
required: true
schema:
type: string
title: Owner Resource
- name: sort
in: query
required: false
schema:
$ref: '#/components/schemas/SlaSort'
default: NAME_ASC
requestBody:
content:
application/json:
schema:
$ref: '#/components/schemas/Body_read_slas_by_owner_resource_api_accounts__account_id__workspaces__workspace_id__slas_by_owner__owner_resource__post'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/ServiceLevelAgreement'
title: Response Read Slas By Owner Resource Api Accounts Account Id Workspaces Workspace Id Slas By Owner Owner Resource Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/slas/{sla_id}:
get:
tags:
- SLAs
summary: Read Sla
operationId: read_sla_api_accounts__account_id__workspaces__workspace_id__slas__sla_id__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
- name: sla_id
in: path
required: true
schema:
type: string
format: uuid
title: Sla Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceLevelAgreement'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
patch:
tags:
- SLAs
summary: Update Sla
operationId: update_sla_api_accounts__account_id__workspaces__workspace_id__slas__sla_id__patch
parameters:
- name: workspace_id
in: path
required: true
schema:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Workspace Id
- name: sla_id
in: path
required: true
schema:
type: string
format: uuid
title: Sla Id
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ServiceLevelAgreementPartialUpdate'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: boolean
title: Response Update Sla Api Accounts Account Id Workspaces Workspace Id Slas Sla Id Patch
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
tags:
- SLAs
summary: Delete Sla
operationId: delete_sla_api_accounts__account_id__workspaces__workspace_id__slas__sla_id__delete
parameters:
- name: workspace_id
in: path
required: true
schema:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Workspace Id
- name: sla_id
in: path
required: true
schema:
type: string
format: uuid
title: Sla Id
- 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: boolean
title: Response Delete Sla Api Accounts Account Id Workspaces Workspace Id Slas Sla Id Delete
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/slas/flow-runs:
post:
tags:
- SLAs
summary: Read Flow Runs
description: "Read all flow runs that have an SLA violation event within the given horizon.\n\nArgs:\n sla_ids (list[UUID]): The IDs of the SLAs to read flow runs for.\n since (datetime): The date to read flow runs since.\n workspace_id (UUID, optional): The ID of the workspace to read flow runs for. Defaults to Path(...).\n account_id (UUID, optional): The ID of the account to read flow runs for. Defaults to Path(...).\n client (AsyncClient, optional): The ClickHouse client to use. Defaults to Depends(clickhouse_client).\n\nReturns:\n Sequence[str]: _description_"
operationId: read_flow_runs_api_accounts__account_id__workspaces__workspace_id__slas_flow_runs_post
parameters:
- name: workspace_id
in: path
required: true
schema:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Workspace Id
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Body_read_flow_runs_api_accounts__account_id__workspaces__workspace_id__slas_flow_runs_post'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: array
items:
type: string
title: Response Read Flow Runs Api Accounts Account Id Workspaces Workspace Id Slas Flow Runs Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/slas/default:
post:
tags:
- SLAs
summary: Create Default Sla
operationId: create_default_sla_api_accounts__account_id__workspaces__workspace_id__slas_default_post
parameters:
- name: workspace_id
in: path
required: true
schema:
type: string
format: uuid
title: Workspace Id
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/Body_create_default_sla_api_accounts__account_id__workspaces__workspace_id__slas_default_post'
responses:
'201':
description: Successful Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Automation'
title: Response Create Default Sla Api Accounts Account Id Workspaces Workspace Id Slas Default Post
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/slas/default/list:
get:
tags:
- SLAs
summary: Read Default Sla List
operationId: read_default_sla_list_api_accounts__account_id__workspaces__workspace_id__slas_default_list_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:
type: string
format: uuid
title: Workspace Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
type: array
items:
$ref: '#/components/schemas/Automation'
title: Response Read Default Sla List Api Accounts Account Id Workspaces Workspace Id Slas Default List Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/api/accounts/{account_id}/workspaces/{workspace_id}/slas/default/{sla_severity}:
get:
tags:
- SLAs
summary: Read Default Sla
operationId: read_default_sla_api_accounts__account_id__workspaces__workspace_id__slas_default__sla_severity__get
parameters:
- name: sla_severity
in: path
required: true
schema:
$ref: '#/components/schemas/SlaSeverity'
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
- name: workspace_id
in: path
required: true
schema:
type: string
format: uuid
title: Workspace Id
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/Automation'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
tags:
- SLAs
summary: Delete Default Sla
operationId: delete_default_sla_api_accounts__account_id__workspaces__workspace_id__slas_default__sla_severity__delete
parameters:
- name: sla_severity
in: path
required: true
schema:
$ref: '#/components/schemas/SlaSeverity'
- name: workspace_id
in: path
required: true
schema:
type: string
format: uuid
title: Workspace Id
- name: account_id
in: path
required: true
schema:
type: string
format: uuid
title: Account Id
responses:
'200':
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.'
Body_create_default_sla_api_accounts__account_id__workspaces__workspace_id__slas_default_post:
properties:
sla_severities:
items:
$ref: '#/components/schemas/SlaSeverity'
type: array
title: Sla Severities
block_id:
type: string
format: uuid
title: Block Id
type: object
required:
- sla_severities
- block_id
title: Body_create_default_sla_api_accounts__account_id__workspaces__workspace_id__slas_default_post
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.
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
TimeToCompletionSla:
properties:
name:
type: string
maxLength: 5000
title: Name
description: The name of this SLA
severity:
$ref: '#/components/schemas/SlaSeverity'
description: The severity of the SLA
default: high
enabled:
anyOf:
- type: boolean
- type: 'null'
title: Enabled
description: Whether this SLA will be evaluated
owner_resource:
anyOf:
- type: string
maxLength: 5000
- type: 'null'
title: Owner Resource
description: The resource that owns this SLA
duration:
type: integer
title: Duration
description: The maximum flow run duration in seconds allowed before the SLA is violated.
additionalProperties: false
type: object
required:
- name
- duration
title: TimeToCompletionSla
description: An SLA that triggers when a flow run takes longer than the specified duration.
FreshnessSla:
properties:
name:
type: string
maxLength: 5000
title: Name
description: The name of this SLA
severity:
$ref: '#/components/schemas/SlaSeverity'
description: The severity of the SLA
default: high
enabled:
anyOf:
- type: boolean
- type: 'null'
title: Enabled
description: Whether this SLA will be evaluated
owner_resource:
anyOf:
- type: string
maxLength: 5000
- type: 'null'
title: Owner Resource
description: The resource that owns this SLA
within:
type: number
title: Within
description: The amount of time after a flow run is considered stale.
resource_match:
additionalProperties:
anyOf:
- type: string
- items:
type: string
type: array
type: object
title: Resource Match
description: The resource to match for this SLA
expected_event:
type: string
maxLength: 5000
title: Expected Event
description: The event that is expected to occur within the specified time window.
additionalProperties: false
type: object
required:
- name
- within
- resource_match
- expected_event
title: FreshnessSla
description: An SLA that triggers when a flow run is stale.
AutomationFilterTags:
properties:
operator:
$ref: '#/components/schemas/prefect_cloud__orion__schemas__filters__Operator'
description: Operator for combining filter criteria. Defaults to 'and_'.
default: and_
all_:
anyOf:
- items:
type: string
# --- truncated at 32 KB (70 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/prefect/refs/heads/main/openapi/prefect-slas-api-openapi.yml