Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To call the API on a self-hosted n8n instance, use the instance’s public URL followed by /api/v1, create an API key in Settings > n8n API, and send that key in the X-N8N-API-KEY request header. For example, a request to https://n8n.example.com/api/v1/workflows?active=true can list active workflows.

The URL only works when n8n knows its public host, protocol, port, and optional path. If a reverse proxy publishes n8n, configure N8N_WEBHOOK_URL, set N8N_PROXY_HOPS=1, and forward the original host, protocol, and client-IP headers. Keep the API root and webhook URL conceptually separate: API calls use /api/v1, while webhook addresses are generated from the public webhook configuration.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What is the self-hosted n8n API URL?

The normal API root is https://<your-public-host>/api/v1. Replace the host with the address users and integrations actually use to reach your n8n editor. If n8n is exposed on a nonstandard port or under a path, include those parts in the URL.

n8n’s documented pattern is <N8N_HOST>:<N8N_PORT>/<N8N_PATH>/api/v<version-number>. For the current API version described in the documentation, that becomes /api/v1. A deployment using a custom path might therefore expose an endpoint such as https://automation.example.com/n8n/api/v1/workflows, provided the path is configured consistently.

#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter | 4Pack Type C Female to A Male Cable Converter for Apple Duo 17 16 15 14 Plus,iWatch Watch 12 11 10,iPad 9 8 Air,Airpods 5 4
  • 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.
URL component Example What it represents
Protocol https:// The public transport scheme. Use HTTPS when the service is reachable outside a private network.
Host n8n.example.com The DNS name or IP address clients use, not an internal-only name that outside clients cannot resolve.
Port :5678 The listener port when it is not hidden behind a proxy or standard HTTPS port.
Optional path /n8n/ The value represented by N8N_PATH, if the installation is mounted below the domain root.
API version /api/v1 The API namespace. Do not substitute the webhook path here.

On a default local installation, the documented values are host localhost, port 5678, protocol http, and path /. That produces a local address such as http://localhost:5678/api/v1. A machine calling the API from elsewhere cannot use its own localhost; it must use a routable address for the n8n server.

How do I configure a self-hosted instance before making API calls?

First decide which address should be authoritative for the editor, API clients, and generated links. Then make the n8n environment and the network entry point agree with that decision.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Set the n8n network identity

Define the host, port, protocol, and optional path in the environment used to start n8n. The variables below are the settings that determine how n8n builds its URLs.

Variable Example Role
N8N_HOST n8n.example.com The host name n8n uses for its public identity.
N8N_PORT 5678 The port on which the n8n process listens when a proxy is not replacing it.
N8N_PROTOCOL https The scheme n8n should use when constructing links.
N8N_PATH / An optional URL prefix. Keep slash placement consistent with the proxy configuration.

Changing these values does not automatically make DNS, firewall rules, certificates, or proxy routes work. Those infrastructure layers must also direct traffic to the n8n listener.

Decide where TLS terminates

For a public installation, a reverse proxy commonly terminates TLS and forwards requests to n8n’s internal listener. In that arrangement, the public URL may be HTTPS even though n8n listens on an internal port. Keep the process listening on its configured internal port and ensure the proxy forwards requests to that port.

Rank #2
Sale
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter | USB C Dongle with 90W Max Power Delivery, 3×5Gbps USB A Data Ports, for MacBook, Dell, and More (Charger Not Included)
  • 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 do I create an n8n API key?

Create the key inside the n8n editor, not by inventing a token in an environment file.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Sign in to the self-hosted n8n editor with the account that should own the integration.
  2. Open Settings > n8n API.
  3. Choose the control to create a key, give it a label that identifies its service or purpose, and select an expiration date.
  4. Copy the secret when n8n displays it and store it in the secret manager used by the calling application. Treat the value like a password.
  5. For an Enterprise instance, apply the narrowest available API-key scopes for the intended resources. On non-Enterprise instances, the authentication guide states that keys have full access to account resources available to that user.

An expiration makes rotation predictable. Create a replacement before the old key expires, update the caller, verify a successful request, and then remove or revoke the former key if the interface provides that control. Never place a key in a browser bundle, a public repository, a screenshot, or a workflow field that is visible to people who do not need it.

How do I make the first API request?

Use the public API root and put the key in the X-N8N-API-KEY header. This example asks for workflows whose active flag is true:

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 host and placeholder key with values from your deployment. If n8n is exposed on a custom path, insert that path before /api/v1. If the service is intentionally local and uses the default listener, the equivalent target is http://localhost:5678/api/v1/workflows?active=true.

Check the result methodically

  • Confirm the request reaches the same host and path shown in the n8n editor.
  • Check that the header name is exactly X-N8N-API-KEY; do not put the key in the query string.
  • Use an API key that has not expired and belongs to an account allowed to access the requested resource.
  • Inspect the response body and HTTP status returned by your client before changing server settings.
  • For a first test, request a harmless read operation rather than deleting, updating, or executing production data.

Which resources can the API access?

The public endpoint reference covers more than workflows. The exact operations depend on the endpoint and the permissions of the authenticated account.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter | 85W Max PD, 2 USB 3.0 & 1 USBC Data Ports, SD/TF Card Reader, for Laptops/Mac and Other Type C Devices (Charger Not Included)
  • 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.
Resource family Typical reason to call it Operational caution
Workflows List, inspect, create, update, activate, or deactivate automation definitions where supported. Changes can affect production automations immediately.
Executions Inspect execution records and troubleshoot runs. Execution data can contain input values and other sensitive information.
Credentials Manage credential records through supported endpoints. Use the smallest scope possible; credential-related operations deserve administrative controls.
Users and projects Handle account or project administration on installations that expose those endpoints. Reserve administrative keys for a separate integration from routine workflow reads.
Audit and tags Review audit information or organize workflow metadata. Audit access may reveal a broad view of activity.
Variables and data tables Read or maintain shared configuration and structured data. Do not assume a variable or table is safe to expose merely because it is not a credential.

Use the endpoint reference that matches the API version installed on your server. A path that exists in one n8n release or edition may not be available in another, so handle unsupported endpoints as a compatibility issue rather than repeatedly changing authentication headers.

How should I configure n8n behind a reverse proxy?

Set the public webhook URL and tell n8n how many proxy hops it should trust. With one reverse proxy in front of n8n, the documented configuration is:

N8N_HOST=n8n.example.com
N8N_PORT=5678
N8N_PROTOCOL=https
N8N_WEBHOOK_URL=https://n8n.example.com/
N8N_PROXY_HOPS=1

The proxy should terminate TLS and forward requests to the internal n8n port. On the last proxy in the chain, forward these headers so n8n can reconstruct the original request:

  • X-Forwarded-For for the client IP chain.
  • X-Forwarded-Host for the public host name.
  • X-Forwarded-Proto for the original protocol, normally https.

N8N_WEBHOOK_URL is not the API root. It tells n8n which public base URL to use when displaying and registering webhook addresses. API calls still use the API namespace under /api/v1. Keeping those concepts separate prevents a common mistake in which an apparently valid webhook is generated with an internal host, the wrong protocol, or a private port.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What a correct proxy flow looks like

  1. A client sends an HTTPS request to the public n8n host.
  2. The reverse proxy validates the TLS connection and routes the request to the n8n listener on its internal port.
  3. The proxy preserves the original host, protocol, and client-IP information in the forwarded headers.
  4. n8n uses the configured public values to generate links and webhook URLs while serving the API request.

If more than one proxy exists, document the complete chain and ensure the trust setting matches the topology you operate. The one-hop value shown above is the documented setup for a single proxy.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray | Data transfer & Fast charging for MacBook, iPhone 17/16/15, iPad, Samsung Galaxy, Apple Watch
  • 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

Where is the self-hosted n8n API playground?

Self-hosted n8n includes a Swagger UI playground. Its location is built from the configured host, port, optional path, and API version rather than being one universal URL for every installation.

The playground is useful for discovering request shapes and trying read operations, but authorizing it grants access to live data. Use test data, avoid sharing the browser session, and prefer a narrowly scoped key when your edition supports scopes. Treat the playground as an administrative interface, not as a harmless documentation viewer.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Why does my API request fail?

Most failures come from a mismatch between the public URL, the key, and the proxy route. Work through the symptom that matches your result.

The host cannot be reached or the connection is refused

  • Verify that the n8n process is running and listening on the configured internal port.
  • From the calling machine, test the public DNS name rather than assuming the server’s localhost is reachable.
  • Check firewall and proxy routing rules, including whether the proxy forwards to the same port configured in N8N_PORT.

The request returns an authentication error

  • Confirm the header is spelled X-N8N-API-KEY and is sent on the request that reaches n8n.
  • Check the key’s expiration and make sure it was copied completely.
  • Verify that the key belongs to the intended n8n account and that Enterprise scopes include the requested resource.

The request returns a not-found response

  • Check whether the installation uses a custom N8N_PATH; omitting it changes the route.
  • Confirm that /api/v1 follows the public base path and is not being sent to a webhook route.
  • Compare the endpoint with the API version supported by the installed n8n release.

Webhook URLs show an internal host or HTTP

  • Set N8N_WEBHOOK_URL to the externally reachable HTTPS base URL, including its trailing slash as shown in the documented example.
  • Set N8N_PROXY_HOPS=1 for the one-proxy arrangement.
  • Ensure the last proxy forwards X-Forwarded-For, X-Forwarded-Host, and X-Forwarded-Proto.
  • Restart n8n after changing environment variables, then regenerate or re-check the displayed webhook address.

The API works directly but not through the public domain

This usually isolates the problem to DNS, TLS, proxy routing, path rewriting, or forwarded headers rather than the API key itself. Compare a direct internal request with the public request, then inspect proxy logs and the n8n process logs for the first point at which the paths diverge.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

How do I secure and operate the integration?

Authentication is only one part of a safe self-hosted API deployment. Apply controls around the key, network, data, and change process.

Best Value
Sale
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display | 85W Max PD, 1 Powered USB-C 5Gbps & 2 Powered USB-A 3.0 5Gbps Data Ports, for MacBook Pro, MacBook Air, Dell and More (Black)
  • 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.
  • Protect the secret: inject the key through a server-side secret store or protected environment variable. Do not commit it to source control.
  • Use HTTPS publicly: terminate TLS at the reverse proxy and avoid sending API keys over an unencrypted public connection.
  • Limit scope: use Enterprise scopes where available and separate read-only or narrowly purposed integrations from administrative automation.
  • Set expiration and rotate: keep an inventory of key labels, owners, expiry dates, and the systems that consume them.
  • Restrict exposure: allow the API host and proxy to be reachable only from the networks that need them when public access is unnecessary.
  • Protect state: maintain persistent storage for the n8n installation and establish backups appropriate to your hosting architecture. API configuration alone does not provide backup or recovery.
  • Monitor changes: retain proxy and n8n logs long enough to investigate failed calls, unexpected activations, and key-rotation mistakes without logging the secret itself.
  • Test safely: begin with read requests and a nonproduction project before allowing an integration to create, update, activate, or execute workflows.

Should I expose n8n directly or use a reverse proxy?

Both approaches can serve the API, but they have different operational consequences. A direct listener is simpler for a private network; a reverse proxy is the usual choice when a stable HTTPS domain and correctly generated public webhooks are required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Deployment choice Public URL and TLS Webhook behavior Operational considerations
Private direct listener Clients connect to the n8n host and listener port directly; TLS and network controls are your responsibility. Works when n8n’s host and protocol match the address clients can reach. Simple routing, but fewer layers for certificate handling and access policy.
One reverse proxy The proxy provides the public HTTPS endpoint and forwards to n8n’s internal port. Set N8N_WEBHOOK_URL, N8N_PROXY_HOPS=1, and the forwarded headers. Centralizes TLS and routing; requires careful path and header configuration.
Custom path deployment The public URL includes the configured path prefix. Both API requests and generated links must preserve the prefix. Path rewriting errors can produce 404 responses even when n8n is healthy.

Choose the arrangement that matches where clients run and who controls DNS, certificates, firewall rules, logs, and backups. The API key mechanism is the same in each case; the URL and proxy correctness are what change.

What is a reliable setup sequence?

  1. Choose the public host and decide whether n8n is at the domain root or a path prefix.
  2. Set N8N_HOST, N8N_PORT, N8N_PROTOCOL, and N8N_PATH where applicable.
  3. If a proxy publishes n8n, set N8N_WEBHOOK_URL and N8N_PROXY_HOPS=1, then forward the three required X-Forwarded-* headers.
  4. Start or restart n8n and confirm that the editor opens at the intended public address.
  5. Create a labeled, expiring key under Settings > n8n API; apply Enterprise scopes if available.
  6. Send a read-only request to <public-base>/api/v1 with the X-N8N-API-KEY header.
  7. Test the same base URL from the actual integration host, not only from the n8n server itself.
  8. Verify a generated webhook URL independently, because webhook configuration and API routing are separate checks.
  9. Record the key owner, expiration date, deployment values, and rollback contact before putting the integration into production.

Frequently Asked Questions

Can I call a self-hosted n8n API from another machine using localhost?

No. In a request sent from another machine, localhost refers to the calling machine, not the n8n server. Use a DNS name or IP address that routes to the n8n host, and expose the listener through the required firewall or proxy path.

Is it safe to put the n8n API key in a frontend JavaScript application?

No. Browser-delivered JavaScript can be inspected by every user who receives it. Put the key in a server-side component and have that component call n8n, or use an integration service whose secret storage is not exposed to browsers.

How should I migrate an API key without downtime?

Create a new key before the old one expires, deploy the new secret to the calling service, and confirm a successful read request. After the replacement is in use, revoke or remove the old key and update your key inventory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Does changing N8N_WEBHOOK_URL change the API endpoint?

No. N8N_WEBHOOK_URL controls the public base used to generate webhook addresses. API requests continue to use the configured public host and path followed by /api/v1.

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.