# n8n Workflow Backup, Restore & Security Audit (`korado_labs/n8n-backup-restore`) Actor

Offsite scheduled backups of all your n8n workflows, tags and variables. One-click restore to any instance (disaster recovery, migration, staging to prod) and a security + hygiene audit. Works with n8n Cloud and self-hosted. Free demo mode, pay per workflow.

- **URL**: https://apify.com/korado\_labs/n8n-backup-restore.md
- **Developed by:** [Korado Labs](https://apify.com/korado_labs) (community)
- **Categories:** Automation, Developer tools, Integrations
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $5.00 / 1,000 workflow backed ups

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## n8n Workflow Backup, Restore & Security Audit

Your n8n instance holds the automations your business runs on — and by default they live in **one SQLite file / database on that one machine**. If the server dies, gets reprovisioned, or someone deletes the wrong workflow, everything is gone. The popular DIY fix (a backup workflow *inside* n8n) has an obvious flaw: it dies with the instance.

This Actor keeps your backups **off-instance, on Apify storage**, and gives you three tools in one:

| Mode | What it does |
|------|--------------|
| 🗄️ **Backup** | Exports **all workflows** (full restorable JSON: nodes, connections, settings), tags and variables to the run's dataset + a single restorable archive in the key-value store. |
| ♻️ **Restore** | Imports a backup into **any** n8n instance — disaster recovery, staging→production promotion, or migration between self-hosted and n8n Cloud. Recreates tags, optionally re-activates workflows. |
| 🛡️ **Audit** | Runs n8n's **built-in security audit** (credentials, nodes, filesystem, instance risks) plus extra hygiene checks: active workflows without an error workflow, abandoned workflows, workflows without triggers, duplicate names. |

Works with **n8n Cloud and self-hosted** instances (any instance where the [public API](https://docs.n8n.io/api/) is enabled).

### 🚀 Try it without connecting anything

Just press **Start** with the default input. With no instance URL, the Actor runs a **free demo** on bundled sample workflows so you can inspect the exact output format. Connect your real instance when you're ready.

### 🕑 Scheduled offsite backups in 2 minutes

1. In n8n: **Settings → n8n API → Create API key**.
2. In this Actor's input: set your **instance URL** and paste the **API key** (stored encrypted by Apify).
3. Create an [Apify Schedule](https://docs.apify.com/platform/schedules) for the Actor — e.g. daily at 03:00.

Every run stores a complete restorable archive at:

```
https://api.apify.com/v2/key-value-stores/{STORE_ID}/records/backup
```

Each run keeps its own archive, so you automatically get **point-in-time snapshots** — restore yesterday's state, or last month's.

### ♻️ Restoring

Set mode to **Restore** and pick a source:

- **Nothing at all** — the latest backup made by this Actor on your account is used automatically. Backup daily, restore with two clicks.
- **Backup URL** — the signed *Backup archive* link from any previous backup run's **Output** tab (point-in-time restore), or
- **Backup JSON** — paste the archive, a JSON array of workflows, or even a single workflow exported from the n8n editor.

Conflict handling when a workflow with the same name exists on the target: **update** it (default), **skip** it, or **create a copy**. Workflows that were active in the backup are only re-activated if you opt in — a restore never silently starts triggers.

> **Note on credentials:** n8n's API intentionally never exposes credential secrets, so no tool can back them up — you re-enter credentials once on a new instance. Everything else (the actual logic you built) is fully restored, and restored nodes keep their credential references, so workflows reconnect as soon as you recreate the credential with the same name.

### 🛡️ Audit output example

```json
{
  "recordType": "audit-finding",
  "auditCategory": "hygiene",
  "riskLevel": "medium",
  "finding": "3 active workflow(s) have no error workflow configured",
  "recommendation": "Set an error workflow so failures alert someone instead of dying silently.",
  "affected": ["Daily sales report", "Lead enrichment", "Invoice sync"]
}
```

### 💰 Pricing

Pay only for what is processed — no start fee, demo runs are free:

- **$0.005** per workflow backed up
- **$0.008** per workflow restored (skipped/failed workflows are never charged)
- **$0.005** per workflow audited (the instance-level n8n security audit report is included free)

A 50-workflow instance backed up daily costs about **$7.50/month** — offsite disaster recovery for less than a coffee.

### 🔐 Security

- The API key input is marked secret — Apify stores it encrypted; it never appears in logs or output.
- The Actor only calls your instance's official public API (`/api/v1`) over HTTPS.
- Backups live in **your** Apify storage, under your account's access control.

### ❓ FAQ

**Does this work with n8n Cloud?** Yes — n8n Cloud exposes the public API. Use your `https://your-team.app.n8n.cloud` URL.

**My instance is on an old n8n version.** Workflows/tags always work. Variables and the built-in security audit degrade gracefully when the endpoint is unavailable — the run tells you in the summary row.

**Can I back up executions?** No — execution history is transient runtime data and not restorable via the API. This Actor backs up the things you can lose permanently: your workflows.

**How do I restore to a brand-new instance?** Spin up n8n, create an owner + API key, run this Actor in restore mode with the new instance URL and your latest backup URL. Done.

# Actor input Schema

## `mode` (type: `string`):

What to do: **Backup** exports all workflows + tags + variables from your instance. **Restore** imports a previous backup into an instance. **Audit** runs n8n's built-in security audit plus workflow hygiene checks.

## `instanceUrl` (type: `string`):

Base URL of your n8n instance, e.g. `https://your-team.app.n8n.cloud` or `https://n8n.your-company.com`. **Leave empty to run a demo** on bundled sample workflows so you can see the output format without connecting anything.

## `apiKey` (type: `string`):

n8n API key. Create it in your n8n instance under Settings → n8n API → Create API key. Stored encrypted by Apify; never written to the dataset or logs.

## `workflowNames` (type: `array`):

If set, only workflows whose name is in this list are backed up / restored / audited. Leave empty to process all workflows.

## `includeInactive` (type: `boolean`):

Backup and audit also cover workflows that are currently deactivated.

## `includeWorkflowJson` (type: `boolean`):

Each backup dataset row embeds the complete restorable workflow JSON (nodes, connections, settings). The full archive is always saved to the run's key-value store as `backup` either way.

## `backupJson` (type: `string`):

Paste a backup here: either the `backup` archive produced by this Actor, an array of n8n workflow objects, or a single workflow exported from the n8n editor. Leave both this and Backup URL empty to automatically restore the latest backup made by this Actor on your account.

## `backupUrl` (type: `string`):

URL of a backup to restore for point-in-time restores: use the signed 'Backup archive' link from the Output tab of a previous backup run. Leave empty (and Backup JSON empty) to automatically use the latest backup made by this Actor.

## `restoreConflict` (type: `string`):

How to handle name collisions on the target instance during restore.

## `activateAfterRestore` (type: `boolean`):

After restoring, activate workflows that were active in the backup. Off by default so a restore never silently starts triggers on the target instance.

## `daysAbandonedWorkflow` (type: `integer`):

Audit flags workflows not updated in this many days as abandoned.

## Actor input object example

```json
{
  "mode": "backup",
  "instanceUrl": "https://your-team.app.n8n.cloud",
  "includeInactive": true,
  "includeWorkflowJson": true,
  "restoreConflict": "update",
  "activateAfterRestore": false,
  "daysAbandonedWorkflow": 90
}
```

# Actor output Schema

## `records` (type: `string`):

All records as JSON. Each item has recordType 'workflow-backup', 'workflow-restore', 'audit-finding' or 'run-summary'.

## `backupArchive` (type: `string`):

Complete backup archive with all workflows, tags and variables. Feed this URL into a later restore run.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "mode": "backup"
};

// Run the Actor and wait for it to finish
const run = await client.actor("korado_labs/n8n-backup-restore").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "mode": "backup" }

# Run the Actor and wait for it to finish
run = client.actor("korado_labs/n8n-backup-restore").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "mode": "backup"
}' |
apify call korado_labs/n8n-backup-restore --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,korado_labs/n8n-backup-restore"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/NTJVEew4aqdK7MWXJ/builds/umVaR3RBjf7wk39tg/openapi.json
