n8

n8n API — REST Reference, Auth, Examples

Complete n8n REST API guide: enable the public API, generate API keys, list and create workflows, query executions, and integrate with CI/CD. Rising +6% worldwide.

The n8n api lets you treat n8n as deployable infrastructure — promote workflows from staging to production, snapshot executions for analytics, or seed new tenant instances with starter templates. Search interest is up +6% worldwide as more teams adopt GitOps for automations.

Enable the public API

n8n Cloud

API access is enabled on plans that include it. Generate a key in Settings → API.

Self-hosted

Set environment variables to enable the API and configure JWT:

N8N_PUBLIC_API_DISABLED=false
N8N_PUBLIC_API_ENDPOINT=api
N8N_PUBLIC_API_SWAGGERUI_DISABLED=false

Restart the container. The Swagger UI is then available at https://your-n8n.example.com/api/v1/docs.

Authentication

All API requests authenticate with the X-N8N-API-KEY header. Store the key in your secrets manager (Doppler, Vault, GitHub Actions secrets) — never commit it to Git.

List workflows

curl -X GET 'https://your-n8n.example.com/api/v1/workflows' \
  -H 'X-N8N-API-KEY: your_api_key_here' \
  -H 'accept: application/json'

Create a workflow from a JSON file

curl -X POST 'https://your-n8n.example.com/api/v1/workflows' \
  -H 'X-N8N-API-KEY: your_api_key_here' \
  -H 'Content-Type: application/json' \
  -d @./my-workflow.json

This is exactly how the workflows on this site can be pushed to your instance via CI — download the JSON, post it to your API, done.

Inspect failed executions

curl -X GET 'https://your-n8n.example.com/api/v1/executions?limit=10&status=error' \
  -H 'X-N8N-API-KEY: your_api_key_here'

Wire this to your monitoring stack (Grafana, Datadog, PagerDuty) to alert on workflow failures without paying for n8n's own enterprise observability.

Real-world API use cases

  • GitOps for automations. Commit workflow JSON to a repo; a CI job posts to the API on merge to main.
  • Multi-tenant seeding. When you onboard a new agency client, run a script that seeds 12 starter workflows from your template repo into their fresh n8n instance.
  • Backup and restore. Nightly job lists all workflows, dumps them to object storage with checksums.
  • Bulk operations. Pause every workflow tagged prospecting during a Black Friday code freeze.
  • Custom internal UI. Build a React or Astro dashboard showing live execution status across your fleet.

API key safety checklist

  • Rotate keys at least quarterly.
  • Limit which IPs can reach /api via Cloudflare WAF rules.
  • Never enable Swagger UI in production-facing instances (set the disabled var to true).
  • Audit who has access to your secrets manager every quarter.

SDKs and client libraries

There is no official multi-language SDK; the API is small enough that fetch or curl in your favorite language suffices. The OpenAPI spec served from the Swagger endpoint can be fed to openapi-generator if you want a typed client.

Further reading

Frequently asked questions

Does n8n have a REST API?
Yes. Enable the public API in settings, generate an API key, and you can list, create, update, delete, and activate workflows programmatically. You can also query executions and credentials metadata.
What is the difference between the n8n API and webhooks?
The API manages n8n itself — workflows, credentials, executions. Webhooks are triggers inside a workflow that receive external events. Different layers, different jobs.
Can I use the n8n API on n8n Cloud?
Yes, on plans that include API access. Generate an API key in Settings → API. Self-hosted has API access on all editions when the public API is enabled.
Is the n8n API rate-limited?
Cloud applies rate limits per plan. Self-host enforces no rate limit by default — you are limited by your server resources. Add Nginx or Cloudflare in front for protection.