Steps
How we tested, and what is real
On 30 October 2026 we ran throwaway n8n 2.43.7 instances in Docker (the official
n8nio/n8n:2.43.7image), created API keys with and without scopes, and called the public API with curl in every wrong way we could think of: no key, a wrong key, the key as a Bearer token, an expired key, a key missing a scope, the wrong URL path, a customN8N_PATH, and the API switched off. Every status code and message below is copied from those runs.Quick answer: which error do you have?
What you get Cause Fix 401 {"message":"Unauthorized"}No key, wrong key, expired key, key sent as Authorization: Bearer, or the public API is disabled.Send the key in the X-N8N-API-KEYheader to/api/v1/...; create a new key if it may have expired.403 {"message":"Forbidden"}The key is valid but lacks the scope for this call (for example only workflow:readwhen creating a workflow).Create a key with the needed scopes. 401 {"status":"error","message":"Unauthorized"}You called /rest/..., the editor's internal API. API keys do not work there.Use /api/v1/....200 with an HTML page, or Unexpected token <You called /api/workflowswithoutv1and got the editor page.Add /v1.400 request/body/active is read-onlyYou sent "active": truewhen creating or updating a workflow.Remove it and call POST /api/v1/workflows/{id}/activate.400 request/body must have required property 'settings'The workflow body has no settings.Send "settings": {}.404 {"message":"Not Found"}Unknown workflow id. Check the id in the workflow URL. 401 Unauthorized: send the key the right way
The public API only accepts the key in the
X-N8N-API-KEYheader. In our runs no key, a wrong key and the right key sent asAuthorization: Bearer <key>all returned the same plain 401{"message":"Unauthorized"}. The header name is not case sensitive (lowercasex-n8n-api-keyworked). A key whose expiry date has passed also returns exactly the same 401, with no word about expiry, so if a key that used to work suddenly fails, check its expiration in Settings > n8n API and create a new one.curl -H "X-N8N-API-KEY: $N8N_API_KEY" https://n8n.example.com/api/v1/workflows403 Forbidden: the key is missing a scope
A 403 means the key itself was accepted. In n8n 2.x every API key has scopes, and creating a key without any was refused (
scopes Required). Our key with onlyworkflow:readandworkflow:listcould list workflows but got 403{"message":"Forbidden"}when creating one. The scopes are grouped by resource, such asworkflow:*,credential:*,execution:*,dataTable:*andcommunityPackage:*. Make a new key that includes the action you need (create, update, delete, activate) and swap it in. So 401 is about the key, 403 is about its scopes.Wrong URL: /rest, missing v1, or N8N_PATH
Three URL mistakes looked like auth problems in our tests. Calling
/rest/workflowswith an API key returned 401{"status":"error","message":"Unauthorized"}, because/restis the editor's own API and only takes a browser login. Calling/api/workflows(nov1) returned HTTP 200 with the editor's HTML page, which shows up asUnexpected token <or HTML in an HTTP Request node. WithN8N_PATH=/n8n/the API moved to/n8n/api/v1/, and/api/v1at the root returned 401. When you set up the n8n API credential in n8n itself, the base URL must also include/api/v1and anyN8N_PATHprefix.API key settings missing, or the docs page is 404
With
N8N_PUBLIC_API_DISABLED=truethe API key settings were gone (creating a key returned 404) and every/api/v1request got 401. Remove that variable and restart to get the API back. WithN8N_PUBLIC_API_SWAGGERUI_DISABLED=trueonly the interactive docs at/api/v1/docsturned into 404; by default that page loads as an HTML playground and the API itself keeps working.400 errors when creating or activating a workflow
Creating a workflow with
"active": truein the body returned 400request/body/active is read-only. Leave it out and activate withPOST /api/v1/workflows/{id}/activate. A body withoutsettingsreturned 400request/body must have required property 'settings'; an empty"settings": {}is enough. Activating a workflow with no trigger returned 400Workflow cannot be activated because it has no trigger node. At least one trigger, webhook, or polling node is required.More activation errors are in n8n workflow could not be activated.curl -X POST -H "X-N8N-API-KEY: $N8N_API_KEY" -H "Content-Type: application/json" \ -d '{"name":"From API","nodes":[],"connections":{},"settings":{}}' \ https://n8n.example.com/api/v1/workflows
All test results
Real runs on n8n 2.43.7 in Docker, 30 October 2026.
| Test | Result |
|---|---|
| No X-N8N-API-KEY header | 401 {"message":"Unauthorized"} |
| Wrong key | 401 {"message":"Unauthorized"} |
| Right key as Authorization: Bearer | 401 {"message":"Unauthorized"} |
| Lowercase x-n8n-api-key header | Works |
| Expired key | 401 {"message":"Unauthorized"} (no expiry wording) |
| Key with workflow:read + workflow:list, POST /api/v1/workflows | 403 {"message":"Forbidden"} |
| Create a key without scopes | Refused: scopes Required |
| API key on /rest/workflows | 401 {"status":"error","message":"Unauthorized"} |
| /api/workflows (no v1) | 200 text/html editor page |
| N8N_PATH=/n8n/, request to /api/v1 | 401; API is at /n8n/api/v1/ |
| N8N_PUBLIC_API_DISABLED=true | Key settings 404, /api/v1 401 |
| N8N_PUBLIC_API_SWAGGERUI_DISABLED=true | /api/v1/docs 404 (default 200) |
| Create workflow with "active": true | 400 request/body/active is read-only |
| Create workflow without settings | 400 request/body must have required property 'settings' |
| Activate workflow without trigger | 400 Workflow cannot be activated because it has no trigger node. |
| GET unknown workflow id | 404 {"message":"Not Found"} |
Checklist
- Header is
X-N8N-API-KEY, not Bearer. - URL is
https://your-host/api/v1/..., plus yourN8N_PATHprefix if you set one. - 401 on a key that used to work? It may have expired: create a new one.
- 403? Add the missing scope to a new key.
- Creating workflows: no
activefield, always sendsettings.
Good to know
- Securing your own webhooks instead: n8n webhook authentication not working.
- Calling other APIs from n8n: n8n HTTP Request node errors.
- Every error text from our guides: n8n error message index.
What we did not test
n8n Cloud, the API behind a reverse proxy that strips custom headers, and every scope one by one. If a proxy is in front of n8n and the right key still gets 401, test the same curl against n8n directly on its port.
Start from a working agent
FAQ
Why does the n8n API return 401 Unauthorized with a valid API key?
The key must go in the X-N8N-API-KEY header to /api/v1/... In our tests a Bearer header, a wrong key, an expired key, a /rest URL and a disabled public API all gave 401. A custom N8N_PATH also moves the API to /your-path/api/v1/.
What is the difference between 401 and 403 in the n8n API?
401 means the key was not accepted. 403 Forbidden means the key works but is missing the scope for that action, so create a key with that scope.
Why does the n8n API return HTML instead of JSON?
You probably called /api/workflows without v1. n8n answers that with the editor page and HTTP 200. Use /api/v1/workflows.
How do I fix "request/body/active is read-only" in n8n?
Remove "active" from the workflow body and activate it afterwards with POST /api/v1/workflows/{id}/activate.
How do I fix "must have required property 'settings'" in the n8n API?
Add "settings": {} to the workflow body when you create it.
Related guides
- n8n Google Sheets node not working: Bad request, invalid_grant, private key fixes
- n8n Webhook authentication not working? 401, 403 and JWT, 28 tests
- n8n JWT node not working: missing exp, Bearer, invalid algorithm, 54 runs
- n8n Airtable node not working: Unauthorized, NOT_FOUND and Base ID fixes
- n8n Google Calendar node not working: "Not a valid Google Calendar ID", OAuth2 fixes
New guides
- GitHub release notifications in Slack (any public repo, stable releases only)
- Send RSS feeds to Slack with a keyword filter (free, incoming webhook)
- Forward emails to a Slack channel (Gmail, Outlook, any IMAP), free with an incoming webhook
- n8n Google Sheets Trigger not working: not firing, activation errors and fixes