# Trigger Git sync job Manually trigger a Git sync for a specific automation to pull the latest changes from its repository. #### 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 #### Path Parameters **`automation_id`** string required The automation ID to sync. ## Returns A confirmation object indicating whether the automation was updated with new changes from Git. Basic Request ```bash curl -X POST "https://api.aitronos.com/v1/streamline/automations/git/sync" \ -H "Authorization: Bearer $FREDDY_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d '{"organization_id": "org_123"}' ``` ```python import os import requests response = requests.post( "https://api.aitronos.com/v1/streamline/automations/git/sync", headers={ "Authorization": f"Bearer {os.environ['FREDDY_SESSION_TOKEN']}", "Content-Type": "application/json" }, json={"organization_id": "org_123"} ) response.raise_for_status() job = response.json() ``` ```javascript const res = await fetch( "https://api.aitronos.com/v1/streamline/automations/git/sync", { method: "POST", headers: { Authorization: `Bearer ${process.env.FREDDY_SESSION_TOKEN}`, "Content-Type": "application/json" }, body: JSON.stringify({ organization_id: "org_123" }) } ); const job = await res.json(); ``` With Options ```bash curl -X POST "https://api.aitronos.com/v1/streamline/automations/git/sync" \ -H "Authorization: Bearer $FREDDY_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -H "Idempotency-Key: git-sync-org_123" \ -d '{"organization_id": "org_123"}' ``` ```python import os import requests payload = {"organization_id": "org_123"} headers = { "Authorization": f"Bearer {os.environ['FREDDY_SESSION_TOKEN']}", "Content-Type": "application/json", "Idempotency-Key": "git-sync-org_123" } requests.post( "https://api.aitronos.com/v1/streamline/automations/git/sync", headers=headers, json=payload, timeout=15 ).raise_for_status() ``` ```javascript await fetch( "https://api.aitronos.com/v1/streamline/automations/git/sync", { method: "POST", headers: { Authorization: `Bearer ${process.env.FREDDY_SESSION_TOKEN}`, "Content-Type": "application/json", "Idempotency-Key": "git-sync-org_123" }, body: JSON.stringify({ organization_id: "org_123" }) } ); ``` Advanced ```bash for org in org_123 org_456; do curl -X POST "https://api.aitronos.com/v1/streamline/automations/git/sync" \ -H "Authorization: Bearer $FREDDY_SESSION_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"organization_id\": \"$org\"}" done ``` ```python import os import requests org_ids = ["org_123", "org_456"] headers = { "Authorization": f"Bearer {os.environ['FREDDY_SESSION_TOKEN']}", "Content-Type": "application/json" } for org in org_ids: response = requests.post( "https://api.aitronos.com/v1/streamline/automations/git/sync", headers=headers, json={"organization_id": org} ) print(org, response.json()["job_id"]) ``` ```javascript async function triggerSync(orgId) { const response = await fetch( "https://api.aitronos.com/v1/streamline/automations/git/sync", { method: "POST", headers: { Authorization: `Bearer ${process.env.FREDDY_SESSION_TOKEN}`, "Content-Type": "application/json" }, body: JSON.stringify({ organization_id: orgId }) } ); if (!response.ok) throw new Error(`Sync failed: ${response.status}`); return response.json(); } const jobs = await Promise.all([triggerSync("org_123"), triggerSync("org_456")]); console.log(jobs); ``` **Response:** 200 OK ```json { "status": "Sync job started", "job_id": "job_abc123" } ``` 400 Bad Request ```json { "success": false, "error": { "code": "ORG_REQUIRED", "message": "organization_id is required", "status": 400, "trace_id": "req_d4a118e7" } } ``` 401 Unauthorized ```json { "success": false, "error": { "code": "UNAUTHORIZED", "message": "Missing session token", "status": 401, "trace_id": "req_bf0fa421" } } ``` 404 Not Found ```json { "success": false, "error": { "code": "ORG_NOT_FOUND", "message": "organization_id org_404 not found", "status": 404, "trace_id": "req_05f27f1d" } } ``` 429 Rate Limit ```json { "success": false, "error": { "code": "RATE_LIMIT", "message": "Too many sync jobs", "status": 429, "retry_after": 120, "trace_id": "req_35651c18" } } ``` 500 Server Error ```json { "success": false, "error": { "code": "INTERNAL_ERROR", "message": "Failed to enqueue sync job", "status": 500, "trace_id": "req_7a54c989" } } ``` ## Related - [Git sync status](/docs/api-reference/streamline/automations-git-sync-status)