POST /ai/trigger to run automations that match a trigger source. This example assumes the project already has an automation configured with the endpoint source. For a named webhook, configure a webhook automation first and replace endpoint below with its exact webhook name.
Use the authentication variables from the quickstart and set PROJECT_ID to the target project. cURL uses Bash and jq; Python uses requests; JavaScript uses Node.js 22 or later with .mjs files. Trigger endpoints are under /ai, with project_id in the request body.
Start the runs
Sendwait: false so the API returns run IDs while execution continues. context carries the JSON input your configured automations expect; the example provides a message.
202. results contains one entry per matched automation, with its agent_id and current status. An empty results array means there are no matched runs to poll. Check the project’s configured source before sending another trigger.
A trigger can match multiple automations. Always include project_id to scope the request to the intended project.
Poll by run ID
Copy anagent_id from the trigger response. Polling accepts up to 50 comma-separated run IDs per request.
items, rather than the trigger response’s results.
Start with a few seconds between polls, increase the interval for long runs, and set a maximum waiting time for your application. Match returned items to the requested
agent_id values; an absent result is not evidence of completion. Output fields can be null when the automation does not provide that output.
Preserve run IDs
Persist returned run IDs before processing results. If a poll fails, retry the poll with the same IDs. Avoid automatically resending the trigger after a timeout: the original runs can still be executing, and another trigger can start additional runs. Prefer polling overwait: true, which holds the trigger connection open and can lose its response to a network timeout while execution continues.