# Execute automation Run a Streamline automation immediately with custom parameters. #### Headers **`Authorization`** string required Bearer token authentication. Use either: - `Bearer ${FREDDY_API_KEY}` for API key authentication - `Bearer ${FREDDY_SESSION_TOKEN}` for session token authentication **`Content-Type`** string required · `application/json` #### Path Parameters **`automation_id`** string required #### Request Body **`parameters`** object optional Key-value payload forwarded to the automation runtime. **`return_mode`** string optional · One of `poll` or `wait` (defaults to `poll`). ## Returns When `return_mode=poll`, returns 202 Accepted with `execution_id` for polling status later. When `return_mode=wait`, waits for completion and returns 200 OK with full execution result. Basic Request ```bash curl -X POST "https://api.aitronos.com/v1/streamline/automations/sauto_daily_report/execute" \ -H "Authorization: Bearer $FREDDY_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "return_mode": "poll" }' ``` ```python import os import requests response = requests.post( "https://api.aitronos.com/v1/streamline/automations/sauto_daily_report/execute", headers={ "Authorization": f"Bearer {os.environ['FREDDY_SESSION_TOKEN']}", "Content-Type": "application/json" }, json={"return_mode": "poll"} ) response.raise_for_status() execution = response.json() ``` ```javascript const res = await fetch( "https://api.aitronos.com/v1/streamline/automations/sauto_daily_report/execute", { method: "POST", headers: { Authorization: `Bearer ${process.env.FREDDY_SESSION_TOKEN}`, "Content-Type": "application/json" }, body: JSON.stringify({ return_mode: "poll" }) } ); const execution = await res.json(); ``` With Options ```bash curl -X POST "https://api.aitronos.com/v1/streamline/automations/sauto_daily_report/execute" \ -H "Authorization: Bearer $FREDDY_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "return_mode": "poll", "parameters": { "report_date": "2025-11-16", "send_email": true } }' ``` ```python import os import requests payload = { "return_mode": "poll", "parameters": { "report_date": "2025-11-16", "send_email": True } } requests.post( "https://api.aitronos.com/v1/streamline/automations/sauto_daily_report/execute", headers={ "Authorization": f"Bearer {os.environ['FREDDY_SESSION_TOKEN']}", "Content-Type": "application/json" }, json=payload ).raise_for_status() ``` ```javascript await fetch( "https://api.aitronos.com/v1/streamline/automations/sauto_daily_report/execute", { method: "POST", headers: { Authorization: `Bearer ${process.env.FREDDY_SESSION_TOKEN}`, "Content-Type": "application/json" }, body: JSON.stringify({ return_mode: "poll", parameters: { report_date: "2025-11-16", send_email: true } }) } ); ``` Advanced ```bash curl -N -X POST "https://api.aitronos.com/v1/streamline/automations/sauto_daily_report/execute" \ -H "Authorization: Bearer $FREDDY_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "return_mode": "stream", "parameters": {"report_date": "2025-11-16"} }' ``` ```python import os import requests with requests.post( "https://api.aitronos.com/v1/streamline/automations/sauto_daily_report/execute", headers={ "Authorization": f"Bearer {os.environ['FREDDY_SESSION_TOKEN']}", "Content-Type": "application/json", "Accept": "text/event-stream" }, json={"return_mode": "stream"}, stream=True ) as response: response.raise_for_status() for line in response.iter_lines(): if line: print(line.decode()) ``` ```javascript const controller = new AbortController(); const response = await fetch( "https://api.aitronos.com/v1/streamline/automations/sauto_daily_report/execute", { method: "POST", headers: { Authorization: `Bearer ${process.env.FREDDY_SESSION_TOKEN}`, "Content-Type": "application/json", Accept: "text/event-stream" }, body: JSON.stringify({ return_mode: "stream" }), signal: controller.signal } ); for await (const chunk of response.body) { process.stdout.write(chunk); } ``` **Response:** 200 OK ```json { "status": "Execution started", "execution_id": "sexec_abc123", "automation_id": "sauto_daily_report" } ``` 400 Bad Request ```json { "success": false, "error": { "code": "INVALID_PARAMETERS", "message": "parameters must be an object", "status": 400, "trace_id": "req_13abf211" } } ``` 401 Unauthorized ```json { "success": false, "error": { "code": "UNAUTHORIZED", "message": "Missing session token", "status": 401, "trace_id": "req_d71c10a3" } } ``` 404 Not Found ```json { "success": false, "error": { "code": "AUTOMATION_NOT_FOUND", "message": "sauto_daily_report does not exist", "status": 404, "trace_id": "req_8bb44cce" } } ``` 429 Rate Limit ```json { "success": false, "error": { "code": "RATE_LIMIT", "message": "Too many executions requested", "status": 429, "retry_after": 10, "trace_id": "req_b6fa7151" } } ``` 500 Server Error ```json { "success": false, "error": { "code": "INTERNAL_ERROR", "message": "Automation runtime failed to start", "status": 500, "trace_id": "req_e4da9c9c" } } ``` ## Related - [Get execution status](/docs/api-reference/streamline/executions-retrieve) - [List executions](/docs/api-reference/streamline/automations-list-executions)