> For the complete documentation index, see [llms.txt](https://docs.n8n.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.n8n.io/connect/n8n-api/source-control.md).

# Source Control

Operations about source control

## Preview pending source control changes

> Previews the pending changes between the instance and the connected Git branch in either the \`push\` or \`pull\` direction.

```json
{"openapi":"3.0.0","info":{"title":"n8n Public API","version":"1.1.1"},"tags":[{"name":"SourceControl","description":"Operations about source control"}],"servers":[{"url":"/api/v1","description":"Current n8n instance (self-hosted built-in playground)"},{"url":"{url}/api/v1","description":"Self-hosted n8n instance","variables":{"url":{"default":"https://example.com"}}}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-N8N-API-KEY"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"n8n-auth"}},"responses":{"badRequest":{"description":"The request is invalid or provides malformed data."},"unauthorized":{"description":"Unauthorized"},"forbidden":{"description":"Forbidden"}}},"paths":{"/source-control/status":{"get":{"operationId":"getSourceControlStatus","tags":["SourceControl"],"summary":"Preview pending source control changes","description":"Previews the pending changes between the instance and the connected Git branch in either the `push` or `pull` direction.","parameters":[{"schema":{"type":"string","enum":["push","pull"]},"required":true,"name":"direction","in":"query"}],"responses":{"200":{"description":"Operation successful.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["credential","workflow","tags","variables","file","folders","project","datatable"]},"status":{"type":"string","enum":["new","modified","deleted","created","renamed","conflicted","ignored","staged","unknown"]},"location":{"type":"string","enum":["local","remote"]},"conflict":{"type":"boolean"},"updatedAt":{"type":"string"},"pushed":{"type":"boolean"},"isLocalPublished":{"type":"boolean"},"isRemoteArchived":{"type":"boolean"},"parentFolderId":{"type":"string","nullable":true},"folderPath":{"type":"array","items":{"type":"string"}},"remoteFolderPath":{"type":"array","items":{"type":"string"}},"owner":{"type":"object","properties":{"type":{"type":"string","enum":["personal","team"]},"projectId":{"type":"string"},"projectName":{"type":"string"}},"required":["type","projectId","projectName"]},"publishingError":{"type":"string"},"publishingErrorDetails":{"type":"object","properties":{"reason":{"type":"string","enum":["review_pending","changes_requested","insufficient_api_key_scope","insufficient_permissions"]},"workflowReviewRequestId":{"type":"string","minLength":1},"versionId":{"type":"string","minLength":1}},"required":["reason"],"additionalProperties":false},"contentImportPolicy":{"type":"object","properties":{"violations":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"checkId":{"type":"string"},"message":{"type":"string"},"subject":{"type":"string"},"subjectType":{"type":"string"},"scope":{"type":"string"},"matchedRuleId":{"type":"string"}},"required":["kind","checkId","message"]}},"checkErrors":{"type":"array","items":{"type":"object","properties":{"checkId":{"type":"string"},"correlationId":{"type":"string"}},"required":["checkId","correlationId"]}}},"required":["violations","checkErrors"]}},"required":["file","id","name","type","status","location","conflict","updatedAt"]}}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/badRequest"},"401":{"$ref":"#/components/responses/unauthorized"},"403":{"$ref":"#/components/responses/forbidden"}}}}}}
```

## Push local source control changes

> Commits and pushes the selected files to the connected Git branch. Each entry in \`fileNames\` is resolved against a fresh preview of the pending changes.

```json
{"openapi":"3.0.0","info":{"title":"n8n Public API","version":"1.1.1"},"tags":[{"name":"SourceControl","description":"Operations about source control"}],"servers":[{"url":"/api/v1","description":"Current n8n instance (self-hosted built-in playground)"},{"url":"{url}/api/v1","description":"Self-hosted n8n instance","variables":{"url":{"default":"https://example.com"}}}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-N8N-API-KEY"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"n8n-auth"}},"responses":{"badRequest":{"description":"The request is invalid or provides malformed data."},"unauthorized":{"description":"Unauthorized"},"forbidden":{"description":"Forbidden"},"unsupportedMediaType":{"description":"Unsupported media type."}}},"paths":{"/source-control/push":{"post":{"operationId":"pushSourceControl","tags":["SourceControl"],"summary":"Push local source control changes","description":"Commits and pushes the selected files to the connected Git branch. Each entry in `fileNames` is resolved against a fresh preview of the pending changes.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"commitMessage":{"type":"string","minLength":1,"maxLength":1000},"fileNames":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","minLength":1},"type":{"type":"string","enum":["credential","workflow","tags","variables","file","folders","project","datatable"]}},"required":["id","type"]},"minItems":1},"force":{"type":"boolean"}},"required":["commitMessage","fileNames"]}}}},"responses":{"200":{"description":"Operation successful.","content":{"application/json":{"schema":{"type":"object","properties":{"data":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["credential","workflow","tags","variables","file","folders","project","datatable"]},"status":{"type":"string","enum":["new","modified","deleted","created","renamed","conflicted","ignored","staged","unknown"]},"location":{"type":"string","enum":["local","remote"]},"conflict":{"type":"boolean"},"updatedAt":{"type":"string"},"pushed":{"type":"boolean"},"isLocalPublished":{"type":"boolean"},"isRemoteArchived":{"type":"boolean"},"parentFolderId":{"type":"string","nullable":true},"folderPath":{"type":"array","items":{"type":"string"}},"remoteFolderPath":{"type":"array","items":{"type":"string"}},"owner":{"type":"object","properties":{"type":{"type":"string","enum":["personal","team"]},"projectId":{"type":"string"},"projectName":{"type":"string"}},"required":["type","projectId","projectName"]},"publishingError":{"type":"string"},"publishingErrorDetails":{"type":"object","properties":{"reason":{"type":"string","enum":["review_pending","changes_requested","insufficient_api_key_scope","insufficient_permissions"]},"workflowReviewRequestId":{"type":"string","minLength":1},"versionId":{"type":"string","minLength":1}},"required":["reason"],"additionalProperties":false},"contentImportPolicy":{"type":"object","properties":{"violations":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"checkId":{"type":"string"},"message":{"type":"string"},"subject":{"type":"string"},"subjectType":{"type":"string"},"scope":{"type":"string"},"matchedRuleId":{"type":"string"}},"required":["kind","checkId","message"]}},"checkErrors":{"type":"array","items":{"type":"object","properties":{"checkId":{"type":"string"},"correlationId":{"type":"string"}},"required":["checkId","correlationId"]}}},"required":["violations","checkErrors"]}},"required":["file","id","name","type","status","location","conflict","updatedAt"]}}},"required":["data"]}}}},"400":{"$ref":"#/components/responses/badRequest"},"401":{"$ref":"#/components/responses/unauthorized"},"403":{"$ref":"#/components/responses/forbidden"},"409":{"description":"The push includes files with unresolved conflicts. Retry with `force: true` to push anyway.","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"conflicts":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["credential","workflow","tags","variables","file","folders","project","datatable"]},"status":{"type":"string","enum":["new","modified","deleted","created","renamed","conflicted","ignored","staged","unknown"]},"location":{"type":"string","enum":["local","remote"]},"conflict":{"type":"boolean"},"updatedAt":{"type":"string"},"pushed":{"type":"boolean"},"isLocalPublished":{"type":"boolean"},"isRemoteArchived":{"type":"boolean"},"parentFolderId":{"type":"string","nullable":true},"folderPath":{"type":"array","items":{"type":"string"}},"remoteFolderPath":{"type":"array","items":{"type":"string"}},"owner":{"type":"object","properties":{"type":{"type":"string","enum":["personal","team"]},"projectId":{"type":"string"},"projectName":{"type":"string"}},"required":["type","projectId","projectName"]},"publishingError":{"type":"string"},"publishingErrorDetails":{"type":"object","properties":{"reason":{"type":"string","enum":["review_pending","changes_requested","insufficient_api_key_scope","insufficient_permissions"]},"workflowReviewRequestId":{"type":"string","minLength":1},"versionId":{"type":"string","minLength":1}},"required":["reason"],"additionalProperties":false},"contentImportPolicy":{"type":"object","properties":{"violations":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"checkId":{"type":"string"},"message":{"type":"string"},"subject":{"type":"string"},"subjectType":{"type":"string"},"scope":{"type":"string"},"matchedRuleId":{"type":"string"}},"required":["kind","checkId","message"]}},"checkErrors":{"type":"array","items":{"type":"object","properties":{"checkId":{"type":"string"},"correlationId":{"type":"string"}},"required":["checkId","correlationId"]}}},"required":["violations","checkErrors"]}},"required":["file","id","name","type","status","location","conflict","updatedAt"]}}},"required":["message","conflicts"]}}}},"415":{"$ref":"#/components/responses/unsupportedMediaType"}}}}}}
```

## Pull changes from the remote repository

> Fetches changes from the connected Git branch into the instance.

```json
{"openapi":"3.0.0","info":{"title":"n8n Public API","version":"1.1.1"},"tags":[{"name":"SourceControl","description":"Operations about source control"}],"servers":[{"url":"/api/v1","description":"Current n8n instance (self-hosted built-in playground)"},{"url":"{url}/api/v1","description":"Self-hosted n8n instance","variables":{"url":{"default":"https://example.com"}}}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]},{"CookieAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-N8N-API-KEY"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"CookieAuth":{"type":"apiKey","in":"cookie","name":"n8n-auth"}},"responses":{"badRequest":{"description":"The request is invalid or provides malformed data."},"unauthorized":{"description":"Unauthorized"},"forbidden":{"description":"Forbidden"},"unsupportedMediaType":{"description":"Unsupported media type."}}},"paths":{"/source-control/pull":{"post":{"operationId":"pullSourceControl","tags":["SourceControl"],"summary":"Pull changes from the remote repository","description":"Fetches changes from the connected Git branch into the instance.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"force":{"type":"boolean","description":"Discard local changes and force the pull to complete."},"autoPublish":{"type":"string","enum":["none","all","published"],"default":"none","description":"Controls automatic workflow publishing after import:\n- `none`: Keep workflows in their local published state (default)\n- `all`: Publish all imported workflows\n- `published`: Publish only workflows that were published locally before import"}}}}}},"responses":{"200":{"description":"Operation successful.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["credential","workflow","tags","variables","file","folders","project","datatable"]},"status":{"type":"string","enum":["new","modified","deleted","created","renamed","conflicted","ignored","staged","unknown"]},"location":{"type":"string","enum":["local","remote"]},"conflict":{"type":"boolean"},"updatedAt":{"type":"string"},"pushed":{"type":"boolean"},"isLocalPublished":{"type":"boolean"},"isRemoteArchived":{"type":"boolean"},"parentFolderId":{"type":"string","nullable":true},"folderPath":{"type":"array","items":{"type":"string"}},"remoteFolderPath":{"type":"array","items":{"type":"string"}},"owner":{"type":"object","properties":{"type":{"type":"string","enum":["personal","team"]},"projectId":{"type":"string"},"projectName":{"type":"string"}},"required":["type","projectId","projectName"]},"publishingError":{"type":"string"},"publishingErrorDetails":{"type":"object","properties":{"reason":{"type":"string","enum":["review_pending","changes_requested","insufficient_api_key_scope","insufficient_permissions"]},"workflowReviewRequestId":{"type":"string","minLength":1},"versionId":{"type":"string","minLength":1}},"required":["reason"],"additionalProperties":false},"contentImportPolicy":{"type":"object","properties":{"violations":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"checkId":{"type":"string"},"message":{"type":"string"},"subject":{"type":"string"},"subjectType":{"type":"string"},"scope":{"type":"string"},"matchedRuleId":{"type":"string"}},"required":["kind","checkId","message"]}},"checkErrors":{"type":"array","items":{"type":"object","properties":{"checkId":{"type":"string"},"correlationId":{"type":"string"}},"required":["checkId","correlationId"]}}},"required":["violations","checkErrors"]}},"required":["file","id","name","type","status","location","conflict","updatedAt"]}}}}},"400":{"$ref":"#/components/responses/badRequest"},"401":{"$ref":"#/components/responses/unauthorized"},"403":{"$ref":"#/components/responses/forbidden"},"409":{"description":"Conflict due to uncommitted local changes or merge conflicts. The response body lists every file in the pull diff; files causing the conflict have `conflict: true` or `status: modified`. Retry with `force: true` to discard local changes.","content":{"application/json":{"schema":{"type":"array","items":{"type":"object","properties":{"file":{"type":"string"},"id":{"type":"string"},"name":{"type":"string"},"type":{"type":"string","enum":["credential","workflow","tags","variables","file","folders","project","datatable"]},"status":{"type":"string","enum":["new","modified","deleted","created","renamed","conflicted","ignored","staged","unknown"]},"location":{"type":"string","enum":["local","remote"]},"conflict":{"type":"boolean"},"updatedAt":{"type":"string"},"pushed":{"type":"boolean"},"isLocalPublished":{"type":"boolean"},"isRemoteArchived":{"type":"boolean"},"parentFolderId":{"type":"string","nullable":true},"folderPath":{"type":"array","items":{"type":"string"}},"remoteFolderPath":{"type":"array","items":{"type":"string"}},"owner":{"type":"object","properties":{"type":{"type":"string","enum":["personal","team"]},"projectId":{"type":"string"},"projectName":{"type":"string"}},"required":["type","projectId","projectName"]},"publishingError":{"type":"string"},"publishingErrorDetails":{"type":"object","properties":{"reason":{"type":"string","enum":["review_pending","changes_requested","insufficient_api_key_scope","insufficient_permissions"]},"workflowReviewRequestId":{"type":"string","minLength":1},"versionId":{"type":"string","minLength":1}},"required":["reason"],"additionalProperties":false},"contentImportPolicy":{"type":"object","properties":{"violations":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"checkId":{"type":"string"},"message":{"type":"string"},"subject":{"type":"string"},"subjectType":{"type":"string"},"scope":{"type":"string"},"matchedRuleId":{"type":"string"}},"required":["kind","checkId","message"]}},"checkErrors":{"type":"array","items":{"type":"object","properties":{"checkId":{"type":"string"},"correlationId":{"type":"string"}},"required":["checkId","correlationId"]}}},"required":["violations","checkErrors"]}},"required":["file","id","name","type","status","location","conflict","updatedAt"]}}}}},"415":{"$ref":"#/components/responses/unsupportedMediaType"}}}}}}
```
