Some links on this page are affiliate links: if you buy through them we may earn a commission, at no extra cost to you.
To call the API on a self-hosted n8n installation, use the instance’s public address followed by /api/v1, then send an API key in the X-N8N-API-KEY header. For example, a normally published instance uses https://n8n.example.com/api/v1. The key is created in the n8n editor under Settings > n8n API.
The API address and webhook address are related but not interchangeable. Your reverse proxy must advertise the public webhook URL separately, while forwarding the original host, protocol, and client IP to n8n. The configuration below covers direct and proxied deployments, key creation, a first request, Swagger testing, and the common reasons webhook URLs are generated incorrectly.
As an Amazon Associate I earn from qualifying purchases.
What is the correct self-hosted n8n API URL?
The normal API root is your public n8n URL plus /api/v1. The host, port, protocol, and optional path must match the way the instance is published.
| Deployment value | How it appears in the API address | Example |
|---|---|---|
| Public HTTPS host | https://<host>/api/v1 |
https://n8n.example.com/api/v1 |
| Nonstandard public port | https://<host>:<port>/api/v1 |
https://n8n.example.com:8443/api/v1 |
| Configured n8n path | https://<host>/<N8N_PATH>/api/v1 |
The path configured for that installation, with its slash conventions preserved |
| Local, unproxied development instance | http://localhost:5678/api/v1 |
The documented default host, port, and protocol |
n8n’s documented request pattern is expressed as <N8N_HOST>:<N8N_PORT>/<N8N_PATH>/api/v<version-number>/workflows?active=true. For the current version-1 API, that means the /api/v1 segment. Do not copy localhost into a request made from another computer: it refers to the computer running the request, not automatically to your n8n server.
#1 Best Overall
- Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
- Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
- Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
- Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
- 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.
How do I set the public address on a self-hosted instance?
Set the address variables before exposing n8n. The documented defaults are localhost, port 5678, protocol http, and the root path /. A production deployment normally replaces those defaults with the name and protocol users actually reach.
Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteWindows Errors? Fix Them Before They Spread
Repair common Windows errors and clear accumulated junk for a smoother, more stable PC - no reinstall needed.Free scan · no reinstall| Variable | Purpose | Documented default or example |
|---|---|---|
N8N_HOST |
Hostname used by n8n for its server address | localhost by default; example: n8n.example.com |
N8N_PORT |
Port on which the n8n process listens | 5678 by default |
N8N_PROTOCOL |
Protocol n8n uses for its address | http by default; use https when n8n itself is serving HTTPS |
N8N_PATH |
Optional path prefix for an installation published below the domain root | / by default |
If a reverse proxy terminates HTTPS, n8n can continue listening on its internal port while the proxy provides the public HTTPS endpoint. In that arrangement, the public URL, not the internal container or VM address, is the one clients should use for API calls.
Example environment configuration
N8N_HOST=n8n.example.com
N8N_PORT=5678
N8N_PROTOCOL=https
N8N_WEBHOOK_URL=https://n8n.example.com/
N8N_PROXY_HOPS=1
Apply environment changes using the restart or redeploy procedure for your installation. Keep the path and trailing slash conventions consistent between the proxy and n8n; a mismatch can produce links that look plausible but do not resolve.
Where do I create the n8n API key?
Create the key in the n8n editor, not in your operating system or proxy configuration. n8n’s authentication documentation states that “n8n uses API keys to authenticate API calls.”
- Sign in to the self-hosted n8n editor.
- Open Settings.
- Select n8n API.
- Choose the control to create a key, give it a label, and set an expiration.
- Copy the key when it is shown and store it in a secret manager or protected environment variable. Treat it like a password.
Every API request must carry the key in the X-N8N-API-KEY header. Enterprise instances can apply API-key scopes. According to the authentication guide, non-Enterprise keys have full access to account resources, so use additional care with those keys.
Rank #2
- 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
- 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
- Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
- 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
- What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.
How should keys be organized?
- Use separate keys for a production integration, a staging integration, and interactive testing when your edition permits it.
- Give each key a label that identifies its owner and purpose.
- Choose an expiration that matches the integration’s lifecycle rather than creating an unbounded credential by default.
- Rotate or revoke a key when its owner leaves, an integration is replaced, or the value may have been exposed.
- Never place the key in a browser-visible page, a public repository, a shell-history example that will be shared, or a URL query string.
How do I make the first API request?
Once the public address and key are ready, call a version-1 endpoint under /api/v1. This read-only workflow request is a useful initial check because it tests the base path, authentication header, and query-string handling together.
curl -X GET 'https://n8n.example.com/api/v1/workflows?active=true'
-H 'accept: application/json'
-H 'X-N8N-API-KEY: YOUR_API_KEY'
Replace the hostname, optional port or path, and key with values from your installation. The active=true filter asks for active workflows; remove or change query parameters only when the endpoint documentation for your n8n version supports that operation.
What does a successful request prove?
- The DNS name and public port reach the server that hosts n8n.
- The proxy, if present, routes the API path to n8n rather than to another application.
- The request uses the correct version prefix, currently
/api/v1. - The API key is present in the exact
X-N8N-API-KEYheader. - The key has permission to read the requested account resource.
If the request fails, test the same URL from the server or network where the caller runs, then compare the host, path, protocol, and header one at a time. A browser address bar is not a substitute for the header-bearing request because it does not add your API key automatically.
Which n8n resources can the API manage?
The public endpoint reference covers more than workflows. The available resource families include workflows, executions, credentials, users, audit information, tags, variables, data tables, projects, and other account resources.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEFix the driver behind crashes, sound loss and screen glitchesFind Drivers →Use the endpoint reference that matches the n8n version installed on your server for the exact operation, required fields, pagination behavior, and permission requirements. The common mistake is to discover an endpoint in a different version and then omit the version-1 prefix or send a method the installed release does not expose.
Rank #3
- Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
- Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
- Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
- Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
- What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
How do I configure n8n behind a reverse proxy?
Set the public webhook URL and proxy-hop count in n8n, then make the final proxy forward the original request metadata. TLS can terminate at the proxy while n8n remains on its internal listener port.
- Publish n8n at the external HTTPS name you want users and webhook providers to reach.
- Set
N8N_WEBHOOK_URLto that public URL, including the trailing slash shown in the documented example:https://n8n.example.com/. - Set
N8N_PROXY_HOPS=1when one reverse-proxy hop sits in front of n8n. Adjust the value only when your actual proxy chain differs. - On the last proxy before n8n, forward
X-Forwarded-For,X-Forwarded-Host, andX-Forwarded-Proto. - Keep the n8n process listening on its internal port, commonly
5678, while the proxy accepts public HTTPS traffic. - Restart or redeploy n8n after changing environment variables, then create or inspect a webhook URL again.
What each forwarded header does
| Header | Information conveyed to n8n | Why it matters |
|---|---|---|
X-Forwarded-For |
The originating client IP as seen through the proxy chain | Preserves client-address information when n8n is not directly internet-facing |
X-Forwarded-Host |
The host requested by the client | Lets n8n distinguish the public hostname from its internal listener address |
X-Forwarded-Proto |
The original protocol, such as HTTPS | Prevents n8n from constructing HTTP links when the user reached the proxy over HTTPS |
Why are my n8n webhook URLs wrong behind the proxy?
Webhook URLs are generated from the public webhook configuration, not from the API root alone. If n8n does not know the external hostname or protocol, it can display or register an address pointing to an internal host, the wrong scheme, or the wrong path.
Common symptoms and fixes
| Symptom | Likely configuration issue | Fix |
|---|---|---|
| The URL contains an internal hostname or container name | N8N_WEBHOOK_URL is unset or still uses an internal address |
Set it to the externally reachable HTTPS URL and redeploy n8n |
The URL starts with http:// even though visitors use HTTPS |
The original protocol is not being passed to n8n | Forward X-Forwarded-Proto from the final proxy |
| The hostname is wrong or missing a subdomain | The proxy does not pass the public host | Forward X-Forwarded-Host and verify the proxy’s host-routing rule |
| Client information is lost across the proxy | The forwarding chain omits the client-IP header | Forward X-Forwarded-For and set the proxy-hop count to match the deployment |
| The URL has a duplicated or missing path segment | N8N_PATH, proxy routing, and webhook URL prefixes disagree |
Make the path prefix identical at every layer, then regenerate or recheck the webhook URL |
Do not “fix” a webhook by adding /api/v1. The API and webhook namespaces serve different purposes: API calls use the versioned API root, while webhook addresses come from the public webhook URL configuration.
Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsHow can I test the API with n8n’s Swagger playground?
Self-hosted n8n includes a Swagger UI playground at a path assembled from your configured host, port, path, and API version 1. It can be useful for discovering the operations available in your installation and seeing the required request structure.
- Open the Swagger playground associated with your self-hosted editor and API version.
- Use its authorization control to enter an API key.
- Select a read-only operation, such as listing workflows, and review the generated request before sending it.
- Confirm that the host, path, and version match the public address you intend to automate.
- Clear the authorization value when finished, especially on a shared workstation.
Authorizing the playground grants it access to live n8n data. Use test data and, where possible, a key with the narrowest available scope. Treat the playground as an administrative tool rather than a harmless documentation page.
Rank #4
- Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
- Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
- Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
- Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
- Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft
Should I expose n8n directly or use a reverse proxy?
Both approaches can work, but they differ in where the public URL and TLS are handled. The proxy arrangement is the usual choice when a separate web server or ingress already manages HTTPS and host routing.
| Consideration | Direct publication | Reverse-proxy publication |
|---|---|---|
| Public URL and TLS | n8n itself serves the address; its protocol and certificate settings must match the public endpoint | The proxy normally terminates TLS and publishes the HTTPS hostname |
| Internal listener | The listener is also the externally reachable service | n8n can remain on an internal port such as 5678 |
| Webhook URL | Derived from the n8n address configuration | Requires N8N_WEBHOOK_URL, proxy-hop configuration, and forwarded headers |
| API request URL | Public address plus /api/v1 |
Proxy’s public address plus /api/v1; never the private listener address for external callers |
| Operational access | Logs and backups depend on the n8n host and its storage setup | Proxy and n8n logs are separate; storage, logging, and backup choices depend on the hosting architecture |
The API documentation establishes the URL, listener, proxy, and key settings. It does not prescribe a particular database, backup system, logging stack, or hosting provider, so those decisions must follow your own deployment architecture.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.What security checks should I complete before automating calls?
- Use HTTPS for the public endpoint so the API key is not sent over an unencrypted connection.
- Keep the key out of source code and pass it through a secret store or protected environment variable.
- Set an expiration and record the owner, purpose, and replacement procedure.
- Use Enterprise scopes when available and appropriate; remember that non-Enterprise keys have full account-resource access according to n8n’s authentication guide.
- Restrict access to the Swagger playground and avoid authorizing it with a broad production key during demonstrations.
- Review proxy access logs and n8n logs for accidental key disclosure before sharing diagnostic output.
- Test with a non-production workflow or account resource before sending write operations.
How do I troubleshoot a failed self-hosted API call?
Work from the outside in: network address, proxy routing, API path, then authentication and permissions. Change one variable at a time so a successful test identifies the layer that was wrong.
- Verify the public address. Confirm that the hostname resolves to the proxy or n8n server intended for this installation and that the caller can reach the published port.
- Verify the path. Start with the public URL, add any configured path prefix, and append
/api/v1. Do not use the editor URL without the API segment. - Verify protocol handling. If HTTPS terminates at a proxy, check that
X-Forwarded-Protoreaches n8n and thatN8N_WEBHOOK_URLuses the HTTPS address. - Verify the header spelling. Send
X-N8N-API-KEYexactly as written. A key in a query parameter or a differently named header will not authenticate the request. - Verify key status. Check that the key was copied correctly, has not expired or been revoked, and belongs to the n8n account you are addressing.
- Verify access scope. On Enterprise, confirm the key’s scopes include the requested resource. On non-Enterprise editions, treat the key as broadly privileged.
- Compare with the playground. A read-only request in Swagger can show whether the problem is the client command or the server’s URL and authentication configuration, but remember that the playground operates on live data.
What should I document for future maintenance?
Record the public API root, the internal listener port, the configured path prefix, the proxy-hop count, the proxy’s forwarded-header behavior, and the owner and expiration of each API key. Keep that record separate from the secret value itself.
Also document where n8n and proxy logs live and how persistent data is backed up. Those storage, logging, and backup choices are specific to the hosting architecture; they are not fixed by the API URL settings. A clear handover note prevents a future operator from substituting the internal listener address for the public API address or changing proxy variables without updating webhook configuration.
Recommended Free Tools
Best Value
- 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
- Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
- Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
- HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
- What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.
Frequently Asked Questions
Can I call a self-hosted n8n API from another server?
Yes, provided that server can route to the n8n public hostname and port. Use the externally published address, not localhost or a container-only hostname, and ensure the network or firewall permits the connection.
Can I keep n8n on port 5678 while users connect over HTTPS?
Yes. In a reverse-proxy design, n8n can keep its internal listener on port 5678 while the proxy accepts public HTTPS traffic. The client still uses the proxy’s hostname and /api/v1 path.
How often should an n8n API key be rotated?
There is no universal interval in the API documentation. Rotate it when its owner, integration, or exposure risk changes, and use the expiration option so an abandoned credential does not remain valid indefinitely.
Is it safe to use the Swagger playground with a production key?
The playground can act on live data after authorization, so use test data and a limited key whenever possible. Avoid pasting a broad production key into a shared browser session or a screen recording.
Free tools Windows power users keep installed
One-click scans. No signup required.
Quick Recap
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

