Andres Ferro
07/01/2025, 9:10 PMMarvin
07/01/2025, 9:10 PMKevin Grismore
07/01/2025, 9:11 PMMarvin
07/01/2025, 9:11 PMpython
import requests
PREFECT_API_KEY = "your-api-key"
PREFECT_API_URL = "<https://api.prefect.cloud/api/accounts/{account_id}/workspaces/{workspace_id}/flow_runs>"
headers = {
"Authorization": f"Bearer {PREFECT_API_KEY}",
"Content-Type": "application/json"
}
payload = {
"deployment_id": "your-deployment-id",
# Optional parameters
"state": {
"type": "SCHEDULED",
"name": "Scheduled"
}
}
response = <http://requests.post|requests.post>(PREFECT_API_URL, json=payload, headers=headers)
A few important points:
- This functionality is available in the free tier
- You'll need to replace the placeholder values:
- `{account_id}`: Your Prefect Cloud account ID
- `{workspace_id}`: Your workspace ID
- `your-api-key`: An API key generated from your Prefect Cloud account
- `your-deployment-id`: The ID of the deployment you want to run
You can find your account ID and workspace ID in the URL when you're logged into the Prefect Cloud UI, and you can generate an API key in the Cloud UI under Settings → API Keys.
For more details and the complete API reference, you can check the REST API documentation.