Endpoints Environment Variables

Ever wondered how you can make your n8n self-hosted instance truly yours? Well, buckle up, because today we’re diving into the world of endpoints environment variables in n8n. This isn’t just about tweaking a few settings; it’s about unlocking the full potential of your automation workflows. Let’s get into how you can customize your n8n API and webhook endpoints using environment variables to achieve better control and monitor your instance like a pro.

Customizing API and Webhook Endpoints

First off, let’s talk about how you can tailor your API and webhook endpoints. If you’re running a self-hosted n8n instance, you’ve got the power to mold it to your needs. Here’s how:

  • Add _FILE to individual variables: You can add _FILE to individual variables to provide their configuration in a separate file. This keeps things clean and organized. For example, if you want to set N8N_PAYLOAD_SIZE_MAX, you can use N8N_PAYLOAD_SIZE_MAX_FILE.
  • N8N_PAYLOAD_SIZE_MAX: By default, this sets the maximum payload size to 16 MiB. If you’re dealing with larger payloads, you might want to adjust this.
  • N8N_FORMDATA_FILE_SIZE_MAX: This one’s crucial if you’re working with files in form-data webhook payloads. It’s set to 200 MiB by default, but you can tweak it to fit your needs.
  • N8N_ENDPOINT_REST: Sets the path used for the REST endpoint, defaulting to “rest”. Change this if you want your REST endpoint to be more unique or secure.
  • N8N_ENDPOINT_WEBHOOK: Similarly, this sets the path for the webhook endpoint, defaulting to “webhook”.
  • N8N_ENDPOINT_WEBHOOK_TEST: For testing webhooks, this defaults to “webhook-test”.
  • N8N_ENDPOINT_WEBHOOK_WAIT: Used for waiting-webhook endpoints, it defaults to “webhook-waiting”.
  • WEBHOOK_URL: If you’re running n8n behind a reverse proxy, this allows you to manually provide the Webhook URL. It’s a game-changer for complex setups.

By customizing these endpoints, you’re not just tweaking settings; you’re optimizing your n8n instance to work exactly how you want it to. It’s about taking control and making your workflows as efficient as possible.

Enabling and Customizing Metrics

Now, let’s shift gears to monitoring. Understanding how your n8n instance is performing is key to scaling your operations. Here’s how you can enable and customize metrics:

  • N8N_METRICS: Set this to true to enable the /metrics endpoint. It’s off by default, so you’ll need to flip the switch to start gathering data.
  • N8N_METRICS_PREFIX: You can set an optional prefix for n8n specific metrics names. It defaults to “n8n_”, but feel free to make it your own.
  • N8N_METRICS_INCLUDE_DEFAULT_METRICS: This exposes default system and node.js metrics when set to true, which it is by default.
  • N8N_METRICS_INCLUDE_CACHE_METRICS: Want to keep an eye on cache hits and misses? Set this to true. It’s off by default.
  • N8N_METRICS_INCLUDE_MESSAGE_EVENT_BUS_METRICS: If you’re interested in event metrics, turn this on. It’s also off by default.
  • N8N_METRICS_INCLUDE_WORKFLOW_ID_LABEL: Include a label for the workflow ID on workflow metrics by setting this to true. It’s off by default.
  • N8N_METRICS_INCLUDE_NODE_TYPE_LABEL: Similar to the above, but for node metrics. Off by default.
  • N8N_METRICS_INCLUDE_CREDENTIAL_TYPE_LABEL: You guessed it, this one’s for credential metrics. Also off by default.
  • N8N_METRICS_INCLUDE_API_ENDPOINTS: Expose metrics for API endpoints by setting this to true. It’s off by default.
  • N8N_METRICS_INCLUDE_API_PATH_LABEL: Include a label for the path of API invocations. Off by default.
  • N8N_METRICS_INCLUDE_API_METHOD_LABEL: Include a label for the HTTP method of API invocations. Off by default.
  • N8N_METRICS_INCLUDE_API_STATUS_CODE_LABEL: Include a label for the HTTP status code of API invocations. Off by default.
  • N8N_METRICS_INCLUDE_QUEUE_METRICS: If you’re in scaling mode, this includes metrics for jobs. It’s off by default.
  • N8N_METRICS_QUEUE_METRICS_INTERVAL: Sets how often to update queue metrics. It defaults to 20 seconds, but you can adjust this to suit your needs.

By enabling and customizing these metrics, you’re not just monitoring; you’re gaining insights that can drive your decision-making and improve your n8n instance’s performance.

Optimizing Performance

Finally, let’s talk about optimizing the performance of your n8n instance. It’s all about controlling the load on the main process. Here’s how:

  • N8N_DISABLE_PRODUCTION_MAIN_PROCESS: Set this to true to disable production webhooks from the main process. It’s off by default, but turning it on can help manage load more effectively.

This simple setting can make a huge difference in how your n8n instance handles traffic and processes workflows. It’s about making your system more robust and ready for whatever comes its way.

So, there you have it. By customizing your API and webhook endpoints, enabling and customizing metrics, and optimizing performance, you’re not just using n8n; you’re mastering it. Ready to take your n8n instance to the next level? Dive into our other resources and keep pushing the boundaries of what’s possible with automation.

Share it :

Other glossary

Interactive Keyboards

Discover how interactive keyboards in Telegram, like inline keyboards and custom replies, enhance user interaction and streamline workflows.

Discourse Node

Learn to integrate and automate Discourse tasks using the Discourse node in n8n. Explore categories, posts, and more.

What’S An API?

Discover what an API (Application Programming Interface) is, how it enables software communication, and explore examples like ClickUp and Gmail APIs.

Automation

Discover what automation is, how it works, and its benefits for businesses. Learn how automation boosts efficiency and reduces errors with technology.

Bạn cần đồng hành và cùng bạn phát triển Kinh doanh

Liên hệ ngay tới Luân và chúng tôi sẽ hỗ trợ Quý khách kết nối tới các chuyên gia am hiểu lĩnh vực của bạn nhất nhé! 🔥