# Create automation via upload Upload a Python script or zip package to register a new Streamline automation from the UI or CLI. #### Headers **`Authorization`** string required **`Content-Type`** string required ยท `multipart/form-data` #### Form Data **`name`** string required **`organization_id`** string required **`execution_file_path`** string required Entry point inside the uploaded archive. **`file`** file required Python source file or zipped project. **`description`** string optional ## Returns The newly created automation object with upload metadata and execution defaults. Basic Request ```bash curl -X POST "https://api.aitronos.com/v1/streamline/automations/upload" \ -H "Authorization: Bearer $FREDDY_SESSION_TOKEN" \ -F "name=Daily Report Generation" \ -F "organization_id=org_123" \ -F "execution_file_path=runner.py" \ -F "file=@./runner.py" ``` ```python import os import requests files = {"file": open("runner.py", "rb")} data = { "name": "Daily Report Generation", "organization_id": "org_123", "execution_file_path": "runner.py" } response = requests.post( "https://api.aitronos.com/v1/streamline/automations/upload", headers={"Authorization": f"Bearer {os.environ['FREDDY_SESSION_TOKEN']}"}, files=files, data=data ) response.raise_for_status() ``` ```javascript import FormData from "form-data"; import fs from "node:fs"; const form = new FormData(); form.append("name", "Daily Report Generation"); form.append("organization_id", "org_123"); form.append("execution_file_path", "runner.py"); form.append("file", fs.createReadStream("./runner.py")); const response = await fetch( "https://api.aitronos.com/v1/streamline/automations/upload", { method: "POST", headers: { Authorization: `Bearer ${process.env.FREDDY_SESSION_TOKEN}`, ...form.getHeaders() }, body: form } ); const automation = await response.json(); ``` With Options ```bash curl -X POST "https://api.aitronos.com/v1/streamline/automations/upload" \ -H "Authorization: Bearer $FREDDY_SESSION_TOKEN" \ -F "name=Daily Report Generation" \ -F "description=Creates PDF and uploads to S3" \ -F "organization_id=org_123" \ -F "execution_file_path=src/main.py" \ -F "file=@./automation.zip" ``` ```python import os import requests files = {"file": open("automation.zip", "rb")} data = { "name": "Daily Report Generation", "description": "Creates PDF and uploads to S3", "organization_id": "org_123", "execution_file_path": "src/main.py" } requests.post( "https://api.aitronos.com/v1/streamline/automations/upload", headers={"Authorization": f"Bearer {os.environ['FREDDY_SESSION_TOKEN']}"}, files=files, data=data ).raise_for_status() ``` ```javascript import FormData from "form-data"; import fs from "node:fs"; const form = new FormData(); form.append("name", "Daily Report Generation"); form.append("description", "Creates PDF and uploads to S3"); form.append("organization_id", "org_123"); form.append("execution_file_path", "src/main.py"); form.append("file", fs.createReadStream("./automation.zip")); await fetch( "https://api.aitronos.com/v1/streamline/automations/upload", { method: "POST", headers: { Authorization: `Bearer ${process.env.FREDDY_SESSION_TOKEN}` }, body: form } ); ``` Advanced ```bash zip automation.zip -r src requirements.txt curl -X POST "https://api.aitronos.com/v1/streamline/automations/upload" \ -H "Authorization: Bearer $FREDDY_SESSION_TOKEN" \ -H "Idempotency-Key: upload-sauto" \ -F "name=Daily Report Generation" \ -F "organization_id=org_123" \ -F "execution_file_path=src/main.py" \ -F "description=Nightly data pipeline" \ -F "file=@./automation.zip" ``` ```python import os import requests with open("automation.zip", "rb") as archive: files = {"file": archive} data = { "name": "Daily Report Generation", "description": "Nightly data pipeline", "organization_id": "org_123", "execution_file_path": "src/main.py" } headers = { "Authorization": f"Bearer {os.environ['FREDDY_SESSION_TOKEN']}", "Idempotency-Key": "upload-sauto" } response = requests.post( "https://api.aitronos.com/v1/streamline/automations/upload", headers=headers, files=files, data=data ) response.raise_for_status() ``` ```javascript import FormData from "form-data"; import fs from "node:fs"; async function createAutomationZipUpload(path) { const form = new FormData(); form.append("name", "Daily Report Generation"); form.append("organization_id", "org_123"); form.append("execution_file_path", "src/main.py"); form.append("file", fs.createReadStream(path)); const response = await fetch( "https://api.aitronos.com/v1/streamline/automations/upload", { method: "POST", headers: { Authorization: `Bearer ${process.env.FREDDY_SESSION_TOKEN}`, "Idempotency-Key": "upload-sauto" }, body: form } ); return response.json(); } await createAutomationZipUpload("./automation.zip"); ``` **Response:** 201 Created ```json { "id": "sauto_daily_report", "name": "Daily Report Generation", "upload_method": "upload", "organization_id": "org_123", "execution_file_path": "src/main.py", "is_active": true, "created_at": "2025-11-17T08:00:00Z" } ``` 400 Bad Request ```json { "success": false, "error": { "code": "FILE_REQUIRED", "message": "file must be provided", "status": 400, "trace_id": "req_e293c5a1" } } ``` 401 Unauthorized ```json { "success": false, "error": { "code": "UNAUTHORIZED", "message": "Missing session token", "status": 401, "trace_id": "req_0fc0df58" } } ``` 404 Not Found ```json { "success": false, "error": { "code": "ORG_NOT_FOUND", "message": "organization_id org_999 not found", "status": 404, "trace_id": "req_8c2466db" } } ``` 429 Rate Limit ```json { "success": false, "error": { "code": "RATE_LIMIT", "message": "Too many uploads", "status": 429, "retry_after": 60, "trace_id": "req_d9f4e74c" } } ``` 500 Server Error ```json { "success": false, "error": { "code": "INTERNAL_ERROR", "message": "Failed to store automation file", "status": 500, "trace_id": "req_5d1d112f" } } ``` ## Related - [Create automation via Git](/docs/api-reference/streamline/automations-create-git) - [List automations](/docs/api-reference/streamline/automations-list)