Issue in using n8n API

Describe the problem/error/question

It seems that the n8n api is unusable when the N8N_ENDPOINT_WEBHOOK environment variable is set to api (which is the case for my projects, and cannot be changed).

My config:


As per this Authentication | n8n Docs , the n8n API endpoint in my case would be:
(which is the same as the syntax for a webhook endpoint).

Every time i try to access the api, n8n assumes that i’m trying to reach a webhook instead.

How do i resolve this overlap between the API endpoint syntax and my Webhook syntax, without changing the Webhook synatx?

Information on your n8n setup

  • n8n version: 1.18.2
  • Database (default: SQLite): Postgres
  • n8n EXECUTIONS_PROCESS setting (default: own, main): main
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu

Hey @shrey-42,

That is an interesting one, I suspect we never expected anyone to try and use the same value for both, This means we potentially have 1 of 2 solutions for this…

  1. Don’t allow endpoint_webhook to be set to api
  2. Set an option to allow the api path to be different

If we allowed both at what point do we prefer one over the other as I could use api and I would probably want to version my api as well so my webhook paths would be v1/xxx.

Do you need both options to be available on the same path?

Currently, my primary constraint is that i have the webhook path set as “api” in a bunch of projects in production, which i can’t really change now, hence, i don’t care whatever the ‘api’ path has to be set as.

Hey @shrey-42,

Good news, I was just looking through the code and I have just found out about N8N_PUBLIC_API_ENDPOINT this will let you change the path for the API. This should solve the issue you are seeing, I will get the documentation updated shortly to include this.

1 Like

Perfect, thanks! :smiley:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.