# Create automation via Git Register a Streamline automation backed by a Git repository. #### Headers **`Authorization`** string required **`Content-Type`** string required · `application/json` #### Request Body **`name`** string required **`organization_id`** string required **`git_repository_url`** string required Public or authenticated HTTPS URL. **`git_branch`** string optional · Defaults to `main` **`execution_file_path`** string required ## Returns The created automation object. Sync jobs run asynchronously after validation. Basic Request ```bash curl -X POST "https://api.aitronos.com/v1/streamline/automations/git" \ -H "Authorization: Bearer $FREDDY_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Automation from Git", "organization_id": "org_123", "git_repository_url": "https://github.com/acme/automation.git", "git_branch": "main", "execution_file_path": "src/main.py" }' ``` ```python import os import requests payload = { "name": "Automation from Git", "organization_id": "org_123", "git_repository_url": "https://github.com/acme/automation.git", "git_branch": "main", "execution_file_path": "src/main.py" } response = requests.post( "https://api.aitronos.com/v1/streamline/automations/git", headers={ "Authorization": f"Bearer {os.environ['FREDDY_SESSION_TOKEN']}", "Content-Type": "application/json" }, json=payload ) response.raise_for_status() ``` ```javascript const payload = { name: "Automation from Git", organization_id: "org_123", git_repository_url: "https://github.com/acme/automation.git", git_branch: "main", execution_file_path: "src/main.py" }; await fetch("https://api.aitronos.com/v1/streamline/automations/git", { method: "POST", headers: { Authorization: `Bearer ${process.env.FREDDY_SESSION_TOKEN}`, "Content-Type": "application/json" }, body: JSON.stringify(payload) }); ``` With Options ```bash curl -X POST "https://api.aitronos.com/v1/streamline/automations/git" \ -H "Authorization: Bearer $FREDDY_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{ "name": "Automation from Git", "organization_id": "org_123", "git_repository_url": "https://github.com/acme/automation.git", "git_branch": "production", "execution_file_path": "jobs/report.py" }' ``` ```python import os import requests payload = { "name": "Automation from Git", "organization_id": "org_123", "git_repository_url": "https://github.com/acme/automation.git", "git_branch": "production", "execution_file_path": "jobs/report.py" } requests.post( "https://api.aitronos.com/v1/streamline/automations/git", 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/git", { method: "POST", headers: { Authorization: `Bearer ${process.env.FREDDY_SESSION_TOKEN}`, "Content-Type": "application/json" }, body: JSON.stringify({ name: "Automation from Git", organization_id: "org_123", git_repository_url: "https://github.com/acme/automation.git", git_branch: "production", execution_file_path: "jobs/report.py" }) }); ``` Advanced ```bash curl -X POST "https://api.aitronos.com/v1/streamline/automations/git" \ -H "Authorization: Bearer $FREDDY_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: git-create-sauto" \ -d '{ "name": "Automation from Git", "organization_id": "org_123", "git_repository_url": "https://github.com/acme/automation.git", "git_branch": "release", "execution_file_path": "pipelines/main.py" }' ``` ```python import os import requests headers = { "Authorization": f"Bearer {os.environ['FREDDY_SESSION_TOKEN']}", "Content-Type": "application/json", "Idempotency-Key": "git-create-sauto" } requests.post( "https://api.aitronos.com/v1/streamline/automations/git", headers=headers, json={ "name": "Automation from Git", "organization_id": "org_123", "git_repository_url": "https://github.com/acme/automation.git", "git_branch": "release", "execution_file_path": "pipelines/main.py" } ).raise_for_status() ``` ```javascript async function createGitAutomation(branch) { const response = await fetch( "https://api.aitronos.com/v1/streamline/automations/git", { method: "POST", headers: { Authorization: `Bearer ${process.env.FREDDY_SESSION_TOKEN}`, "Content-Type": "application/json", "Idempotency-Key": `git-create-${branch}` }, body: JSON.stringify({ name: `Automation ${branch}`, organization_id: "org_123", git_repository_url: "https://github.com/acme/automation.git", git_branch: branch, execution_file_path: "pipelines/main.py" }) } ); return response.json(); } await createGitAutomation("release"); ``` **Response:** 201 Created ```json { "id": "sauto_git_123", "name": "Automation from Git", "upload_method": "git", "git_repository_url": "https://github.com/acme/automation.git", "git_branch": "main", "execution_file_path": "src/main.py", "is_active": true, "initial_sync_status": "queued" } ``` 400 Bad Request ```json { "success": false, "error": { "code": "INVALID_REPO", "message": "git_repository_url must be https", "status": 400, "trace_id": "req_39104dbd" } } ``` 401 Unauthorized ```json { "success": false, "error": { "code": "UNAUTHORIZED", "message": "Missing session token", "status": 401, "trace_id": "req_848644d2" } } ``` 404 Not Found ```json { "success": false, "error": { "code": "ORG_NOT_FOUND", "message": "organization_id org_404 not found", "status": 404, "trace_id": "req_2aa35056" } } ``` 429 Rate Limit ```json { "success": false, "error": { "code": "RATE_LIMIT", "message": "Too many Git automations created", "status": 429, "retry_after": 60, "trace_id": "req_fa16a96b" } } ``` 500 Server Error ```json { "success": false, "error": { "code": "INTERNAL_ERROR", "message": "Failed to validate repository", "status": 500, "trace_id": "req_cdf0a7d9" } } ``` ## Related - [Trigger Git sync](/docs/api-reference/streamline/automations-git-sync) - [Git sync history](/docs/api-reference/streamline/automations-git-sync-status)