Chris Sankat
10/28/2025, 7:16 PMMarvin
10/28/2025, 7:16 PMMarvin
10/28/2025, 7:22 PMprefect.flow-run.Completed).
- Use a CallWebhook action to POST to Workspace B’s API endpoint to create a flow run for the target deployment:
- POST https://api.prefect.cloud/api/accounts/<account_id_b>/workspaces/<workspace_id_b>/deployments/<deployment_id_b>/flow-runs
- Include header Authorization: Bearer <API_KEY_WITH_ACCESS_TO_WS_B>
- Body can pass parameters/job variables; you can Jinja-template data from the triggering event.
- Docs:
- Event triggers and automations
- Chaining deployments with events
- REST: Create flow run from deployment
- Service accounts (grant a service account access to Workspace B and use its API key)
- Use the Python SDK against Workspace B
- From any environment (including a small serverless function invoked by a CallWebhook), use a client pointed at Workspace B to trigger the target deployment:
import os, asyncio
from prefect.client.orchestration import PrefectClient
async def main():
client = PrefectClient(
api="<https://api.prefect.cloud/api/accounts/<account_id_b>/workspaces/<workspace_id_b>>",
api_key=os.environ["PREFECT_API_KEY_WS_B"],
)
await client.create_flow_run_from_deployment(
deployment_id="<deployment_id_b>",
parameters={"upstream_run_id": "<insert if you want to pass context>"},
)
asyncio.run(main())
- Docs: Connect to Cloud, Create flow run from deployment
- Use the CLI pointed at Workspace B (from CI or a webhook handler)
- Run with Workspace B’s API URL and key:
export PREFECT_API_URL="<https://api.prefect.cloud/api/accounts/<account_id_b>/workspaces/<workspace_id_b>>"
export PREFECT_API_KEY="<api_key_with_access_to_ws_b>"
prefect deployment run "<FLOW_NAME>/<DEPLOYMENT_NAME>"
- This works well from GitHub Actions or your own CI that is triggered after the source deployment completes.
Notes and limitations
- RunDeployment action only targets deployments within the same workspace; it cannot cross workspaces directly.
- Events and webhooks are workspace-scoped; Workspace B cannot “listen” to events from Workspace A without an external bridge (e.g., CallWebhook to an endpoint that calls B’s API).
- Prefer using a service account with access to Workspace B to avoid tying auth to a personal key.
Would you like an example Automation JSON that uses CallWebhook in Workspace A to trigger a specific deployment in Workspace B? Also, are both workspaces under the same Prefect Cloud account? That determines whether a single service account can span both.