Arno Burnuk
08/20/2025, 8:15 PMMarvin
08/20/2025, 8:15 PMArno Burnuk
08/20/2025, 8:22 PMMarvin
08/20/2025, 8:31 PMmsg
) in the request body.
Option A: Direct REST API (authenticated)
- You’ll need:
- Prefect Cloud API key
- Your account_id and workspace_id
- The deployment_id (or the flow/deployment name to look it up)
1) If you already know the deployment_id:
curl -X POST "<https://api.prefect.cloud/api/accounts/ACCOUNT_ID/workspaces/WORKSPACE_ID/deployments/DEPLOYMENT_ID/create_flow_run>" \
-H "Authorization: Bearer PREFECT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"parameters": {"msg": "hello"}}'
2) If you only know the name (FLOW_NAME/DEPLOYMENT_NAME), look up the deployment_id then trigger:
# Look up deployment by name
DEPLOYMENT_ID=$(curl -s \
-H "Authorization: Bearer PREFECT_API_KEY" \
"<https://api.prefect.cloud/api/accounts/ACCOUNT_ID/workspaces/WORKSPACE_ID/deployments/name/FLOW_NAME/DEPLOYMENT_NAME>" \
| jq -r '.id')
# Trigger a flow run with parameters
curl -X POST "<https://api.prefect.cloud/api/accounts/ACCOUNT_ID/workspaces/WORKSPACE_ID/deployments/$DEPLOYMENT_ID/create_flow_run>" \
-H "Authorization: Bearer PREFECT_API_KEY" \
-H "Content-Type: application/json" \
-d '{"parameters": {"msg": "hello"}}'
Notes:
- Your flow should accept a parameter named msg
(e.g., @flow def my_flow(msg: str): ...
).
- The response includes the new flow_run.id
, which you can use to monitor status in the UI or via API.
- API reference: Create a flow run from a deployment
Option B: Webhook + Automation (no API key on caller)
If you prefer a “webhook-style” URL to POST to (useful for external systems), you can:
1) Create a Cloud Webhook (gets you a unique URL)
- CLI help: prefect cloud webhook --help
2) Create an Automation in Prefect Cloud: Trigger “On webhook event” -> Action “Run a deployment”
3) Map the incoming JSON’s msg
field to the deployment parameter msg
in the Automation’s parameter mapping.
Docs:
- Webhooks and automations: Create deployment triggers with automations
- Connecting to Cloud / API keys: Connect to Prefect Cloud
Want me to tailor the exact curl command for your setup? Share:
- Your flow/deployment name (e.g., AgentFlow/prod
)
- The parameter name(s) you expect (looks like msg
)
- Whether you want to use the direct API or a webhook URL
I’ll fill in the placeholders and produce a ready-to-run snippet.