n8n - 💡(How to fix) Fix Anthropic API HTTP Request returns 404/400 despite correct cURL import. [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
n8n-io/n8n#29085Fetched 2026-04-25 06:21:51
View on GitHub
Comments
2
Participants
2
Timeline
5
Reactions
0
Timeline (top)
commented ×2labeled ×1mentioned ×1subscribed ×1

Error Message

  1. Observe 404 (Not Found) or 400 (Bad Request) error, even though the same request works perfectly via cURL from the same server's terminal.
  • error: all
RAW_BUFFERClick to expand / collapse

Bug Description

<img width="1366" height="768" alt="Image" src="https://github.com/user-attachments/assets/80e86cba-3184-4821-bb57-e9b571fcab68" /> <img width="1366" height="768" alt="Image" src="https://github.com/user-attachments/assets/7c45e35e-58ee-42a1-a12f-a84c7e6be958" /> <img width="1366" height="768" alt="Image" src="https://github.com/user-attachments/assets/92c1e772-1b7f-49ca-9503-114654de3e67" />

The exact same cURL command works in the terminal but returns 404 (Not Found) or 400 (Bad Request) when imported into the n8n HTTP Request node. Headers: x-api-key, anthropic-version: 2023-06-01, content-type: application/json. I've tried both Raw and JSON Body Content Types. Is there a known bug with invisible characters or JSON parsing in the HTTP Request node?

To Reproduce

  1. Create a new workflow on a self-hosted n8n instance.
  2. Add an "HTTP Request" node.
  3. Set Method to POST and URL to https://api.anthropic.com/v1/messages.
  4. Enable "Send Headers" and add:
    • x-api-key: [Your Valid API Key]
    • anthropic-version: 2023-06-01
    • content-type: application/json
  5. Enable "Send Body", set Body Content Type to JSON, and use "Using JSON" option.
  6. Provide a valid JSON body (e.g., model: claude-3-haiku-20240307, messages: [{role: user, content: hello}]).
  7. Execute the node.
  8. Observe 404 (Not Found) or 400 (Bad Request) error, even though the same request works perfectly via cURL from the same server's terminal.

Expected behavior

The HTTP Request node should return a 200 OK response from the Anthropic API (https://api.anthropic.com/v1/messages). The same request works via cURL in the terminal, but fails within n8n despite correct headers (x-api-key, anthropic-version) and valid JSON body.

  1. Отладочная информация (Debug Info)
<img width="1366" height="768" alt="Image" src="https://github.com/user-attachments/assets/b9695cee-577b-4c83-ab8a-d1b803a4b93a" />

Debug Info

Debug info

core

  • n8nVersion: 2.16.0
  • platform: docker (self-hosted)
  • nodeJsVersion:
<img width="506" height="285" alt="Image" src="https://github.com/user-attachments/assets/e29fcbab-6a82-476d-8227-36c1d3108490" /> <img width="506" height="285" alt="Image" src="https://github.com/user-attachments/assets/1047d9fe-3ebd-467d-9ab0-a99c571f7e59" />
  • nodeEnv: production
  • database: postgres
  • executionMode: regular
  • concurrency: -1
  • license: community
  • consumerId: unknown

storage

  • success: all
  • error: all
  • progress: false
  • manual: true
  • binaryMode: filesystem

pruning

  • enabled: true
  • maxAge: 336 hours
  • maxCount: 10000 executions

client

  • userAgent: mozilla/5.0 (windows nt 10.0; win64; x64) applewebkit/537.36 (khtml, like gecko) chrome/147.0.0.0 safari/537.36
  • isTouchDevice: false

security

  • secureCookie: false

Generated at: 2026-04-24T09:16:47.235Z

Operating System

Linux (Ubuntu 22.04)

n8n Version

1.30.1

Node.js Version

24.14.1

Database

SQLite (default)

Execution mode

main (default)

Hosting

n8n cloud

extent analysis

TL;DR

The issue might be due to differences in how the HTTP Request node in n8n handles JSON bodies or headers compared to cURL, so adjusting the body or header settings could resolve the 404 or 400 errors.

Guidance

  • Verify that the JSON body is correctly formatted and escaped in the n8n HTTP Request node, as differences in parsing could lead to errors.
  • Check if the content-type header is correctly set to application/json and if the x-api-key and anthropic-version headers are properly configured.
  • Try setting the Body Content Type to "Raw" and manually specifying the JSON body to see if it makes a difference.
  • Ensure that the n8n instance and the terminal from which cURL is run have the same network configuration and can reach the Anthropic API without issues.

Example

No specific code example can be provided without more details on the exact JSON body and headers being used, but ensuring the JSON is valid and properly escaped is crucial.

Notes

The issue might be specific to how n8n handles HTTP requests differently than cURL, or there could be environment-specific issues (like network settings or API key validation) that need to be addressed.

Recommendation

Apply a workaround by carefully reviewing and adjusting the JSON body and headers in the n8n HTTP Request node to match the working cURL command as closely as possible, considering any potential parsing or configuration differences.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

The HTTP Request node should return a 200 OK response from the Anthropic API (https://api.anthropic.com/v1/messages). The same request works via cURL in the terminal, but fails within n8n despite correct headers (x-api-key, anthropic-version) and valid JSON body.

  1. Отладочная информация (Debug Info)
<img width="1366" height="768" alt="Image" src="https://github.com/user-attachments/assets/b9695cee-577b-4c83-ab8a-d1b803a4b93a" />

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING