Feat(source-control): Add push endpoint to Public API v1

The idea is:

The source control push endpoint (POST /rest/source-control/push-workfolder) is only available via the internal REST API, which requires cookie-based session authentication. This makes it impossible to automate daily Git pushes for workflow backups in environments that use SSO (e.g. Okta), since programmatic login is not supported for SSO users.
Describe the solution you’d like
Add POST /api/v1/source-control/push to the Public API v1, authenticated via X-N8N-API-KEY, with a request body equivalent to the internal endpoint:
{
“force”: false,
“commitMessage”: “chore: automated daily push”
}
This already exists for pull (POST /api/v1/source-control/pull) — push should be a symmetric counterpart.
Describe alternatives you’ve considered
Using the internal /rest/ API — blocked by SSO, not suitable for automation
Running raw git push outside n8n — bypasses n8n’s push logic and commit metadata
Using the root account with username/password — unacceptable security risk

My use case:

The source control push endpoint (POST /rest/source-control/push-workfolder) is only available via the internal REST API, which requires cookie-based session authentication. This makes it impossible to automate daily Git pushes for workflow backups in environments that use SSO (e.g. Okta), since programmatic login is not supported for SSO users.
I think it would be beneficial to add this because:
Automated daily Git push enables reliable, hands-off version control backups of workflows and credentials — a critical GitOps requirement for enterprise teams. Without this, teams relying on SSO have no secure way to automate source control backups and must depend on manual triggers, which are inconsistent and do not scale across multinational organizations operating across time zones.
Any resources to support this:
Existing pull handler for reference: packages/cli/src/public-api/v1/handlers/source-control/source-control.handler.ts
Internal push service already exists: SourceControlService.pushWorkfolder
n8n Public API v1 docs: n8n public REST API Documentation and Guides | n8n Docs

I think it would be beneficial to add this because:

Any resources to support this?

Are you willing to work on this?

Yes — I am willing to contribute this as a PR. The internal push service already exists; the change is minimal and mirrors the existing pull endpoint.

1 Like

Hi, adding my support for this request.

Use case
We’d like to automate workflow backups to Git from CI/scheduled jobs on an SSO-protected instance. Using cookie-based auth with /rest/source-control/push-workfolder is impractical in this context — API keys are a much more natural fit. The fact that there’s an API-key-based /source-control/pullpublic endpoint but no equivalent for push is also a bit surprising.

Technical note
This looks like a relatively small and symmetric change compared to the existing pull handler:

  • SourceControlService.pushWorkfolder() already exists and is used by the internal controller (source-control.controller.ee.ts).

  • The public pull handler (packages/cli/src/public-api/v1/handlers/source-control/source-control.handler.ts) is ~35 lines and could be mirrored for push.

  • What seems to be needed:

    • A new sourceControl:push API-key scope

    • A PushWorkFolderRequestDto in /api-types (if it doesn’t exist yet)

    • An OpenAPI entry for the new endpoint

Offer
I’m happy to open a PR for this if the team is open to it. Before I invest the time, could someone from n8n clarify:

  1. Are community PRs to .ee modules acceptable for this kind of change, or is this strictly for internal implementation?

  2. Are there any scope constraints you’d prefer — for example, should the first iteration be push-only, or also cover status/diff endpoints?

Thanks!

1 Like